Skip to main content

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"
    }
  ]
}
FieldDescription
countTotal number of items across all pages
total_pagesNumber of pages available
nextURL for the next page (null if last page)
previousURL for the previous page (null if first page)
resultsArray of items for the current page

Extraction Results Output Formats

The workflow results endpoint (/workflows/{id}/results/) supports three output formats:
FormatParameterDescription
CSVoutput_format=csvTabular data (default), ideal for spreadsheets
JSONoutput_format=jsonStructured data with full metadata
JSON Linesoutput_format=jsonlOne 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"

Consistent Formatting with as_lists=true

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

When to Use Each Format

Use CaseRecommended Format
Spreadsheet importoutput_format=csv
Standard API integrationoutput_format=json
Automated data pipelinesoutput_format=json&as_lists=true
Streaming/large datasetsoutput_format=jsonl

Supported Endpoints

Endpoints supporting as_lists=true

EndpointDescription
GET /workflows/{id}/results/?output_format=json&as_lists=trueWorkflow extraction results
GET /jobs/{id}/?as_lists=trueIndividual job results

Endpoints where as_lists=true has no effect

EndpointReason
GET /workflows/Returns workflow metadata, not extraction data
GET /workflows/{id}/Returns single workflow details
Any endpoint returning only metadataNo 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
  }
}
PropertyDescription
valueThe extracted value
confidenceConfidence score (0-100)
evidenceArray of source locations in the document
verification_statusWhether the value has been manually verified
value_unitUnit of measurement (e.g., “USD” for currency)