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

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