# API Overview Buy temporary phone numbers and read SMS verification codes from your own code. Use the DogeSMS API to buy a temporary phone number for a service and country, then read the SMS verification code it receives — all from your own server. New here? Follow the [Quick start](https://docs.dogesms.com/guides/quick-start): one API key and four requests get you from zero to a code. Working with an AI assistant? [Connect it to DogeSMS](https://www.dogesms.com/ai-agents) and let it check prices, buy after you confirm, and read the code back. Every page has a **Copy page as Markdown** button, and the whole site is available to tools as [/llms.txt](https://docs.dogesms.com/llms.txt) and [/llms-full.txt](https://docs.dogesms.com/llms-full.txt). --- ## Order flow This is the request order for buying a number and reading its code. 1. Authenticate every request with your API key: [Authentication](https://docs.dogesms.com/guides/authentication). 2. Find a service and country, and the price you will lock: `GET /catalog/prices`. 3. Create an order with an `Idempotency-Key`: `POST /orders`. 4. Get the number and the code by polling `GET /orders`, or through [webhooks](https://docs.dogesms.com/guides/webhooks). 5. No code yet? Cancel for a refund after 2 minutes: `POST /orders/{id}/cancel`. ## Base URL ``` https://api.dogesms.com/v1 ``` ## Response envelope Every response is wrapped in an envelope carrying a `request_id` (also echoed in the `X-Request-Id` header — include it when contacting support): ```json { "data": { ... }, "request_id": "req_..." } // success { "error": { "code": "...", "message": "..." }, "request_id": "req_..." } // error ``` Authentication failures emitted before request-id middleware use a flat shape without `request_id`: ```json { "error": "Missing API Key", "code": "API_KEY_MISSING" } ``` Access-gate and rate-limit errors use the standard envelope. Branch on the `code` field in both shapes; it is stable across releases. ## Amounts All money amounts are integer **cents** (USD). `250` means `$2.50`. --- # Quick start From API key to SMS code in five requests. A typical integration goes from credentials to an SMS code in five steps. Every example uses `sk_live_…` as a placeholder — replace it with your own key, and keep the key on your server. ### 1. Create an API key Create a key in the dashboard under **Dashboard → API Keys**. Copy it right away: it is shown only once. Use one key per environment (development, staging, production) so rotation and audit logs stay clean. ### 2. Check your balance ```bash curl https://api.dogesms.com/v1/balance \ -H "Authorization: Bearer sk_live_…" ``` The balance is an integer in cents (USD): divide by 100 to display dollars. Top up in the dashboard if it is low. See `GET /balance`. ### 3. Look up the price ```bash curl "https://api.dogesms.com/v1/catalog/prices?country_code=US" \ -H "Authorization: Bearer sk_live_…" ``` Each row has a `service_code` and the `price_cents` that an order locks right now — for example `43` means $0.43. Use `GET /catalog/services` and `GET /catalog/countries` to list what is available. ### 4. Create an order ```bash curl https://api.dogesms.com/v1/orders \ -H "Authorization: Bearer sk_live_…" \ -H "Idempotency-Key: 3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93" \ -H "Content-Type: application/json" \ -d '{"service_code":"whatsapp","country_code":"US"}' ``` Send a fresh UUID as `Idempotency-Key` with every new order, so a retry never buys twice (see [Idempotency](https://docs.dogesms.com/guides/idempotency)). Store the returned order `id` right away: tracking and cancelling both depend on it. Your wallet is charged only when a number is allocated. See `POST /orders`. ### 5. Get the number and the code Poll all your open orders with one request every 5 seconds: ```bash curl "https://api.dogesms.com/v1/orders?status=pending,active" \ -H "Authorization: Bearer sk_live_…" ``` The order becomes `active` with a `phone_number` (for example `+1 (555) 014-2290`), then `completed` with `sms_code` and `sms_content`. For real-time delivery without polling, register a [webhook](https://docs.dogesms.com/guides/webhooks). Treat `expired`, `cancelled` and `failed` as final. If the SMS does not arrive, cancel with `POST /orders/{id}/cancel` (allowed 2 minutes after creation) and the charge is refunded. --- # Authentication Send your API key with every request. Every request must include your API key (starts with `sk_live_`), using either header: ``` Authorization: Bearer sk_live_xxx X-API-Key: sk_live_xxx ``` Keep your key on the server side only. The API is designed for server-to-server use and does not serve browser cross-origin requests. - Keys start with `sk_live_`. Never share a key or commit it to source control. - Create, view and revoke keys in **Dashboard → API Keys**. A revoked key stops working immediately; generate a new one if a key ever leaks. - Only active accounts can use the API. ### When authentication fails Authentication errors are returned before the request reaches the API, in a flat shape without `request_id`: ```json { "error": "Missing API Key", "code": "API_KEY_MISSING" } ``` | Status | Code | Meaning | |---|---|---| | 401 | `API_KEY_MISSING` | No key in `Authorization` or `X-API-Key` | | 401 | `API_KEY_INVALID_FORMAT` | The value does not start with `sk_live_` | | 401 | `API_KEY_INVALID` | No such key | | 401 | `API_KEY_REVOKED` | The key was revoked in the dashboard | | 403 | `ACCOUNT_BANNED` | The account is banned | | 403 | `EMAIL_NOT_VERIFIED` | The account email is not verified yet | | 403 | `ACCOUNT_NOT_ACTIVE` | The account is not active | --- # Rate limits Per-minute, daily and price-query limits, and how to stay under them. Your account has a personal limit **tier** — a bundle of four limits. Reads (GET) and writes (POST) use separate per-minute buckets: | Tier | Reads /min | Writes /min | Requests /day | Concurrent active orders | How to get it | |---|---:|---:|---:|---:|---| | Default | 60 | 60 | 20,000 | 100 | Every account, out of the box | | 500 | 500 | 120 | 100,000 | 500 | Automatic at $500 lifetime top-ups, or apply in the dashboard | | 1000 | 1,000 | 200 | 300,000 | 1,000 | Automatic at $1,000 lifetime top-ups, or apply in the dashboard | **Raising your limits**: tiers unlock automatically the moment your lifetime top-ups reach the threshold — no review, no waiting. Need different numbers (or can't top up yet)? Submit a request with your use case in Dashboard → API Keys → Rate Limits; our team reviews it and you get the decision by email. Custom tiers beyond 1000/min are possible for high-volume integrations. Price queries have separate windows: 1,000 per 5 hours and 10,000 per 7 days (VIP: 5,000 / 50,000). Every response carries `X-RateLimit-Limit` / `X-RateLimit-Remaining` / `X-RateLimit-Reset` (and `X-RateLimit-Day-*` for the daily quota) — the values reflect **your** tier. Price queries additionally expose `X-RateLimit-Price-5h-*` and `X-RateLimit-Price-Week-*`. On `429`, honour the `Retry-After` header before retrying — hammering after 429 only wastes your daily quota. **Not every `429` is a rate limit.** Branch on the `code` field: | Code | Meaning | What to do | |---|---|---| | `RATE_LIMITED` | Per-minute request limit hit | Wait for `Retry-After`, then resume | | `RATE_LIMITED_DAILY` | Daily request quota exhausted | Wait for the UTC day reset | | `TOO_MANY_ACTIVE_ORDERS` | Too many orders currently awaiting SMS | Wait for active orders to complete/expire — retrying sooner cannot succeed | Catalog responses also carry `Cache-Control`; caching them client-side keeps you well under the limits. --- # Idempotency Retry order creation safely without buying twice. Network calls fail in the middle. To make a retry safe, send an `Idempotency-Key` header with `POST /orders` (and `POST /rentals`). - The key **must be a UUID**. A malformed key is rejected with `400 VALIDATION_ERROR`. - Retrying with the same key returns the original order, with its current live status, instead of buying a second number. - A key stays bound to the first attempt forever. Reusing it after that order has finished returns the original order again — never a new one. Generate a fresh UUID for every new order and store it with the order. - An idempotent replay does not include `price_cents` (the price is shown only in the response that created the order). - `POST /orders/{id}/cancel` does not use this header; cancelling twice is already safe. ```bash curl https://api.dogesms.com/v1/orders \ -H "Authorization: Bearer sk_live_…" \ -H "Idempotency-Key: 3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93" \ -H "Content-Type: application/json" \ -d '{"service_code":"whatsapp","country_code":"US"}' ``` When you retry after a `429`, keep the same `Idempotency-Key` and wait for `Retry-After` first. --- # Order status Track every order by polling, webhooks, or both. An order moves through these statuses: | Status | Meaning | Final? | |---|---|---| | `pending` | Waiting for a number (usually seconds). Not charged yet. | No | | `active` | A number is allocated (`phone_number` is set) and charged. Waiting for the SMS. | No | | `completed` | The SMS arrived: `sms_code` and `sms_content` are set. | Yes | | `expired` | No SMS arrived in time. The charge is refunded. | Yes | | `cancelled` | You cancelled it. Any charge is refunded. | Yes | | `failed` | No number could be allocated. Never charged. | Yes | Two complementary paths — use either or both: **Polling (default, no setup).** Every account can poll order status out of the box. The efficient pattern is **list polling**: one `GET /orders?status=pending,active` every 5 seconds covers *all* your in-flight orders with a single request (12 requests/min regardless of order count). Poll `GET /orders/{id}` for one specific order only — per-order polling multiplies request volume by your concurrency and burns your rate limit budget for no benefit. **Webhooks (optional, recommended for real-time).** Register an endpoint once in Dashboard → API Keys → Webhooks, verify it, and we push `order.number_allocated` / `order.completed` and failure events with an HMAC-SHA256 signature — typically faster than any polling interval and it costs none of your rate limit. See the `webhooks` section below. Use delivery history in the dashboard to monitor webhook failures; polling doubles as your reconciliation path. ### Polling endpoints - `GET /orders` lists your orders, newest first, with `status`, `startTime` / `endTime` filters and `limit` / `offset` pagination. - `GET /orders/{id}` returns one order. Polling is on for every account by default. It is turned off only for an individual account under abuse review; requests then return `403 ORDER_QUERY_NOT_AVAILABLE`. Contact [support](https://docs.dogesms.com/guides/support) to restore access. --- # Webhooks Get order events pushed to your server the moment they happen. Register one HTTPS endpoint and we send every order event to it with an HTTP `POST` — number allocated, SMS received, failed, expired. Webhooks are faster than any polling interval and cost none of your rate limit. ### Register your endpoint 1. Open **Dashboard → API Keys → Webhooks** and add your URL. Your API key and webhook endpoint belong to the same account. 2. Copy the signing secret: it is shown only once. 3. Click **Verify Webhook**. We send a `webhook.test` event; return any `2xx` within 10 seconds to start receiving events. ### Events | Event | When | Key fields | |---|---|---| | `order.number_allocated` | A number is allocated; the order becomes `active` | `phone_number` (no `sms_code` yet) | | `order.completed` | The SMS arrives; the order becomes `completed` | `sms_code`, `sms_content` | | `order.failed` | No number could be allocated | `error_code`; nothing is charged | | `order.expired` | A number was allocated but no SMS arrived in time | The charge is refunded automatically | Every order event carries `amount_cents` (the amount charged; `0` for failed orders) and, for orders placed by channel, `channel_id`. Each request also carries `X-Webhook-Event` with the event type. ### Example payloads `order.number_allocated` ```json { "event_type": "order.number_allocated", "order_id": "3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93", "service_code": "string", "country_code": "string", "phone_number": "+15550142290", "status": "active", "allocated_at": "2026-12-01T09:00:00Z", "amount_cents": 43, "channel_id": "string" } ``` `order.completed` ```json { "event_type": "order.completed", "order_id": "3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93", "service_code": "string", "country_code": "string", "phone_number": "+15550142290", "sms_code": "string", "sms_content": "string", "completed_at": "2026-12-01T09:00:00Z", "amount_cents": 43, "channel_id": "string" } ``` `order.failed` ```json { "event_type": "order.failed", "order_id": "3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93", "service_code": "string", "country_code": "string", "status": "failed", "error_code": "NO_NUMBERS_AVAILABLE", "failed_at": "2026-12-01T09:00:00Z", "amount_cents": 0, "channel_id": "string" } ``` `order.expired` ```json { "event_type": "order.expired", "order_id": "3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93", "service_code": "string", "country_code": "string", "phone_number": "+15550142290", "status": "expired", "expired_at": "2026-12-01T09:00:00Z", "amount_cents": 43, "channel_id": "string" } ``` ### Verify the signature Every delivery carries `X-Webhook-Signature: sha256=`: an HMAC-SHA256 of the **raw request body** keyed with your webhook secret. Compute it yourself and compare in constant time before trusting the payload. ```js import crypto from "node:crypto"; function verify(rawBody, header, secret) { const expected = "sha256=" + crypto .createHmac("sha256", secret) .update(rawBody) // raw bytes, not parsed JSON .digest("hex"); const sig = Buffer.from(header || "", "utf8"); const exp = Buffer.from(expected, "utf8"); // length check first: timingSafeEqual throws on unequal lengths return sig.length === exp.length && crypto.timingSafeEqual(sig, exp); } ``` ```python import hashlib, hmac def verify(raw_body: bytes, header: str, secret: str) -> bool: expected = "sha256=" + hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest() return hmac.compare_digest(expected, header or "") ``` ### Delivery and retries Respond with a `2xx` quickly (within 10 seconds). A failed delivery is retried up to 5 times with backoff: 30s → 5m → 30m → 2h. Delivery is best-effort, so make your handler idempotent: the same event can arrive more than once. ### Reconciliation Watch failed deliveries in the dashboard's delivery history. Polling doubles as your reconciliation path: `GET /orders?status=pending,active` shows anything a missed event left open. See [Order status](https://docs.dogesms.com/guides/order-status). --- # Errors Error shapes, status codes and what to do about each one. Every response is wrapped in an envelope carrying a `request_id` (also echoed in the `X-Request-Id` header — include it when contacting support): ```json { "data": { ... }, "request_id": "req_..." } // success { "error": { "code": "...", "message": "..." }, "request_id": "req_..." } // error ``` Authentication failures emitted before request-id middleware use a flat shape without `request_id`: ```json { "error": "Missing API Key", "code": "API_KEY_MISSING" } ``` Access-gate and rate-limit errors use the standard envelope. Branch on the `code` field in both shapes; it is stable across releases. Always branch on `code`, never on `message`: codes are stable across releases, messages are not. Include the `request_id` (also in the `X-Request-Id` header) when you contact support. ### Common status codes | Status | Meaning | What to do | |---|---|---| | 401 | The API key is missing, malformed or revoked. | Check the header format (`Bearer sk_live_…`) and that the key is active in the dashboard. | | 403 | The key is valid but the account is restricted (banned, unverified email, inactive), or order polling was turned off for the account (`ORDER_QUERY_NOT_AVAILABLE`). | Check your account in the dashboard; contact support if it is unexpected. | | 409 | The order is already final, or cancellation is temporarily unavailable (`CANCEL_DENIED_RETRY_LATER`). | Do not blindly retry writes. Wait, or use the final webhook event. | | 412 | `PRICE_CHANGED`: the price is above your `max_price_cents` (beyond the 5% tolerance). | Re-read the catalog, raise the cap or remove it, and retry. | | 422 | `INSUFFICIENT_BALANCE`, `SERVICE_NOT_AVAILABLE`, `CHANNEL_UNAVAILABLE` and similar. | Top up; retry later or try another country; pick another channel. | | 429 | Rate limit, daily quota, or too many active orders. | Branch on `code` and honour `Retry-After`. See [Rate limits](https://docs.dogesms.com/guides/rate-limits). | `429` and `422 SERVICE_NOT_AVAILABLE` are normal operating conditions. Back off and retry instead of showing raw codes to your users. ### Every error code, by endpoint | Endpoint | Status | Codes | |---|---|---| | [`GET /orders`](https://docs.dogesms.com/reference/list-orders) | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | [`GET /orders`](https://docs.dogesms.com/reference/list-orders) | 403 | `ORDER_QUERY_NOT_AVAILABLE` | | [`POST /orders`](https://docs.dogesms.com/reference/create-order) | 400 | `VALIDATION_ERROR`, `CURRENCY_MISMATCH` | | [`POST /orders`](https://docs.dogesms.com/reference/create-order) | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | [`POST /orders`](https://docs.dogesms.com/reference/create-order) | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | | [`POST /orders`](https://docs.dogesms.com/reference/create-order) | 412 | `PRICE_CHANGED` | | [`POST /orders`](https://docs.dogesms.com/reference/create-order) | 422 | `INSUFFICIENT_BALANCE`, `WALLET_NOT_INITIALIZED`, `SERVICE_NOT_AVAILABLE`, `CHANNEL_UNAVAILABLE` | | [`POST /orders`](https://docs.dogesms.com/reference/create-order) | 429 | `RATE_LIMITED`, `RATE_LIMITED_DAILY`, `TOO_MANY_ACTIVE_ORDERS` | | [`GET /orders/{id}`](https://docs.dogesms.com/reference/get-order) | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | [`GET /orders/{id}`](https://docs.dogesms.com/reference/get-order) | 403 | `ORDER_QUERY_NOT_AVAILABLE` | | [`GET /orders/{id}`](https://docs.dogesms.com/reference/get-order) | 404 | `ORDER_NOT_FOUND` | | [`POST /orders/{id}/cancel`](https://docs.dogesms.com/reference/cancel-order) | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | [`POST /orders/{id}/cancel`](https://docs.dogesms.com/reference/cancel-order) | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | | [`POST /orders/{id}/cancel`](https://docs.dogesms.com/reference/cancel-order) | 404 | `ORDER_NOT_FOUND` | | [`POST /orders/{id}/cancel`](https://docs.dogesms.com/reference/cancel-order) | 409 | `CANCEL_DENIED_RETRY_LATER`, `ORDER_ALREADY_TERMINAL` | | [`POST /orders/{id}/cancel`](https://docs.dogesms.com/reference/cancel-order) | 422 | `CANCEL_TOO_EARLY` | | [`GET /balance`](https://docs.dogesms.com/reference/get-balance) | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | [`GET /balance`](https://docs.dogesms.com/reference/get-balance) | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | | [`GET /catalog/services`](https://docs.dogesms.com/reference/list-services) | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | [`GET /catalog/services`](https://docs.dogesms.com/reference/list-services) | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | | [`GET /catalog/countries`](https://docs.dogesms.com/reference/list-countries) | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | [`GET /catalog/countries`](https://docs.dogesms.com/reference/list-countries) | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | | [`GET /catalog/prices`](https://docs.dogesms.com/reference/list-prices) | 400 | `INVALID_REQUEST` | | [`GET /catalog/prices`](https://docs.dogesms.com/reference/list-prices) | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | [`GET /catalog/prices`](https://docs.dogesms.com/reference/list-prices) | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | | [`GET /catalog/prices`](https://docs.dogesms.com/reference/list-prices) | 404 | `COUNTRY_NOT_FOUND` | | [`GET /catalog/prices`](https://docs.dogesms.com/reference/list-prices) | 429 | `PRICE_RATE_LIMITED` | | [`GET /catalog/channels`](https://docs.dogesms.com/reference/list-channels) | 400 | `INVALID_REQUEST` | | [`GET /catalog/channels`](https://docs.dogesms.com/reference/list-channels) | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | [`GET /catalog/channels`](https://docs.dogesms.com/reference/list-channels) | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | | [`GET /catalog/channels`](https://docs.dogesms.com/reference/list-channels) | 404 | `COUNTRY_NOT_FOUND` | | [`GET /catalog/channels`](https://docs.dogesms.com/reference/list-channels) | 429 | `PRICE_RATE_LIMITED` | | [`GET /rentals/plans`](https://docs.dogesms.com/reference/list-rental-plans) | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | [`GET /rentals/plans`](https://docs.dogesms.com/reference/list-rental-plans) | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | | [`POST /rentals/tos-accept`](https://docs.dogesms.com/reference/accept-rental-tos) | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | [`POST /rentals/tos-accept`](https://docs.dogesms.com/reference/accept-rental-tos) | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | | [`GET /rentals`](https://docs.dogesms.com/reference/list-rentals) | 400 | `VALIDATION_ERROR` | | [`GET /rentals`](https://docs.dogesms.com/reference/list-rentals) | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | [`GET /rentals`](https://docs.dogesms.com/reference/list-rentals) | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | | [`POST /rentals`](https://docs.dogesms.com/reference/create-rental) | 400 | `VALIDATION_ERROR` | | [`POST /rentals`](https://docs.dogesms.com/reference/create-rental) | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | [`POST /rentals`](https://docs.dogesms.com/reference/create-rental) | 402 | `INSUFFICIENT_BALANCE` | | [`POST /rentals`](https://docs.dogesms.com/reference/create-rental) | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | | [`POST /rentals`](https://docs.dogesms.com/reference/create-rental) | 404 | `RENTAL_PLAN_NOT_FOUND` | | [`POST /rentals`](https://docs.dogesms.com/reference/create-rental) | 412 | `RENTAL_TOS_NOT_ACCEPTED`, `PRICE_CHANGED` | | [`POST /rentals`](https://docs.dogesms.com/reference/create-rental) | 503 | `RENTAL_NO_NUMBERS` | | [`GET /rentals/sms`](https://docs.dogesms.com/reference/list-rental-sms-feed) | 400 | `VALIDATION_ERROR` | | [`GET /rentals/sms`](https://docs.dogesms.com/reference/list-rental-sms-feed) | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | [`GET /rentals/sms`](https://docs.dogesms.com/reference/list-rental-sms-feed) | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | | [`GET /rentals/{id}`](https://docs.dogesms.com/reference/get-rental) | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | [`GET /rentals/{id}`](https://docs.dogesms.com/reference/get-rental) | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | | [`GET /rentals/{id}`](https://docs.dogesms.com/reference/get-rental) | 404 | `RENTAL_NOT_FOUND` | | [`GET /rentals/{id}/sms`](https://docs.dogesms.com/reference/list-rental-sms) | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | [`GET /rentals/{id}/sms`](https://docs.dogesms.com/reference/list-rental-sms) | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | | [`GET /rentals/{id}/sms`](https://docs.dogesms.com/reference/list-rental-sms) | 404 | `RENTAL_NOT_FOUND` | --- # Changelog What changed in each API version. ## Version 2026.11 - **Prices for one service across all countries.** `GET /catalog/prices?service_code=whatsapp` returns one row per country where the service can be ordered, cheapest first, each with `country_code` and `country_name`. One request replaces a per-country loop. `country_code` is now optional when `service_code` is given; passing both returns just that service's row in that country. ## Version 2026.10.1 - **Channels.** New `GET /catalog/channels` lists every channel you can order in a country: a stable `channel_id`, the price you lock when you order it, a stock level, a quality level, and its recommended position (`rank`) within the service. - **Order a specific channel.** `POST /orders` accepts `channel_id`. The order is placed only on that channel, at its listed `price_cents`; if the channel cannot supply a number, the order fails and you are not charged — it is never moved to another channel. - **Reconciliation fields.** The create response carries `price_cents` (the price locked for that order). Orders placed by channel carry `channel_id`. Webhook events carry `amount_cents`, plus `channel_id` for orders placed by channel. ## Version 2026.10 - **The catalog now shows the price you lock.** `GET /catalog/prices` returns, per service, the price that `POST /orders` locks for that service and country at that moment — normally exactly what you are charged (see `max_price_cents` for the 5% tolerance). Previously it served a reference snapshot that could differ from the charge. - **Service codes match ordering.** `code` in `GET /catalog/services` and `service_code` in `GET /catalog/prices` are the values `POST /orders` accepts (e.g. `openai`). Older reference codes are gone. - **New `tier` field** on each price row tells you which tier that price lands on (`premium` when a service has no `standard` supply). - **`available_count` is a stock level**, not an exact count: one of `0`, `10`, `50`, `200`, `500`, meaning "at least this many". - **Default price cap.** If you omit `max_price_cents`, the price locked at order time becomes your cap: you are never charged more than 5% above it. See `max_price_cents` for details. --- # Support How to reach us. | Channel | Where | Hours | |---|---|---| | Telegram | [@dogesms_official](https://t.me/dogesms_official) | Daily 09:00–21:00 (UTC+8), live follow-up | | Email | [support@dogesms.com](mailto:support@dogesms.com) | 24/7 ticket intake, reviewed in business hours | When you report a problem, include the `request_id` from the response (or the `X-Request-Id` header) and the order `id`. For high-volume or enterprise access, contact the sales team through the same channels. Rate limits above the built-in tiers can be requested in **Dashboard → API Keys → Rate Limits**. --- # List your orders `GET https://api.dogesms.com/v1/orders` Available to every account by default — this is the recommended polling endpoint. One `GET /orders?status=pending,active` every 5 seconds tracks all your in-flight orders with a single request. `403 ORDER_QUERY_NOT_AVAILABLE` is returned only when polling has been disabled for your account (e.g. abuse review) — contact support. ## Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `limit` | query | integer | no | Page size, max 100. | | `offset` | query | integer | no | | | `startTime` | query | string (date-time) | no | RFC3339; filters by `created_at`. | | `endTime` | query | string (date-time) | no | RFC3339; filters by `created_at`. | | `status` | query | string | no | Comma-separated order statuses, e.g. `active,completed`. | ## Request examples ### cURL ```bash curl "https://api.dogesms.com/v1/orders?status=pending,active" \ -H "Authorization: Bearer sk_live_…" ``` ### Node ```js const res = await fetch("https://api.dogesms.com/v1/orders?status=pending,active", { headers: { Authorization: `Bearer ${process.env.DOGESMS_API_KEY}`, }, }); const json = await res.json(); console.log(res.status, json); ``` ### Python ```python import os import requests res = requests.get( "https://api.dogesms.com/v1/orders?status=pending,active", headers={ "Authorization": f"Bearer {os.environ['DOGESMS_API_KEY']}", }, timeout=30, ) print(res.status_code, res.json()) ``` ## Responses ### 200 Order list, newest first. ```json { "data": { "items": [ { "id": "3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93", "order_no": "string", "service_code": "whatsapp", "country_code": "US", "status": "pending", "amount_cents": 43, "currency": "USD", "phone_number": "+15550142290", "sms_code": "string", "sms_content": "string", "created_at": "2026-12-01T09:00:00Z", "activated_at": "2026-12-01T09:00:00Z", "expired_at": "2026-12-01T09:00:00Z", "completed_at": "2026-12-01T09:00:00Z", "cancelled_at": "2026-12-01T09:00:00Z", "sms_received_at": "2026-12-01T09:00:00Z", "error_code": "string", "error_message": "string", "channel_id": "ch_2j6kq4x7m3np5r2t8v4w", "price_cents": 43 } ], "total": 42, "limit": 20, "offset": 0 }, "request_id": "string" } ``` ### 401 Missing or invalid API key (`API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED`). Emitted by the auth layer before the handler — flat shape, no `request_id`. ### 403 `ORDER_QUERY_NOT_AVAILABLE` — order status polling has been disabled for your account (e.g. abuse review). Polling is enabled by default for all accounts; contact support to restore access. ## Error codes | Status | Codes | |---|---| | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | 403 | `ORDER_QUERY_NOT_AVAILABLE` | --- # Create an order (buy a number) `POST https://api.dogesms.com/v1/orders` Buys a temporary number for the given service and country. The order stays `pending` until a number is allocated (usually within seconds), then becomes `active`; when the SMS code arrives it becomes `completed`. **Billing**: your wallet is charged **when the number is successfully allocated**, not at creation — while the order is `pending`, `amount_cents` is `0` and no funds have moved. If allocation fails (`failed`), you are never charged. **Price is resolved server-side** — you cannot self-quote. The resolved price is the same `price_cents` that `GET /catalog/prices` shows for this service and country at that moment (default tier) — or, when you pass `channel_id`, that channel's `price_cents` in `GET /catalog/channels`. The create response returns it as `price_cents` (omitted when an `Idempotency-Key` replay returns an existing order). Pass `max_price_cents` to protect against price moves between your catalog read and the purchase: if the resolved price exceeds your cap by **more than 5%**, a `412 PRICE_CHANGED` is returned instead of charging you. Note the 5% tolerance — with `max_price_cents: 100` you may still be charged up to 105 cents; treat it as drift protection, not an exact budget ceiling. If you omit `max_price_cents`, the price locked at order time is your cap (same 5% tolerance). You are normally charged exactly the locked price; if the number can only be supplied at a higher price, the charge can rise up to 5% above your cap. When no number can be allocated within the cap, the order ends as `failed` with `NO_NUMBERS_AVAILABLE` and you are not charged. Send a higher `max_price_cents` if you prefer a higher fill rate over price. **Ordering a specific channel**: pass a `channel_id` from `GET /catalog/channels`. `service_code`, `country_code` and `tier` may then be omitted; if you send them, they must match the channel. The number comes only from that channel: if it cannot supply one, the order ends as `failed` with `NO_NUMBERS_AVAILABLE` and you are not charged — it is never moved to another channel. A channel that is no longer available returns `422 CHANNEL_UNAVAILABLE` and no order is created. Supports idempotency: pass a UUID in the `Idempotency-Key` header; retrying with the same key returns the original order (with its current live status) instead of buying twice. Receive the allocated number and SMS code by polling `GET /orders` / `GET /orders/{id}`, or through the `order.number_allocated` and `order.completed` webhook events. Accounts with polling disabled (abuse review) instead get a fixed `pending` creation acknowledgement (`amount_cents: 0`) without phone/SMS/live status — even on idempotent replay — and receive all lifecycle updates through webhooks. ## Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `Idempotency-Key` | header | string (uuid) | no | UUID; retries with the same key return the original order. | ## Request body Content type: `application/json` | Field | Type | Required | Description | |---|---|---|---| | `service_code` | string | no | Service code from the catalog, e.g. `whatsapp`. Required unless `channel_id` is sent; if sent with it, must match the channel. | | `country_code` | string | no | ISO 3166-1 alpha-2 country code, e.g. `US`. Required unless `channel_id` is sent; if sent with it, must match the channel. | | `tier` | enum | no | Price tier; defaults to `standard`. With `channel_id`, optional and must match the channel if sent. Allowed: `standard`, `premium`. | | `channel_id` | string | no | A `channel_id` from `GET /catalog/channels`. The order is placed only on that channel, at its `price_cents`; if the channel cannot supply a number the order fails and you are not charged. | | `max_price_cents` | integer | no | Optional price-drift protection in cents. If the resolved price exceeds this value by **more than 5%**, the API returns `412 PRICE_CHANGED` instead of charging you — i.e. with a cap of `100` you may still be charged up to `105`. Not an exact budget ceiling. When omitted, the price locked at order time is used as the cap (with the same 5% tolerance); do not send 0. | ```json { "service_code": "whatsapp", "country_code": "US" } ``` ## Request examples ### cURL ```bash curl -X POST "https://api.dogesms.com/v1/orders" \ -H "Authorization: Bearer sk_live_…" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"service_code":"whatsapp","country_code":"US"}' ``` ### Node ```js const res = await fetch("https://api.dogesms.com/v1/orders", { method: "POST", headers: { Authorization: `Bearer ${process.env.DOGESMS_API_KEY}`, "Idempotency-Key": crypto.randomUUID(), "Content-Type": "application/json", }, body: JSON.stringify({ "service_code": "whatsapp", "country_code": "US" }), }); const json = await res.json(); console.log(res.status, json); ``` ### Python ```python import os, uuid import requests res = requests.post( "https://api.dogesms.com/v1/orders", headers={ "Authorization": f"Bearer {os.environ['DOGESMS_API_KEY']}", "Idempotency-Key": str(uuid.uuid4()), }, json={ "service_code": "whatsapp", "country_code": "US" }, timeout=30, ) print(res.status_code, res.json()) ``` ## Responses ### 201 Order accepted (`pending`). Track it by polling or webhooks. For accounts with polling disabled (abuse review) this is a fixed creation acknowledgement even on idempotent replay: no phone, SMS, live status, or settled amount is returned. ```json { "data": { "id": "3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93", "order_no": "string", "service_code": "whatsapp", "country_code": "US", "status": "pending", "amount_cents": 43, "currency": "USD", "phone_number": "+15550142290", "sms_code": "string", "sms_content": "string", "created_at": "2026-12-01T09:00:00Z", "activated_at": "2026-12-01T09:00:00Z", "expired_at": "2026-12-01T09:00:00Z", "completed_at": "2026-12-01T09:00:00Z", "cancelled_at": "2026-12-01T09:00:00Z", "sms_received_at": "2026-12-01T09:00:00Z", "error_code": "string", "error_message": "string", "channel_id": "ch_2j6kq4x7m3np5r2t8v4w", "price_cents": 43 }, "request_id": "req_9b2d5c1e-..." } ``` ### 400 Validation error (`VALIDATION_ERROR`, `CURRENCY_MISMATCH`) — including a missing `service_code` / `country_code` without `channel_id`, an unknown `channel_id`, or `service_code` / `country_code` / `tier` that do not match it. ### 401 Missing or invalid API key (`API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED`). Emitted by the auth layer before the handler — flat shape, no `request_id`. ### 403 Key is valid but the account is not eligible (`ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE`). Emitted by the auth layer — flat shape. ### 412 `PRICE_CHANGED` — current price exceeds your `max_price_cents`; re-read the catalog and retry. ### 422 `INSUFFICIENT_BALANCE`, `WALLET_NOT_INITIALIZED`, `SERVICE_NOT_AVAILABLE`, or `CHANNEL_UNAVAILABLE` (the `channel_id` is delisted, suspended, or temporarily unavailable — pick another channel from `GET /catalog/channels`). No order is created. ### 429 Branch on `code` and honour `Retry-After`: - `RATE_LIMITED` / `RATE_LIMITED_DAILY`: wait until the indicated reset. - `TOO_MANY_ACTIVE_ORDERS`: wait for current orders to finish. ## Error codes | Status | Codes | |---|---| | 400 | `VALIDATION_ERROR`, `CURRENCY_MISMATCH` | | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | | 412 | `PRICE_CHANGED` | | 422 | `INSUFFICIENT_BALANCE`, `WALLET_NOT_INITIALIZED`, `SERVICE_NOT_AVAILABLE`, `CHANNEL_UNAVAILABLE` | | 429 | `RATE_LIMITED`, `RATE_LIMITED_DAILY`, `TOO_MANY_ACTIVE_ORDERS` | --- # Get a single order `GET https://api.dogesms.com/v1/orders/{id}` Available by default, same as `GET /orders`. Prefer list polling to track many orders — poll this endpoint only for a single order of interest. ## Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `id` | path | string (uuid) | yes | | ## Request examples ### cURL ```bash curl "https://api.dogesms.com/v1/orders/3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93" \ -H "Authorization: Bearer sk_live_…" ``` ### Node ```js const res = await fetch("https://api.dogesms.com/v1/orders/3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93", { headers: { Authorization: `Bearer ${process.env.DOGESMS_API_KEY}`, }, }); const json = await res.json(); console.log(res.status, json); ``` ### Python ```python import os import requests res = requests.get( "https://api.dogesms.com/v1/orders/3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93", headers={ "Authorization": f"Bearer {os.environ['DOGESMS_API_KEY']}", }, timeout=30, ) print(res.status_code, res.json()) ``` ## Responses ### 200 The order. ```json { "data": { "id": "3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93", "order_no": "string", "service_code": "whatsapp", "country_code": "US", "status": "pending", "amount_cents": 43, "currency": "USD", "phone_number": "+15550142290", "sms_code": "string", "sms_content": "string", "created_at": "2026-12-01T09:00:00Z", "activated_at": "2026-12-01T09:00:00Z", "expired_at": "2026-12-01T09:00:00Z", "completed_at": "2026-12-01T09:00:00Z", "cancelled_at": "2026-12-01T09:00:00Z", "sms_received_at": "2026-12-01T09:00:00Z", "error_code": "string", "error_message": "string", "channel_id": "ch_2j6kq4x7m3np5r2t8v4w", "price_cents": 43 }, "request_id": "req_9b2d5c1e-..." } ``` ### 401 Missing or invalid API key (`API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED`). Emitted by the auth layer before the handler — flat shape, no `request_id`. ### 403 `ORDER_QUERY_NOT_AVAILABLE` — order status polling has been disabled for your account (e.g. abuse review). Polling is enabled by default for all accounts; contact support to restore access. ### 404 `ORDER_NOT_FOUND` — no such order under your account. ## Error codes | Status | Codes | |---|---| | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | 403 | `ORDER_QUERY_NOT_AVAILABLE` | | 404 | `ORDER_NOT_FOUND` | --- # Cancel an order (refund) `POST https://api.dogesms.com/v1/orders/{id}/cancel` Cancels an order that has not received an SMS yet. If the number was already allocated (order charged), the charge is refunded; a still `pending` order was never charged. Allowed only after a 2-minute cooldown from creation (`422 CANCEL_TOO_EARLY` before that). Cancellation may be temporarily refused while the SMS could still be in transit (`409 CANCEL_DENIED_RETRY_LATER`) — the order stays `active` and keeps waiting for the SMS; retry in a few minutes or let the order expire for an automatic refund. Cancelling an order that is **already terminal** returns `200` with the order's full current state (idempotent replay) — **always check `status` in the response**: a `completed` order was charged and is NOT refunded by this call; only `status: cancelled` means the charge was released. For accounts with polling disabled (abuse review), the terminal case returns `409 ORDER_ALREADY_TERMINAL` instead, and a successful cancellation returns a fixed `cancelled` acknowledgement (`amount_cents: 0`) without phone/SMS/live fields. ## Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `id` | path | string (uuid) | yes | | ## Request examples ### cURL ```bash curl -X POST "https://api.dogesms.com/v1/orders/3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93/cancel" \ -H "Authorization: Bearer sk_live_…" ``` ### Node ```js const res = await fetch("https://api.dogesms.com/v1/orders/3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93/cancel", { method: "POST", headers: { Authorization: `Bearer ${process.env.DOGESMS_API_KEY}`, }, }); const json = await res.json(); console.log(res.status, json); ``` ### Python ```python import os import requests res = requests.post( "https://api.dogesms.com/v1/orders/3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93/cancel", headers={ "Authorization": f"Bearer {os.environ['DOGESMS_API_KEY']}", }, timeout=30, ) print(res.status_code, res.json()) ``` ## Responses ### 200 Cancellation accepted, or idempotent replay for an already-terminal order — branch on `status`: `cancelled` = charge released; `completed` = SMS was delivered and the charge stands. For accounts with polling disabled (abuse review), this is a fixed `cancelled` acknowledgement without phone, SMS, settled amount, or other live fields. ```json { "data": { "id": "3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93", "order_no": "string", "service_code": "whatsapp", "country_code": "US", "status": "pending", "amount_cents": 43, "currency": "USD", "phone_number": "+15550142290", "sms_code": "string", "sms_content": "string", "created_at": "2026-12-01T09:00:00Z", "activated_at": "2026-12-01T09:00:00Z", "expired_at": "2026-12-01T09:00:00Z", "completed_at": "2026-12-01T09:00:00Z", "cancelled_at": "2026-12-01T09:00:00Z", "sms_received_at": "2026-12-01T09:00:00Z", "error_code": "string", "error_message": "string", "channel_id": "ch_2j6kq4x7m3np5r2t8v4w", "price_cents": 43 }, "request_id": "req_9b2d5c1e-..." } ``` ### 401 Missing or invalid API key (`API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED`). Emitted by the auth layer before the handler — flat shape, no `request_id`. ### 403 Key is valid but the account is not eligible (`ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE`). Emitted by the auth layer — flat shape. ### 404 `ORDER_NOT_FOUND` — no such order under your account. ### 409 `CANCEL_DENIED_RETRY_LATER` — cancellation temporarily unavailable (SMS may still arrive), order stays active, retry in a few minutes; or `ORDER_ALREADY_TERMINAL` — returned for the already-terminal case only when polling is disabled for the account (with polling enabled the terminal case replays `200` + current state instead). ### 422 `CANCEL_TOO_EARLY` — wait out the 2-minute cooldown. ## Error codes | Status | Codes | |---|---| | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | | 404 | `ORDER_NOT_FOUND` | | 409 | `CANCEL_DENIED_RETRY_LATER`, `ORDER_ALREADY_TERMINAL` | | 422 | `CANCEL_TOO_EARLY` | --- # Get wallet balance `GET https://api.dogesms.com/v1/balance` ## Request examples ### cURL ```bash curl "https://api.dogesms.com/v1/balance" \ -H "Authorization: Bearer sk_live_…" ``` ### Node ```js const res = await fetch("https://api.dogesms.com/v1/balance", { headers: { Authorization: `Bearer ${process.env.DOGESMS_API_KEY}`, }, }); const json = await res.json(); console.log(res.status, json); ``` ### Python ```python import os import requests res = requests.get( "https://api.dogesms.com/v1/balance", headers={ "Authorization": f"Bearer {os.environ['DOGESMS_API_KEY']}", }, timeout=30, ) print(res.status_code, res.json()) ``` ## Responses ### 200 Current balance in cents. ```json { "data": { "balance_cents": 1250, "currency": "USD" }, "request_id": "string" } ``` ### 401 Missing or invalid API key (`API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED`). Emitted by the auth layer before the handler — flat shape, no `request_id`. ### 403 Key is valid but the account is not eligible (`ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE`). Emitted by the auth layer — flat shape. ## Error codes | Status | Codes | |---|---| | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | --- # List available services `GET https://api.dogesms.com/v1/catalog/services` Services you can order right now in at least one country — exactly the services that appear in some country's `GET /catalog/prices`. Use `code` as `service_code` when ordering; which countries a service is orderable in is shown by `GET /catalog/prices`. Built from the same cached price lists that `GET /catalog/prices` serves, so the two always agree; the response carries `Cache-Control: private, max-age=30`. ## Request examples ### cURL ```bash curl "https://api.dogesms.com/v1/catalog/services" \ -H "Authorization: Bearer sk_live_…" ``` ### Node ```js const res = await fetch("https://api.dogesms.com/v1/catalog/services", { headers: { Authorization: `Bearer ${process.env.DOGESMS_API_KEY}`, }, }); const json = await res.json(); console.log(res.status, json); ``` ### Python ```python import os import requests res = requests.get( "https://api.dogesms.com/v1/catalog/services", headers={ "Authorization": f"Bearer {os.environ['DOGESMS_API_KEY']}", }, timeout=30, ) print(res.status_code, res.json()) ``` ## Responses ### 200 Service list. ```json { "data": [ { "code": "whatsapp", "name": "WhatsApp" } ], "request_id": "string" } ``` ### 401 Missing or invalid API key (`API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED`). Emitted by the auth layer before the handler — flat shape, no `request_id`. ### 403 Key is valid but the account is not eligible (`ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE`). Emitted by the auth layer — flat shape. ## Error codes | Status | Codes | |---|---| | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | --- # List available countries `GET https://api.dogesms.com/v1/catalog/countries` Countries with at least one service you can order right now, sorted by `service_count` (highest first). `service_count` equals the number of rows `GET /catalog/prices` returns for that country. Built from the same cached price lists that `GET /catalog/prices` serves, so the two always agree; the response carries `Cache-Control: private, max-age=30`. ## Request examples ### cURL ```bash curl "https://api.dogesms.com/v1/catalog/countries" \ -H "Authorization: Bearer sk_live_…" ``` ### Node ```js const res = await fetch("https://api.dogesms.com/v1/catalog/countries", { headers: { Authorization: `Bearer ${process.env.DOGESMS_API_KEY}`, }, }); const json = await res.json(); console.log(res.status, json); ``` ### Python ```python import os import requests res = requests.get( "https://api.dogesms.com/v1/catalog/countries", headers={ "Authorization": f"Bearer {os.environ['DOGESMS_API_KEY']}", }, timeout=30, ) print(res.status_code, res.json()) ``` ## Responses ### 200 Country list. ```json { "data": [ { "code": "US", "name": "United States", "phone_prefix": 1, "service_count": 50 } ], "request_id": "string" } ``` ### 401 Missing or invalid API key (`API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED`). Emitted by the auth layer before the handler — flat shape, no `request_id`. ### 403 Key is valid but the account is not eligible (`ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE`). Emitted by the auth layer — flat shape. ## Error codes | Status | Codes | |---|---| | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | --- # List prices for one country, or one service across all countries `GET https://api.dogesms.com/v1/catalog/prices` Pass `country_code`, `service_code`, or both. **By country** (`country_code`): one row per orderable service in that country. Add `service_code` to get just that service's row. **By service** (`service_code` only): one row per country where that service can be ordered right now, cheapest first (ties: more stock first, then country code). Each row adds `country_code` and `country_name` and is identical to that service's row in the country's own price list. Use this to compare countries in **one request** instead of calling this endpoint once per country. An unknown service, or one with no stock anywhere, returns an empty list. `price_cents` is the price `POST /orders` locks for that service and country when you do not pass `tier`; `tier` tells you which tier that price lands on. You are normally charged exactly `price_cents`; if the number can only be supplied at a higher price, you may be charged more, but never more than 5% above `max_price_cents` (which defaults to the locked price). Services missing from a country's list cannot be ordered there right now. An unknown country returns `404 COUNTRY_NOT_FOUND`; a known country with no stock returns an empty list. Ordering with `tier: premium` explicitly may lock a different price than the row shows. Prices usually change once a day; pass `max_price_cents` when ordering to guard against moves between your read and the purchase. Cached — response carries `Cache-Control: private, max-age=30`. **Do not repeatedly query this endpoint**: cache it client-side and honour `Retry-After` on 429. Each request counts as one price query, whichever mode you use. Standard accounts receive 1,000 price queries per 5 hours and 10,000 per 7 days. VIP accounts receive 5,000 per 5 hours and 50,000 per 7 days. ## Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `country_code` | query | string | no | ISO 3166-1 alpha-2, e.g. `US`. Required unless `service_code` is given. | | `service_code` | query | string | no | Service code from `GET /catalog/services`, e.g. `whatsapp` (case-insensitive). Alone: that service across all countries. With `country_code`: only that service's row. | ## Request examples ### cURL ```bash curl "https://api.dogesms.com/v1/catalog/prices?country_code=US" \ -H "Authorization: Bearer sk_live_…" ``` ### Node ```js const res = await fetch("https://api.dogesms.com/v1/catalog/prices?country_code=US", { headers: { Authorization: `Bearer ${process.env.DOGESMS_API_KEY}`, }, }); const json = await res.json(); console.log(res.status, json); ``` ### Python ```python import os import requests res = requests.get( "https://api.dogesms.com/v1/catalog/prices?country_code=US", headers={ "Authorization": f"Bearer {os.environ['DOGESMS_API_KEY']}", }, timeout=30, ) print(res.status_code, res.json()) ``` ## Responses ### 200 Price list. ```json { "data": [ { "country_code": "ID", "country_name": "Indonesia", "service_code": "whatsapp", "service_name": "WhatsApp", "price_cents": 43, "tier": "standard", "available_count": 500 } ], "request_id": "string" } ``` ### 400 `INVALID_REQUEST` — neither `country_code` nor `service_code` given, malformed `country_code`, or `service_code` longer than 64 characters. ### 401 Missing or invalid API key (`API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED`). Emitted by the auth layer before the handler — flat shape, no `request_id`. ### 403 Key is valid but the account is not eligible (`ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE`). Emitted by the auth layer — flat shape. ### 404 `COUNTRY_NOT_FOUND` (only when `country_code` is given). ### 429 `PRICE_RATE_LIMITED` — cache responses and retry after the returned reset time. Contact vip@dogesms.com if a verified business integration needs higher limits. ## Error codes | Status | Codes | |---|---| | 400 | `INVALID_REQUEST` | | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | | 404 | `COUNTRY_NOT_FOUND` | | 429 | `PRICE_RATE_LIMITED` | --- # List channels for one country `GET https://api.dogesms.com/v1/catalog/channels` One row per channel you can order in the given country. A channel is one specific source of numbers for a service; ordering with its `channel_id` buys only from that channel, at its `price_cents`. - `price_cents` is the price `POST /orders` locks when you pass that `channel_id` — normally exactly what you are charged. - `rank` is our recommended order within each service (`1` = best). - `quality` is a level from recent delivery results: `high`, `medium`, `low`, or `unknown` (not enough recent orders yet). It is informational, not a guarantee. - `channel_id` is stable: a channel keeps its ID, and an ID is never reused or pointed at another channel, so you can store it. When a channel is delisted it disappears from this list and ordering with its ID returns `422 CHANNEL_UNAVAILABLE`. Pass `service_code` to get a single service. An unknown country returns `404 COUNTRY_NOT_FOUND`; an unknown service returns an empty list. Cached — response carries `Cache-Control: private, max-age=60`. Send `Accept-Encoding: gzip`: large countries return thousands of rows. Counts toward the same price query limits as `GET /catalog/prices`. ## Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `country_code` | query | string | yes | ISO 3166-1 alpha-2, e.g. `US`. | | `service_code` | query | string | no | Only return channels for this service, e.g. `whatsapp`. | ## Request examples ### cURL ```bash curl "https://api.dogesms.com/v1/catalog/channels?country_code=US" \ -H "Authorization: Bearer sk_live_…" ``` ### Node ```js const res = await fetch("https://api.dogesms.com/v1/catalog/channels?country_code=US", { headers: { Authorization: `Bearer ${process.env.DOGESMS_API_KEY}`, }, }); const json = await res.json(); console.log(res.status, json); ``` ### Python ```python import os import requests res = requests.get( "https://api.dogesms.com/v1/catalog/channels?country_code=US", headers={ "Authorization": f"Bearer {os.environ['DOGESMS_API_KEY']}", }, timeout=30, ) print(res.status_code, res.json()) ``` ## Responses ### 200 Channel list, grouped by service and ordered by `rank`. ```json { "data": [ { "service_code": "whatsapp", "channel_id": "ch_2j6kq4x7m3np5r2t8v4w", "price_cents": 43, "tier": "standard", "available_count": 500, "quality": "high", "rank": 1 } ], "request_id": "string" } ``` ### 400 `INVALID_REQUEST` — missing or malformed `country_code`. ### 401 Missing or invalid API key (`API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED`). Emitted by the auth layer before the handler — flat shape, no `request_id`. ### 403 Key is valid but the account is not eligible (`ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE`). Emitted by the auth layer — flat shape. ### 404 `COUNTRY_NOT_FOUND`. ### 429 `PRICE_RATE_LIMITED` — cache responses and retry after the returned reset time. ## Error codes | Status | Codes | |---|---| | 400 | `INVALID_REQUEST` | | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | | 404 | `COUNTRY_NOT_FOUND` | | 429 | `PRICE_RATE_LIMITED` | --- # List rental plans `GET https://api.dogesms.com/v1/rentals/plans` Every rentable combination of country, service, duration and tier with its price. `service_code: null` means the plan accepts any service except those listed in its `excluded_service_codes`. Use the returned `duration_days` when creating a rental — valid durations are data-driven, not fixed. The same country / service / duration may appear twice with different `tier` values (`standard` and `premium`); pass the `tier` you want when creating a rental. ## Request examples ### cURL ```bash curl "https://api.dogesms.com/v1/rentals/plans" \ -H "Authorization: Bearer sk_live_…" ``` ### Node ```js const res = await fetch("https://api.dogesms.com/v1/rentals/plans", { headers: { Authorization: `Bearer ${process.env.DOGESMS_API_KEY}`, }, }); const json = await res.json(); console.log(res.status, json); ``` ### Python ```python import os import requests res = requests.get( "https://api.dogesms.com/v1/rentals/plans", headers={ "Authorization": f"Bearer {os.environ['DOGESMS_API_KEY']}", }, timeout=30, ) print(res.status_code, res.json()) ``` ## Responses ### 200 Rental plans. ```json { "data": [ { "country_code": "CA", "service_code": "whatsapp", "duration_days": 30, "tier": "standard", "price_cents": 43, "original_price_cents": 0, "currency": "USD", "excluded_service_codes": [ "openai" ] } ], "request_id": "string" } ``` ### 401 Missing or invalid API key (`API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED`). Emitted by the auth layer before the handler — flat shape, no `request_id`. ### 403 Key is valid but the account is not eligible (`ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE`). Emitted by the auth layer — flat shape. ## Error codes | Status | Codes | |---|---| | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | --- # Accept the rental terms of service `POST https://api.dogesms.com/v1/rentals/tos-accept` Rentals require accepting the rental terms once per account (same record the dashboard uses). Idempotent — calling it again is a no-op. Until accepted, `POST /rentals` answers `412 RENTAL_TOS_NOT_ACCEPTED`. ## Request examples ### cURL ```bash curl -X POST "https://api.dogesms.com/v1/rentals/tos-accept" \ -H "Authorization: Bearer sk_live_…" ``` ### Node ```js const res = await fetch("https://api.dogesms.com/v1/rentals/tos-accept", { method: "POST", headers: { Authorization: `Bearer ${process.env.DOGESMS_API_KEY}`, }, }); const json = await res.json(); console.log(res.status, json); ``` ### Python ```python import os import requests res = requests.post( "https://api.dogesms.com/v1/rentals/tos-accept", headers={ "Authorization": f"Bearer {os.environ['DOGESMS_API_KEY']}", }, timeout=30, ) print(res.status_code, res.json()) ``` ## Responses ### 200 Accepted (or already accepted). ```json { "data": { "accepted": true }, "request_id": "string" } ``` ### 401 Missing or invalid API key (`API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED`). Emitted by the auth layer before the handler — flat shape, no `request_id`. ### 403 Key is valid but the account is not eligible (`ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE`). Emitted by the auth layer — flat shape. ## Error codes | Status | Codes | |---|---| | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | --- # List your rentals `GET https://api.dogesms.com/v1/rentals` ## Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `status` | query | string | no | Comma-separated filter: `active`, `expired`, `refunded`, `force_released` (also `payment_pending` for rentals created in the dashboard). | | `limit` | query | integer | no | | | `offset` | query | integer | no | | ## Request examples ### cURL ```bash curl "https://api.dogesms.com/v1/rentals?status=active" \ -H "Authorization: Bearer sk_live_…" ``` ### Node ```js const res = await fetch("https://api.dogesms.com/v1/rentals?status=active", { headers: { Authorization: `Bearer ${process.env.DOGESMS_API_KEY}`, }, }); const json = await res.json(); console.log(res.status, json); ``` ### Python ```python import os import requests res = requests.get( "https://api.dogesms.com/v1/rentals?status=active", headers={ "Authorization": f"Bearer {os.environ['DOGESMS_API_KEY']}", }, timeout=30, ) print(res.status_code, res.json()) ``` ## Responses ### 200 Rentals, newest first. ```json { "data": { "items": [ { "id": "3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93", "status": "active", "phone_number": "+15550142290", "country_code": "CA", "service_code": "whatsapp", "duration_days": 30, "tier": "standard", "price_cents": 43, "currency": "USD", "auto_renew": true, "started_at": "2026-12-01T09:00:00Z", "expires_at": "2026-12-01T09:00:00Z", "released_at": "2026-12-01T09:00:00Z", "created_at": "2026-12-01T09:00:00Z" } ], "total": 3, "limit": 20, "offset": 0 }, "request_id": "string" } ``` ### 400 `VALIDATION_ERROR` — unknown `status` value. ### 401 Missing or invalid API key (`API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED`). Emitted by the auth layer before the handler — flat shape, no `request_id`. ### 403 Key is valid but the account is not eligible (`ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE`). Emitted by the auth layer — flat shape. ## Error codes | Status | Codes | |---|---| | 400 | `VALIDATION_ERROR` | | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | --- # Rent a number `POST https://api.dogesms.com/v1/rentals` Charges one billing period from your wallet and assigns a number right away. Rentals created through the API **never auto-renew**: the number is yours until `expires_at`, then the rental ends on its own. Renewal is not available through the API yet. Send `Idempotency-Key: ` to make retries safe — a replay with the same key returns the rental created by the first request instead of renting a second number. Pass the `price_cents` you saw in `GET /rentals/plans` as `max_price_cents`: if the plan has been repriced above it since, you get `412 PRICE_CHANGED` and nothing is charged — re-read the plans and retry. `tier` is optional. When you omit it, the rental is created on whichever of the two tiers is cheaper for that country / service / duration — the same choice the dashboard makes by default. Note that the two tiers are not always the same product: a `standard` plan for a specific service may be fulfilled by a number rented for any service, while `premium` plans are dedicated to the requested service. Pass `tier` to pin one. ## Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `Idempotency-Key` | header | string (uuid) | no | | ## Request body Content type: `application/json` | Field | Type | Required | Description | |---|---|---|---| | `country_code` | string | yes | ISO 3166-1 alpha-2. | | `service_code` | string | no | Optional. Omit (or send an empty string) to rent a number for any service, where a plan allows it. | | `duration_days` | integer | yes | Billing period in days (1–365). Must match a plan from `GET /rentals/plans`; values outside 1–365 are rejected with `VALIDATION_ERROR` before any plan lookup. | | `max_price_cents` | integer | no | Optional cap on what you are willing to pay for the first period, in cents. Send the plan price you saw; if the plan is now priced above it you get `412 PRICE_CHANGED` and nothing is charged. Omitted = pay the current plan price. | | `tier` | enum | no | Optional quality tier, as listed in `GET /rentals/plans`. Omitted = the cheaper of the two tiers available for that country / service / duration (on a tie, `standard`); pass it to pin a tier. Any other value is a `400 VALIDATION_ERROR`; a tier with no plan for that country / service / duration is `404 RENTAL_PLAN_NOT_FOUND`. Allowed: `standard`, `premium`. | ```json { "country_code": "CA", "service_code": "whatsapp", "duration_days": 30, "max_price_cents": 1250, "tier": "standard" } ``` ## Request examples ### cURL ```bash curl -X POST "https://api.dogesms.com/v1/rentals" \ -H "Authorization: Bearer sk_live_…" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"country_code":"CA","service_code":"whatsapp","duration_days":30,"max_price_cents":1250,"tier":"standard"}' ``` ### Node ```js const res = await fetch("https://api.dogesms.com/v1/rentals", { method: "POST", headers: { Authorization: `Bearer ${process.env.DOGESMS_API_KEY}`, "Idempotency-Key": crypto.randomUUID(), "Content-Type": "application/json", }, body: JSON.stringify({ "country_code": "CA", "service_code": "whatsapp", "duration_days": 30, "max_price_cents": 1250, "tier": "standard" }), }); const json = await res.json(); console.log(res.status, json); ``` ### Python ```python import os, uuid import requests res = requests.post( "https://api.dogesms.com/v1/rentals", headers={ "Authorization": f"Bearer {os.environ['DOGESMS_API_KEY']}", "Idempotency-Key": str(uuid.uuid4()), }, json={ "country_code": "CA", "service_code": "whatsapp", "duration_days": 30, "max_price_cents": 1250, "tier": "standard" }, timeout=30, ) print(res.status_code, res.json()) ``` ## Responses ### 201 Rental created and number assigned. ```json { "data": { "id": "3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93", "status": "active", "phone_number": "+15550142290", "country_code": "CA", "service_code": "whatsapp", "duration_days": 30, "tier": "standard", "price_cents": 43, "currency": "USD", "auto_renew": true, "started_at": "2026-12-01T09:00:00Z", "expires_at": "2026-12-01T09:00:00Z", "released_at": "2026-12-01T09:00:00Z", "created_at": "2026-12-01T09:00:00Z" }, "request_id": "string" } ``` ### 400 `VALIDATION_ERROR` — missing `country_code`, `duration_days` outside 1–365, non-positive `max_price_cents`, an unknown `tier`, or a malformed `Idempotency-Key`. ### 401 Missing or invalid API key (`API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED`). Emitted by the auth layer before the handler — flat shape, no `request_id`. ### 402 `INSUFFICIENT_BALANCE` — top up first; nothing was charged. ### 403 Key is valid but the account is not eligible (`ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE`). Emitted by the auth layer — flat shape. ### 404 `RENTAL_PLAN_NOT_FOUND` — no plan for that country / service / duration / tier; see `GET /rentals/plans`. ### 412 `RENTAL_TOS_NOT_ACCEPTED` — call `POST /rentals/tos-accept` first. `PRICE_CHANGED` — the plan price is above your `max_price_cents`; nothing was charged, re-read the plans and retry. ### 503 `RENTAL_NO_NUMBERS` — no number available for that country / service right now; nothing was charged. Retry later. ## Error codes | Status | Codes | |---|---| | 400 | `VALIDATION_ERROR` | | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | 402 | `INSUFFICIENT_BALANCE` | | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | | 404 | `RENTAL_PLAN_NOT_FOUND` | | 412 | `RENTAL_TOS_NOT_ACCEPTED`, `PRICE_CHANGED` | | 503 | `RENTAL_NO_NUMBERS` | --- # Account-wide SMS feed (all rentals) `GET https://api.dogesms.com/v1/rentals/sms` Every SMS received by **any** of your rentals as a cursor feed. This is the endpoint to poll: one request covers all your rentals, however many you have. Remember the returned `next_after` and send it back as `after` on the next call — you only receive messages that were recorded after that point. Each item carries its `rental_id` and its own `cursor`. Cursors and message ids are opaque tokens: store and send them back verbatim, never parse them. The feed is ordered by when each message was recorded for your rental, which is not necessarily by `id` or by `received_at`. A message you have not seen is never skipped: anything recorded after your cursor shows up on a later call. In the rare case a message is re-processed on our side it may appear again with a new cursor — de-duplicate by `id` if that matters to you. ## Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `after` | query | string | no | Opaque cursor from a previous call (`next_after`, or an item's `cursor`). Omit to start from the beginning. Only a cursor this API returned is accepted — anything else is `400 VALIDATION_ERROR`. | | `limit` | query | integer | no | | ## Request examples ### cURL ```bash curl "https://api.dogesms.com/v1/rentals/sms" \ -H "Authorization: Bearer sk_live_…" ``` ### Node ```js const res = await fetch("https://api.dogesms.com/v1/rentals/sms", { headers: { Authorization: `Bearer ${process.env.DOGESMS_API_KEY}`, }, }); const json = await res.json(); console.log(res.status, json); ``` ### Python ```python import os import requests res = requests.get( "https://api.dogesms.com/v1/rentals/sms", headers={ "Authorization": f"Bearer {os.environ['DOGESMS_API_KEY']}", }, timeout=30, ) print(res.status_code, res.json()) ``` ## Responses ### 200 SMS page. ```json { "data": { "items": [ { "id": "sms_k3m7q2x9p4r6t8v1w5y0", "cursor": "Zm9vYmFyLWN1cnNvci1leGFtcGxl", "rental_id": "3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93", "from": "WhatsApp", "text": "string", "code": "123456", "received_at": "2026-12-01T09:00:00Z" } ], "limit": 50, "after": "string", "next_after": "Zm9vYmFyLWN1cnNvci1leGFtcGxl" }, "request_id": "string" } ``` ### 400 `VALIDATION_ERROR` — `after` is not a cursor we issued. ### 401 Missing or invalid API key (`API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED`). Emitted by the auth layer before the handler — flat shape, no `request_id`. ### 403 Key is valid but the account is not eligible (`ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE`). Emitted by the auth layer — flat shape. ## Error codes | Status | Codes | |---|---| | 400 | `VALIDATION_ERROR` | | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | --- # Get a rental `GET https://api.dogesms.com/v1/rentals/{id}` Status and dates of one rental. `phone_number` stays in the response after the rental has ended — you paid for the period, keep it for your records. ## Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `id` | path | string (uuid) | yes | | ## Request examples ### cURL ```bash curl "https://api.dogesms.com/v1/rentals/3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93" \ -H "Authorization: Bearer sk_live_…" ``` ### Node ```js const res = await fetch("https://api.dogesms.com/v1/rentals/3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93", { headers: { Authorization: `Bearer ${process.env.DOGESMS_API_KEY}`, }, }); const json = await res.json(); console.log(res.status, json); ``` ### Python ```python import os import requests res = requests.get( "https://api.dogesms.com/v1/rentals/3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93", headers={ "Authorization": f"Bearer {os.environ['DOGESMS_API_KEY']}", }, timeout=30, ) print(res.status_code, res.json()) ``` ## Responses ### 200 The rental. ```json { "data": { "id": "3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93", "status": "active", "phone_number": "+15550142290", "country_code": "CA", "service_code": "whatsapp", "duration_days": 30, "tier": "standard", "price_cents": 43, "currency": "USD", "auto_renew": true, "started_at": "2026-12-01T09:00:00Z", "expires_at": "2026-12-01T09:00:00Z", "released_at": "2026-12-01T09:00:00Z", "created_at": "2026-12-01T09:00:00Z" }, "request_id": "string" } ``` ### 401 Missing or invalid API key (`API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED`). Emitted by the auth layer before the handler — flat shape, no `request_id`. ### 403 Key is valid but the account is not eligible (`ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE`). Emitted by the auth layer — flat shape. ### 404 `RENTAL_NOT_FOUND` — no such rental under your account. ## Error codes | Status | Codes | |---|---| | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | | 404 | `RENTAL_NOT_FOUND` | --- # SMS received by one rental `GET https://api.dogesms.com/v1/rentals/{id}/sms` Same cursor semantics as `GET /rentals/sms`, limited to one rental. Prefer the account-wide feed when you have more than a couple of rentals. ## Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `id` | path | string (uuid) | yes | | | `after` | query | string | no | Opaque cursor from a previous call (`next_after`, or an item's `cursor`). Omit to start from the beginning. Only a cursor this API returned is accepted — anything else is `400 VALIDATION_ERROR`. | | `limit` | query | integer | no | | ## Request examples ### cURL ```bash curl "https://api.dogesms.com/v1/rentals/3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93/sms" \ -H "Authorization: Bearer sk_live_…" ``` ### Node ```js const res = await fetch("https://api.dogesms.com/v1/rentals/3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93/sms", { headers: { Authorization: `Bearer ${process.env.DOGESMS_API_KEY}`, }, }); const json = await res.json(); console.log(res.status, json); ``` ### Python ```python import os import requests res = requests.get( "https://api.dogesms.com/v1/rentals/3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93/sms", headers={ "Authorization": f"Bearer {os.environ['DOGESMS_API_KEY']}", }, timeout=30, ) print(res.status_code, res.json()) ``` ## Responses ### 200 SMS page. ```json { "data": { "items": [ { "id": "sms_k3m7q2x9p4r6t8v1w5y0", "cursor": "Zm9vYmFyLWN1cnNvci1leGFtcGxl", "rental_id": "3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93", "from": "WhatsApp", "text": "string", "code": "123456", "received_at": "2026-12-01T09:00:00Z" } ], "limit": 50, "after": "string", "next_after": "Zm9vYmFyLWN1cnNvci1leGFtcGxl" }, "request_id": "string" } ``` ### 401 Missing or invalid API key (`API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED`). Emitted by the auth layer before the handler — flat shape, no `request_id`. ### 403 Key is valid but the account is not eligible (`ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE`). Emitted by the auth layer — flat shape. ### 404 `RENTAL_NOT_FOUND` — no such rental under your account. ## Error codes | Status | Codes | |---|---| | 401 | `API_KEY_MISSING`, `API_KEY_INVALID_FORMAT`, `API_KEY_INVALID`, `API_KEY_REVOKED` | | 403 | `ACCOUNT_BANNED`, `EMAIL_NOT_VERIFIED`, `ACCOUNT_NOT_ACTIVE` | | 404 | `RENTAL_NOT_FOUND` | --- # Endpoint verification test Webhook event `webhook.test` — sent as `POST` to your endpoint. Sent when you click Verify Webhook in the dashboard. Return any 2xx within 10 seconds to verify the endpoint and start receiving event deliveries. ## Payload Content type: `application/json` | Field | Type | Required | Description | |---|---|---|---| | `event_type` | string | no | Allowed: `webhook.test`. | | `sent_at` | string | no | | ```json { "event_type": "webhook.test", "sent_at": "2026-12-01T09:00:00Z" } ``` ## Responses ### 200 Return any 2xx to verify the endpoint. --- # Number allocated Webhook event `order.number_allocated` — sent as `POST` to your endpoint. Sent when a phone number is allocated to your order. Register your endpoint in Dashboard → API Keys → Webhooks. **Verify the signature**: each delivery carries `X-Webhook-Signature: sha256=` — HMAC-SHA256 of the raw request body using your webhook secret — and `X-Webhook-Event` with the event type. Respond `2xx` quickly; non-2xx deliveries are retried with backoff (30s → 5m → 30m → 2h). ## Payload Content type: `application/json` | Field | Type | Required | Description | |---|---|---|---| | `event_type` | string | no | Allowed: `order.number_allocated`. | | `order_id` | string | no | | | `service_code` | string | no | | | `country_code` | string | no | | | `phone_number` | string | no | E.164 with the leading `+` and country calling code; same passthrough exception as the order `phone_number`. | | `status` | string | no | Allowed: `active`. | | `allocated_at` | string | no | | | `amount_cents` | integer | no | Amount charged for this order in cents (the same `amount_cents` as the order). | | `channel_id` | string | no | The `channel_id` the order was placed with. Present only for orders placed by channel. | ```json { "event_type": "order.number_allocated", "order_id": "3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93", "service_code": "string", "country_code": "string", "phone_number": "+15550142290", "status": "active", "allocated_at": "2026-12-01T09:00:00Z", "amount_cents": 43, "channel_id": "string" } ``` ## Responses ### 200 Return any 2xx to acknowledge. --- # SMS code received Webhook event `order.completed` — sent as `POST` to your endpoint. ## Payload Content type: `application/json` | Field | Type | Required | Description | |---|---|---|---| | `event_type` | string | no | Allowed: `order.completed`. | | `order_id` | string | no | | | `service_code` | string | no | | | `country_code` | string | no | | | `phone_number` | string | no | E.164 with the leading `+` and country calling code; same passthrough exception as the order `phone_number`. | | `sms_code` | string | no | Extracted verification code, with digit-group separators removed (`123-456` → `123456`); same value as `sms_code` on the order. | | `sms_content` | string | no | | | `completed_at` | string | no | | | `amount_cents` | integer | no | Amount charged for this order in cents (the same `amount_cents` as the order). | | `channel_id` | string | no | The `channel_id` the order was placed with. Present only for orders placed by channel. | ```json { "event_type": "order.completed", "order_id": "3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93", "service_code": "string", "country_code": "string", "phone_number": "+15550142290", "sms_code": "string", "sms_content": "string", "completed_at": "2026-12-01T09:00:00Z", "amount_cents": 43, "channel_id": "string" } ``` ## Responses ### 200 Return any 2xx to acknowledge. --- # Order failed (refunded) Webhook event `order.failed` — sent as `POST` to your endpoint. ## Payload Content type: `application/json` | Field | Type | Required | Description | |---|---|---|---| | `event_type` | string | no | Allowed: `order.failed`. | | `order_id` | string | no | | | `service_code` | string | no | | | `country_code` | string | no | | | `status` | string | no | Allowed: `failed`. | | `error_code` | string | no | | | `failed_at` | string | no | | | `amount_cents` | integer | no | Always `0` — failed orders are not charged. | | `channel_id` | string | no | The `channel_id` the order was placed with. Present only for orders placed by channel. | ```json { "event_type": "order.failed", "order_id": "3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93", "service_code": "string", "country_code": "string", "status": "failed", "error_code": "NO_NUMBERS_AVAILABLE", "failed_at": "2026-12-01T09:00:00Z", "amount_cents": 0, "channel_id": "string" } ``` ## Responses ### 200 Return any 2xx to acknowledge. --- # Order expired without SMS (refunded) Webhook event `order.expired` — sent as `POST` to your endpoint. ## Payload Content type: `application/json` | Field | Type | Required | Description | |---|---|---|---| | `event_type` | string | no | Allowed: `order.expired`. | | `order_id` | string | no | | | `service_code` | string | no | | | `country_code` | string | no | | | `phone_number` | string | no | E.164 with the leading `+` and country calling code; same passthrough exception as the order `phone_number`. | | `status` | string | no | Allowed: `expired`. | | `expired_at` | string | no | | | `amount_cents` | integer | no | Amount that was charged for this order in cents; it has been refunded to your balance. | | `channel_id` | string | no | The `channel_id` the order was placed with. Present only for orders placed by channel. | ```json { "event_type": "order.expired", "order_id": "3f6c2a9e-8b1d-4c7a-9e2f-5d4b1a7c0e93", "service_code": "string", "country_code": "string", "phone_number": "+15550142290", "status": "expired", "expired_at": "2026-12-01T09:00:00Z", "amount_cents": 43, "channel_id": "string" } ``` ## Responses ### 200 Return any 2xx to acknowledge.