Iteration Layer
Menu

Extract Legal Invoice Data

Extract timekeeper entries, disbursements, matter references, and billing summaries from law firm invoices.

Who this is for

Corporate legal departments and legal ops agencies use this recipe to process outside counsel invoices — extracting timekeeper rates, hours, disbursements, and matter codes for e-billing systems and cost analysis.

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": "legal-invoice-HW-2026-0341.pdf",
        "url": "https://example.com/legal-billing/invoice-HW-2026-0341.pdf"
      }
    ],
    "schema": {
      "fields": [
        {
          "name": "law_firm",
          "type": "TEXT",
          "description": "Name of the law firm"
        },
        {
          "name": "invoice_number",
          "type": "TEXT",
          "description": "Invoice number"
        },
        {
          "name": "invoice_date",
          "type": "DATE",
          "description": "Invoice date"
        },
        {
          "name": "client_name",
          "type": "TEXT",
          "description": "Client name"
        },
        {
          "name": "matter_number",
          "type": "TEXT",
          "description": "Matter or case reference number"
        },
        {
          "name": "matter_description",
          "type": "TEXT",
          "description": "Description of the matter"
        },
        {
          "name": "billing_period",
          "type": "TEXT",
          "description": "Billing period covered"
        },
        {
          "name": "time_entries",
          "type": "ARRAY",
          "description": "Individual time entries",
          "fields": [
            {
              "name": "timekeeper",
              "type": "TEXT",
              "description": "Name and title of the timekeeper"
            },
            {
              "name": "date",
              "type": "DATE",
              "description": "Date of the time entry"
            },
            {
              "name": "description",
              "type": "TEXT",
              "description": "Description of work performed"
            },
            {
              "name": "hours",
              "type": "DECIMAL",
              "description": "Hours billed"
            },
            {
              "name": "rate",
              "type": "CURRENCY_AMOUNT",
              "description": "Hourly rate"
            },
            {
              "name": "amount",
              "type": "CURRENCY_AMOUNT",
              "description": "Total amount for this entry"
            }
          ]
        },
        {
          "name": "total_fees",
          "type": "CURRENCY_AMOUNT",
          "description": "Total professional fees"
        },
        {
          "name": "total_disbursements",
          "type": "CURRENCY_AMOUNT",
          "description": "Total disbursements and expenses"
        },
        {
          "name": "total_amount",
          "type": "CURRENCY_AMOUNT",
          "description": "Total invoice amount"
        },
        {
          "name": "payment_terms",
          "type": "TEXT",
          "description": "Payment terms"
        }
      ]
    }
  }'
Response
{
  "success": true,
  "data": {
    "law_firm": {
      "value": "Harrison & Whitfield LLP",
      "confidence": 0.99,
      "citations": ["Harrison & Whitfield LLP"]
    },
    "invoice_number": {
      "value": "HW-2026-0341",
      "confidence": 0.99,
      "citations": ["Invoice No. HW-2026-0341"]
    },
    "invoice_date": {
      "value": "2026-03-31",
      "confidence": 0.98,
      "citations": ["Date: March 31, 2026"]
    },
    "client_name": {
      "value": "Pinnacle Industries Inc.",
      "confidence": 0.98,
      "citations": ["Client: Pinnacle Industries Inc."]
    },
    "matter_number": {
      "value": "PIN-2025-0047",
      "confidence": 0.97,
      "citations": ["Matter No. PIN-2025-0047"]
    },
    "matter_description": {
      "value": "Employment litigation — wrongful termination defense",
      "confidence": 0.95,
      "citations": ["Re: Employment Litigation — Wrongful Termination Defense"]
    },
    "billing_period": {
      "value": "March 1–31, 2026",
      "confidence": 0.97,
      "citations": ["For services rendered: March 1–31, 2026"]
    },
    "time_entries": {
      "value": [
        {
          "timekeeper": {
            "value": "Sarah Chen, Partner",
            "confidence": 0.97,
            "citations": ["Sarah Chen, Partner"]
          },
          "date": {
            "value": "2026-03-05",
            "confidence": 0.96,
            "citations": ["03/05/2026"]
          },
          "description": {
            "value": "Review amended complaint; conference with client re discovery strategy",
            "confidence": 0.94,
            "citations": ["Review amended complaint; conf. w/ client re discovery strategy"]
          },
          "hours": {
            "value": 3.5,
            "confidence": 0.98,
            "citations": ["3.5"]
          },
          "rate": {
            "value": {
              "amount": "475.00",
              "currency": "USD"
            },
            "confidence": 0.97,
            "citations": ["$475.00/hr"]
          },
          "amount": {
            "value": {
              "amount": "1662.50",
              "currency": "USD"
            },
            "confidence": 0.97,
            "citations": ["$1,662.50"]
          }
        },
        {
          "timekeeper": {
            "value": "David Park, Associate",
            "confidence": 0.97,
            "citations": ["David Park, Associate"]
          },
          "date": {
            "value": "2026-03-12",
            "confidence": 0.96,
            "citations": ["03/12/2026"]
          },
          "description": {
            "value": "Draft responses to interrogatories; document review (142 documents)",
            "confidence": 0.93,
            "citations": ["Draft responses to interrogatories; doc review (142 docs)"]
          },
          "hours": {
            "value": 6.2,
            "confidence": 0.97,
            "citations": ["6.2"]
          },
          "rate": {
            "value": {
              "amount": "325.00",
              "currency": "USD"
            },
            "confidence": 0.97,
            "citations": ["$325.00/hr"]
          },
          "amount": {
            "value": {
              "amount": "2015.00",
              "currency": "USD"
            },
            "confidence": 0.97,
            "citations": ["$2,015.00"]
          }
        }
      ],
      "confidence": 0.96,
      "citations": []
    },
    "total_fees": {
      "value": {
        "amount": "3677.50",
        "currency": "USD"
      },
      "confidence": 0.98,
      "citations": ["Total Professional Fees: $3,677.50"]
    },
    "total_disbursements": {
      "value": {
        "amount": "247.80",
        "currency": "USD"
      },
      "confidence": 0.96,
      "citations": ["Disbursements: $247.80"]
    },
    "total_amount": {
      "value": {
        "amount": "3925.30",
        "currency": "USD"
      },
      "confidence": 0.98,
      "citations": ["Total Due: $3,925.30"]
    },
    "payment_terms": {
      "value": "Net 30",
      "confidence": 0.95,
      "citations": ["Payment Terms: Net 30"]
    }
  }
}
Request
import { IterationLayer } from "iterationlayer";
const client = new IterationLayer({ apiKey: "YOUR_API_KEY" });

const result = await client.extractDocument({
  files: [{ type: "url", name: "legal-invoice-HW-2026-0341.pdf", url: "https://example.com/legal-billing/invoice-HW-2026-0341.pdf" }],
  schema: {
    fields: [
      { name: "law_firm", type: "TEXT", description: "Name of the law firm" },
      { name: "invoice_number", type: "TEXT", description: "Invoice number" },
      { name: "invoice_date", type: "DATE", description: "Invoice date" },
      { name: "client_name", type: "TEXT", description: "Client name" },
      { name: "matter_number", type: "TEXT", description: "Matter or case reference number" },
      { name: "matter_description", type: "TEXT", description: "Description of the matter" },
      { name: "billing_period", type: "TEXT", description: "Billing period covered" },
      {
        name: "time_entries", type: "ARRAY", description: "Individual time entries",
        fields: [
          { name: "timekeeper", type: "TEXT", description: "Name and title of the timekeeper" },
          { name: "date", type: "DATE", description: "Date of the time entry" },
          { name: "description", type: "TEXT", description: "Description of work performed" },
          { name: "hours", type: "DECIMAL", description: "Hours billed" },
          { name: "rate", type: "CURRENCY_AMOUNT", description: "Hourly rate" },
          { name: "amount", type: "CURRENCY_AMOUNT", description: "Total amount for this entry" },
        ],
      },
      { name: "total_fees", type: "CURRENCY_AMOUNT", description: "Total professional fees" },
      { name: "total_disbursements", type: "CURRENCY_AMOUNT", description: "Total disbursements and expenses" },
      { name: "total_amount", type: "CURRENCY_AMOUNT", description: "Total invoice amount" },
      { name: "payment_terms", type: "TEXT", description: "Payment terms" },
    ],
  },
});
Response
{
  "success": true,
  "data": {
    "law_firm": {
      "value": "Harrison & Whitfield LLP",
      "confidence": 0.99,
      "citations": ["Harrison & Whitfield LLP"]
    },
    "invoice_number": {
      "value": "HW-2026-0341",
      "confidence": 0.99,
      "citations": ["Invoice No. HW-2026-0341"]
    },
    "invoice_date": {
      "value": "2026-03-31",
      "confidence": 0.98,
      "citations": ["Date: March 31, 2026"]
    },
    "client_name": {
      "value": "Pinnacle Industries Inc.",
      "confidence": 0.98,
      "citations": ["Client: Pinnacle Industries Inc."]
    },
    "matter_number": {
      "value": "PIN-2025-0047",
      "confidence": 0.97,
      "citations": ["Matter No. PIN-2025-0047"]
    },
    "matter_description": {
      "value": "Employment litigation — wrongful termination defense",
      "confidence": 0.95,
      "citations": ["Re: Employment Litigation — Wrongful Termination Defense"]
    },
    "billing_period": {
      "value": "March 1–31, 2026",
      "confidence": 0.97,
      "citations": ["For services rendered: March 1–31, 2026"]
    },
    "time_entries": {
      "value": [
        {
          "timekeeper": {
            "value": "Sarah Chen, Partner",
            "confidence": 0.97,
            "citations": ["Sarah Chen, Partner"]
          },
          "date": {
            "value": "2026-03-05",
            "confidence": 0.96,
            "citations": ["03/05/2026"]
          },
          "description": {
            "value": "Review amended complaint; conference with client re discovery strategy",
            "confidence": 0.94,
            "citations": ["Review amended complaint; conf. w/ client re discovery strategy"]
          },
          "hours": {
            "value": 3.5,
            "confidence": 0.98,
            "citations": ["3.5"]
          },
          "rate": {
            "value": {
              "amount": "475.00",
              "currency": "USD"
            },
            "confidence": 0.97,
            "citations": ["$475.00/hr"]
          },
          "amount": {
            "value": {
              "amount": "1662.50",
              "currency": "USD"
            },
            "confidence": 0.97,
            "citations": ["$1,662.50"]
          }
        },
        {
          "timekeeper": {
            "value": "David Park, Associate",
            "confidence": 0.97,
            "citations": ["David Park, Associate"]
          },
          "date": {
            "value": "2026-03-12",
            "confidence": 0.96,
            "citations": ["03/12/2026"]
          },
          "description": {
            "value": "Draft responses to interrogatories; document review (142 documents)",
            "confidence": 0.93,
            "citations": ["Draft responses to interrogatories; doc review (142 docs)"]
          },
          "hours": {
            "value": 6.2,
            "confidence": 0.97,
            "citations": ["6.2"]
          },
          "rate": {
            "value": {
              "amount": "325.00",
              "currency": "USD"
            },
            "confidence": 0.97,
            "citations": ["$325.00/hr"]
          },
          "amount": {
            "value": {
              "amount": "2015.00",
              "currency": "USD"
            },
            "confidence": 0.97,
            "citations": ["$2,015.00"]
          }
        }
      ],
      "confidence": 0.96,
      "citations": []
    },
    "total_fees": {
      "value": {
        "amount": "3677.50",
        "currency": "USD"
      },
      "confidence": 0.98,
      "citations": ["Total Professional Fees: $3,677.50"]
    },
    "total_disbursements": {
      "value": {
        "amount": "247.80",
        "currency": "USD"
      },
      "confidence": 0.96,
      "citations": ["Disbursements: $247.80"]
    },
    "total_amount": {
      "value": {
        "amount": "3925.30",
        "currency": "USD"
      },
      "confidence": 0.98,
      "citations": ["Total Due: $3,925.30"]
    },
    "payment_terms": {
      "value": "Net 30",
      "confidence": 0.95,
      "citations": ["Payment Terms: Net 30"]
    }
  }
}
Request
from iterationlayer import IterationLayer
client = IterationLayer(api_key="YOUR_API_KEY")

result = client.extract_document(
    files=[{"type": "url", "name": "legal-invoice-HW-2026-0341.pdf", "url": "https://example.com/legal-billing/invoice-HW-2026-0341.pdf"}],
    schema={
        "fields": [
            {"name": "law_firm", "type": "TEXT", "description": "Name of the law firm"},
            {"name": "invoice_number", "type": "TEXT", "description": "Invoice number"},
            {"name": "invoice_date", "type": "DATE", "description": "Invoice date"},
            {"name": "client_name", "type": "TEXT", "description": "Client name"},
            {"name": "matter_number", "type": "TEXT", "description": "Matter or case reference number"},
            {"name": "matter_description", "type": "TEXT", "description": "Description of the matter"},
            {"name": "billing_period", "type": "TEXT", "description": "Billing period covered"},
            {
                "name": "time_entries", "type": "ARRAY", "description": "Individual time entries",
                "fields": [
                    {"name": "timekeeper", "type": "TEXT", "description": "Name and title of the timekeeper"},
                    {"name": "date", "type": "DATE", "description": "Date of the time entry"},
                    {"name": "description", "type": "TEXT", "description": "Description of work performed"},
                    {"name": "hours", "type": "DECIMAL", "description": "Hours billed"},
                    {"name": "rate", "type": "CURRENCY_AMOUNT", "description": "Hourly rate"},
                    {"name": "amount", "type": "CURRENCY_AMOUNT", "description": "Total amount for this entry"},
                ],
            },
            {"name": "total_fees", "type": "CURRENCY_AMOUNT", "description": "Total professional fees"},
            {"name": "total_disbursements", "type": "CURRENCY_AMOUNT", "description": "Total disbursements and expenses"},
            {"name": "total_amount", "type": "CURRENCY_AMOUNT", "description": "Total invoice amount"},
            {"name": "payment_terms", "type": "TEXT", "description": "Payment terms"},
        ]
    },
)
Response
{
  "success": true,
  "data": {
    "law_firm": {
      "value": "Harrison & Whitfield LLP",
      "confidence": 0.99,
      "citations": ["Harrison & Whitfield LLP"]
    },
    "invoice_number": {
      "value": "HW-2026-0341",
      "confidence": 0.99,
      "citations": ["Invoice No. HW-2026-0341"]
    },
    "invoice_date": {
      "value": "2026-03-31",
      "confidence": 0.98,
      "citations": ["Date: March 31, 2026"]
    },
    "client_name": {
      "value": "Pinnacle Industries Inc.",
      "confidence": 0.98,
      "citations": ["Client: Pinnacle Industries Inc."]
    },
    "matter_number": {
      "value": "PIN-2025-0047",
      "confidence": 0.97,
      "citations": ["Matter No. PIN-2025-0047"]
    },
    "matter_description": {
      "value": "Employment litigation — wrongful termination defense",
      "confidence": 0.95,
      "citations": ["Re: Employment Litigation — Wrongful Termination Defense"]
    },
    "billing_period": {
      "value": "March 1–31, 2026",
      "confidence": 0.97,
      "citations": ["For services rendered: March 1–31, 2026"]
    },
    "time_entries": {
      "value": [
        {
          "timekeeper": {
            "value": "Sarah Chen, Partner",
            "confidence": 0.97,
            "citations": ["Sarah Chen, Partner"]
          },
          "date": {
            "value": "2026-03-05",
            "confidence": 0.96,
            "citations": ["03/05/2026"]
          },
          "description": {
            "value": "Review amended complaint; conference with client re discovery strategy",
            "confidence": 0.94,
            "citations": ["Review amended complaint; conf. w/ client re discovery strategy"]
          },
          "hours": {
            "value": 3.5,
            "confidence": 0.98,
            "citations": ["3.5"]
          },
          "rate": {
            "value": {
              "amount": "475.00",
              "currency": "USD"
            },
            "confidence": 0.97,
            "citations": ["$475.00/hr"]
          },
          "amount": {
            "value": {
              "amount": "1662.50",
              "currency": "USD"
            },
            "confidence": 0.97,
            "citations": ["$1,662.50"]
          }
        },
        {
          "timekeeper": {
            "value": "David Park, Associate",
            "confidence": 0.97,
            "citations": ["David Park, Associate"]
          },
          "date": {
            "value": "2026-03-12",
            "confidence": 0.96,
            "citations": ["03/12/2026"]
          },
          "description": {
            "value": "Draft responses to interrogatories; document review (142 documents)",
            "confidence": 0.93,
            "citations": ["Draft responses to interrogatories; doc review (142 docs)"]
          },
          "hours": {
            "value": 6.2,
            "confidence": 0.97,
            "citations": ["6.2"]
          },
          "rate": {
            "value": {
              "amount": "325.00",
              "currency": "USD"
            },
            "confidence": 0.97,
            "citations": ["$325.00/hr"]
          },
          "amount": {
            "value": {
              "amount": "2015.00",
              "currency": "USD"
            },
            "confidence": 0.97,
            "citations": ["$2,015.00"]
          }
        }
      ],
      "confidence": 0.96,
      "citations": []
    },
    "total_fees": {
      "value": {
        "amount": "3677.50",
        "currency": "USD"
      },
      "confidence": 0.98,
      "citations": ["Total Professional Fees: $3,677.50"]
    },
    "total_disbursements": {
      "value": {
        "amount": "247.80",
        "currency": "USD"
      },
      "confidence": 0.96,
      "citations": ["Disbursements: $247.80"]
    },
    "total_amount": {
      "value": {
        "amount": "3925.30",
        "currency": "USD"
      },
      "confidence": 0.98,
      "citations": ["Total Due: $3,925.30"]
    },
    "payment_terms": {
      "value": "Net 30",
      "confidence": 0.95,
      "citations": ["Payment Terms: Net 30"]
    }
  }
}
Request
package main

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

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

    result, err := client.ExtractDocument(il.ExtractDocumentRequest{
        Files: []il.FileInput{
            il.FileInput{
                Type: "url",
                Name: "legal-invoice-HW-2026-0341.pdf",
                Url: "https://example.com/legal-billing/invoice-HW-2026-0341.pdf",
            },
        },
        Schema: il.ExtractionSchema{
            Fields: []any{
                il.TextFieldConfig{
                    Name: "law_firm",
                    Type: "TEXT",
                    Description: "Name of the law firm",
                },
                il.TextFieldConfig{
                    Name: "invoice_number",
                    Type: "TEXT",
                    Description: "Invoice number",
                },
                il.DateFieldConfig{
                    Name: "invoice_date",
                    Type: "DATE",
                    Description: "Invoice date",
                },
                il.TextFieldConfig{
                    Name: "client_name",
                    Type: "TEXT",
                    Description: "Client name",
                },
                il.TextFieldConfig{
                    Name: "matter_number",
                    Type: "TEXT",
                    Description: "Matter or case reference number",
                },
                il.TextFieldConfig{
                    Name: "matter_description",
                    Type: "TEXT",
                    Description: "Description of the matter",
                },
                il.TextFieldConfig{
                    Name: "billing_period",
                    Type: "TEXT",
                    Description: "Billing period covered",
                },
                il.ArrayFieldConfig{
                    Name: "time_entries",
                    Type: "ARRAY",
                    Description: "Individual time entries",
                    Fields: []any{
                        il.TextFieldConfig{
                            Name: "timekeeper",
                            Type: "TEXT",
                            Description: "Name and title of the timekeeper",
                        },
                        il.DateFieldConfig{
                            Name: "date",
                            Type: "DATE",
                            Description: "Date of the time entry",
                        },
                        il.TextFieldConfig{
                            Name: "description",
                            Type: "TEXT",
                            Description: "Description of work performed",
                        },
                        il.DecimalFieldConfig{
                            Name: "hours",
                            Type: "DECIMAL",
                            Description: "Hours billed",
                        },
                        il.CurrencyAmountFieldConfig{
                            Name: "rate",
                            Type: "CURRENCY_AMOUNT",
                            Description: "Hourly rate",
                        },
                        il.CurrencyAmountFieldConfig{
                            Name: "amount",
                            Type: "CURRENCY_AMOUNT",
                            Description: "Total amount for this entry",
                        },
                    },
                },
                il.CurrencyAmountFieldConfig{
                    Name: "total_fees",
                    Type: "CURRENCY_AMOUNT",
                    Description: "Total professional fees",
                },
                il.CurrencyAmountFieldConfig{
                    Name: "total_disbursements",
                    Type: "CURRENCY_AMOUNT",
                    Description: "Total disbursements and expenses",
                },
                il.CurrencyAmountFieldConfig{
                    Name: "total_amount",
                    Type: "CURRENCY_AMOUNT",
                    Description: "Total invoice amount",
                },
                il.TextFieldConfig{
                    Name: "payment_terms",
                    Type: "TEXT",
                    Description: "Payment terms",
                },
            },
        },
    })
    if err != nil {
        panic(err)
    }

    _ = result
}
Response
{
  "success": true,
  "data": {
    "law_firm": {
      "value": "Harrison & Whitfield LLP",
      "confidence": 0.99,
      "citations": ["Harrison & Whitfield LLP"]
    },
    "invoice_number": {
      "value": "HW-2026-0341",
      "confidence": 0.99,
      "citations": ["Invoice No. HW-2026-0341"]
    },
    "invoice_date": {
      "value": "2026-03-31",
      "confidence": 0.98,
      "citations": ["Date: March 31, 2026"]
    },
    "client_name": {
      "value": "Pinnacle Industries Inc.",
      "confidence": 0.98,
      "citations": ["Client: Pinnacle Industries Inc."]
    },
    "matter_number": {
      "value": "PIN-2025-0047",
      "confidence": 0.97,
      "citations": ["Matter No. PIN-2025-0047"]
    },
    "matter_description": {
      "value": "Employment litigation — wrongful termination defense",
      "confidence": 0.95,
      "citations": ["Re: Employment Litigation — Wrongful Termination Defense"]
    },
    "billing_period": {
      "value": "March 1–31, 2026",
      "confidence": 0.97,
      "citations": ["For services rendered: March 1–31, 2026"]
    },
    "time_entries": {
      "value": [
        {
          "timekeeper": {
            "value": "Sarah Chen, Partner",
            "confidence": 0.97,
            "citations": ["Sarah Chen, Partner"]
          },
          "date": {
            "value": "2026-03-05",
            "confidence": 0.96,
            "citations": ["03/05/2026"]
          },
          "description": {
            "value": "Review amended complaint; conference with client re discovery strategy",
            "confidence": 0.94,
            "citations": ["Review amended complaint; conf. w/ client re discovery strategy"]
          },
          "hours": {
            "value": 3.5,
            "confidence": 0.98,
            "citations": ["3.5"]
          },
          "rate": {
            "value": {
              "amount": "475.00",
              "currency": "USD"
            },
            "confidence": 0.97,
            "citations": ["$475.00/hr"]
          },
          "amount": {
            "value": {
              "amount": "1662.50",
              "currency": "USD"
            },
            "confidence": 0.97,
            "citations": ["$1,662.50"]
          }
        },
        {
          "timekeeper": {
            "value": "David Park, Associate",
            "confidence": 0.97,
            "citations": ["David Park, Associate"]
          },
          "date": {
            "value": "2026-03-12",
            "confidence": 0.96,
            "citations": ["03/12/2026"]
          },
          "description": {
            "value": "Draft responses to interrogatories; document review (142 documents)",
            "confidence": 0.93,
            "citations": ["Draft responses to interrogatories; doc review (142 docs)"]
          },
          "hours": {
            "value": 6.2,
            "confidence": 0.97,
            "citations": ["6.2"]
          },
          "rate": {
            "value": {
              "amount": "325.00",
              "currency": "USD"
            },
            "confidence": 0.97,
            "citations": ["$325.00/hr"]
          },
          "amount": {
            "value": {
              "amount": "2015.00",
              "currency": "USD"
            },
            "confidence": 0.97,
            "citations": ["$2,015.00"]
          }
        }
      ],
      "confidence": 0.96,
      "citations": []
    },
    "total_fees": {
      "value": {
        "amount": "3677.50",
        "currency": "USD"
      },
      "confidence": 0.98,
      "citations": ["Total Professional Fees: $3,677.50"]
    },
    "total_disbursements": {
      "value": {
        "amount": "247.80",
        "currency": "USD"
      },
      "confidence": 0.96,
      "citations": ["Disbursements: $247.80"]
    },
    "total_amount": {
      "value": {
        "amount": "3925.30",
        "currency": "USD"
      },
      "confidence": 0.98,
      "citations": ["Total Due: $3,925.30"]
    },
    "payment_terms": {
      "value": "Net 30",
      "confidence": 0.95,
      "citations": ["Payment Terms: Net 30"]
    }
  }
}
Template
{
  "name": "Extract legal invoice data in Iteration Layer",
  "nodes": [
    {
      "parameters": {
        "content": "## Extract Legal Invoice Data\n\nCorporate legal departments and legal ops agencies use this recipe to process outside counsel invoices — extracting timekeeper rates, hours, disbursements, and matter codes for e-billing systems and cost analysis.\n\n**Note:** This workflow uses the Iteration Layer community node (`n8n-nodes-iterationlayer`). Install it via Settings > Community Nodes on self-hosted n8n, or add it directly on n8n Cloud with Verified Community Nodes enabled.",
        "height": 280,
        "width": 500,
        "color": 2
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [200, 40],
      "id": "c5d6e7f8-a9b0-1234-cdef-234567890101",
      "name": "Overview"
    },
    {
      "parameters": {
        "content": "### Step 1: Extract Legal Invoice\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": "c5d6e7f8-a9b0-1234-cdef-234567890102",
      "name": "Step 1 Note"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [250, 300],
      "id": "c5d6e7f8-a9b0-1234-cdef-234567890103",
      "name": "Manual Trigger"
    },
    {
      "parameters": {
        "resource": "documentExtraction",
        "schemaInputMode": "rawJson",
        "schemaJson": "{\"fields\":[{\"name\":\"law_firm\",\"type\":\"TEXT\",\"description\":\"Law firm name\"},{\"name\":\"invoice_number\",\"type\":\"TEXT\",\"description\":\"Invoice number\"},{\"name\":\"invoice_date\",\"type\":\"DATE\",\"description\":\"Invoice date\"},{\"name\":\"client_name\",\"type\":\"TEXT\",\"description\":\"Client name\"},{\"name\":\"matter_number\",\"type\":\"TEXT\",\"description\":\"Matter number\"},{\"name\":\"matter_description\",\"type\":\"TEXT\",\"description\":\"Matter description\"},{\"name\":\"billing_period\",\"type\":\"TEXT\",\"description\":\"Billing period\"},{\"name\":\"time_entries\",\"type\":\"ARRAY\",\"description\":\"Time entries\",\"fields\":[{\"name\":\"timekeeper\",\"type\":\"TEXT\",\"description\":\"Timekeeper\"},{\"name\":\"date\",\"type\":\"DATE\",\"description\":\"Date\"},{\"name\":\"description\",\"type\":\"TEXT\",\"description\":\"Work description\"},{\"name\":\"hours\",\"type\":\"DECIMAL\",\"description\":\"Hours\"},{\"name\":\"rate\",\"type\":\"CURRENCY_AMOUNT\",\"description\":\"Rate\"},{\"name\":\"amount\",\"type\":\"CURRENCY_AMOUNT\",\"description\":\"Amount\"}]},{\"name\":\"total_fees\",\"type\":\"CURRENCY_AMOUNT\",\"description\":\"Total fees\"},{\"name\":\"total_disbursements\",\"type\":\"CURRENCY_AMOUNT\",\"description\":\"Disbursements\"},{\"name\":\"total_amount\",\"type\":\"CURRENCY_AMOUNT\",\"description\":\"Total amount\"},{\"name\":\"payment_terms\",\"type\":\"TEXT\",\"description\":\"Payment terms\"}]}",
        "files": {
          "fileValues": [
            {
              "fileInputMode": "url",
              "fileName": "legal-invoice-HW-2026-0341.pdf",
              "fileUrl": "https://example.com/legal-billing/invoice-HW-2026-0341.pdf"
            }
          ]
        }
      },
      "type": "n8n-nodes-iterationlayer.iterationLayer",
      "typeVersion": 1,
      "position": [500, 300],
      "id": "c5d6e7f8-a9b0-1234-cdef-234567890104",
      "name": "Extract Legal Invoice",
      "credentials": {
        "iterationLayerApi": {
          "id": "1",
          "name": "Iteration Layer API"
        }
      }
    }
  ],
  "connections": {
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Extract Legal Invoice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}
Prompt
Extract legal invoice data from the file at [file URL]. Use the extract_document tool with these fields:

- law_firm (TEXT): Name of the law firm
- invoice_number (TEXT): Invoice number
- invoice_date (DATE): Invoice date
- client_name (TEXT): Client name
- matter_number (TEXT): Matter or case reference number
- matter_description (TEXT): Description of the matter
- billing_period (TEXT): Billing period covered
- time_entries (ARRAY): Each with timekeeper (TEXT), date (DATE), description (TEXT), hours (DECIMAL), rate (CURRENCY_AMOUNT), amount (CURRENCY_AMOUNT)
- total_fees (CURRENCY_AMOUNT): Total professional fees
- total_disbursements (CURRENCY_AMOUNT): Total disbursements and expenses
- total_amount (CURRENCY_AMOUNT): Total invoice amount
- payment_terms (TEXT): Payment terms

Related Recipes

Try with your own data

Start the 7-day trial and run this recipe in minutes.