Rate limits and pagination
Rate limits
Calls made with an API key are limited to 100 requests per minute. The count is kept per key and per request method: GET, POST, PUT, DELETE and PATCH each have their own count. So one key can send 100 GET requests a minute and, on top of that, 100 POST requests. All GET requests share one count, whichever endpoint they go to. A different key has its own counts.
When you go over, the gateway refuses the request with 429. Wait for the minute to roll over, then continue. If the response carries a Retry-After header, wait that many seconds. In the CLI a 429 exits with code 4.
Voice and message usage is separate from this limit. It follows your plan and credits, not the API request count.
Stay under the limit
- Add a short wait between calls in a loop.
- On
429, wait, then retry the same request. Make the wait longer each time. - Cache lists you read often, such as voices or phone numbers.
- Prefer a webhook to polling. Have Atlas call you when a call ends instead of asking every few seconds. See Webhooks.
- Give each system its own key so one busy system doesn’t use up another’s minute.
Reading long lists
List endpoints return their rows in the value array of one response. The public API has no “next page” step: no endpoint in the API reference takes a paging parameter, and the gateway passes back only a few response headers (Content-Type, Location, Retry-After and ETag). If a list is long, narrow it with filters.
What each list does
If you may have more than 1000 contacts, narrow GET /contactlist/global with the search, startDate and endDate query parameters, or read contacts one job at a time. These three parameters are not in the API reference yet, so the CLI has no flags for them. Use curl.
Narrow with filters
Each list endpoint has its own filters. For call records, read one day at a time:
The same with the CLI:
Run atlas call get-call-records --help, or open the endpoint in the API reference, to see all its filters.
Keep your own place
- Read a bounded window, such as one day, then move to the next.
- Store the id of the last item you handled, and skip anything you have already seen.
- Don’t treat a short list as proof that you have everything. Check the same window again later if it matters.
Troubleshooting
- If you get
429, then wait for theRetry-Afterseconds (or until the minute rolls over) and send the same request again. - If
GET /callreturns400with “Date range cannot exceed 90 days”, then split the range into windows of 90 days or less. - If
GET /callreturns400with “Start date must be before end date” or “Invalid date format”, then send ISO 8601 dates withstartDatebeforeendDate. - If a contact list stops at exactly 1000 rows, then narrow it with
search,startDateandendDate, or read one job at a time. - If a repeat call returns the same call list as a minute ago, then wait 60 seconds. The answer is cached.
