Guides
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}/canceldoes not use this header; cancelling twice is already safe.
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.