Errors
The API uses standard HTTP status codes and returns a consistent JSON error body.
Error Shape
{
"error": {
"type": "invalid_request_error",
"message": "document_id is required.",
"code": "invalid_param",
"param": "document_id"
}
}| Field | Type | Description |
|---|---|---|
type | string | Error category (see below) |
message | string | Human-readable explanation |
code | string | Machine-readable error code |
param | string | The parameter that caused the error (if applicable) |
Error Types
| Type | Description |
|---|---|
invalid_request_error | The request was malformed or missing required parameters |
authentication_error | The API key is missing, invalid, or expired |
not_found_error | The requested resource does not exist |
rate_limit_error | You’ve exceeded your rate limit |
api_error | Something went wrong on our end |
HTTP Status Codes
| Status | Meaning |
|---|---|
200 | Success |
400 | Bad request — check param and message |
401 | Unauthorized — invalid or missing API key |
403 | Forbidden — key lacks required scope |
404 | Not found |
429 | Rate limited — check Retry-After header |
500 | Internal error — retry or contact support |
Handling Errors
import requests
r = requests.post(
"https://docld.com/api/v1/extractions",
headers={"Authorization": "Bearer docld_..."},
json={"document_id": "doc_abc123", "schema_id": "sch_xyz"}
)
if r.status_code != 200:
err = r.json()["error"]
print(f"{err['type']}: {err['message']}")Request IDs
Every response includes an x-request-id header. Include this when reporting issues to support for faster debugging.
Last updated on