Skip to main content

Errors

All API errors return a consistent JSON response body. There are two error formats depending on the error source.

Validation errors

Returned when the document definition has structural issues — invalid JSON, unrecognized properties, or type mismatches. These are caught before any PDF generation begins.

{
"code": "SCHEMA_ERROR",
"path": "$.document.content[0].tabel",
"message": "Invalid value or unrecognized property at '$.document.content[0].tabel'."
}
FieldTypeDescription
codestringMachine-readable error code
pathstringJSON path to the problematic property
messagestringHuman-readable description

Validation error codes

CodeDescription
INVALID_JSONRequest body is not valid JSON
MISSING_ROOTMissing document root property and no content array to auto-wrap
INVALID_DEFINITIONDocument definition is null after deserialization
EMPTY_CONTENTContent array is present but empty
SCHEMA_ERRORUnrecognized property name or type mismatch at the given path

Examples

Typo in property name:

// Request: { "document": { "content": [{ "tabel": {} }] } }

{
"code": "SCHEMA_ERROR",
"path": "$.document.content[0].tabel",
"message": "Invalid value or unrecognized property at '$.document.content[0].tabel'."
}

Wrong type:

// Request: { "document": { "pageSetup": { "margins": "50" }, "content": [{ "p": "Hi" }] } }

{
"code": "SCHEMA_ERROR",
"path": "$.document.pageSetup.margins",
"message": "Invalid value or unrecognized property at '$.document.pageSetup.margins'."
}

Not JSON:

{
"code": "INVALID_JSON",
"path": "$",
"message": "Content does not appear to be JSON."
}

Empty content:

{
"code": "EMPTY_CONTENT",
"path": "document.content",
"message": "Content array must contain at least one element."
}

Auto-wrapping

If you send a bare document definition without the document wrapper, the API will wrap it for you automatically:

// This works:
{ "content": [{ "p": "Hello" }] }

// The API treats it as:
{ "document": { "content": [{ "p": "Hello" }] } }

If neither document nor content is found at the root, the API returns a MISSING_ROOT error.

Server errors

Returned by the global exception handler for infrastructure, authorization, and runtime errors. Uses the RFC 7807 Problem Details format.

{
"status": 503,
"title": "Service Unavailable",
"detail": "Database service is temporarily unavailable.",
"instance": "/api/v1/tenants/{tenantId}/documents/generate-from-payload",
"traceId": "00-abc123def456-789012-00",
"errorCode": "DATABASE_UNAVAILABLE",
"isRetryable": true,
"retryAfterSeconds": 30
}
FieldTypeDescription
statusintegerHTTP status code
titlestringStandard HTTP reason phrase
detailstringHuman-readable description
instancestringRequest path that triggered the error
traceIdstringUnique trace ID for support requests
errorCodestringMachine-readable error code
isRetryablebooleanWhether the request can be retried
retryAfterSecondsintegerSeconds to wait before retrying (when retryable)

HTTP status codes

StatusWhenRetryable
400Invalid JSON, schema errors, empty content, bad request parametersNo
401Missing or invalid API keyNo
403Insufficient permissions or tenant mismatchNo
404Template or document not foundNo
429Rate limit exceededYes — check X-RateLimit-Reset header
500PDF generation failure or unexpected server errorMaybe — retry once
503Database, storage, or external service temporarily unavailableYes — check retryAfterSeconds

Server error codes

CodeStatusDescription
VALIDATION_ERROR400Invalid request parameters
INVALID_OPERATION400Operation not valid in current state
ACCESS_DENIED401Authentication failed
TENANT_CLAIM_MISSING403Tenant information missing from token
TENANT_MISMATCH403Accessing a resource from a different tenant
FILE_NOT_FOUND404Requested file does not exist
REQUEST_CANCELLED400Client cancelled the request
DATABASE_UNAVAILABLE503Database temporarily unavailable (retryable)
AZURE_SERVICE_ERROR503Storage service temporarily unavailable (retryable)
EXTERNAL_SERVICE_ERROR503External dependency temporarily unavailable (retryable)
NETWORK_ERROR503Network connectivity issue (retryable)
SERVICE_TIMEOUT503Request timed out
INTERNAL_ERROR500Unexpected server error

Rate limiting

Rate limit headers are included in every response:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 57
X-RateLimit-Reset: 1711843200
HeaderDescription
X-RateLimit-LimitMaximum requests per minute for your plan
X-RateLimit-RemainingRequests remaining in the current window
X-RateLimit-ResetUnix timestamp when the rate limit resets

Best practices

  1. Check the HTTP status code first before parsing the response body.
  2. Use code for programmatic handling — match on error codes, not message strings.
  3. Use path to locate the issue in validation errors — it points to the exact JSON property.
  4. Retry on 429 and 503 with backoff. Use retryAfterSeconds or X-RateLimit-Reset to determine wait time.
  5. Do not retry on 400, 401, 403, or 404 — fix the request first.
  6. Log traceId for server errors — include it when contacting support.
  7. Validate locally with the JSON Schema to catch errors before sending to the API.