Invoice

Extract vendor, amounts, line items, and tax details.

Schema Key

invoice

Usage

Use this template when creating a schema via the API or SDK:

const schema = await client.schemas.create('my-workspace', {
  schemaKey: 'invoice',
  name: 'Invoice',
  definition: { /* see definition below */ },
});

Definition

{
  "type": "object",
  "properties": {
    "vendor": {
      "type": "object",
      "description": "Information about the vendor or supplier.",
      "properties": {
        "name": {
          "type": "string",
          "description": "Name of the vendor or supplier."
        },
        "address": {
          "type": "object",
          "description": "Vendor address.",
          "properties": {
            "street": {
              "type": "string",
              "description": "Street address."
            },
            "city": {
              "type": "string",
              "description": "City."
            },
            "country": {
              "type": "string",
              "description": "Country."
            },
            "postal_code": {
              "type": "string",
              "description": "Postal or ZIP code."
            }
          },
          "required": [
            "street",
            "city",
            "country"
          ],
          "additionalProperties": false
        },
        "tax_id": {
          "type": "string",
          "description": "Tax identification number of the vendor."
        }
      },
      "required": [
        "name"
      ],
      "additionalProperties": false
    },
    "buyer": {
      "type": "object",
      "description": "Information about the buyer or customer.",
      "properties": {
        "name": {
          "type": "string",
          "description": "Name of the buyer or customer."
        },
        "address": {
          "type": "object",
          "description": "Buyer address.",
          "properties": {
            "street": {
              "type": "string",
              "description": "Street address."
            },
            "city": {
              "type": "string",
              "description": "City."
            },
            "country": {
              "type": "string",
              "description": "Country."
            },
            "postal_code": {
              "type": "string",
              "description": "Postal or ZIP code."
            }
          },
          "required": [
            "street",
            "city",
            "country"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "name"
      ],
      "additionalProperties": false
    },
    "invoice_number": {
      "type": "string",
      "description": "Unique invoice identifier."
    },
    "invoice_date": {
      "type": "object",
      "description": "Date the invoice was issued.",
      "properties": {
        "year": {
          "type": "integer",
          "description": "Year (e.g. 2024)."
        },
        "month": {
          "type": "integer",
          "description": "Month (1-12).",
          "minimum": 1,
          "maximum": 12
        },
        "day": {
          "type": "integer",
          "description": "Day of the month.",
          "minimum": 1,
          "maximum": 31
        }
      },
      "required": [
        "year",
        "month",
        "day"
      ],
      "additionalProperties": false
    },
    "due_date": {
      "type": "object",
      "description": "Payment due date.",
      "properties": {
        "year": {
          "type": "integer",
          "description": "Year (e.g. 2024)."
        },
        "month": {
          "type": "integer",
          "description": "Month (1-12).",
          "minimum": 1,
          "maximum": 12
        },
        "day": {
          "type": "integer",
          "description": "Day of the month.",
          "minimum": 1,
          "maximum": 31
        }
      },
      "required": [
        "year",
        "month",
        "day"
      ],
      "additionalProperties": false
    },
    "currency": {
      "type": "string",
      "description": "Currency code (e.g. USD, EUR)."
    },
    "line_items": {
      "type": "array",
      "description": "List of line items on the invoice.",
      "items": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "description": "Description of the item or service."
          },
          "quantity": {
            "type": "number",
            "description": "Quantity of units."
          },
          "unit_price": {
            "type": "number",
            "description": "Price per unit."
          },
          "amount": {
            "type": "number",
            "description": "Total amount for this line item."
          }
        },
        "required": [
          "description",
          "quantity",
          "unit_price",
          "amount"
        ],
        "additionalProperties": false
      }
    },
    "subtotal": {
      "type": "number",
      "description": "Sum of all line items before tax."
    },
    "tax": {
      "type": "number",
      "description": "Total tax amount."
    },
    "total": {
      "type": "number",
      "description": "Total amount due including tax."
    },
    "payment_terms": {
      "type": "string",
      "description": "Payment terms or conditions (e.g. Net 30)."
    }
  },
  "required": [
    "vendor",
    "invoice_number",
    "invoice_date",
    "line_items",
    "total"
  ],
  "additionalProperties": false
}