Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.anyformat.ai/llms.txt

Use this file to discover all available pages before exploring further.

Workflow fields

We recommend creating this workflow in the anyformat platform where you can test with sample receipt photos and iterate on field descriptions. Copy the workflow ID to use with the API.
FieldTypeDescription
store_namestringName of the store or merchant
store_addressstringStore location
receipt_datedateDate of purchase
total_amountfloatTotal amount charged
tax_amountfloatTax amount
number_of_itemsintegerNumber of items purchased
payment_methodenumHow the purchase was paid
contains_alcoholbooleanWhether alcohol was purchased

End-to-end

Python package + class names are provisional. pip install anyformat-sdk and from anyformat.sdk import Client work today, but both are expected to change before the official launch — pin the version you ship with.
# 1. Create the workflow
curl -X POST 'https://api.anyformat.ai/v2/workflows/' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ANYFORMAT_API_KEY" \
  -d '{
    "name": "Receipt Scanner",
    "description": "Extract receipt details from photos and scans",
    "nodes": [
      {"id": "parse_1", "type": "parse"},
      {
        "id": "extract_1",
        "type": "extract",
        "extraction_schema": {
          "fields": [
            {"name": "store_name",       "description": "Name of the store or merchant",          "data_type": "string"},
            {"name": "store_address",    "description": "Full address of the store location",     "data_type": "string"},
            {"name": "receipt_date",     "description": "Date of the purchase transaction",       "data_type": "date"},
            {"name": "total_amount",     "description": "Total amount charged including tax",     "data_type": "float"},
            {"name": "tax_amount",       "description": "Total tax amount",                       "data_type": "float"},
            {"name": "number_of_items",  "description": "Total number of items purchased",        "data_type": "integer"},
            {
              "name": "payment_method",
              "description": "Payment method used for the transaction",
              "data_type": "enum",
              "enum_options": [
                {"name": "cash",            "description": "Cash payment"},
                {"name": "credit_card",     "description": "Credit card payment"},
                {"name": "debit_card",      "description": "Debit card payment"},
                {"name": "mobile_payment",  "description": "Mobile or digital wallet payment"}
              ]
            },
            {"name": "contains_alcohol", "description": "Whether any alcoholic beverage was included in the purchase", "data_type": "boolean"}
          ]
        }
      }
    ],
    "edges": [{"source": "parse_1", "target": "extract_1"}]
  }'

# 2. Run a receipt photo
curl -X POST 'https://api.anyformat.ai/v2/workflows/WORKFLOW_ID/run/' \
  -H "Authorization: Bearer $ANYFORMAT_API_KEY" \
  -F 'file=@receipt.jpg'

# 3. Poll for results
curl -H "Authorization: Bearer $ANYFORMAT_API_KEY" \
  'https://api.anyformat.ai/v2/workflows/WORKFLOW_ID/files/COLLECTION_ID/results/'

Tips

  • For receipt photos, good lighting and a flat surface produce significantly better results.
  • PNG images generally extract better than compressed JPG. If quality matters, prefer PNG.
  • enum with explicit options constrains the output to known values, preventing free-text variations like “Visa” vs “credit card” vs “CC”.

Next steps

Response formats

The unified JSON response shape

Errors

Handle rate limits and retries in production