curl -X POST 'https://api.anyformat.ai/v3/workflows/0686bb97-8c30-70f0-8000-97669e000eb8/upload/' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Idempotency-Key: 5f2b6c3e-8a1d-4f7e-9c0b-1a2b3c4d5e6f' \
-F 'files=@/path/to/contract.pdf' \
-F 'files=@/path/to/annex-a.pdf' \
-F 'metadata={"customer_reference": "CR-2026-99001-ZTX"}'
import requests
workflow_id = "0686bb97-8c30-70f0-8000-97669e000eb8"
url = f"https://api.anyformat.ai/v3/workflows/{workflow_id}/upload/"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Idempotency-Key": "5f2b6c3e-8a1d-4f7e-9c0b-1a2b3c4d5e6f",
}
with open("contract.pdf", "rb") as f1, open("annex-a.pdf", "rb") as f2:
files = [("files", f1), ("files", f2)]
packet = requests.post(url, headers=headers, files=files).json()
print(packet["document_packet_id"])
interface DocumentPacketCreated {
document_packet_id: string;
workflow_id: string;
files: { id: string; name: string; original_name: string | null }[];
}
const workflowId = '0686bb97-8c30-70f0-8000-97669e000eb8';
const formData = new FormData();
formData.append('files', fileInput.files[0]);
const response = await fetch(
`https://api.anyformat.ai/v3/workflows/${workflowId}/upload/`,
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Idempotency-Key': crypto.randomUUID(),
},
body: formData,
}
);
if (!response.ok) {
throw new Error(`API error: ${response.status}`);
}
const packet: DocumentPacketCreated = await response.json();
console.log(packet.document_packet_id);
{
"document_packet_id": "069dcc2c-e14c-7606-8000-2ee4fb17b4e1",
"workflow_id": "0686bb97-8c30-70f0-8000-97669e000eb8",
"files": [
{ "id": "069dcc2c-e14c-7606-8000-2ee4fb17b4e2", "name": "contract.pdf", "original_name": null },
{ "id": "069dcc2c-e14c-7606-8000-2ee4fb17b4e3", "name": "annex-a.pdf", "original_name": null }
]
}
Upload
Upload Document Packet
Upload one or more files as a single document packet, without running it
POST
/
v3
/
workflows
/
{workflow_id}
/
upload
/
curl -X POST 'https://api.anyformat.ai/v3/workflows/0686bb97-8c30-70f0-8000-97669e000eb8/upload/' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Idempotency-Key: 5f2b6c3e-8a1d-4f7e-9c0b-1a2b3c4d5e6f' \
-F 'files=@/path/to/contract.pdf' \
-F 'files=@/path/to/annex-a.pdf' \
-F 'metadata={"customer_reference": "CR-2026-99001-ZTX"}'
import requests
workflow_id = "0686bb97-8c30-70f0-8000-97669e000eb8"
url = f"https://api.anyformat.ai/v3/workflows/{workflow_id}/upload/"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Idempotency-Key": "5f2b6c3e-8a1d-4f7e-9c0b-1a2b3c4d5e6f",
}
with open("contract.pdf", "rb") as f1, open("annex-a.pdf", "rb") as f2:
files = [("files", f1), ("files", f2)]
packet = requests.post(url, headers=headers, files=files).json()
print(packet["document_packet_id"])
interface DocumentPacketCreated {
document_packet_id: string;
workflow_id: string;
files: { id: string; name: string; original_name: string | null }[];
}
const workflowId = '0686bb97-8c30-70f0-8000-97669e000eb8';
const formData = new FormData();
formData.append('files', fileInput.files[0]);
const response = await fetch(
`https://api.anyformat.ai/v3/workflows/${workflowId}/upload/`,
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Idempotency-Key': crypto.randomUUID(),
},
body: formData,
}
);
if (!response.ok) {
throw new Error(`API error: ${response.status}`);
}
const packet: DocumentPacketCreated = await response.json();
console.log(packet.document_packet_id);
{
"document_packet_id": "069dcc2c-e14c-7606-8000-2ee4fb17b4e1",
"workflow_id": "0686bb97-8c30-70f0-8000-97669e000eb8",
"files": [
{ "id": "069dcc2c-e14c-7606-8000-2ee4fb17b4e2", "name": "contract.pdf", "original_name": null },
{ "id": "069dcc2c-e14c-7606-8000-2ee4fb17b4e3", "name": "annex-a.pdf", "original_name": null }
]
}
Rate limit tier: submission, 60 requests/min. See Rate limits.
Uploads 1–100 files as a single document packet, the unit a run addresses. Every file lands in one packet. Creation is all-or-nothing: one rejected file fails the whole request and stores nothing. An unsupported type and disguised bytes both cause a rejection.
This endpoint uploads without processing. Trigger extraction afterwards with
POST /v3/document-packets/{document_packet_id}/run/. To do both in one call, use Upload and Run.
Send the files as multipart form data under the files field, repeating the field for a packet with several files. A file above the per-file size cap is rejected before any bytes reach S3. See Files for the cap and the supported formats. Bundle several files only when they form one document, such as a contract and its annexes. Put unrelated documents in separate packets.
Retries are safe with Idempotency-Key. Pass any unique string. Retrying the request with the same key replays the original upload, so the API creates no duplicate packet. See Idempotency.
Filenames are unique within a workflow. The on_conflict form field decides what a collision does:
error, the default. The whole request fails with409before anything is uploaded. The response lists the conflicting names and the name each one would take.rename. The colliding file gets a(n)counter before its extension, socontract.pdfbecomescontract (1).pdf. Each returned file’snameis then the name it was stored under, andoriginal_nameholds the name you uploaded.original_nameisnullwhen no rename happened.
metadata form field. It takes a JSON-encoded object, sent as a string because multipart carries no nested objects. Free text in natural language goes inside it, under the __anyformat_free_text__ key. GET /v3/document-packets/{document_packet_id}/ echoes it back. A top-level key whose name matches an extract-schema field reaches the LLM and becomes the extracted value. See Attaching metadata for the full contract.
curl -X POST 'https://api.anyformat.ai/v3/workflows/0686bb97-8c30-70f0-8000-97669e000eb8/upload/' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Idempotency-Key: 5f2b6c3e-8a1d-4f7e-9c0b-1a2b3c4d5e6f' \
-F 'files=@/path/to/contract.pdf' \
-F 'files=@/path/to/annex-a.pdf' \
-F 'metadata={"customer_reference": "CR-2026-99001-ZTX"}'
import requests
workflow_id = "0686bb97-8c30-70f0-8000-97669e000eb8"
url = f"https://api.anyformat.ai/v3/workflows/{workflow_id}/upload/"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Idempotency-Key": "5f2b6c3e-8a1d-4f7e-9c0b-1a2b3c4d5e6f",
}
with open("contract.pdf", "rb") as f1, open("annex-a.pdf", "rb") as f2:
files = [("files", f1), ("files", f2)]
packet = requests.post(url, headers=headers, files=files).json()
print(packet["document_packet_id"])
interface DocumentPacketCreated {
document_packet_id: string;
workflow_id: string;
files: { id: string; name: string; original_name: string | null }[];
}
const workflowId = '0686bb97-8c30-70f0-8000-97669e000eb8';
const formData = new FormData();
formData.append('files', fileInput.files[0]);
const response = await fetch(
`https://api.anyformat.ai/v3/workflows/${workflowId}/upload/`,
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Idempotency-Key': crypto.randomUUID(),
},
body: formData,
}
);
if (!response.ok) {
throw new Error(`API error: ${response.status}`);
}
const packet: DocumentPacketCreated = await response.json();
console.log(packet.document_packet_id);
{
"document_packet_id": "069dcc2c-e14c-7606-8000-2ee4fb17b4e1",
"workflow_id": "0686bb97-8c30-70f0-8000-97669e000eb8",
"files": [
{ "id": "069dcc2c-e14c-7606-8000-2ee4fb17b4e2", "name": "contract.pdf", "original_name": null },
{ "id": "069dcc2c-e14c-7606-8000-2ee4fb17b4e3", "name": "annex-a.pdf", "original_name": null }
]
}
Authorizations
Headers
Body
multipart/form-data
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).
Available options:
error, rename Response
Successful Response
Response for the packet-creating uploads (multipart and from-url).

