Response Formats
The anyformat API supports multiple response formats to accommodate different use cases and integration patterns.
Paginated List Responses
Endpoints that return multiple items use paginated responses:
{
"count": 25,
"total_pages": 3,
"next": "https://api.anyformat.ai/workflows/?page=2",
"previous": null,
"results": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Invoice Data Extraction",
"description": "Extracts invoice data from PDF documents",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-20T14:22:00Z"
}
]
}
| Field | Description |
|---|
count | Total number of items across all pages |
total_pages | Number of pages available |
next | URL for the next page (null if last page) |
previous | URL for the previous page (null if first page) |
results | Array of items for the current page |
The workflow results endpoint (/workflows/{id}/results/) supports three output formats:
| Format | Parameter | Description |
|---|
| CSV | output_format=csv | Tabular data (default), ideal for spreadsheets |
| JSON | output_format=json | Structured data with full metadata |
| JSON Lines | output_format=jsonl | One JSON object per line, ideal for streaming |
# CSV (default)
curl "https://api.anyformat.ai/workflows/{id}/results/" \
-H "x-api-key: YOUR_API_KEY"
# JSON
curl "https://api.anyformat.ai/workflows/{id}/results/?output_format=json" \
-H "x-api-key: YOUR_API_KEY"
# JSON Lines
curl "https://api.anyformat.ai/workflows/{id}/results/?output_format=jsonl" \
-H "x-api-key: YOUR_API_KEY"
The as_lists=true parameter transforms extracted fields to a consistent array format, making automated processing easier.
The as_lists=true parameter only works with output_format=json. It is ignored for CSV and JSONL formats.
Standard Response
{
"id": "362963",
"status": "processed",
"processed_at": "2024-01-15T10:30:00Z",
"results": {
"invoice_id": {
"value": "13152556",
"evidence": [{"text": "Invoice #13152556", "page_number": 1}],
"confidence": 95
},
"vendor_name": {
"value": "Acme Corporation",
"evidence": [{"text": "From: Acme Corporation", "page_number": 1}],
"confidence": 92
},
"line_items": [
{
"description": {"value": "Consulting", "confidence": 90},
"amount": {"value": 500.00, "confidence": 95}
},
{
"description": {"value": "Support", "confidence": 88},
"amount": {"value": 250.00, "confidence": 92}
}
]
}
}
With as_lists=true
{
"id": "362963",
"status": "processed",
"processed_at": "2024-01-15T10:30:00Z",
"results": {
"invoice_id": [
{
"value": "13152556",
"evidence": [{"text": "Invoice #13152556", "page_number": 1}],
"confidence": 95
}
],
"vendor_name": [
{
"value": "Acme Corporation",
"evidence": [{"text": "From: Acme Corporation", "page_number": 1}],
"confidence": 92
}
],
"line_items": [
{
"description": {"value": "Consulting", "confidence": 90},
"amount": {"value": 500.00, "confidence": 95}
},
{
"description": {"value": "Support", "confidence": 88},
"amount": {"value": 250.00, "confidence": 92}
}
]
}
}
Key differences:
- Metadata fields (
id, status, processed_at) remain unchanged
- Single-value fields (
invoice_id, vendor_name) are wrapped in arrays
- Already-array fields (
line_items) remain unchanged
| Use Case | Recommended Format |
|---|
| Spreadsheet import | output_format=csv |
| Standard API integration | output_format=json |
| Automated data pipelines | output_format=json&as_lists=true |
| Streaming/large datasets | output_format=jsonl |
Supported Endpoints
Endpoints supporting as_lists=true
| Endpoint | Description |
|---|
GET /workflows/{id}/results/?output_format=json&as_lists=true | Workflow extraction results |
GET /jobs/{id}/?as_lists=true | Individual job results |
Endpoints where as_lists=true has no effect
| Endpoint | Reason |
|---|
GET /workflows/ | Returns workflow metadata, not extraction data |
GET /workflows/{id}/ | Returns single workflow details |
| Any endpoint returning only metadata | No extracted data fields to transform |
Result Field Structure
Each extracted field in the results contains:
{
"field_name": {
"value": "extracted_value",
"confidence": 95,
"evidence": [
{
"text": "Snippet from document",
"page_number": 1
}
],
"verification_status": "not_verified",
"value_unit": null
}
}
| Property | Description |
|---|
value | The extracted value |
confidence | Confidence score (0-100) |
evidence | Array of source locations in the document |
verification_status | Whether the value has been manually verified |
value_unit | Unit of measurement (e.g., “USD” for currency) |