DocsWebsitePricingSupportConsole
API reference

Errors

Errors share one shape. Branch on the code; the message is for people and may change.

422 Unprocessable Entity
{
  "error": {
    "code": "sender_not_approved",
    "message": "sender ID \"Shop\" is not approved for this account; register it in the console"
  }
}

Codes#

HTTPcodeWhenWhat to do
400invalid_jsonThe body isn't JSON, is over 64 KiB, has a field of the wrong type, or a field we don't knowFix the request; the message says what's wrong
400invalid_idempotency_keyIdempotency-Key over 255 bytesUse a shorter key
400invalid_limitlimit isn't 1–200Fix the parameter
401unauthorizedNo Authorization header, or an unknown or revoked keyCheck the key on the API keys page
401key_expiredThe key is past its expiry dateMake a new key, or change the date on the API keys page
402insufficient_balanceYour balance and credit limit don't cover the priceAdd credits in the console
403account_pendingYour account is waiting for approvalWait for the review; you'll get an email
403account_suspendedYour account is suspendedContact support
403service_suspendedSending is suspended for the whole serviceContact support
403ip_not_allowedThe key was used from an address it doesn't allowAdd the address to the key, or call from an allowed one. See Limiting a key
403permission_deniedThe key doesn't have the permission this endpoint needsGive the key that permission on the API keys page
403trial_numberOn trial credits, the number isn't one of your verified test numbersAdd credits, or verify the number in the console
403country_not_allowedThe number is in a country your account doesn't send to (Fraud protection)Add the country under Fraud protection in the web app
403unsafe_linkA link in the text is on a public phishing or malware listRemove the link. If you're sure it's safe, the check can be turned off under Fraud protection, Content and links
403content_blockedThe text matches one of your content rulesChange the text, or the rule under Fraud protection, Content and links
403spending_limit_reachedYour account reached its daily or monthly spending limitWait for the reset (retry_after), or raise the limit under Fraud protection
404not_foundNo such message, or no such endpointCheck the id and the path
405method_not_allowedThe path exists under another method, such as POST /v1/balance for GET /v1/balance; the Allow header names itUse the method the message names
409idempotency_key_reusedThe Idempotency-Key was used for a message with another to, from or bodyUse a new key for a new message
422invalid_toNot a valid number in international formatSend +, the country code and the number
422invalid_fromNot a possible sender IDSee Sender IDs
422sender_not_approvedThe sender ID isn't approved for your accountRegister it and wait for approval
422invalid_bodyThe text is emptySend some text
422body_too_longThe text needs more than 10 partsShorten it; see Encoding
422destination_not_enabledYour account doesn't send to that country or networkAsk us to enable it
422invalid_callback_urlcallback_url isn't an absolute http(s) URLFix the URL
422invalid_template_idNo template of yours has that template_idCheck the id with GET /v1/templates
422missing_variablesThe text has a {{variable}} with no value in variablesSend a value for each variable the message names
422invalid_validity_periodvalidity_period isn't 10 to 86,400 secondsFix the value
422invalid_client_referenceclient_reference is over 256 characters or has line breaksShorten it
422invalid_messagesA batch's messages is empty or holds more than 100Split it into batches of 100
400invalid_countrycountry on GET /v1/prices isn't a two-letter codeSend an ISO 3166-1 code, such as GB
429rate_limitedOver your account's messages per secondRetry after the Retry-After header's seconds (also retry_after in the error); see Rate limits
500internal_errorSomething went wrong on our sideRetry with the same Idempotency-Key

A message we accepted and then couldn't deliver isn't an API error: the send answered 201, and the outcome comes later as its status and error code.