Skip to main content

Error envelope

All errors return a JSON body in this shape:

Common error codes

401 — Invalid API key

Check that your Authorization: Bearer sk_test_... header is present and that the key has not been revoked in the dashboard.

422 — Validation error

422 — Schema conflict

429 — Rate limit

When you hit the rate limit, the response includes a Retry-After header indicating how many seconds to wait before retrying:
Always honour the Retry-After value. Retrying immediately will continue to be rejected.

Idempotency

The POST /v1/documents endpoint accepts an Idempotency-Key header. When you provide a key:
  • First request: processed normally; the response is stored alongside the key.
  • Duplicate request (same body): the stored response is returned immediately — no new document is created and no second charge occurs. This is safe to use for retrying after network failures.
  • Duplicate request (different body): returns 409 Conflict with code idempotency_conflict.
Idempotency keys are scoped to your organisation and must be at most 255 characters. Use a UUID or a stable identifier from your own system (e.g. a database row ID) to avoid collisions.

When to use Idempotency-Key

Use it any time you cannot guarantee delivery:
  • Retrying after a network timeout where you don’t know if the server received the first request.
  • Background jobs that may be requeued on failure.
  • Any code path where submitting the same document twice would cause a duplicate charge or duplicate downstream processing.
Do not reuse the same key with a different file or form fields — that produces a 409. Generate a fresh key for each logically distinct submission.