{
  "name": "Invoice",
  "systemPrompt": "You are a data extraction agent. Extract data in the required structured format.",
  "outputFormat": "xlsx",
  "extractionFields": [
    {
      "name": "vendor_name",
      "description": "The legal or trading name of the company or person issuing the invoice. Usually found near the top of the document in the header, vendor block, or letterhead.",
      "type": "string",
      "required": true
    },
    {
      "name": "invoice_number",
      "description": "The invoice identifier or reference number assigned by the vendor. Extract the primary invoice number only, not purchase order numbers or account numbers.",
      "type": "string",
      "required": true
    },
    {
      "name": "invoice_date",
      "description": "The date the invoice was issued. Return the document's invoice date as it appears on the invoice.",
      "type": "string",
      "required": true
    },
    {
      "name": "due_date",
      "description": "The payment due date for the invoice, if shown. Extract the date associated with due, payment due, or payable by.",
      "type": "string",
      "required": false
    },
    {
      "name": "currency",
      "description": "The currency used for invoice amounts, such as USD, EUR, GBP, or the currency symbol if no code is shown clearly.",
      "type": "string",
      "required": false
    },
    {
      "name": "subtotal",
      "description": "The subtotal before tax, shipping, discounts, or additional fees. Return a number only without currency symbols or separators other than the decimal point.",
      "type": "number",
      "required": false
    },
    {
      "name": "tax_amount",
      "description": "The total tax amount applied to the invoice. Return a numeric value only.",
      "type": "number",
      "required": false
    },
    {
      "name": "total_amount",
      "description": "The final invoice total due including tax and fees. Return a numeric value only without currency symbols.",
      "type": "number",
      "required": true
    },
    {
      "name": "line_items",
      "description": "Each invoice line item or service row shown in the line item table.",
      "type": "array",
      "required": false,
      "expandToRows": true,
      "items": [
        {
          "name": "description",
          "description": "The description, product name, service name, or line item label for the invoice row.",
          "type": "string",
          "required": true
        },
        {
          "name": "quantity",
          "description": "The quantity for the line item if shown. Return a number only.",
          "type": "number",
          "required": false
        },
        {
          "name": "unit_price",
          "description": "The price per unit for the line item if shown. Return a number only.",
          "type": "number",
          "required": false
        },
        {
          "name": "line_amount",
          "description": "The total amount for the line item row. Return a number only.",
          "type": "number",
          "required": false
        }
      ]
    }
  ]
}
