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

# Invoices overview

> API reference for managing invoices and payment documents

## Overview

The Invoices API provides functionality for managing:

* Invoice creation and processing
* OCR document extraction
* QR code generation/reading
* PDF generation
* Customer invoicing

## Core Concepts

### Invoice Status

| Status    | Description      | Next States   |
| --------- | ---------------- | ------------- |
| `draft`   | Initial state    | pending, sent |
| `pending` | Awaiting payment | paid, overdue |
| `paid`    | Payment received | -             |
| `sent`    | Invoice sent     | paid, overdue |
| `overdue` | Payment late     | paid          |

### Party Types

| Type       | Description       |
| ---------- | ----------------- |
| `receiver` | Invoice recipient |
| `sender`   | Invoice sender    |

### Invoice Properties

| Field            | Description        | Required |
| ---------------- | ------------------ | -------- |
| `invoice_number` | Unique identifier  | Auto     |
| `description`    | Invoice details    | Yes      |
| `due_date`       | Payment deadline   | Yes      |
| `currency`       | Invoice currency   | Yes      |
| `iban`           | Payment account    | Yes      |
| `customer_id`    | Customer reference | Yes      |

### Line Items

| Field         | Description    | Required |
| ------------- | -------------- | -------- |
| `title`       | Item name      | Yes      |
| `description` | Item details   | No       |
| `quantity`    | Item count     | Yes      |
| `unit_price`  | Price per unit | Yes      |

### Amount Components

| Field      | Description      | Calculation                                    |
| ---------- | ---------------- | ---------------------------------------------- |
| `subtotal` | Items total      | Sum of (quantity × unit\_price)                |
| `shipping` | Shipping cost    | Optional fixed amount                          |
| `discount` | Applied discount | Percentage or fixed amount                     |
| `vat`      | Tax amount       | Percentage of (subtotal + shipping - discount) |
| `total`    | Final amount     | subtotal + shipping - discount + vat           |

## Validation Rules

### Amount Rules

* Non-negative values
* Valid currency codes
* Valid VAT rates (0-100%)
* Valid discounts (0-100%)

### Document Rules

* PDF/JPEG/PNG formats
* Max size: 10MB
* Swiss QR-bill standard
* OCR quality requirements

## Security Requirements

* Invoice access control
* PDF encryption
* Data validation
* Audit logging
* Customer scoping

<Note>
  See individual endpoint documentation for detailed request/response formats and examples.
</Note>
