Extract Multi-Invoice Data

Extract structured data from multiple invoice files in a single API call using an array schema.

Who this is for

Accounts payable teams and finance platforms use this recipe to process many invoices at once. Pass multiple invoice files and define an array schema to extract each invoice's vendor, date, line items, and total — ready for import into your 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-acme.pdf",
        "url": "https://example.com/invoices/invoice-acme.pdf"
      },
      {
        "type": "url",
        "name": "invoice-global-freight.pdf",
        "url": "https://example.com/invoices/invoice-global-freight.pdf"
      }
    ],
    "schema": {
      "fields": [
        {
          "name": "invoices",
          "type": "ARRAY",
          "description": "One entry per invoice file",
          "fields": [
            {
              "name": "vendor_name",
              "type": "TEXT",
              "description": "Vendor or supplier name"
            },
            {
              "name": "invoice_number",
              "type": "TEXT",
              "description": "Invoice reference number"
            },
            {
              "name": "invoice_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": "TEXT",
                  "description": "Quantity ordered"
                },
                {
                  "name": "amount",
                  "type": "CURRENCY_AMOUNT",
                  "description": "Line item amount"
                }
              ]
            },
            {
              "name": "total_amount",
              "type": "CURRENCY_AMOUNT",
              "description": "Total invoice amount"
            }
          ]
        }
      ]
    }
  }'
Response
{
  "success": true,
  "data": {
    "invoices": {
      "value": [
        {
          "vendor_name": {
            "value": "Acme Office Supplies Ltd.",
            "confidence": 0.97,
            "citations": ["Acme Office Supplies Ltd."],
            "source": "invoice-acme.pdf"
          },
          "invoice_number": {
            "value": "INV-2026-0041",
            "confidence": 0.99,
            "citations": ["Invoice #INV-2026-0041"],
            "source": "invoice-acme.pdf"
          },
          "invoice_date": {
            "value": "2026-03-01",
            "confidence": 0.98,
            "citations": ["Date: March 1, 2026"],
            "source": "invoice-acme.pdf"
          },
          "line_items": {
            "value": [
              {
                "description": {
                  "value": "Ergonomic Desk Chair",
                  "confidence": 0.96,
                  "citations": ["Ergonomic Desk Chair"]
                },
                "quantity": {
                  "value": "2",
                  "confidence": 0.98,
                  "citations": ["Qty: 2"]
                },
                "amount": {
                  "value": {
                    "amount": "699.98",
                    "currency": "USD"
                  },
                  "confidence": 0.97,
                  "citations": ["$699.98"]
                }
              },
              {
                "description": {
                  "value": "Standing Desk Converter",
                  "confidence": 0.95,
                  "citations": ["Standing Desk Converter"]
                },
                "quantity": {
                  "value": "1",
                  "confidence": 0.99,
                  "citations": ["Qty: 1"]
                },
                "amount": {
                  "value": {
                    "amount": "189.00",
                    "currency": "USD"
                  },
                  "confidence": 0.96,
                  "citations": ["$189.00"]
                }
              }
            ],
            "confidence": 0.96,
            "citations": []
          },
          "total_amount": {
            "value": {
              "amount": "888.98",
              "currency": "USD"
            },
            "confidence": 0.98,
            "citations": ["Total Due: $888.98"],
            "source": "invoice-acme.pdf"
          }
        },
        {
          "vendor_name": {
            "value": "Global Freight Solutions",
            "confidence": 0.96,
            "citations": ["Global Freight Solutions"],
            "source": "invoice-global-freight.pdf"
          },
          "invoice_number": {
            "value": "GFS-90215",
            "confidence": 0.99,
            "citations": ["Invoice No. GFS-90215"],
            "source": "invoice-global-freight.pdf"
          },
          "invoice_date": {
            "value": "2026-03-03",
            "confidence": 0.97,
            "citations": ["Date: 03/03/2026"],
            "source": "invoice-global-freight.pdf"
          },
          "line_items": {
            "value": [
              {
                "description": {
                  "value": "Overnight Parcel Shipping (5 kg)",
                  "confidence": 0.94,
                  "citations": ["Overnight Parcel Shipping (5 kg)"]
                },
                "quantity": {
                  "value": "3",
                  "confidence": 0.98,
                  "citations": ["Qty: 3"]
                },
                "amount": {
                  "value": {
                    "amount": "134.85",
                    "currency": "USD"
                  },
                  "confidence": 0.95,
                  "citations": ["$134.85"]
                }
              },
              {
                "description": {
                  "value": "Pallet Freight (LTL, 200 kg)",
                  "confidence": 0.93,
                  "citations": ["Pallet Freight (LTL, 200 kg)"]
                },
                "quantity": {
                  "value": "1",
                  "confidence": 0.99,
                  "citations": ["Qty: 1"]
                },
                "amount": {
                  "value": {
                    "amount": "420.00",
                    "currency": "USD"
                  },
                  "confidence": 0.96,
                  "citations": ["$420.00"]
                }
              }
            ],
            "confidence": 0.95,
            "citations": []
          },
          "total_amount": {
            "value": {
              "amount": "554.85",
              "currency": "USD"
            },
            "confidence": 0.97,
            "citations": ["Total: $554.85"],
            "source": "invoice-global-freight.pdf"
          }
        }
      ],
      "confidence": 0.96,
      "citations": []
    }
  }
}
Request
import { IterationLayer } from "iterationlayer";
const client = new IterationLayer({ apiKey: "YOUR_API_KEY" });

const result = await client.extract({
  files: [
    {
      type: "url",
      name: "invoice-acme.pdf",
      url: "https://example.com/invoices/invoice-acme.pdf",
    },
    {
      type: "url",
      name: "invoice-global-freight.pdf",
      url: "https://example.com/invoices/invoice-global-freight.pdf",
    },
  ],
  schema: {
    fields: [
      {
        name: "invoices",
        type: "ARRAY",
        description: "One entry per invoice file",
        fields: [
          {
            name: "vendor_name",
            type: "TEXT",
            description: "Vendor or supplier name",
          },
          {
            name: "invoice_number",
            type: "TEXT",
            description: "Invoice reference number",
          },
          {
            name: "invoice_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: "TEXT",
                description: "Quantity ordered",
              },
              {
                name: "amount",
                type: "CURRENCY_AMOUNT",
                description: "Line item amount",
              },
            ],
          },
          {
            name: "total_amount",
            type: "CURRENCY_AMOUNT",
            description: "Total invoice amount",
          },
        ],
      },
    ],
  },
});

console.log(result);
Response
{
  "success": true,
  "data": {
    "invoices": {
      "value": [
        {
          "vendor_name": {
            "value": "Acme Office Supplies Ltd.",
            "confidence": 0.97,
            "citations": ["Acme Office Supplies Ltd."],
            "source": "invoice-acme.pdf"
          },
          "invoice_number": {
            "value": "INV-2026-0041",
            "confidence": 0.99,
            "citations": ["Invoice #INV-2026-0041"],
            "source": "invoice-acme.pdf"
          },
          "invoice_date": {
            "value": "2026-03-01",
            "confidence": 0.98,
            "citations": ["Date: March 1, 2026"],
            "source": "invoice-acme.pdf"
          },
          "line_items": {
            "value": [
              {
                "description": {
                  "value": "Ergonomic Desk Chair",
                  "confidence": 0.96,
                  "citations": ["Ergonomic Desk Chair"]
                },
                "quantity": {
                  "value": "2",
                  "confidence": 0.98,
                  "citations": ["Qty: 2"]
                },
                "amount": {
                  "value": {
                    "amount": "699.98",
                    "currency": "USD"
                  },
                  "confidence": 0.97,
                  "citations": ["$699.98"]
                }
              },
              {
                "description": {
                  "value": "Standing Desk Converter",
                  "confidence": 0.95,
                  "citations": ["Standing Desk Converter"]
                },
                "quantity": {
                  "value": "1",
                  "confidence": 0.99,
                  "citations": ["Qty: 1"]
                },
                "amount": {
                  "value": {
                    "amount": "189.00",
                    "currency": "USD"
                  },
                  "confidence": 0.96,
                  "citations": ["$189.00"]
                }
              }
            ],
            "confidence": 0.96,
            "citations": []
          },
          "total_amount": {
            "value": {
              "amount": "888.98",
              "currency": "USD"
            },
            "confidence": 0.98,
            "citations": ["Total Due: $888.98"],
            "source": "invoice-acme.pdf"
          }
        },
        {
          "vendor_name": {
            "value": "Global Freight Solutions",
            "confidence": 0.96,
            "citations": ["Global Freight Solutions"],
            "source": "invoice-global-freight.pdf"
          },
          "invoice_number": {
            "value": "GFS-90215",
            "confidence": 0.99,
            "citations": ["Invoice No. GFS-90215"],
            "source": "invoice-global-freight.pdf"
          },
          "invoice_date": {
            "value": "2026-03-03",
            "confidence": 0.97,
            "citations": ["Date: 03/03/2026"],
            "source": "invoice-global-freight.pdf"
          },
          "line_items": {
            "value": [
              {
                "description": {
                  "value": "Overnight Parcel Shipping (5 kg)",
                  "confidence": 0.94,
                  "citations": ["Overnight Parcel Shipping (5 kg)"]
                },
                "quantity": {
                  "value": "3",
                  "confidence": 0.98,
                  "citations": ["Qty: 3"]
                },
                "amount": {
                  "value": {
                    "amount": "134.85",
                    "currency": "USD"
                  },
                  "confidence": 0.95,
                  "citations": ["$134.85"]
                }
              },
              {
                "description": {
                  "value": "Pallet Freight (LTL, 200 kg)",
                  "confidence": 0.93,
                  "citations": ["Pallet Freight (LTL, 200 kg)"]
                },
                "quantity": {
                  "value": "1",
                  "confidence": 0.99,
                  "citations": ["Qty: 1"]
                },
                "amount": {
                  "value": {
                    "amount": "420.00",
                    "currency": "USD"
                  },
                  "confidence": 0.96,
                  "citations": ["$420.00"]
                }
              }
            ],
            "confidence": 0.95,
            "citations": []
          },
          "total_amount": {
            "value": {
              "amount": "554.85",
              "currency": "USD"
            },
            "confidence": 0.97,
            "citations": ["Total: $554.85"],
            "source": "invoice-global-freight.pdf"
          }
        }
      ],
      "confidence": 0.96,
      "citations": []
    }
  }
}
Request
from iterationlayer import IterationLayer
client = IterationLayer(api_key="YOUR_API_KEY")

result = client.extract(
    files=[
        {
            "type": "url",
            "name": "invoice-acme.pdf",
            "url": "https://example.com/invoices/invoice-acme.pdf",
        },
        {
            "type": "url",
            "name": "invoice-global-freight.pdf",
            "url": "https://example.com/invoices/invoice-global-freight.pdf",
        },
    ],
    schema={
        "fields": [
            {
                "name": "invoices",
                "type": "ARRAY",
                "description": "One entry per invoice file",
                "fields": [
                    {
                        "name": "vendor_name",
                        "type": "TEXT",
                        "description": "Vendor or supplier name",
                    },
                    {
                        "name": "invoice_number",
                        "type": "TEXT",
                        "description": "Invoice reference number",
                    },
                    {
                        "name": "invoice_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": "TEXT",
                                "description": "Quantity ordered",
                            },
                            {
                                "name": "amount",
                                "type": "CURRENCY_AMOUNT",
                                "description": "Line item amount",
                            },
                        ],
                    },
                    {
                        "name": "total_amount",
                        "type": "CURRENCY_AMOUNT",
                        "description": "Total invoice amount",
                    },
                ],
            },
        ]
    },
)

print(result)
Response
{
  "success": true,
  "data": {
    "invoices": {
      "value": [
        {
          "vendor_name": {
            "value": "Acme Office Supplies Ltd.",
            "confidence": 0.97,
            "citations": ["Acme Office Supplies Ltd."],
            "source": "invoice-acme.pdf"
          },
          "invoice_number": {
            "value": "INV-2026-0041",
            "confidence": 0.99,
            "citations": ["Invoice #INV-2026-0041"],
            "source": "invoice-acme.pdf"
          },
          "invoice_date": {
            "value": "2026-03-01",
            "confidence": 0.98,
            "citations": ["Date: March 1, 2026"],
            "source": "invoice-acme.pdf"
          },
          "line_items": {
            "value": [
              {
                "description": {
                  "value": "Ergonomic Desk Chair",
                  "confidence": 0.96,
                  "citations": ["Ergonomic Desk Chair"]
                },
                "quantity": {
                  "value": "2",
                  "confidence": 0.98,
                  "citations": ["Qty: 2"]
                },
                "amount": {
                  "value": {
                    "amount": "699.98",
                    "currency": "USD"
                  },
                  "confidence": 0.97,
                  "citations": ["$699.98"]
                }
              },
              {
                "description": {
                  "value": "Standing Desk Converter",
                  "confidence": 0.95,
                  "citations": ["Standing Desk Converter"]
                },
                "quantity": {
                  "value": "1",
                  "confidence": 0.99,
                  "citations": ["Qty: 1"]
                },
                "amount": {
                  "value": {
                    "amount": "189.00",
                    "currency": "USD"
                  },
                  "confidence": 0.96,
                  "citations": ["$189.00"]
                }
              }
            ],
            "confidence": 0.96,
            "citations": []
          },
          "total_amount": {
            "value": {
              "amount": "888.98",
              "currency": "USD"
            },
            "confidence": 0.98,
            "citations": ["Total Due: $888.98"],
            "source": "invoice-acme.pdf"
          }
        },
        {
          "vendor_name": {
            "value": "Global Freight Solutions",
            "confidence": 0.96,
            "citations": ["Global Freight Solutions"],
            "source": "invoice-global-freight.pdf"
          },
          "invoice_number": {
            "value": "GFS-90215",
            "confidence": 0.99,
            "citations": ["Invoice No. GFS-90215"],
            "source": "invoice-global-freight.pdf"
          },
          "invoice_date": {
            "value": "2026-03-03",
            "confidence": 0.97,
            "citations": ["Date: 03/03/2026"],
            "source": "invoice-global-freight.pdf"
          },
          "line_items": {
            "value": [
              {
                "description": {
                  "value": "Overnight Parcel Shipping (5 kg)",
                  "confidence": 0.94,
                  "citations": ["Overnight Parcel Shipping (5 kg)"]
                },
                "quantity": {
                  "value": "3",
                  "confidence": 0.98,
                  "citations": ["Qty: 3"]
                },
                "amount": {
                  "value": {
                    "amount": "134.85",
                    "currency": "USD"
                  },
                  "confidence": 0.95,
                  "citations": ["$134.85"]
                }
              },
              {
                "description": {
                  "value": "Pallet Freight (LTL, 200 kg)",
                  "confidence": 0.93,
                  "citations": ["Pallet Freight (LTL, 200 kg)"]
                },
                "quantity": {
                  "value": "1",
                  "confidence": 0.99,
                  "citations": ["Qty: 1"]
                },
                "amount": {
                  "value": {
                    "amount": "420.00",
                    "currency": "USD"
                  },
                  "confidence": 0.96,
                  "citations": ["$420.00"]
                }
              }
            ],
            "confidence": 0.95,
            "citations": []
          },
          "total_amount": {
            "value": {
              "amount": "554.85",
              "currency": "USD"
            },
            "confidence": 0.97,
            "citations": ["Total: $554.85"],
            "source": "invoice-global-freight.pdf"
          }
        }
      ],
      "confidence": 0.96,
      "citations": []
    }
  }
}
Request
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("invoice-acme.pdf", "https://example.com/invoices/invoice-acme.pdf"),
        il.NewFileFromURL("invoice-global-freight.pdf", "https://example.com/invoices/invoice-global-freight.pdf"),
    },
    Schema: il.ExtractionSchema{
        "invoices": il.NewArrayFieldConfig(
            "invoices",
            "One entry per invoice file",
            []il.FieldConfig{
                il.NewTextFieldConfig(
                    "vendor_name", "Vendor or supplier name",
                ),
                il.NewTextFieldConfig(
                    "invoice_number", "Invoice reference number",
                ),
                il.NewDateFieldConfig(
                    "invoice_date", "Invoice date",
                ),
                il.NewArrayFieldConfig(
                    "line_items",
                    "Individual line items",
                    []il.FieldConfig{
                        il.NewTextFieldConfig(
                            "description", "Item description",
                        ),
                        il.NewTextFieldConfig(
                            "quantity", "Quantity ordered",
                        ),
                        il.NewCurrencyAmountFieldConfig(
                            "amount", "Line item amount",
                        ),
                    },
                ),
                il.NewCurrencyAmountFieldConfig(
                    "total_amount", "Total invoice amount",
                ),
            },
        ),
    },
})
Response
{
  "success": true,
  "data": {
    "invoices": {
      "value": [
        {
          "vendor_name": {
            "value": "Acme Office Supplies Ltd.",
            "confidence": 0.97,
            "citations": ["Acme Office Supplies Ltd."],
            "source": "invoice-acme.pdf"
          },
          "invoice_number": {
            "value": "INV-2026-0041",
            "confidence": 0.99,
            "citations": ["Invoice #INV-2026-0041"],
            "source": "invoice-acme.pdf"
          },
          "invoice_date": {
            "value": "2026-03-01",
            "confidence": 0.98,
            "citations": ["Date: March 1, 2026"],
            "source": "invoice-acme.pdf"
          },
          "line_items": {
            "value": [
              {
                "description": {
                  "value": "Ergonomic Desk Chair",
                  "confidence": 0.96,
                  "citations": ["Ergonomic Desk Chair"]
                },
                "quantity": {
                  "value": "2",
                  "confidence": 0.98,
                  "citations": ["Qty: 2"]
                },
                "amount": {
                  "value": {
                    "amount": "699.98",
                    "currency": "USD"
                  },
                  "confidence": 0.97,
                  "citations": ["$699.98"]
                }
              },
              {
                "description": {
                  "value": "Standing Desk Converter",
                  "confidence": 0.95,
                  "citations": ["Standing Desk Converter"]
                },
                "quantity": {
                  "value": "1",
                  "confidence": 0.99,
                  "citations": ["Qty: 1"]
                },
                "amount": {
                  "value": {
                    "amount": "189.00",
                    "currency": "USD"
                  },
                  "confidence": 0.96,
                  "citations": ["$189.00"]
                }
              }
            ],
            "confidence": 0.96,
            "citations": []
          },
          "total_amount": {
            "value": {
              "amount": "888.98",
              "currency": "USD"
            },
            "confidence": 0.98,
            "citations": ["Total Due: $888.98"],
            "source": "invoice-acme.pdf"
          }
        },
        {
          "vendor_name": {
            "value": "Global Freight Solutions",
            "confidence": 0.96,
            "citations": ["Global Freight Solutions"],
            "source": "invoice-global-freight.pdf"
          },
          "invoice_number": {
            "value": "GFS-90215",
            "confidence": 0.99,
            "citations": ["Invoice No. GFS-90215"],
            "source": "invoice-global-freight.pdf"
          },
          "invoice_date": {
            "value": "2026-03-03",
            "confidence": 0.97,
            "citations": ["Date: 03/03/2026"],
            "source": "invoice-global-freight.pdf"
          },
          "line_items": {
            "value": [
              {
                "description": {
                  "value": "Overnight Parcel Shipping (5 kg)",
                  "confidence": 0.94,
                  "citations": ["Overnight Parcel Shipping (5 kg)"]
                },
                "quantity": {
                  "value": "3",
                  "confidence": 0.98,
                  "citations": ["Qty: 3"]
                },
                "amount": {
                  "value": {
                    "amount": "134.85",
                    "currency": "USD"
                  },
                  "confidence": 0.95,
                  "citations": ["$134.85"]
                }
              },
              {
                "description": {
                  "value": "Pallet Freight (LTL, 200 kg)",
                  "confidence": 0.93,
                  "citations": ["Pallet Freight (LTL, 200 kg)"]
                },
                "quantity": {
                  "value": "1",
                  "confidence": 0.99,
                  "citations": ["Qty: 1"]
                },
                "amount": {
                  "value": {
                    "amount": "420.00",
                    "currency": "USD"
                  },
                  "confidence": 0.96,
                  "citations": ["$420.00"]
                }
              }
            ],
            "confidence": 0.95,
            "citations": []
          },
          "total_amount": {
            "value": {
              "amount": "554.85",
              "currency": "USD"
            },
            "confidence": 0.97,
            "citations": ["Total: $554.85"],
            "source": "invoice-global-freight.pdf"
          }
        }
      ],
      "confidence": 0.96,
      "citations": []
    }
  }
}

Related Recipes

Start building in minutes

Free trial credits included. No credit card required.