Errors and limits
What every endpoint has in common: how errors look, how fast you can call, and how to retry safely.
Errors
Every error has the same body. Branch on code, show message to a person, and keep request_id for support.
{
"error": {
"request_id": "0912e0ad-9977-40ff-a461-ffafe5b0f755",
"code": "invalid_request",
"message": "page_size is out of range",
"status": 400
}
}| Status | Code | What happened |
|---|---|---|
| 400 | invalid_request | The request is malformed: an unknown field, a value out of range, or the wrong method. |
| 401 | unauthorized | The key is missing, mistyped, expired or revoked. |
| 402 | insufficient_credits | Not enough credits to hold what the run could cost. |
| 403 | plan_required | Your plan does not include the API, or something this request asks for. |
| 403 | scope_missing | The key does not have the scope this endpoint needs. |
| 403 | forbidden | This key may not do that. |
| 404 | not_found | No such campaign, run or result in your workspace. |
| 409 | conflict | Not possible in the current state, such as running a campaign that is no longer a draft. |
| 409 | idempotency_in_progress | The first request with this Idempotency-Key is still working. Wait for Retry-After (1 second) and send it again. |
| 413 | payload_too_large | The request body is too large. |
| 422 | idempotency_key_reused | This Idempotency-Key was already used for a different request. |
| 429 | rate_limited | Too many requests. Wait for Retry-After seconds. |
| 429 | concurrency_limited | As many campaigns are running as your plan allows. Wait for one to finish. |
| 500 | internal_error | Something failed on our side. Safe to retry with the same Idempotency-Key. |
Rate limits
Counted per key and across all of a workspace's keys. A 429 carries Retry-After, in seconds.
| Plan | Per key | Per workspace |
|---|
Requests
You make the key up: any unique id per request, such as a UUID, and you reuse it only when retrying that same request. Send an Idempotency-Key with any request that creates, runs or cancels. The same key with the same request returns the first answer again, marked Idempotent-Replayed: true, for 24 hours. A failed request (5xx) is not stored, so retrying it is safe.
Idempotency-Key: 00000000-0000-4000-8000-000000000000
Lists take page (from 1) and page_size (up to 100; 20 by default for campaigns and bulk runs, 50 for results and leads) and answer with:
datapagepage_sizetotalhas_more
A campaign and its results answer with an ETag. Send it back and an unchanged answer is a 304 with no body.
If-None-Match: "…"
Every answer carries a request id, also in an error's body. Send your own (1 to 64 letters, digits, dots, underscores or hyphens) to trace a call end to end.
X-Request-Id