Zum Hauptinhalt springen

Errors

The API returns a consistent error envelope for all error responses.

Error format

{
"type": "error",
"error": {
"type": "not_found_error",
"message": "Document not found"
}
}

Status codes

StatusError TypeWhen it happens
400invalid_request_errorMalformed request body or invalid parameters
401authentication_errorMissing or invalid Authorization: Bearer token
403permission_errorAPI key does not have access to the requested resource
404not_found_errorDocument, job, or schema not found
408request_timeout_errorRequest took too long to process
409conflict_errorResource already exists or conflicting operation
413request_too_largeFile exceeds the 100 MB upload limit
422unprocessable_entity_errorValid request but the operation cannot be performed
429rate_limit_errorToo many requests — back off and retry
500api_errorUnexpected server error

Wrong API host

Every error in the table above arrives in the envelope shown at the top of this page. A response that is not in that envelope did not come from the API at all — it came from something in front of it, which almost always means the request went to the wrong host or the /v1 prefix is missing.

What you get backWhat it means
404 with {"message": "no Route matched with those values"}Reached the API gateway, but no route matched. Usually a missing /v1 prefix, or a typo such as /V1 — paths are case-sensitive.
405 Method Not Allowed on a POSTThe host is serving the web app, not the API. A static web server rejects POST.
200 with HTML instead of JSONSame cause: the web app host returned its page for an unknown path. A GET probe against the wrong host can look successful — check the response body, not just the status.

In all three cases the fix is the base URL, not the API key: the key was never checked, because the request never reached the API. Confirm you are using the API host issued with your key, followed by /v1.

Handling errors

response = requests.post(url, headers=headers, files=files)

if response.status_code >= 400:
error = response.json()["error"]
print(f"{error['type']}: {error['message']}")
tipp

For 429 responses, wait before retrying. The error message includes the recommended wait time.


Next steps