Errors
Errors use ordinary HTTP status codes plus a short machine-readable code. Branch on those two; the message is for people and may be reworded.
Shape of an error
HTTP/1.1 403 Forbidden
Content-Type: application/json; charset=utf-8
{
"errors": [
{
"code": "insufficient_scope",
"message": "This token does not have the required scope: read:stats"
}
]
}
errors is a list. An error about one input also carries field, the name of the parameter or body field at fault.
Codes
| Status | Code | Meaning | What to do |
|---|---|---|---|
401 | invalid_token | No key was sent, or the key is unknown, switched off, expired or revoked, or its owner is no longer active. | Check the Authorization: Bearer … header. Create a new key if this one is gone. |
403 | access_not_approved | Affiliate or advertiser key whose account has no approved API access. | Ask for access under My profile → API keys, or contact the network if it was revoked. |
403 | insufficient_scope | The key lacks the scope this endpoint needs. The message names it. | Use a key with that scope. Affiliates and advertisers: the network has to grant it first. |
403 | forbidden | Your role cannot do this at all, for example an advertiser key asking for tracking links. | Nothing to retry. Check you are reading the reference for your API. |
403 | feature_unavailable | The network's plan does not include the API. | Talk to the network. |
404 | not_found | The record does not exist, or it is not yours to see. The two are not told apart on purpose. | Check the id. |
422 | varies | An input is missing or not valid. The code says which rule failed (for example invalid_group_by, invalid_url) and field says where. | Fix the input. Sending the same call again gives the same answer. |
429 | rate_limited | Too many calls with this key in the last minute or hour. | Wait and try again. See Rate limits. |
What to retry
- 429: retry after the wait the headers give you.
- 5xx or no answer: something failed on the instance or on the way. Retry with a growing pause (for example 1, 2, 4, 8 seconds) and stop after a few attempts.
- Everything else in 4xx: do not retry as is. The call has to change first.
Creating a conversion is safe to send again: the same offer_id and tx_id never create a second conversion.