> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bouncebox.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Extraction templates

> Invoice, order, and custom schemas — the exact shape of the data BounceBox extracts from your email.

Every mailbox uses one template that defines the shape of the extracted data. Pick it with the template chips in the mailbox editor: `INVOICE`, `ORDER`, or `CUSTOM`.

## Invoice template

| Field              | Meaning                                                                          |
| ------------------ | -------------------------------------------------------------------------------- |
| `supplier_name`    | Legal name of the supplier that issued the invoice                               |
| `supplier_country` | ISO 3166-1 alpha-2 country code                                                  |
| `supplier_vat_no`  | VAT / tax registration number                                                    |
| `invoice_number`   | Invoice, receipt, or reference number                                            |
| `invoice_date`     | Issue date, `YYYY-MM-DD`; if only a billing period is shown, the period end date |
| `due_date`         | Payment due date, `YYYY-MM-DD`                                                   |
| `currency`         | ISO 4217 code, e.g. `USD`, `EUR`                                                 |
| `amount_total`     | The final Total / Amount Due / Amount Paid figure, including tax                 |
| `vat_inclusive`    | `true` when `amount_total` already includes tax                                  |
| `net_amount`       | Pre-tax amount when shown separately, otherwise `0`                              |
| `tax_amount`       | Tax / VAT shown on the invoice, otherwise `0`                                    |
| `description`      | One-line summary of what was invoiced                                            |
| `line_items`       | Itemized charges, each with `description`, `quantity`, `unit_price`, `amount`    |
| `confidence`       | 0–1 confidence that the total amount, currency, and invoice date are correct     |

## Order template

| Field           | Meaning                                |
| --------------- | -------------------------------------- |
| `customer_name` | Name of the customer placing the order |
| `order_ref`     | Order or PO reference number           |
| `order_date`    | Order date, `YYYY-MM-DD`               |
| `currency`      | ISO 4217 currency code                 |
| `notes`         | Delivery notes or special instructions |
| `line_items`    | All line items — see below             |

Each order line item:

| Field         | Meaning                                                                  |
| ------------- | ------------------------------------------------------------------------ |
| `raw_text`    | The original line text exactly as it appeared in the email or attachment |
| `matched_sku` | The SKU from your catalog this line matches, or `null`                   |
| `name`        | Human-readable product name                                              |
| `quantity`    | Ordered quantity                                                         |
| `uom`         | Unit of measure: `pcs`, `box`, `kg`, ...                                 |
| `unit_price`  | Price per unit                                                           |
| `total`       | Line total                                                               |

**SKU matching** — on Pro, your active catalog SKUs are provided to the model for every order line, so lines come back matched to real products. You can always correct a match in the inbox. See [SKU Catalog](/dashboard/sku-catalog) and [Inbox](/dashboard/inbox).

## Custom template

Available on Pro and Custom plans. Define your own fields with the field builder as a JSON object:

```json theme={null}
{
  "fields": [
    { "name": "order_ref", "type": "text", "description": "Purchase order reference" },
    { "name": "total_amount", "type": "number", "description": "Order total as a number" }
  ]
}
```

Each field has a `name`, a `type` (`text`, `number`, and other simple types), and a `description`. The description is what the model reads, so write it like an instruction — say what the field is, where it lives in the document, and what to do when it's missing.

## Instructions for the model

Every template ships with sensible default extraction instructions. For mailbox-specific rules, use **Instructions for the model** in the mailbox editor — up to 4000 characters of free text. Good uses:

* "All dates in these invoices are DD/MM/YYYY."
* "Ignore footer totals; the real total is in the summary table."
* "Tax is always 21% VAT unless the document states otherwise."

The instructions add to the template defaults — you don't need to repeat the template's field rules.
