Guides

Quick start

From API key to SMS code in five requests.

.md

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

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

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

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). 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:

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.

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.