curl -X POST 'https://api.anyformat.ai/v2/workflows/550e8400-e29b-41d4-a716-446655440000/upload/' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-F 'file=@/path/to/document.pdf'
import requests
workflow_id = "550e8400-e29b-41d4-a716-446655440000"
url = f"https://api.anyformat.ai/v2/workflows/{workflow_id}/upload/"
headers = {
"Authorization": "Bearer YOUR_API_KEY"
}
with open('document.pdf', 'rb') as f:
response = requests.post(
url,
headers=headers,
files={'file': f}
)
print(response.json())
const workflowId = '550e8400-e29b-41d4-a716-446655440000';
const formData = new FormData();
formData.append('file', fileInput.files[0]);
const response = await fetch(`https://api.anyformat.ai/v2/workflows/${workflowId}/upload/`, {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
},
body: formData
});
const data = await response.json();
console.log(data);
interface UploadResponse {
status: string;
filename: string | null;
file_collection_id: string | null;
file_id: string | null;
}
const workflowId = '550e8400-e29b-41d4-a716-446655440000';
const formData = new FormData();
formData.append('file', fileInput.files[0]);
const response = await fetch(
`https://api.anyformat.ai/v2/workflows/${workflowId}/upload/`,
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
},
body: formData
}
);
if (!response.ok) {
throw new Error(`API error: ${response.status}`);
}
const data: UploadResponse = await response.json();
console.log(data);
{
"status": "uploaded",
"filename": "document.pdf",
"file_collection_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"file_id": "f0e1d2c3-b4a5-6789-0abc-def123456789"
}
Upload File
Upload a file to a workflow without triggering processing
curl -X POST 'https://api.anyformat.ai/v2/workflows/550e8400-e29b-41d4-a716-446655440000/upload/' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-F 'file=@/path/to/document.pdf'
import requests
workflow_id = "550e8400-e29b-41d4-a716-446655440000"
url = f"https://api.anyformat.ai/v2/workflows/{workflow_id}/upload/"
headers = {
"Authorization": "Bearer YOUR_API_KEY"
}
with open('document.pdf', 'rb') as f:
response = requests.post(
url,
headers=headers,
files={'file': f}
)
print(response.json())
const workflowId = '550e8400-e29b-41d4-a716-446655440000';
const formData = new FormData();
formData.append('file', fileInput.files[0]);
const response = await fetch(`https://api.anyformat.ai/v2/workflows/${workflowId}/upload/`, {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
},
body: formData
});
const data = await response.json();
console.log(data);
interface UploadResponse {
status: string;
filename: string | null;
file_collection_id: string | null;
file_id: string | null;
}
const workflowId = '550e8400-e29b-41d4-a716-446655440000';
const formData = new FormData();
formData.append('file', fileInput.files[0]);
const response = await fetch(
`https://api.anyformat.ai/v2/workflows/${workflowId}/upload/`,
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
},
body: formData
}
);
if (!response.ok) {
throw new Error(`API error: ${response.status}`);
}
const data: UploadResponse = await response.json();
console.log(data);
{
"status": "uploaded",
"filename": "document.pdf",
"file_collection_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"file_id": "f0e1d2c3-b4a5-6789-0abc-def123456789"
}
file_collection_id. To process it, call Run Uploaded File with that id. (For upload-and-process in one call, use Run Workflow instead.)
file_collection_id is the handle you run and poll. See Packets and files. file_id identifies the single file inside it, and reads that file’s content and results.curl -X POST 'https://api.anyformat.ai/v2/workflows/550e8400-e29b-41d4-a716-446655440000/upload/' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-F 'file=@/path/to/document.pdf'
import requests
workflow_id = "550e8400-e29b-41d4-a716-446655440000"
url = f"https://api.anyformat.ai/v2/workflows/{workflow_id}/upload/"
headers = {
"Authorization": "Bearer YOUR_API_KEY"
}
with open('document.pdf', 'rb') as f:
response = requests.post(
url,
headers=headers,
files={'file': f}
)
print(response.json())
const workflowId = '550e8400-e29b-41d4-a716-446655440000';
const formData = new FormData();
formData.append('file', fileInput.files[0]);
const response = await fetch(`https://api.anyformat.ai/v2/workflows/${workflowId}/upload/`, {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
},
body: formData
});
const data = await response.json();
console.log(data);
interface UploadResponse {
status: string;
filename: string | null;
file_collection_id: string | null;
file_id: string | null;
}
const workflowId = '550e8400-e29b-41d4-a716-446655440000';
const formData = new FormData();
formData.append('file', fileInput.files[0]);
const response = await fetch(
`https://api.anyformat.ai/v2/workflows/${workflowId}/upload/`,
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
},
body: formData
}
);
if (!response.ok) {
throw new Error(`API error: ${response.status}`);
}
const data: UploadResponse = await response.json();
console.log(data);
{
"status": "uploaded",
"filename": "document.pdf",
"file_collection_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"file_id": "f0e1d2c3-b4a5-6789-0abc-def123456789"
}
Authorizations
API key issued from app.anyformat.ai/api-key. Send as Authorization: Bearer <key>.
Path Parameters
Body
Response
Successful Response
Confirmation that a file was uploaded successfully without triggering extraction.
Upload result: uploaded on success.
"uploaded"
Name the file was stored under. Auto-renamed with a (n) counter when it collides with an existing file in the workflow; original_filename then holds the name you uploaded.
"invoice.pdf"
The name you uploaded, present only when the file was auto-renamed to avoid a duplicate name in the workflow. null when filename is the name you uploaded.
"invoice.pdf"
The collection UUID the file was uploaded into. Use it to poll results via GET /v2/workflows/{workflow_id}/files/{file_collection_id}/results/.
"069dcc2c-e14c-7606-8000-2ee4fb17b4e1"
The UUID of the uploaded file. Pass it to POST /v2/workflows/{workflow_id}/files/{file_id}/run/ to start extraction.
"069dcc2c-e14c-7606-8000-2ee4fb17b4e2"

