Errors and limits

What each code means and how many requests you can make.

Errors always have the same shape. Program against code, never against message: the text can change, the code cannot.

json
{
  "error": {
    "code": "device_not_found",
    "message": "Device dev_oppo_cph2577 not found.",
    "requestId": "req_01H8X2K9"
  }
}

HTTP statuses

StatusMeaningWhat to do
200acceptednothing
400the request is malformedfix the body; retrying will not help
401invalid or revoked keycreate a new key
402no messages left on the planwait for renewal or change plan
404the device does not existcheck the deviceId in /devices
429too many requestsslow down; the limit resets every minute
5xxfailure on our sideretry with the same Idempotency-Key

Error codes

CodeWhen it happens
validation_errora field is missing or malformed
invalid_numberthe number is not in E.164, or does not exist
message_too_longabove 10 segments (1530 GSM-7 characters, 670 Unicode)
device_not_foundthe deviceId does not belong to the account
quota_exceededthis cycle's messages have run out
rate_limitedabove the request limit for this account
invalid_keythe key was revoked, or never existed

Limits

LimitValue
API requests60 per minute per key, multiplied by the phones connected to the account (up to 3000)
Sending per phoneroughly 30 messages per minute, set by the phone and the carrier
Messages per cycleyour plan's quota; every response tells you what is left
Message length10 segments
reference field200 characters

An offline phone does not reject the message

It goes into the queue and is sent when the phone comes back. The response says `deviceOnline: false` so you can tell the difference between "sent in a second" and "waiting for a phone". Leave out deviceId and the phone with the shortest queue is used.

The real limit is the phone's, not the API's

One phone sends roughly 30 messages per minute. Anything accepted faster than that waits in the queue.