curl -X POST 'https://api.anyformat.ai/v3/document-packets/069dcc2c-e14c-7606-8000-2ee4fb17b4e1/run/' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Idempotency-Key: 9e8d7c6b-5a4f-3e2d-1c0b-a9b8c7d6e5f4'
import requests
document_packet_id = "069dcc2c-e14c-7606-8000-2ee4fb17b4e1"
url = f"https://api.anyformat.ai/v3/document-packets/{document_packet_id}/run/"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Idempotency-Key": "9e8d7c6b-5a4f-3e2d-1c0b-a9b8c7d6e5f4",
}
triggered = requests.post(url, headers=headers).json()
print(triggered["run_id"])
interface RunTriggered {
run_id: string;
document_packet_id: string;
workflow_id: string;
workflow_version_id?: string;
status: 'queued' | 'in_progress' | 'processed' | 'error' | 'cancelled';
}
const packetId = '069dcc2c-e14c-7606-8000-2ee4fb17b4e1';
const response = await fetch(
`https://api.anyformat.ai/v3/document-packets/${packetId}/run/`,
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Idempotency-Key': crypto.randomUUID(),
},
}
);
if (!response.ok) {
throw new Error(`API error: ${response.status}`);
}
const triggered: RunTriggered = await response.json();
console.log(triggered.run_id);
{
"run_id": "069dcc2c-e14c-7606-8000-2ee4fb17b4fa",
"document_packet_id": "069dcc2c-e14c-7606-8000-2ee4fb17b4e1",
"workflow_id": "0686bb97-8c30-70f0-8000-97669e000eb8",
"workflow_version_id": "FGaV4I2JAA",
"status": "queued"
}
Document packets
Run Document Packet
Run (or re-run) a document packet on the latest version of its workflow, or on a chosen version
POST
/
v3
/
document-packets
/
{document_packet_id}
/
run
/
curl -X POST 'https://api.anyformat.ai/v3/document-packets/069dcc2c-e14c-7606-8000-2ee4fb17b4e1/run/' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Idempotency-Key: 9e8d7c6b-5a4f-3e2d-1c0b-a9b8c7d6e5f4'
import requests
document_packet_id = "069dcc2c-e14c-7606-8000-2ee4fb17b4e1"
url = f"https://api.anyformat.ai/v3/document-packets/{document_packet_id}/run/"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Idempotency-Key": "9e8d7c6b-5a4f-3e2d-1c0b-a9b8c7d6e5f4",
}
triggered = requests.post(url, headers=headers).json()
print(triggered["run_id"])
interface RunTriggered {
run_id: string;
document_packet_id: string;
workflow_id: string;
workflow_version_id?: string;
status: 'queued' | 'in_progress' | 'processed' | 'error' | 'cancelled';
}
const packetId = '069dcc2c-e14c-7606-8000-2ee4fb17b4e1';
const response = await fetch(
`https://api.anyformat.ai/v3/document-packets/${packetId}/run/`,
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Idempotency-Key': crypto.randomUUID(),
},
}
);
if (!response.ok) {
throw new Error(`API error: ${response.status}`);
}
const triggered: RunTriggered = await response.json();
console.log(triggered.run_id);
{
"run_id": "069dcc2c-e14c-7606-8000-2ee4fb17b4fa",
"document_packet_id": "069dcc2c-e14c-7606-8000-2ee4fb17b4e1",
"workflow_id": "0686bb97-8c30-70f0-8000-97669e000eb8",
"workflow_version_id": "FGaV4I2JAA",
"status": "queued"
}
Rate limit tier: submission, 60 requests/min. See Rate limits.
Runs, or re-runs, a document packet on the latest version of its workflow, or on the version you choose. The path is flat: the packet already knows its workflow, so no
An
workflow_id appears in the URL.
Every call creates a new run. Re-running the same document after editing the workflow is the intended flow. Earlier runs stay readable at GET /v3/runs/{run_id}/ with their own results. The platform meters a re-run like a fresh run. See How credits work.
Run a chosen version. Send an optional JSON body with workflow_version_id, a version_id from GET /v3/workflows/{workflow_id}/versions/. The run uses that version, not the latest. Pin a version to keep production runs off the candidates the optimizer saves, and to make a result reproducible. Without the body, or with {}, the latest version runs. An unknown version, or a version of another workflow, returns 404 and starts no run. The body accepts no other key: a misspelled key such as version_id is refused, so a typo cannot run the wrong version.
curl -X POST 'https://api.anyformat.ai/v3/document-packets/069dcc2c-e14c-7606-8000-2ee4fb17b4e1/run/' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"workflow_version_id": "FGaV4I2JAA"}'
Idempotency-Key replay is the one exception. Retrying with the same key returns the original run, and triggers and bills no second extraction. The key is scoped by version: the same key with a different workflow_version_id starts a separate run. See Idempotency.
An unknown id returns 404, as does a packet belonging to another organization. An organization without extraction credit receives 402 PAYMENT_REQUIRED.
curl -X POST 'https://api.anyformat.ai/v3/document-packets/069dcc2c-e14c-7606-8000-2ee4fb17b4e1/run/' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Idempotency-Key: 9e8d7c6b-5a4f-3e2d-1c0b-a9b8c7d6e5f4'
import requests
document_packet_id = "069dcc2c-e14c-7606-8000-2ee4fb17b4e1"
url = f"https://api.anyformat.ai/v3/document-packets/{document_packet_id}/run/"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Idempotency-Key": "9e8d7c6b-5a4f-3e2d-1c0b-a9b8c7d6e5f4",
}
triggered = requests.post(url, headers=headers).json()
print(triggered["run_id"])
interface RunTriggered {
run_id: string;
document_packet_id: string;
workflow_id: string;
workflow_version_id?: string;
status: 'queued' | 'in_progress' | 'processed' | 'error' | 'cancelled';
}
const packetId = '069dcc2c-e14c-7606-8000-2ee4fb17b4e1';
const response = await fetch(
`https://api.anyformat.ai/v3/document-packets/${packetId}/run/`,
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Idempotency-Key': crypto.randomUUID(),
},
}
);
if (!response.ok) {
throw new Error(`API error: ${response.status}`);
}
const triggered: RunTriggered = await response.json();
console.log(triggered.run_id);
{
"run_id": "069dcc2c-e14c-7606-8000-2ee4fb17b4fa",
"document_packet_id": "069dcc2c-e14c-7606-8000-2ee4fb17b4e1",
"workflow_id": "0686bb97-8c30-70f0-8000-97669e000eb8",
"workflow_version_id": "FGaV4I2JAA",
"status": "queued"
}
Authorizations
Headers
Body
application/json
Optional body of POST /v3/document-packets/{document_packet_id}/run/.
Response
Successful Response
202 response for the two workflow run triggers: the run, and the version it runs on.

