Errors
Every error from /v1 has the same shape:
{
"error": {
"code": "invalid_parameter",
"message": "stat: is not a parameter of this endpoint",
"param": "stat"
}
}codeis stable, and is what your program should switch on. It will not change within/v1.messageis a sentence for a person. It may be reworded at any time; do not parse it.paramnames the query parameter at fault, oninvalid_parameteronly.
Every response, error or not, also carries an x-request-id header. Quote it if you write to us about a
call.
The codes
| Status | code | What happened | What to do |
|---|---|---|---|
400 | invalid_parameter | A parameter is unknown, malformed or out of range, or a cursor is not one this API issued. param names it. | Fix the request. Retrying it unchanged will fail the same way. |
401 | unauthorized | No key, a key that is not valid or has been revoked, or a key sent in the URL. | Send a valid key in the Authorization header. See Authentication. |
402 | payment_required | The key's account has no API plan, its plan's first payment is still being confirmed, or billing is past due. The message says which. | Start the plan in Settings › API, wait a few seconds for its payment, or update the card in Settings › Billing. |
403 | forbidden | The key's account is suspended, or its API access is switched off. | Contact us. |
404 | not_found | No outage or network has that id, or the path is not an endpoint. | Check the id. Outage ids are stable for an outage's whole life. |
429 | rate_limited | The key is over its per-minute limit, or this address has had 20 requests refused for a missing or bad key in the last minute. | Wait for the retry-after header's seconds; for the second, fix the key first. See Rate limits. |
500 | internal_error | Something failed on our side. It has been logged. | Retry with a backoff. |
None of these is billed. Only a 2xx counts as a call; see Billing and usage.
Unknown parameters are refused
The API is strict about query parameters. A misspelt filter is refused with 400, never silently ignored:
GET /v1/outages?stat=vic{
"error": {
"code": "invalid_parameter",
"message": "stat: is not a parameter of this endpoint",
"param": "stat"
}
}That is deliberate. Ignored, ?stat=vic would quietly return every outage in the country — the worst way
for a typo to fail on a metered API. The same goes for a value outside a parameter's vocabulary, such as
status=open or a network id nobody issued.
Retrying
429and5xxare worth retrying, after a wait. Useretry-afterfor a429and an increasing backoff for a5xx.- Every other
4xxdescribes the request. Retrying it unchanged returns the same error. - A failed upstream feed is not an error. If a network's feed is down, the API still answers
200with the last data it recorded, andmeta.data_as_ofand the network'sfeed.statusin GET/v1/networkssay how fresh it is.