Rate limits
Each team has its own limits: 1,000 requests a minute to each API in live, and 120 a minute in the sandbox. One team's traffic never uses up another's.
The limits
| Limit | |
|---|---|
| Live keys | 1,000 requests a minute per team, to each API: the Messaging API and the Airtime API count apart |
| Sandbox keys | 120 requests a minute per team, across all its sandbox keys and both APIs |
| The app in Test mode, and the Simulator | 600 requests a minute per team, counted apart from your keys |
The sandbox's minute starts with your first request, and the count goes back to zero a minute later. Refused requests count too, so sending faster doesn't free you sooner. If you need more than 1,000 a minute in live, ask us.
When you go over
Ponitor answers 429 Too Many Requests with the code E01011, and nothing is sent or charged. In the sandbox, the message says when to try again:
{
"error": {
"type": "rate_limit_error",
"code": "E01011",
"name": "RateLimited",
"message": "Too many sandbox API requests from this team (limit 120 per 60 seconds). Try again in 42 seconds.",
"doc_url": "https://docs.ponitor.com/api/errors#E01011",
"request_id": "d4e5f6a7-b8c9-4d0e-8f1a-2b3c4d5e6f7a"
}
}
In live, the 429 comes from the API gateway in front of Ponitor, with the same error object and code. Its message doesn't say how long to wait. Branch on the 429 status or on error.code, not on the message. The sandbox's body also still carries "code": "rate_limited" from before codes, which is deprecated. See The error body.
Retry a 429
- Wait before you send again. Wait longer each time, for example 1, 2, 4 and 8 seconds.
- Send the same request with the same
externalId. If an earlier attempt went through, you get it back with200, and nothing is sent or charged twice. See Retries and externalId.
Send many messages
- To send the same message to a contact group or a file of numbers, use SMS › Campaigns in the app. A campaign sends to every number from one request.
- Follow messages and purchases with a webhook, not by calling Get a message in a loop.