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

# Document

> Invoice and credit note document structure

## Overview

The `Document` schema defines the structure for creating invoices, credit notes, and debit notes via the e-invoice.be API. This is the primary schema used when calling `POST /api/documents/`.

<Note>
  Only the `items` array is strictly required. All other fields are optional but recommended for complete, Peppol-compliant e-invoices.
</Note>

## Document Metadata

<ParamField body="document_type" type="enum" default="INVOICE">
  Type of document to create

  * `INVOICE` - Standard invoice
  * `CREDIT_NOTE` - Credit note (refund/adjustment)
  * `DEBIT_NOTE` - Debit note
</ParamField>

<ParamField body="state" type="enum" default="DRAFT">
  Document state

  * `DRAFT` - Created but not sent
  * `TRANSIT` - Being transmitted
  * `SENT` - Successfully delivered
  * `FAILED` - Transmission failed
  * `RECEIVED` - Received from another party

  **State Flow Diagrams:**

  Outbound documents (direction: `OUTBOUND`):

  <img src="https://mintcdn.com/e-invoicebe/8In8u_5_qJ_GERTQ/images/outbound-state-diagram.png?fit=max&auto=format&n=8In8u_5_qJ_GERTQ&q=85&s=b8df9b4e1b9c93ec597a9109aba5a147" alt="Outbound document state flow" width="889" height="925" data-path="images/outbound-state-diagram.png" />

  <Note>
    Documents in `TRANSIT` state use an exponential backoff retry strategy with 10 retry attempts before transitioning to `FAILED`. Retry delays are: 1, 2, 4, 8, 16, 32, 64, 128, 256, and 360 minutes (final retry capped at 6 hours).

    Documents in `FAILED` state can be retried by calling `POST /api/documents/{id}/send` again, which will transition them back to `TRANSIT` for another delivery attempt.

    **Coming soon**: Detailed transmission attempt history will be available in a future release, allowing you to view all retry attempts, timestamps, and failure reasons for each transmission.
  </Note>

  Inbound documents (direction: `INBOUND`):

  <img src="https://mintcdn.com/e-invoicebe/8In8u_5_qJ_GERTQ/images/inbound-state-diagram.png?fit=max&auto=format&n=8In8u_5_qJ_GERTQ&q=85&s=e0dd4f17d665b047b494e4376d5f060f" alt="Inbound document state flow" width="687" height="580" data-path="images/inbound-state-diagram.png" />
</ParamField>

<ParamField body="direction" type="enum" default="OUTBOUND">
  Document direction

  * `OUTBOUND` - Sending to customer
  * `INBOUND` - Received from supplier
</ParamField>

## Vendor (Supplier) Information

<ParamField body="vendor_name" type="string">
  Your company name

  Example: `"Your Company BVBA"`
</ParamField>

<ParamField body="vendor_tax_id" type="string">
  Your VAT number, including the country prefix. For Belgium this is the VAT number.

  Example: `"BE1018265814"`

  The API automatically derives the Peppol participant ID from this value when transmitting. To set the recipient's Peppol ID explicitly, use `customer_peppol_id` (format `scheme:identifier`, e.g. `"0208:0123456789"`).
</ParamField>

<ParamField body="vendor_address" type="string">
  Your company address (full address as single string)

  Example: `"Main Street 123, 1000 Brussels, Belgium"`
</ParamField>

<ParamField body="vendor_address_recipient" type="string">
  Department or person at vendor address

  Example: `"Accounts Department"`
</ParamField>

<ParamField body="vendor_email" type="string">
  Your contact email address

  Example: `"billing@yourcompany.com"`
</ParamField>

## Customer (Buyer) Information

<ParamField body="customer_name" type="string">
  Customer company name

  Example: `"Customer Company NV"`
</ParamField>

<ParamField body="customer_tax_id" type="string">
  Customer VAT number, including the country prefix. For Belgium this is the VAT number.

  Example: `"BE0848934496"`
</ParamField>

<ParamField body="customer_peppol_id" type="string">
  Customer Peppol participant ID in format `scheme:identifier`

  Example: `"0208:0848934496"`
</ParamField>

<ParamField body="customer_id" type="string">
  Internal customer reference/ID

  Example: `"CUST-12345"`
</ParamField>

<ParamField body="customer_address" type="string">
  Customer address (full address as single string)

  Example: `"Customer Lane 456, 2000 Antwerp, Belgium"`
</ParamField>

<ParamField body="customer_address_recipient" type="string">
  Department or person at customer address

  Example: `"Accounts Payable"`
</ParamField>

<ParamField body="customer_email" type="string">
  Customer contact email

  Example: `"ap@customer.com"`
</ParamField>

## Invoice Details

<ParamField body="invoice_id" type="string">
  Unique invoice number

  Example: `"INV-2024-001"`
</ParamField>

<ParamField body="invoice_date" type="string">
  Invoice issue date in ISO 8601 format (`YYYY-MM-DD`)

  Example: `"2024-10-24"`
</ParamField>

<ParamField body="due_date" type="string">
  Payment due date in ISO 8601 format (`YYYY-MM-DD`)

  Example: `"2024-11-24"`
</ParamField>

<ParamField body="purchase_order" type="string">
  Customer purchase order reference. For credit notes, use this to reference the original invoice.

  Example: `"PO-12345"` or `"INV-2024-001"` (for credit notes)
</ParamField>

<ParamField body="note" type="string">
  Free-text note or description

  Example: `"Thank you for your business"` or `"Full refund - goods returned"`
</ParamField>

<ParamField body="payment_term" type="string">
  Payment terms description

  Example: `"Payment due within 30 days"` or `"Net 30"`
</ParamField>

## Financial Fields

<ParamField body="currency" type="enum" default="EUR">
  Currency code (ISO 4217)

  Supported: `EUR`, `USD`, `GBP`, `JPY`, `CHF`, `CAD`, `AUD`, `NZD`, `CNY`, `INR`, `SEK`, `NOK`, `DKK`, `SGD`, `HKD`

  Example: `"EUR"`
</ParamField>

<ParamField body="subtotal" type="number">
  Taxable base amount (after document-level allowances and charges, before tax)

  Corresponds to UBL `cac:LegalMonetaryTotal/cbc:TaxExclusiveAmount`

  Example: `1000.00`
</ParamField>

<ParamField body="total_discount" type="number">
  Total document-level allowances (discounts only, not charges)

  Corresponds to UBL `cac:LegalMonetaryTotal/cbc:AllowanceTotalAmount`

  Example: `50.00`
</ParamField>

<ParamField body="total_tax" type="number">
  Total VAT/tax amount

  Corresponds to UBL `cac:TaxTotal/cbc:TaxAmount`

  Example: `210.00`
</ParamField>

<ParamField body="invoice_total" type="number">
  Total invoice amount including tax (subtotal + total\_tax)

  Corresponds to UBL `cac:LegalMonetaryTotal/cbc:TaxInclusiveAmount`

  Example: `1210.00`
</ParamField>

<ParamField body="amount_due" type="number">
  Amount due for payment after prepayments

  Corresponds to UBL `cac:LegalMonetaryTotal/cbc:PayableAmount`

  Example: `1210.00`
</ParamField>

<ParamField body="previous_unpaid_balance" type="number">
  Previous outstanding balance (if any). Hidden/internal field: it is excluded from the transmitted document and does not appear in the generated UBL.

  Example: `100.00`
</ParamField>

## Tax Information

<ParamField body="tax_code" type="enum" default="S">
  Tax category code (UNCL5305)

  * `S` - Standard rate (most common)
  * `Z` - Zero rated
  * `E` - Exempt from tax
  * `AE` - VAT Reverse Charge
  * `K`, `G`, `O`, `L`, `M`, `B` - Other special cases
</ParamField>

<ParamField body="vatex" type="enum">
  VAT exemption reason code (when tax\_code is E, AE, K, G, O, L, M, or B)

  Example: `"VATEX-EU-132"` for intra-community supply
</ParamField>

<ParamField body="vatex_note" type="string">
  VAT exemption explanation

  Example: `"Reverse charge applies - Art. 196 EU VAT Directive"`
</ParamField>

## Service Period

<ParamField body="service_start_date" type="string">
  Service period start date (ISO 8601: `YYYY-MM-DD`)

  Example: `"2024-10-01"`
</ParamField>

<ParamField body="service_end_date" type="string">
  Service period end date (ISO 8601: `YYYY-MM-DD`)

  Example: `"2024-10-31"`
</ParamField>

## Additional Addresses

<ParamField body="billing_address" type="string">
  Billing address (if different from customer address)

  Example: `"Billing Street 1, 1000 Brussels, Belgium"`
</ParamField>

<ParamField body="billing_address_recipient" type="string">
  Recipient at billing address

  Example: `"Accounts Payable Department"`
</ParamField>

<ParamField body="shipping_address" type="string">
  Delivery/shipping address

  Example: `"Warehouse 5, Industrial Park, 3000 Leuven, Belgium"`
</ParamField>

<ParamField body="shipping_address_recipient" type="string">
  Recipient at shipping address

  Example: `"Warehouse Manager"`
</ParamField>

<ParamField body="service_address" type="string">
  Service location address

  Example: `"Service Location 3, 3000 Leuven, Belgium"`
</ParamField>

<ParamField body="service_address_recipient" type="string">
  Recipient at service address
</ParamField>

<ParamField body="remittance_address" type="string">
  Remittance/payment address

  Example: `"Payment Processing Center, 1000 Brussels, Belgium"`
</ParamField>

<ParamField body="remittance_address_recipient" type="string">
  Recipient at remittance address
</ParamField>

## Line Items

<ParamField body="items" type="array" required>
  Array of line items (minimum 1 required)

  See [LineItem schema](/api-reference/schemas/line-item) for details.

  Example:

  ```json theme={null}
  [
    {
      "description": "Professional Services",
      "quantity": 10,
      "unit": "C62",
      "unit_price": 100.00,
      "tax_rate": "21.00"
    }
  ]
  ```
</ParamField>

## Payment Details

<ParamField body="payment_details" type="array">
  Array of payment method details

  Example:

  ```json theme={null}
  [
    {
      "iban": "BE68539007547034",
      "swift": "GEBABEBB",
      "payment_reference": "INV-2024-001"
    }
  ]
  ```
</ParamField>

## Allowances and Charges

<ParamField body="allowances" type="array">
  Document-level allowances (discounts)

  Example:

  ```json theme={null}
  [
    {
      "amount": 50.00,
      "reason": "Early payment discount (5%)",
      "tax_code": "S",
      "tax_rate": "21.00"
    }
  ]
  ```
</ParamField>

<ParamField body="charges" type="array">
  Document-level charges (fees)

  Example:

  ```json theme={null}
  [
    {
      "amount": 25.00,
      "reason": "Shipping and handling",
      "tax_code": "S",
      "tax_rate": "21.00"
    }
  ]
  ```
</ParamField>

## Tax Details

<ParamField body="tax_details" type="array">
  Detailed tax breakdown by category/rate

  Automatically calculated if not provided.
</ParamField>

## Attachments

<ParamField body="attachments" type="array">
  Document attachments (supporting files)

  Example:

  ```json theme={null}
  [
    {
      "file_name": "supporting_document.pdf",
      "file_type": "application/pdf",
      "file_data": "<base64-encoded file data>"
    }
  ]
  ```
</ParamField>

## Example

Complete invoice example:

```json theme={null}
{
  "document_type": "INVOICE",
  "invoice_id": "INV-2024-001",
  "invoice_date": "2024-10-24",
  "due_date": "2024-11-24",
  "currency": "EUR",
  "purchase_order": "PO-12345",
  "vendor_name": "Your Company BVBA",
  "vendor_tax_id": "BE1018265814",
  "vendor_address": "Main Street 123, 1000 Brussels, Belgium",
  "vendor_email": "billing@yourcompany.com",
  "customer_name": "Customer Company NV",
  "customer_tax_id": "BE0848934496",
  "customer_address": "Customer Lane 456, 2000 Antwerp, Belgium",
  "items": [
    {
      "description": "Professional Services",
      "quantity": 10,
      "unit": "C62",
      "unit_price": 100.00,
      "tax_rate": "21.00"
    }
  ],
  "payment_term": "Net 30 days",
  "payment_details": [
    {
      "iban": "BE68539007547034",
      "swift": "GEBABEBB",
      "payment_reference": "INV-2024-001"
    }
  ]
}
```

## Related

* [LineItem Schema](/api-reference/schemas/line-item)
* [Creating Invoices Guide](/guides/creating-invoices)
* [Validation Guide](/guides/validation)
