Upload and Run
Upload a document packet and start a run in a single call
202 response returns the new run_id. Poll GET /v3/runs/{run_id}/ until status is terminal — the results arrive inline on that same read.
Send the files as multipart form data under the files field (repeat it for a multi-file packet); files above the per-file size cap are rejected at slot mint (before any bytes reach S3). Packet creation is all-or-nothing.
Idempotency-Key. Retrying with the same key replays the original packet and run — no duplicate upload, no second extraction billed. See Idempotency.on_conflict form field. By default (error) a filename that collides with an existing file fails the request with 409 before anything is uploaded or run. Pass rename to auto-rename instead (invoice.pdf → invoice (1).pdf); this 202 response returns only the run_id, so read the names the files were stored under from GET /v3/document-packets/{document_packet_id}/.metadata form field. Optional; a JSON-encoded object stapled to the packet (multipart can’t carry nested objects natively, so send the JSON as a string). The value flows into this run’s extract prompt as a “Document Metadata” section: a top-level key whose name matches an extract-schema field is surfaced to the LLM and used as the extracted value, and the metadata itself is echoed back on GET /v3/document-packets/{document_packet_id}/. See Attaching metadata.402 PAYMENT_REQUIRED.
Authorizations
API key issued from app.anyformat.ai/api-key. Send as Authorization: Bearer <key>.
Headers
Optional caller-supplied key (Stripe convention). Retrying the request with the same key replays the original packet AND run — no duplicate upload, no second extraction.
Path Parameters
Body
1..10 files forming one document packet.
Optional JSON-encoded object of free-form metadata attached to the packet. The extract operator may source datapoints from a top-level key whose name matches a schema field.
How to handle an uploaded filename that already exists in the workflow (filenames are unique within a workflow). error (the default) rejects the whole request with 409 and lists the conflicting names, so a rename is never silent — the caller must opt in. rename accepts the collision and lets the server auto-rename the file by inserting a (n) counter before the extension (invoice.pdf → invoice (1).pdf).
error, rename Response
Successful Response
202 response for both run triggers (upload/run/ and
document-packets/{id}/run/).
Unique identifier of the new run (hyphenated UUID).
"069dcc2c-e14c-7606-8000-2ee4fb17b4f9"
The document packet the run executes on (hyphenated UUID).
"069dcc2c-e14c-7606-8000-2ee4fb17b4e1"
The workflow being run (hyphenated UUID).
"0686bb97-8c30-70f0-8000-97669e000eb8"
Status at acceptance time — normally queued.
queued, in_progress, processed, error, cancelled "queued"

