Error philosophy

Errors in the API are designed to be immediately actionable — every failure response tells you exactly what went wrong and what to do next. Three principles guide the design: 1. The error code is stable, the message is human. Every error body contains a machine-readable error code that is stable across API versions. Use this in your conditionals. The message field is plain English, safe to log or display, but not for programmatic branching. 2. The status code maps to a category, the body maps to a cause. 402 always means insufficient balance. 429 always means you’re rate-limited. 422 means the request was syntactically valid but semantically wrong. The body narrows it further with a specific error code and details where relevant. 3. Opaque errors are a bug. A 403 that gives you nothing to act on, or a 500 with no context, is a platform defect. Every error response should either tell you how to fix the request or tell you to retry with specific timing guidance.
Read the full Errors reference for all status codes, the envelope shape, and the 402 balance response fields.

Billing on success

Successful sends return a billing object inline — no separate call needed to see your balance, the hold, the charged units, or where you stand on volume tiers.
See Billing units for holds, units, and volume prices.

Common HTTP errors

Test Agent sends return a generic 403 when the target number is not the verified test phone. The response deliberately does not reveal whether the number belongs to another account.

Idempotency

Send endpoints accept an idempotency key so safe retries never duplicate a message. Pass the key in the Idempotency-Key request header. Use one key per logical send — derived from something your system already has, such as the order number, or a UUID you generate once and store with the send — and retry the same request with the same key if it fails. Never generate a new key per attempt: a new key is a new message.
If the original request succeeded but the response was lost in transit, replaying with the same key returns the original response — no duplicate charge, no duplicate send.

Errors reference

Full status code table, error envelope shape, and 402 balance response fields.

Billing API

Proactive balance checks and tier queries before large sends.

API conventions

Rate limits, retry patterns, and idempotency details.

Our philosophy

Why errors and billing are designed to be transparent and actionable.