How rate limits work
A rate limit caps how many requests you can make in a period of time. It protects the platform so every customer gets reliable delivery. Limits are generous and designed so normal traffic never notices them.
- Limits apply per API key, so each channel has its own allowance.
- Sandbox and production are limited separately.
- The limit counts requests, not recipients. One request to 1,000 recipients counts as one request.
Rate limits and credits
These are two different things, and people often mix them up.
| Rate limit | Credits | |
|---|---|---|
| What it measures | How fast you send requests. | How many messages you can send in total. |
| When you run out | 429 error. Wait and retry. | 402 error. Top up to continue. |
| How it resets | Automatically, after a short time. | Only when you add credits. |
When you reach a limit
The API answers with 429 Too Many Requests. Nothing is sent for that request, so it is safe to send it again once the limit clears.
{
"success": false,
"error": "rate_limited",
"message": "Too many requests. Please retry shortly."
}Responses include headers that describe your limit, how much of it you have left and when it resets. Read them to pace your requests before you ever see a 429. The full header list is in the API reference.
Retry with backoff
Do not retry straight away, and do not retry in a tight loop. Wait a little longer after each attempt, which is called exponential backoff. Adding a small random delay stops many clients retrying at the same moment.
async function sendWithRetry(url, options, attempts = 5) {
for (let i = 0; i < attempts; i++) {
const res = await fetch(url, options);
if (res.status !== 429 && res.status < 500) return res;
const wait = 2 ** i * 500 + Math.random() * 250;
await new Promise((r) => setTimeout(r, wait));
}
throw new Error("Rate limited after several retries");
}import random
import time
import requests
def send_with_retry(url, headers, body, attempts=5):
for i in range(attempts):
res = requests.post(url, json=body, headers=headers, timeout=15)
if res.status_code != 429 and res.status_code < 500:
return res
time.sleep(2 ** i * 0.5 + random.random() * 0.25)
raise RuntimeError("Rate limited after several retries")Send in batches
The easiest way to stay under a limit is to make fewer requests. Put many recipients in one request instead of sending one request per person.
curl -X POST https://api.avenolink.com/api/v1/send/sms \
-H "x-api-key: YOUR_SMS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"recipients": ["265XXXXXXXXX", "265YYYYYYYYY", "265ZZZZZZZZZ"],
"sender_id": "AVENOLINK",
"message": "Our shop opens at 8 AM tomorrow."
}'- Group large lists into batches and send them one after another.
- Use a queue in your own system and send at a steady pace, rather than all at once.
- Spread scheduled campaigns across a few minutes instead of the exact same second.
Best practices
- Cache anything you read often, instead of asking the API again.
- Use webhooks for delivery status instead of repeatedly checking.
- Retry only
429,500and503, never400or401. - Set a request timeout so a slow response never blocks your app.
- Log every
429. A steady stream of them means your sending pattern needs smoothing.
Need a higher limit?
If your traffic is growing or you run large campaigns, we can raise your limits. Contact the team with your expected volume, the channel and the time of day your peaks happen, and we will set you up before you need it.