Iteration Layer

Extract Invoice Data

Extract vendor name, line items, totals, and dates from invoice documents.

No credit card required — start with free trial credits

Who this is for

Accounts payable teams and finance automation platforms use this recipe to eliminate manual invoice data entry. Upload an invoice in any supported format and receive structured JSON with vendor details, line items, and totals — ready to feed into your ERP or accounting system.

Request
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": "invoice.pdf",
        "url": "https://example.com/invoices/2026-001.pdf"
      }
    ],
    "schema": {
      "fields": [
        {
          "name": "vendor",
          "type": "TEXT",
          "description": "Vendor or supplier name"
        },
        {
          "name": "invoice_number",
          "type": "TEXT",
          "description": "Invoice reference number"
        },
        {
          "name": "date",
          "type": "DATE",
          "description": "Invoice date"
        },
        {
          "name": "line_items",
          "type": "ARRAY",
          "description": "Individual line items",
          "fields": [
            {
              "name": "description",
              "type": "TEXT",
              "description": "Item description"
            },
            {
              "name": "quantity",
              "type": "INTEGER",
              "description": "Quantity ordered"
            },
            {
              "name": "unit_price",
              "type": "CURRENCY_AMOUNT",
              "description": "Price per unit"
            }
          ]
        },
        {
          "name": "total_amount",
          "type": "CURRENCY_AMOUNT",
          "description": "Total invoice amount"
        }
      ]
    }
  }'
Response
{
  "success": true,
  "data": {
    "vendor": {
      "value": "Acme Office Supplies Ltd.",
      "confidence": 0.97,
      "citations": ["Acme Office Supplies Ltd."]
    },
    "invoice_number": {
      "value": "INV-2026-001",
      "confidence": 0.99,
      "citations": ["Invoice #INV-2026-001"]
    },
    "date": {
      "value": "2026-01-15",
      "confidence": 0.98,
      "citations": ["Date: January 15, 2026"]
    },
    "line_items": {
      "value": [
        {
          "description": {
            "value": "Ergonomic Desk Chair",
            "confidence": 0.96,
            "citations": ["Ergonomic Desk Chair"]
          },
          "quantity": {
            "value": 2,
            "confidence": 0.98,
            "citations": ["Qty: 2"]
          },
          "unit_price": {
            "value": {
              "amount": "349.99",
              "currency": "USD"
            },
            "confidence": 0.97,
            "citations": ["$349.99 each"]
          }
        },
        {
          "description": {
            "value": "Standing Desk Converter",
            "confidence": 0.95,
            "citations": ["Standing Desk Converter"]
          },
          "quantity": {
            "value": 1,
            "confidence": 0.99,
            "citations": ["Qty: 1"]
          },
          "unit_price": {
            "value": {
              "amount": "189.00",
              "currency": "USD"
            },
            "confidence": 0.96,
            "citations": ["$189.00 each"]
          }
        }
      ],
      "confidence": 0.96,
      "citations": []
    },
    "total_amount": {
      "value": {
        "amount": "888.98",
        "currency": "USD"
      },
      "confidence": 0.98,
      "citations": ["Total Due: $888.98"]
    }
  }
}
Request
import { IterationLayer } from "iterationlayer";
const client = new IterationLayer({ apiKey: "YOUR_API_KEY" });

const result = await client.extract({
  files: [
    {
      type: "url",
      name: "invoice.pdf",
      url: "https://example.com/invoices/2026-001.pdf",
    },
  ],
  schema: {
    fields: [
      {
        name: "vendor",
        type: "TEXT",
        description: "Vendor or supplier name",
      },
      {
        name: "invoice_number",
        type: "TEXT",
        description: "Invoice reference number",
      },
      {
        name: "date",
        type: "DATE",
        description: "Invoice date",
      },
      {
        name: "line_items",
        type: "ARRAY",
        description: "Individual line items",
        fields: [
          {
            name: "description",
            type: "TEXT",
            description: "Item description",
          },
          {
            name: "quantity",
            type: "INTEGER",
            description: "Quantity ordered",
          },
          {
            name: "unit_price",
            type: "CURRENCY_AMOUNT",
            description: "Price per unit",
          },
        ],
      },
      {
        name: "total_amount",
        type: "CURRENCY_AMOUNT",
        description: "Total invoice amount",
      },
    ],
  },
});
Response
{
  "success": true,
  "data": {
    "vendor": {
      "value": "Acme Office Supplies Ltd.",
      "confidence": 0.97,
      "citations": ["Acme Office Supplies Ltd."]
    },
    "invoice_number": {
      "value": "INV-2026-001",
      "confidence": 0.99,
      "citations": ["Invoice #INV-2026-001"]
    },
    "date": {
      "value": "2026-01-15",
      "confidence": 0.98,
      "citations": ["Date: January 15, 2026"]
    },
    "line_items": {
      "value": [
        {
          "description": {
            "value": "Ergonomic Desk Chair",
            "confidence": 0.96,
            "citations": ["Ergonomic Desk Chair"]
          },
          "quantity": {
            "value": 2,
            "confidence": 0.98,
            "citations": ["Qty: 2"]
          },
          "unit_price": {
            "value": {
              "amount": "349.99",
              "currency": "USD"
            },
            "confidence": 0.97,
            "citations": ["$349.99 each"]
          }
        },
        {
          "description": {
            "value": "Standing Desk Converter",
            "confidence": 0.95,
            "citations": ["Standing Desk Converter"]
          },
          "quantity": {
            "value": 1,
            "confidence": 0.99,
            "citations": ["Qty: 1"]
          },
          "unit_price": {
            "value": {
              "amount": "189.00",
              "currency": "USD"
            },
            "confidence": 0.96,
            "citations": ["$189.00 each"]
          }
        }
      ],
      "confidence": 0.96,
      "citations": []
    },
    "total_amount": {
      "value": {
        "amount": "888.98",
        "currency": "USD"
      },
      "confidence": 0.98,
      "citations": ["Total Due: $888.98"]
    }
  }
}
Request
from iterationlayer import IterationLayer
client = IterationLayer(api_key="YOUR_API_KEY")

result = client.extract(
    files=[
        {
            "type": "url",
            "name": "invoice.pdf",
            "url": "https://example.com/invoices/2026-001.pdf",
        }
    ],
    schema={
        "fields": [
            {
                "name": "vendor",
                "type": "TEXT",
                "description": "Vendor or supplier name",
            },
            {
                "name": "invoice_number",
                "type": "TEXT",
                "description": "Invoice reference number",
            },
            {
                "name": "date",
                "type": "DATE",
                "description": "Invoice date",
            },
            {
                "name": "line_items",
                "type": "ARRAY",
                "description": "Individual line items",
                "fields": [
                    {
                        "name": "description",
                        "type": "TEXT",
                        "description": "Item description",
                    },
                    {
                        "name": "quantity",
                        "type": "INTEGER",
                        "description": "Quantity ordered",
                    },
                    {
                        "name": "unit_price",
                        "type": "CURRENCY_AMOUNT",
                        "description": "Price per unit",
                    },
                ],
            },
            {
                "name": "total_amount",
                "type": "CURRENCY_AMOUNT",
                "description": "Total invoice amount",
            },
        ]
    },
)
Response
{
  "success": true,
  "data": {
    "vendor": {
      "value": "Acme Office Supplies Ltd.",
      "confidence": 0.97,
      "citations": ["Acme Office Supplies Ltd."]
    },
    "invoice_number": {
      "value": "INV-2026-001",
      "confidence": 0.99,
      "citations": ["Invoice #INV-2026-001"]
    },
    "date": {
      "value": "2026-01-15",
      "confidence": 0.98,
      "citations": ["Date: January 15, 2026"]
    },
    "line_items": {
      "value": [
        {
          "description": {
            "value": "Ergonomic Desk Chair",
            "confidence": 0.96,
            "citations": ["Ergonomic Desk Chair"]
          },
          "quantity": {
            "value": 2,
            "confidence": 0.98,
            "citations": ["Qty: 2"]
          },
          "unit_price": {
            "value": {
              "amount": "349.99",
              "currency": "USD"
            },
            "confidence": 0.97,
            "citations": ["$349.99 each"]
          }
        },
        {
          "description": {
            "value": "Standing Desk Converter",
            "confidence": 0.95,
            "citations": ["Standing Desk Converter"]
          },
          "quantity": {
            "value": 1,
            "confidence": 0.99,
            "citations": ["Qty: 1"]
          },
          "unit_price": {
            "value": {
              "amount": "189.00",
              "currency": "USD"
            },
            "confidence": 0.96,
            "citations": ["$189.00 each"]
          }
        }
      ],
      "confidence": 0.96,
      "citations": []
    },
    "total_amount": {
      "value": {
        "amount": "888.98",
        "currency": "USD"
      },
      "confidence": 0.98,
      "citations": ["Total Due: $888.98"]
    }
  }
}
Request
package main

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

func main() {
    client := il.NewClient("YOUR_API_KEY")

    result, err := client.Extract(il.ExtractRequest{
        Files: []il.FileInput{
            il.NewFileFromURL(
                "invoice.pdf",
                "https://example.com/invoices/2026-001.pdf",
            ),
        },
        Schema: il.ExtractionSchema{
            "vendor": il.NewTextFieldConfig(
                "vendor",
                "Vendor or supplier name",
            ),
            "invoice_number": il.NewTextFieldConfig(
                "invoice_number",
                "Invoice reference number",
            ),
            "date": il.NewDateFieldConfig(
                "date",
                "Invoice date",
            ),
            "line_items": il.NewArrayFieldConfig(
                "line_items",
                "Individual line items",
                []il.FieldConfig{
                    il.NewTextFieldConfig(
                        "description",
                        "Item description",
                    ),
                    il.NewIntegerFieldConfig(
                        "quantity",
                        "Quantity ordered",
                    ),
                    il.NewCurrencyAmountFieldConfig(
                        "unit_price",
                        "Price per unit",
                    ),
                },
            ),
            "total_amount": il.NewCurrencyAmountFieldConfig(
                "total_amount",
                "Total invoice amount",
            ),
        },
    })
    if err != nil {
        panic(err)
    }
}
Response
{
  "success": true,
  "data": {
    "vendor": {
      "value": "Acme Office Supplies Ltd.",
      "confidence": 0.97,
      "citations": ["Acme Office Supplies Ltd."]
    },
    "invoice_number": {
      "value": "INV-2026-001",
      "confidence": 0.99,
      "citations": ["Invoice #INV-2026-001"]
    },
    "date": {
      "value": "2026-01-15",
      "confidence": 0.98,
      "citations": ["Date: January 15, 2026"]
    },
    "line_items": {
      "value": [
        {
          "description": {
            "value": "Ergonomic Desk Chair",
            "confidence": 0.96,
            "citations": ["Ergonomic Desk Chair"]
          },
          "quantity": {
            "value": 2,
            "confidence": 0.98,
            "citations": ["Qty: 2"]
          },
          "unit_price": {
            "value": {
              "amount": "349.99",
              "currency": "USD"
            },
            "confidence": 0.97,
            "citations": ["$349.99 each"]
          }
        },
        {
          "description": {
            "value": "Standing Desk Converter",
            "confidence": 0.95,
            "citations": ["Standing Desk Converter"]
          },
          "quantity": {
            "value": 1,
            "confidence": 0.99,
            "citations": ["Qty: 1"]
          },
          "unit_price": {
            "value": {
              "amount": "189.00",
              "currency": "USD"
            },
            "confidence": 0.96,
            "citations": ["$189.00 each"]
          }
        }
      ],
      "confidence": 0.96,
      "citations": []
    },
    "total_amount": {
      "value": {
        "amount": "888.98",
        "currency": "USD"
      },
      "confidence": 0.98,
      "citations": ["Total Due: $888.98"]
    }
  }
}
Template
{
  "name": "Extract Invoice Data",
  "nodes": [
    {
      "parameters": {
        "content": "## Extract Invoice Data\n\nAccounts payable teams and finance automation platforms use this recipe to eliminate manual invoice data entry. Upload an invoice in any supported format and receive structured JSON with vendor details, line items, and totals \u2014 ready to feed into your ERP or accounting system.\n\n**Note:** This workflow uses the Iteration Layer community node (`n8n-nodes-iterationlayer`). Install it via Settings > Community Nodes before importing. Self-hosted n8n only.",
        "height": 280,
        "width": 500,
        "color": 2
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        200,
        40
      ],
      "id": "740bbc39-f879-4a4d-b1a7-4b66dfac8f09",
      "name": "Overview"
    },
    {
      "parameters": {
        "content": "### Step 1: Extract Data\nResource: **Document Extraction**\n\nConfigure the Document Extraction parameters below, then connect your credentials.",
        "height": 160,
        "width": 300,
        "color": 6
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        475,
        100
      ],
      "id": "0ad47fa7-0338-4060-bc1b-f5c1aa248b53",
      "name": "Step 1 Note"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        250,
        300
      ],
      "id": "c9d0e1f2-a3b4-5678-cdef-789012345678",
      "name": "Manual Trigger"
    },
    {
      "parameters": {
        "resource": "documentExtraction",
        "schemaInputMode": "rawJson",
        "schemaJson": "{\"fields\":[{\"name\":\"vendor\",\"type\":\"TEXT\",\"description\":\"Vendor or supplier name\"},{\"name\":\"invoice_number\",\"type\":\"TEXT\",\"description\":\"Invoice reference number\"},{\"name\":\"date\",\"type\":\"DATE\",\"description\":\"Invoice date\"},{\"name\":\"line_items\",\"type\":\"ARRAY\",\"description\":\"Individual line items\",\"fields\":[{\"name\":\"description\",\"type\":\"TEXT\",\"description\":\"Item description\"},{\"name\":\"quantity\",\"type\":\"INTEGER\",\"description\":\"Quantity ordered\"},{\"name\":\"unit_price\",\"type\":\"CURRENCY_AMOUNT\",\"description\":\"Price per unit\"}]},{\"name\":\"total_amount\",\"type\":\"CURRENCY_AMOUNT\",\"description\":\"Total invoice amount\"}]}",
        "files": {
          "fileValues": [
            {
              "fileInputMode": "url",
              "fileName": "invoice.pdf",
              "fileUrl": "https://example.com/invoices/2026-001.pdf"
            }
          ]
        }
      },
      "type": "n8n-nodes-iterationlayer.iterationLayer",
      "typeVersion": 1,
      "position": [
        500,
        300
      ],
      "id": "d0e1f2a3-b4c5-6789-defa-890123456789",
      "name": "Extract Data",
      "credentials": {
        "iterationLayerApi": {
          "id": "1",
          "name": "Iteration Layer API"
        }
      }
    }
  ],
  "connections": {
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Extract Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}
Prompt
Extract invoice data from the file at [file URL]. Use the extract_document tool with these fields:

- vendor (TEXT): Vendor or supplier name
- invoice_number (TEXT): Invoice reference number
- date (DATE): Invoice date
- line_items (ARRAY): Each with description (TEXT), quantity (INTEGER), unit_price (CURRENCY_AMOUNT)
- total_amount (CURRENCY_AMOUNT): Total invoice amount

Related Recipes

Try with your own data

Get a free API key and run this recipe in minutes. No credit card required.