Concepts
Rate limits
Limits are counted per API key. Two of them apply to the export endpoints; the endpoints that take data in limit the size of each request instead.
Limits by endpoint#
| Endpoint | Limit per key | Counted |
|---|---|---|
| POST /exports/data-export | 60 exports a minute | Across all of MTA's servers, from the exports the key created in the last 60 seconds. |
| GET /exports/account, attribution-models, metrics, breakdowns, and data-export/result/{id} | 100 requests a second | On each server instance separately. |
| GET /exports/data-export/download/… | None | Signed links take no key. |
| POST /orders, POST /spend, POST /views | None | See the size limits below. |
Creating an export does not count toward the 100 a second, and the other export endpoints do not count toward the 60 a minute.
When you hit a limit#
The request is refused with 429 and nothing happens. Retry-After says how many seconds to wait; X-Nb-Limit-Retry-After carries the same number for clients that read it. The body says which limit you hit.
Response 429
HTTP/2 429
content-type: application/json
retry-after: 12
x-nb-limit-retry-after: 12
{ "detail": "Rate limit exceeded: 60 data-export requests per minute per API key. Retry after 12 seconds." }Wait the given seconds, then send the same request again.
Request size limits#
| Endpoint | Per request | Over the limit |
|---|---|---|
| POST /orders | 1 to 1,000 orders; at most 20 MB | 400 for too many orders, 413 for a body over 20 MB |
| POST /spend | 1 to 10,000 rows | 400 |
| POST /views | Up to 10,000 views and 50 coverage ranges; at most 20 MB | 400 for too many items, 413 for a body over 20 MB |
| POST /exports/data-export | A period of at most 731 days | 422 |
A download has up to 300 seconds on the server. Export files are sized so that each finishes well inside that; see Files and pagination.
Staying under the limits#
- Ask for one export that covers the whole period rather than one per day. An export of up to two years is a single request.
- Poll an export's result every few seconds. Exports of up to 31 days have usually finished by the time the create request returns.
- Read
GET /exports/metricsonce per job. The list is the same for every brand and changes only when the API does. - Batch orders, spend and views up to the size limits.
Questions about the API: support@growthdept.ai.