Errors
Every refusal is one JSON shape: RFC 9457 Problem Details, served as
application/problem+json, whatever refused it - a document definition, a plan, a missing resource, the rate limit, the
server itself. Nothing is stored or billed for a refusal.
{
"type": "https://docs.docpayload.com/api-reference/errors#schema",
"title": "The definition is not on the schema",
"status": 400,
"detail": "\"tabel\" is not in this schema; this object takes: source, break, p, th, td, h1, h2, h3, h4, h5, h6, title, lang, id, ol, ul, table, image, hr, columns, svg, toc, style, header, and 8 more",
"instance": "/v1/{tenantId}/documents/generate/pdf",
"code": "SCHEMA",
"target": "document.content.0",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736",
"isRetryable": false
}
| Member | Type | Description |
|---|---|---|
type | string | The problem's identifier: this page at the code's own anchor. Two refusals with one type are the same problem |
title | string | What the problem is, the same every time for its type |
status | integer | The HTTP status of the response |
detail | string | What is wrong in this request, for a person. Branch on code, never on this text |
instance | string | The request's path |
code | string | The stable error code, listed below. Match on it in code |
target | string | Where the problem is, when it is in one place: a field of the request, or a place in a document definition as dotted keys and indexes (document.content.0) |
errors | object | A form's fields and the reasons each was refused, when the request had several (VALIDATION_ERROR) |
requestId | string | The request's id, also sent as the Request-Id header: give it when contacting support |
isRetryable | boolean | Whether the same request may succeed when sent again |
retryAfterSeconds | integer | How long to wait before retrying, when there is a known wait; also sent as the Retry-After header |
A problem may carry a member of its own type besides these: retired (RETIRED), allowed (the values a field
takes), resendAfterSeconds (CODE_RECENTLY_SENT). A client ignores a member it does not know (RFC 9457 3.2).
The token endpoint, POST /oauth2/token, is the one exception: its errors are OAuth 2.0's own { error, error_description },
as RFC 6749, section 5.2 defines them for any OAuth client library.
A failed render is not a refusal: it is answered 500 with the generation response itself, "status": "failed"; see
Generate.
Validation errors
A document definition is refused with 400 before anything is rendered, stored or billed: text that is not JSON, a key or
a value the schema does not name, a required member missing, or a limit exceeded. The definition is read exactly as the
published schema states it: a key in another case, a retired spelling or a definition without its root is refused, never
guessed at. target names the place, and detail says what is wrong there and what the place takes instead.
Wrong type, for { "document": { "pageSetup": { "margin": true }, "content": [{ "p": "Hi" }] } }:
{
"type": "https://docs.docpayload.com/api-reference/errors#schema",
"title": "The definition is not on the schema",
"status": 400,
"detail": "Expected a number, CSS's spacing shorthand (\"20mm\", \"10mm 20mm\") or a list of four lengths - numbers in points or unit strings (\"0.5in\", \"12.7mm\", \"48px\", \"36pt\").",
"code": "SCHEMA",
"target": "document.pageSetup.margin"
}
Empty content, for { "document": { "content": [] } }: code EMPTY_CONTENT, target document.content.
The root key is required. A definition is written inside document, or a component inside component. A bare
{ "content": [...] } is refused with SCHEMA at target $, and detail says where to put it.
Resource limits
A definition past one of the engine's resource limits is refused with a code naming the limit; the codes and their defaults are under A document past a resource limit, and every limit is on Limits.
Retired words
Definitions written in the previous shape (documentDefinition, margins, bookmark, colNumber, tabLeader, upper-case
values such as "CENTER", ...) are translated to the schema's spelling until 1 April 2027. A translated request
succeeds, and its response carries two headers announcing the end:
Deprecation: @1791072000
Sunset: Thu, 01 Apr 2027 00:00:00 GMT
A word that cannot be carried without changing the document, and every old word after that date, is refused with
RETIRED. target is the first word's place, and the retired list names each word, where it stands and what the
schema writes instead:
{
"code": "RETIRED",
"target": "document.content.0.columns.colNumber",
"detail": "document.content.0.columns.colNumber: colNumber is retired; the schema writes columnCount; the window for the previous schema has closed.",
"retired": [
{ "path": "document.content.0.columns.colNumber", "word": "colNumber", "replacement": "columnCount", "lost": false, "reason": "CSS Multi-column 1 names it column-count" }
]
}
HTTP status codes
| Status | When | Retryable |
|---|---|---|
| 400 | A definition refused, a request parameter not valid, a rule of the resource broken | No |
| 401 | Missing, invalid or expired access token | No |
| 402 | The plan does not include API access, the monthly allowance is used up, or the account is suspended for an unpaid invoice | No - see the plan |
| 403 | Insufficient permissions, the path naming another tenant, or a key used from an address its allow-list does not name | No |
| 404 | The resource does not exist | No |
| 408 | The request body arrived too slowly (REQUEST_TIMEOUT) | Yes - send it again |
| 409 | Changed by another request at the same time (CONFLICT), a name already in use (NAME_TAKEN), or the first request with an Idempotency-Key still running (IDEMPOTENCY_KEY_IN_FLIGHT) | CONFLICT: reload and retry; IDEMPOTENCY_KEY_IN_FLIGHT: wait and retry |
| 412 | The resource changed since the version named in If-Match (PRECONDITION_FAILED) | Read it again, then make the change on what it is now |
| 413 | The request body is over 1 MB | No |
| 429 | Rate limit exceeded | Yes - wait the seconds in Retry-After |
| 500 | A render that failed, or an unexpected server error | Maybe - retry once |
| 503 | The render worker, database, storage, or an external service temporarily unavailable | Yes - see retryAfterSeconds |
Error codes
A code is part of the contract: it is never renamed, and a new one is announced in the changelog. Each
code's type is this page at its anchor.
The request
| Code | Status | Title | When |
|---|---|---|---|
BAD_REQUEST | 400 | The request could not be read | The request could not be read: a body cut short, a webhook that is not one |
VALIDATION_ERROR | 400 | A request parameter is not valid | A parameter or a request member is missing, malformed or out of range; target names it, errors lists a form's fields |
INVALID_CONTENT_TYPE | 400 | The body is not sent as JSON | A route that reads JSON was sent another Content-Type |
RULE_VIOLATION | 400 | The request breaks a rule of the resource | The request breaks a rule of the resource (a revision named differently from its parent, say) |
INVALID_TENANT_ID | 400 | The tenant id is not a valid identifier | The tenant id in the path is not an identifier |
TENANT_ACCESS_ERROR | 400 | The tenant could not be resolved | The tenant could not be resolved from the credential |
METHOD_NOT_ALLOWED | 405 | The resource does not answer this method | The path exists, not with this method |
UNSUPPORTED_MEDIA_TYPE | 415 | The body is not in a media type this resource reads | The body is in a media type the route does not read |
PAYLOAD_TOO_LARGE | 413 | The request is larger than the server accepts | The request body is over its cap (1 MB through the API), or the definition's text over 16 MiB |
REQUEST_TIMEOUT | 408 | The request body was not received in time | The body arrived more slowly than the server reads one; send it again |
A document definition refused
| Code | Status | Title | When |
|---|---|---|---|
INVALID_JSON | 400 | The definition is not JSON | The definition is not JSON |
SCHEMA | 400 | The definition is not on the schema | A key the schema does not name, a value of the wrong kind, a required member missing, or no document or component root |
OUT_OF_RANGE | 400 | A value is outside its range | A number outside the bounds its key allows |
UNKNOWN_VALUE | 400 | A value is not one the key takes | A word outside the set its key declares |
PATTERN_MISMATCH | 400 | A value is not in the form the key takes | A string not in the form its key's pattern states |
MISSING_REQUIRED | 400 | A key another key requires is missing | A key another key requires beside it |
CONFLICTING_PROPERTIES | 400 | Two keys that exclude each other are both set | Two keys on one node that exclude each other |
EMPTY_NODE | 400 | A content node is empty | A content node with no key at all ({}) |
EMPTY_CONTENT | 400 | The document has no content | A document whose content array is empty |
RETIRED | 400 | The definition uses a retired word | A word of the previous schema that cannot be translated; retired lists every one |
REFUSED | 400 | The document was refused | The render refused the document for a reason no other code names |
UNRESOLVED_COMPONENT | 400 | A component the document uses does not exist | A use names a component the tenant does not have |
SIGNATURE_NOT_APPLIED | 400 | The signature the document asks for cannot be applied | Its certificate was not found or could not be read |
A document past a resource limit
| Code | Status | Title | When |
|---|---|---|---|
ASSETS_TOO_LARGE | 400 | The files the document names are too large together | Over 64 MiB together |
IMAGES_TOO_LARGE | 400 | The document's images are too large together | Over 512 MiB decoded, together |
NESTING_TOO_DEEP | 400 | The document nests too deeply | The composed document nests past the limit |
EQUATION_TOO_DEEP | 400 | An equation nests too deeply | Over 64 grouping levels in one equation |
EQUATIONS_TOO_LARGE | 400 | The document's equations are too long together | Over 65,536 characters of equation source |
CONTENT_TOO_LARGE | 400 | Data binding added too many content nodes | Over 250,000 nodes added by data binding |
TOO_MANY_COMPONENTS | 400 | The document uses too many components | Over 1,000 component uses |
TABLE_TOO_LARGE | 400 | The document's tables have too many cells | Over 100,000 table cells |
TOO_MANY_PAGES | 400 | The document has too many pages | Over 10,000 pages in one PDF |
BARCODES_TOO_LARGE | 400 | The document's barcodes draw too many marks | Over 250,000 barcode marks |
SVG_TOO_LARGE | 400 | The document's svg draws too many path segments | Over 250,000 svg path segments |
TOO_MANY_BACKGROUND_TILES | 400 | A tiled background repeats too many times | Over 250,000 copies of a tiled background image |
TOO_MANY_BALANCE_TRIALS | 400 | Balancing the columns took too many layouts | Over 5,000 layouts tried to balance flowing columns |
Who is asking
| Code | Status | Title | When |
|---|---|---|---|
UNAUTHORIZED | 401 | Authentication is required | No access token, or one that is invalid or expired |
ACCESS_DENIED | 401 | Access denied | The credential was refused |
INVALID_CREDENTIALS | 401 | The email or password is not correct | Signing in to the app |
EMAIL_NOT_CONFIRMED | 400 | The email address is not confirmed yet | Signing in before the confirmation mail was followed |
SESSION_ENDED | 401 | The session has ended | The app's session cannot be renewed; sign in again |
SESSION_RENEWED | 409 | Another request renewed the session a moment ago | Another tab renewed the session first; use its token |
TWO_FACTOR_NOT_STARTED | 401 | No two-factor sign-in is in progress | A code was sent with no sign-in waiting for it |
TWO_FACTOR_NOT_ENABLED | 400 | Two-factor authentication is not on for this account | A two-factor step for an account without it |
INVALID_TWO_FACTOR_CODE | 400 | The code is not correct | A sign-in code or recovery code that is not correct |
ACCOUNT_LOCKED | 423 | The account is locked for a while after failed attempts | After repeated failed sign-ins; it opens again on its own |
INVALID_TOKEN | 400 | The link is not valid or has expired | A confirmation, reset or invitation link that is wrong or has expired |
PASSWORD_INCORRECT | 400 | The current password is not correct | Changing a setting that asks for the current password |
PASSWORD_REJECTED | 400 | The password was not accepted | A new password the password rules refuse; detail says which |
CODE_RECENTLY_SENT | 429 | A code was sent moments ago | Asking for another code inside the wait; resendAfterSeconds says how long |
TOO_MANY_ATTEMPTS | 429 | Too many failed attempts | Repeated failed attempts at a protected change |
What the plan, the tenant or the role allows
| Code | Status | Title | When |
|---|---|---|---|
API_ACCESS_NOT_IN_PLAN | 402 | The plan does not include API access | The free plan, after its trial |
MONTHLY_ALLOWANCE_REACHED | 402 | The plan's documents for the month are used up | The plan's documents for the month are used up |
ACCOUNT_SUSPENDED | 402 | The account is suspended until an unpaid invoice is settled | Until an unpaid invoice is settled |
FORBIDDEN | 403 | The credential does not allow this | The token has no permission for this resource |
TENANT_CLAIM_MISSING | 403 | The credential names no tenant | The token carries no tenant |
TENANT_MISMATCH | 403 | The path names another tenant than the credential | The path's {tenantId} is not the credential's tenant |
IP_NOT_ALLOWED | 403 | The key is used from an address its allow-list does not name | The tenant's IP allow-list does not name the caller's address |
ROLE_RANK | 403 | The action needs a role above the caller's | Granting or changing a role above the caller's own |
EMAIL_DELIVERY_NOT_ON_PLAN | 402 | The plan does not include email delivery | Mailing a document on a plan without email delivery |
EMAIL_DELIVERY_NOT_ENABLED | 403 | Email delivery is turned off for the organization | The organization has not turned email delivery on |
EMAIL_RECIPIENT_NOT_ALLOWED | 403 | A recipient is outside the organization's allowed domains | An address outside the domains the organization allows |
EMAIL_DELIVERY_CEILING | 429 | The organization's mails for the day are used up | The organization's daily mail ceiling is reached |
The resource
| Code | Status | Title | When |
|---|---|---|---|
NOT_FOUND | 404 | The resource does not exist | The template, document, key or other resource does not exist, or is not the tenant's |
FILE_NOT_FOUND | 404 | The file does not exist | An asset or another stored file that does not exist |
CONFLICT | 409 | It was changed by another request at the same time | Changed by another request at the same time; reload and retry |
NAME_TAKEN | 409 | The name is already in use | A template, folder, slug or identifier already in use; choose another |
PRECONDITION_FAILED | 412 | The resource changed since it was read | The If-Match names a version that is no longer the resource's, or the resource is gone; nothing was changed. Read it again and make the change on what it is now |
IDEMPOTENCY_KEY_INVALID | 400 | The Idempotency-Key is not one | The key is not a quoted string of 1 to 255 printable ASCII characters (Retrying safely) |
IDEMPOTENCY_KEY_IN_FLIGHT | 409 | A request is outstanding for this Idempotency-Key | The first request with this key still runs; wait and send it again |
IDEMPOTENCY_KEY_REUSED | 422 | The Idempotency-Key is already used | The key was sent with another request; send a new key |
RATE_LIMIT_EXCEEDED | 429 | Too many requests | Wait the seconds in Retry-After |
REQUEST_CANCELLED | 499 | The request was cancelled | The caller closed the request |
The server and what it depends on
| Code | Status | Title | When |
|---|---|---|---|
INTERNAL_ERROR | 500 | An unexpected error occurred | An unexpected server error; retry once, then contact support with the requestId |
EMAIL_TEMPLATE_MISSING | 500 | A mail template is missing on the server | A mail the server sends could not be written |
DATABASE_ERROR | 500 | A database error occurred | A database error that will not pass on its own |
FEATURE_UNAVAILABLE | 503 | This deployment does not offer the feature | This deployment does not offer the feature |
RENDER_WORKER_UNAVAILABLE | 503 | The render worker is not answering | Retryable, after 30 s |
DATABASE_UNAVAILABLE | 503 | The database is temporarily unavailable | |
DATABASE_CONNECTION_FAILED | 503 | The database could not be reached | |
DATABASE_TIMEOUT | 503 | The database did not answer in time | |
DATABASE_CONSTRAINT_VIOLATION | 503 | A database constraint refused the change | |
BLOB_STORAGE_ERROR | 503 | File storage is temporarily unavailable | |
KEY_STORE_ERROR | 503 | The key store is temporarily unavailable | |
STORAGE_SERVICE_ERROR | 503 | A storage service is temporarily unavailable | |
EXTERNAL_SERVICE_ERROR | 503 | An external service is temporarily unavailable | |
EXTERNAL_HTTP_SERVICE_ERROR | 502 | An external service answered with an error | |
EMAIL_SERVICE_ERROR | 503 | The email service is temporarily unavailable | |
PAYMENT_PROVIDER_UNAVAILABLE | 503 | The payment provider is temporarily unavailable | |
NETWORK_ERROR | 503 | A network connection failed | |
SERVICE_TIMEOUT | 503 | A service did not answer in time | |
OPERATION_TIMEOUT | 503 | The operation took too long | |
SERVICE_UNAVAILABLE | 503 | The service is temporarily unavailable | The server is starting, stopping or overloaded |
MEMORY_EXHAUSTED | 507 | Server memory is temporarily exhausted | |
CONNECTION_POOL_EXHAUSTED | 507 | Database connections are temporarily exhausted |
Rate limiting
A request over a rate limit is answered 429 with RATE_LIMIT_EXCEEDED, and the Retry-After header gives the seconds to
wait before the limit resets. RateLimit says which limit is spent, and the problem's violated-policies names it. The problem is retryable: its
isRetryable is true, and its retryAfterSeconds holds the same seconds as the header:
HTTP/1.1 429 Too Many Requests
Retry-After: 37
RateLimit: "workspace";a=5412, "documents";a=0;w=37
Content-Type: application/problem+json
{ "code": "RATE_LIMIT_EXCEEDED", "violated-policies": ["documents"], "isRetryable": true, "retryAfterSeconds": 37, ... }
The limits themselves are listed under Rate limits.
Best practices
- Check the HTTP status first, then read the body: every refusal is
application/problem+json. - Branch on
code, never ondetailortitle: those are for people and may be reworded. - Use
targetto point at the field, or the place in the definition, that was refused. - Retry on
409 CONFLICT,429and503with backoff, waitingretryAfterSecondsor theRetry-Afterheader. - Do not retry on
400,401,402,403,404or413: fix the request first. - Log
requestIdfor server errors, and include it when contacting support. - Validate locally against the JSON Schema to catch a definition's errors before sending it.