eCMRhub.docs

Errors

Error format, status codes and the codes an agent should handle, with what to do for each.

Every error is JSON with a stable code and a human message:

{ "code": "VERSION_CONFLICT", "message": "..." }

The CLI and the SDK wrap it as {"error":{"status","code","message","retryable"}}, and add approval for 428. REST endpoints may add details and hint.

  • Decide by code, not by message. Messages are written for people and are often in Polish.
  • retryable is true for 429 and 5xx. Repeat the same request with the same ids and idempotency keys. Other errors need a change before trying again.
  • 404 does not reveal other companies' data. An id from another company looks like an id that does not exist.

By status

StatusMeaningWhat to do
400The request is malformedFix the input; compare with the schema
401No valid sign-inSign in again or ask for a new key; do not loop
403Signed in, but not allowedTell the user what is missing
404Not found, or not yoursCheck the id
409Conflict with the current stateRead the current state, then retry
410Gone: deleted, expired or revokedDo not retry; start a new one if needed
413Too largeSend less
422Valid JSON, incomplete or wrong for this stepFill the named fields, or do the missing step first
428A person must approveShow the approval link, wait, repeat with the approval id
429Rate limitWait and retry
5xxServer or network problemRetry with the same keys

Codes to handle

CodeStatusMeaning and action
UNAUTHENTICATED401The session or token expired or was signed out. Sign in again.
API_KEY_INVALID401The API key is wrong, revoked or expired. Ask the user for a new key.
CONNECTION_REVOKED401The company disconnected this OAuth connection. A person must sign in again. In build.
FORBIDDEN403Not allowed for this kind of caller (for example, a person-only operation).
API_KEY_FORBIDDEN403The API key lacks the permission named in the message. The owner can create a key with it.
CONNECTION_FORBIDDEN403The OAuth connection lacks the permission, or the operation is for a person only. In build.
APPROVAL_REJECTED403The person rejected the approval. Ask the user what to change. In build.
NOT_FOUND404No such id in this company.
INVALID_REQUEST400The request body or parameters are wrong.
INVALID_OPERATION_INPUT400The input does not match the operation's schema. The message names the field.
VERSION_CONFLICT409The draft changed since your revision. Read it again and retry with the new revision.
LIBRARY_VERSION_CONFLICT409The address book changed meanwhile. Read it again and retry.
IDEMPOTENCY_CONFLICT409The same idempotency key was used with a different payload. Use a new key for a new write.
DRAFT_ISSUED409An issued document cannot be deleted.
LINK_REPLACED409A newer signing link for this role exists; the old request does nothing.
APPROVAL_MISMATCH409The input differs from what the person approved. Repeat the approved input, or request a new approval. In build.
APPROVAL_CONSUMED409The approval was already used; the operation already ran. In build.
APPROVAL_NOT_FOUND404No such approval for this company. In build.
APPROVAL_LIMIT429Too many approvals are waiting for this connection; ask the person to decide them. In build.
DRAFT_DELETED410The draft was deleted.
GRANT_EXPIRED410The signing link expired or was revoked. Create a new one.
APPROVAL_EXPIRED410The approval is older than 24 hours. Call again without the id. In build.
PAYLOAD_TOO_LARGE413The request is too big.
INCOMPLETE_DOCUMENT422Required fields are missing. Run ecmrhub drafts check and fill them.
NOT_ISSUED422Issue the document before creating a signing link.
APPROVAL_REQUIRED428A person must approve this exact call. See Human approvals. In build.
TRANSPORT_ERROR503No answer from the server. The write may or may not have happened; repeat with the same keys.

CLI exit codes

The CLI maps errors to exit codes: 1 error, 2 usage, 3 not signed in, 4 missing permission, 5 waiting for approval. See CLI reference.

On this page