Parse Receipts and Expenses

Extract merchant details, dates, and line items from receipts into structured JSON for expense tracking workflows.

Who this is for

Finance teams and expense management apps use this recipe to automate receipt processing. Upload a receipt photo or PDF and receive structured JSON with merchant name, date, individual items, and total — ready for expense reports or reimbursement workflows.

curl -X POST https://api.iterationlayer.com/document-extraction/v1/extract \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "files": [
      {
        "type": "url",
        "name": "receipt.pdf",
        "url": "https://example.com/receipts/purchase-receipt.pdf"
      }
    ],
    "schema": {
      "fields": [
        { "name": "merchant_name", "type": "TEXT", "description": "Name of the merchant or store" },
        { "name": "date", "type": "DATE", "description": "Date of the transaction" },
        { "name": "items", "type": "ARRAY", "description": "Individual line items on the receipt", "fields": [
          { "name": "name", "type": "TEXT", "description": "Item name or description" },
          { "name": "amount", "type": "CURRENCY_AMOUNT", "description": "Item price" }
        ]},
        { "name": "total_amount", "type": "CURRENCY_AMOUNT", "description": "Total amount charged" },
        { "name": "currency", "type": "CURRENCY_CODE", "description": "Currency code (e.g. USD, EUR)" }
      ]
    }
  }'
import { IterationLayer } from "iterationlayer";
const client = new IterationLayer({ apiKey: "YOUR_API_KEY" });

const result = await client.extract({
  files: [
    {
      type: "url",
      name: "receipt.pdf",
      url: "https://example.com/receipts/purchase-receipt.pdf",
    },
  ],
  schema: {
    fields: [
      { name: "merchant_name", type: "TEXT", description: "Name of the merchant or store" },
      { name: "date", type: "DATE", description: "Date of the transaction" },
      { name: "items", type: "ARRAY", description: "Individual line items on the receipt", fields: [
        { name: "name", type: "TEXT", description: "Item name or description" },
        { name: "amount", type: "CURRENCY_AMOUNT", description: "Item price" },
      ]},
      { name: "total_amount", type: "CURRENCY_AMOUNT", description: "Total amount charged" },
      { name: "currency", type: "CURRENCY_CODE", description: "Currency code (e.g. USD, EUR)" },
    ],
  },
});

console.log(result);
from iterationlayer import IterationLayer
client = IterationLayer(api_key="YOUR_API_KEY")

result = client.extract(
    files=[
        {
            "type": "url",
            "name": "receipt.pdf",
            "url": "https://example.com/receipts/purchase-receipt.pdf",
        }
    ],
    schema={
        "fields": [
            {"name": "merchant_name", "type": "TEXT", "description": "Name of the merchant or store"},
            {"name": "date", "type": "DATE", "description": "Date of the transaction"},
            {"name": "items", "type": "ARRAY", "description": "Individual line items on the receipt", "fields": [
                {"name": "name", "type": "TEXT", "description": "Item name or description"},
                {"name": "amount", "type": "CURRENCY_AMOUNT", "description": "Item price"},
            ]},
            {"name": "total_amount", "type": "CURRENCY_AMOUNT", "description": "Total amount charged"},
            {"name": "currency", "type": "CURRENCY_CODE", "description": "Currency code (e.g. USD, EUR)"},
        ]
    },
)

print(result)
package main

import il "github.com/iterationlayer/sdk-go"

client := il.NewClient("YOUR_API_KEY")

result, err := client.Extract(il.ExtractRequest{
    Files: []il.FileInput{
        il.NewFileFromURL("receipt.pdf", "https://example.com/receipts/purchase-receipt.pdf"),
    },
    Schema: il.ExtractionSchema{
        "merchant_name": il.NewTextFieldConfig("merchant_name", "Name of the merchant or store"),
        "date":          il.NewDateFieldConfig("date", "Date of the transaction"),
        "items": il.NewArrayFieldConfig("items", "Individual line items on the receipt", []il.FieldConfig{
            il.NewTextFieldConfig("name", "Item name or description"),
            il.NewCurrencyAmountFieldConfig("amount", "Item price"),
        }),
        "total_amount": il.NewCurrencyAmountFieldConfig("total_amount", "Total amount charged"),
        "currency":     il.NewCurrencyCodeFieldConfig("currency", "Currency code (e.g. USD, EUR)"),
    },
})

Related Recipes

Start building in minutes

Free trial credits included. No credit card required.