Rent a number
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: <uuid> 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.
GET /rentals/plans; values outside 1–365 are rejected with VALIDATION_ERROR before any plan lookup.412 PRICE_CHANGED and nothing is charged. Omitted = pay the current plan price.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.| Name | Type | Required | Description |
|---|---|---|---|
| Idempotency-Key | string (uuid) | Optional | — |
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"}'
Rental created and number assigned.
payment_pending only appears on rentals created in the dashboard.+. Present in every status, including after the rental ended.null = rented for any service.false for rentals created through the API.| Status | Code | When |
|---|---|---|
| 400 | VALIDATION_ERROR | VALIDATION_ERROR — missing country_code, duration_days outside 1–365, non-positive max_price_cents, an unknown tier, or a malformed Idempotency-Key. |
| 401 | API_KEY_MISSING API_KEY_INVALID_FORMAT API_KEY_INVALID API_KEY_REVOKED | 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 | INSUFFICIENT_BALANCE — top up first; nothing was charged. |
| 403 | ACCOUNT_BANNED EMAIL_NOT_VERIFIED ACCOUNT_NOT_ACTIVE | 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 | RENTAL_PLAN_NOT_FOUND — no plan for that country / service / duration / tier; see GET /rentals/plans. |
| 412 | RENTAL_TOS_NOT_ACCEPTED PRICE_CHANGED | 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 | RENTAL_NO_NUMBERS — no number available for that country / service right now; nothing was charged. Retry later. |
Branch on code, not on the message. Full list: Errors.