Once a workflow has processed your file, you can retrieve the extraction results using the jobs/:id/ endpoint:
Remember that all API endpoints require a trailing slash (/) and your API key in the x-api-key header.
curl -X GET "https://api.anyformat.ai/jobs/123/" \
-H "x-api-key: YOUR_API_KEY"
{
"id": "362963",
"status": "processed",
"workflow_id": "550e8400-e29b-41d4-a716-446655440000",
"processed_at": "2024-01-15T10:30:00Z",
"created_at": "2024-01-15T09:45:00Z",
"updated_at": "2024-01-15T10:30:00Z",
"results": {
"invoice_number": {
"value": "INV-001",
"confidence": 95,
"evidence": [{"text": "Invoice #INV-001", "page_number": 1}]
},
"total_amount": {
"value": "1250.00",
"confidence": 88,
"evidence": [{"text": "Total: $1,250.00", "page_number": 1}]
},
"line_items": [
{
"description": {
"value": "Consulting Services",
"confidence": 92,
"evidence": [{"text": "Consulting Services", "page_number": 1}]
},
"amount": {
"value": "1250.00",
"confidence": 90,
"evidence": [{"text": "$1,250.00", "page_number": 1}]
}
}
]
}
}
For additional response formatting options including as_lists=true for consistent field formatting, see the Response Formats Guide.
Job status values
The status field in the response can be one of:
pending: Job is queued for processing.
in_progress: Job is being processed.
processed: Processing finished successfully.
error: Processing encountered an error.
The results of the job will only be available when the job status is processed. In any other case, the results object will be empty.
Workflow Results Endpoint
To retrieve the results of all the extractions for a specific workflow, you can use the workflows/:id/results/ endpoint. This endpoint will return the extractions results for all the jobs of a given workflow.
curl -X GET "https://api.anyformat.ai/workflows/8/results/?output_format=csv&file__last_processed_at__gte=2024-12-20" \
-H "x-api-key: YOUR_API_KEY"
Workflow results query parameters
Notice in the examples above that the output_format parameter is used to specify the format of the response. The default format is CSV, but you can also request JSON or JSON lines format.
# CSV (default)
curl -X GET "https://api.anyformat.ai/workflows/8/results/" \
-H "x-api-key: YOUR_API_KEY"
# JSON format
curl -X GET "https://api.anyformat.ai/workflows/8/results/?output_format=json" \
-H "x-api-key: YOUR_API_KEY"
# JSON format with consistent field formatting
curl -X GET "https://api.anyformat.ai/workflows/8/results/?output_format=json&as_lists=true" \
-H "x-api-key: YOUR_API_KEY"
# JSON Lines format
curl -X GET "https://api.anyformat.ai/workflows/8/results/?output_format=jsonl" \
-H "x-api-key: YOUR_API_KEY"
| Parameter | Description | Notes |
|---|
output_format=csv | CSV format (default) | Tabular data, good for spreadsheet import |
output_format=json | JSON format | Structured data with full metadata |
output_format=jsonl | JSON Lines format | One JSON object per line |
as_lists=true | Consistent field formatting | Only works with output_format=json, transforms extracted data fields to consistent list format |
Note: The as_lists parameter only affects JSON format responses. It’s ignored for CSV and JSONL formats.
JSON with as_lists=true example:
curl -X GET "https://api.anyformat.ai/workflows/8/results/?output_format=json&as_lists=true" \
-H "x-api-key: YOUR_API_KEY"
This transforms extracted data fields to consistent list format:
{
"file_name.pdf": {
"file_name": "file_name.pdf",
"status": "processed",
"results": {
"field_name": [{
"id": 123,
"value": "extracted_value",
"confidence": 95,
"evidence": [{"page_number": 1}],
"verification_status": "not_verified",
"value_unit": null
}],
"another_field": [
{
"id": 124,
"value": "item1: 100",
"confidence": 92,
"evidence": [{"page_number": 1}],
"verification_status": "not_verified",
"value_unit": null
},
{
"id": 125,
"value": "item2: 200",
"confidence": 90,
"evidence": [{"page_number": 1}],
"verification_status": "not_verified",
"value_unit": null
}
],
"empty_field": []
}
}
}
For more details about response formats, see the Response Formats Guide.
Query Parameters
Similarly to the output_format parameter, this endpoint supports a number of filters that you can use to retrieve the results you are interested in. These can all be combined using the & operator, so you can retrieve more specific results:
File name filters
| Parameter | Description |
|---|
file__name__iexact | Exact file name match (case-insensitive) |
file__name__icontains | File name contains (case-insensitive) |
file__name__not_icontains | File name does not contain (case-insensitive) |
file__name__not_iexact | File name does not match exactly (case-insensitive) |
file__name__istartswith | File name starts with (case-insensitive) |
file__name__iendswith | File name ends with (case-insensitive) |
# Get results for files containing "invoice"
curl -X GET "https://api.anyformat.ai/workflows/8/results/?file__name__icontains=invoice" \
-H "x-api-key: YOUR_API_KEY"
# Get results for exact file name
curl -X GET "https://api.anyformat.ai/workflows/8/results/?file__name__iexact=invoice-2024-03.pdf" \
-H "x-api-key: YOUR_API_KEY"
File upload date filters
| Parameter | Description |
|---|
file__created_at | Exact file creation date match |
file__created_at__gt | File created after this date |
file__created_at__lt | File created before this date |
file__created_at__gte | File created on or after this date |
file__created_at__lte | File created on or before this date |
Processing time filters
| Parameter | Description | Format |
|---|
file__last_processed_at | Last processing date | ISO 8601 datetime |
file__last_processed_at__gt | Last processed after date | ISO 8601 datetime |
file__last_processed_at__lt | Last processed before date | ISO 8601 datetime |
file__last_processed_at__gte | Last processed on or after date | ISO 8601 datetime |
file__last_processed_at__lte | Last processed on or before date | ISO 8601 datetime |
# Get results from files processed after December 20, 2024
curl -X GET "https://api.anyformat.ai/workflows/8/results/?file__last_processed_at__gte=2024-12-20" \
-H "x-api-key: YOUR_API_KEY"
# Get results from files processed in a specific time window
curl -X GET "https://api.anyformat.ai/workflows/8/results/?file__last_processed_at__gte=2024-03-01&file__last_processed_at__lt=2024-04-01" \
-H "x-api-key: YOUR_API_KEY"
Error Handling
The API uses structured error responses to help you handle different types of errors. All error responses include:
error: Human-readable error description
detail: Detailed explanation of what went wrong
error_code: Machine-readable error code for programmatic handling
For complete error handling information, see the Error Handling Guide.