API reference

Errors

Every error has the same shape. Branch on code: it is stable, while message is for people and may change.

422 Unprocessable Entity
{  "error": {    "type": "invalid_request",    "code": "answers_invalid",    "message": "qst_01JB8ZK9P4MC0H2N4R6T8V0X2B: type (expected number).",    "fields": [      {        "field": "qst_01JB8ZK9P4MC0H2N4R6T8V0X2B",        "issue": "type",        "expected": "number"      }    ],    "request_id": "req_01JB8ZK4QWX2M7R9T3V5N8P6CD"  }}
  • type groups codes by HTTP status (below).
  • fields lists each bad field with an issue: missing, type, invalid, unknown_field or not_asked.
  • retryable: true means the same request can succeed later.
  • request_id is also in the Request-Id header. Quote it when you contact support.

Types

StatusTypeMeaning
400invalid_requestThe request could not be read.
401authentication_errorNo key, or a key we do not know.
404not_foundThe thing you asked for does not exist for this key.
409conflictThe request clashes with the current state.
410goneIt existed, but expired and was deleted.
422invalid_requestThe request was read but a value is wrong.
429rate_limit_errorToo many requests for this key.
500, 503api_errorOur side failed. Safe to retry with the same Idempotency-Key.

Common to every endpoint

StatusCodeWhat to do
400body_invalidThe body isn't valid JSON for this endpoint; message says where it broke.
400body_too_largeBodies are limited to 1 MB.
400idempotency_key_invalidKeys are at most 255 characters.
401key_missingSend Authorization: Bearer dg_test_… (or a dgt_… access token).
401key_invalidThe key or access token is unknown, revoked or expired. Check it and its environment.
401secret_key_in_browserThe request came from a browser (it has an Origin header). Call the API from your server; never ship a key to a browser.
409idempotency_key_reusedThe key was used with a different body. Use a new key for a new request.
409idempotency_request_in_progressThe first request with this key is still running. Retry shortly.
429rate_limitedWait Retry-After seconds
500internal_errorOur fault. Retry with the same Idempotency-Key; quote request_id to support.

Endpoint codes

StatusCodeWhat to do
401launch_code_invalidThe code is unknown, already used, expired (5 minutes), or its key was revoked. Open the link from the portal again.
404document_not_foundCheck the ID and that it belongs to your organisation.
404file_not_foundThe link is not valid. Take the URL from the document again.
404session_not_foundCheck the ID, and that Docgen-Subject is the subject the session was created for.
409session_closedThe session was closed and takes no more messages. Start a new one.
409session_not_readyThe session is still finding the form or asking questions; pending_question is what is left.
409turn_in_progressAnother message to this session is being handled. Retry when it returns.
410document_expiredThe files were deleted at expires_at. Generate it again.
410file_expiredThe link passed its expires_at and the file was deleted.
410session_deletedThe session was deleted with its conversation and answers. Start a new one.
422answer_invaliderror.fields says what the question expects; for a form question, one of its option values.
422format_unavailableDOCX is not available yet; ask for pdf or html. A form filed on its official PDF (a deed, for example) comes only as pdf.
422jurisdiction_invalidUse a state code such as US-FL.
422mode_unavailableA form filed on its official PDF comes only in advanced mode, which is its default. The session's document.generate action lists the modes and formats a form offers.
422parameter_invaliderror.fields names the bad parameter (message, settings, lifetime_seconds, metadata).
422parameter_missingSend text, answer, or both.
422question_invalidAnswer pending_question.id, or a question already answered.
422subject_requiredSend Docgen-Subject, set from your own login (never from what the browser sent).
503provider_unavailableFinding a form by conversation needs a model; live keys get this until one is configured.