Skip to main content
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'
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 }[];
}

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" },
    { "id": "069dcc2c-e14c-7606-8000-2ee4fb17b4e3", "name": "annex-a.pdf" }
  ]
}
Rate limit tier: submission (60 req/min) — see Rate limits. Uploads 1–10 files as a single document packet — the unit that runs later address. All files are grouped into one packet; creation is all-or-nothing, so any rejected file (unsupported type, disguised bytes) fails the whole request and nothing is stored. This endpoint uploads without processing. Trigger extraction afterwards via POST /v3/document-packets/{document_packet_id}/run/ — or do both in one call with Upload and Run. Send the files as multipart form data under the files field (repeat the field for a multi-file packet). Files above the per-file size cap are rejected at slot mint (before any bytes reach S3); see Files for the cap and supported formats. Bundle multiple files only when they belong together as one document (a contract and its annexes) — unrelated documents should be separate packets.
Retries are safe with Idempotency-Key. Pass any unique string; retrying the request with the same key replays the original upload, so no duplicate packet is created. See Idempotency.
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'
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 }[];
}

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" },
    { "id": "069dcc2c-e14c-7606-8000-2ee4fb17b4e3", "name": "annex-a.pdf" }
  ]
}

Authorizations

Authorization
string
header
required

API key issued from app.anyformat.ai/api-key. Send as Authorization: Bearer <key>.

Headers

Idempotency-Key
string | null

Optional caller-supplied key (Stripe convention). Retrying the request with the same key replays the original upload slots so no duplicate packet is created.

Path Parameters

workflow_id
string
required

Body

multipart/form-data
files
string[]
required

1..10 files forming one document packet.

Response

Successful Response

Response for the packet-creating uploads (multipart and from-url).

document_packet_id
string
required

Unique identifier of the newly created document packet (hyphenated UUID).

Example:

"069dcc2c-e14c-7606-8000-2ee4fb17b4e1"

workflow_id
string
required

The workflow the packet was created under (hyphenated UUID).

Example:

"0686bb97-8c30-70f0-8000-97669e000eb8"

files
DocumentPacketFileV3 · object[]
required

Files in the packet, in the order they were provided.