Errors
Error Responses
The API uses standard HTTP status codes. Every error response returns a JSON body with a
detail field describing the problem.
400 — Bad Request
The request is missing a required parameter or contains an invalid value. Check that
api_key,
series,
date_from, and
date_to
are all present and correctly formatted.
{"detail": "Invalid series code(s)"}
401 — Unauthorized
The API key is missing, invalid, or has been revoked. Generate a new key at insight.apeek.io if needed.
{"detail": {"error": "invalid_api_key", "revoked": false}}
If the key was explicitly revoked:
{"detail": {"error": "invalid_api_key", "revoked": true}}
422 — Validation Error
The parameters are syntactically valid but violate a business rule. Common causes:
date_from is after
date_to,
or the date format is not YYYY-MM-DD.
{"detail": "date_from must be <= date_to"}
429 — Too Many Requests
You have exceeded the per-minute or daily rate limit. The response includes reset timers so you know when to retry. See Authentication for rate limit details.
{
"detail": {
"error": "minute_limit_exceeded",
"minute_remaining": 0,
"minute_reset": 42,
"day_remaining": 120,
"day_reset": 36000
}
}
When the daily limit is exceeded instead:
{
"detail": {
"error": "day_limit_exceeded",
"minute_remaining": 55,
"minute_reset": 18,
"day_remaining": 0,
"day_reset": 14400
}
}
500 — Internal Server Error
An unexpected error occurred on the server. If this persists, contact support.
{"detail": "Internal server error in data query"}
503 — Service Unavailable
A downstream dependency (database or cache) is temporarily unreachable. Retry after a short delay.
{"detail": "Database failure"}
Handling errors in code
Always check the HTTP status code before parsing the response body. Example in Python:
import requests
response = requests.get(url, params=params)
if response.status_code == 200:
data = response.json()["data"]
elif response.status_code == 429:
detail = response.json()["detail"]
wait = detail["minute_reset"]
print(f"Rate limited. Retry in {wait} seconds.")
elif response.status_code == 401:
print("Invalid or revoked API key.")
else:
print(f"Error {response.status_code}: {response.text}")