Skip to main content
Every document submitted to POST /v1/documents is processed asynchronously. The API returns 202 Accepted immediately with a document object; the actual extraction happens in the background. This guide explains the status lifecycle and the three consumption modes.

Status lifecycle

A document moves through the following states: Terminal states are completed, partially_completed, failed, and deleted. Once a document reaches a terminal state it does not change again.

Consumption modes

Register a URL once; Folio calls it whenever a document reaches a terminal state.
Your server receives a POST with the event payload. No polling required. See Webhooks for signature verification and event types. Best for: production integrations, high volume, latency-sensitive pipelines.

2. Long-poll (?wait=<seconds>)

Pass ?wait=<seconds> on GET /v1/documents/{id}. The server holds the HTTP connection open until the document leaves queued/processing, or the timeout expires (whichever comes first). The response is the updated document object.
If the document finishes within the window you get the terminal status in one round-trip. If the timeout fires before processing completes, the response returns the current (non-terminal) status — loop and call again.
wait=0 (the default) is an immediate poll with no hold: useful for checking status without blocking.
Best for: scripts, CLIs, short-lived jobs where a persistent webhook listener is impractical.

3. Fetch result directly

Once you know (via webhook or poll) that the document is in a terminal state, fetch the full extraction result:
A 409 means the document is not yet in a terminal state. A 200 returns the full result object including extract, tables, review_status, flags, and provenance fields. Best for: fetching the structured payload after any notification method has confirmed completion.

Choosing a mode

Listing documents

You can list all documents for your organisation using GET /v1/documents. Supports cursor-based pagination via limit and starting_after, and a status filter: