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

# Working with Accounts in Invoices

This guide explains how to correctly provide account information when creating **Invoices** via the **Unified API**.

## Invoice

The "create invoice" endpoint is designed specifically for creating customer (sales) and supplier (purchase) invoices in the way they are typically booked in accounting.

In most cases, it results in the creation of an **invoice object** in the target accounting system. This object offers a higher level of abstraction than a generic journal entry:

* You provide the **`partner_id`** at the invoice level.
* The API automatically generates the receivable (customer) or payable (supplier) line in the background, using the account set on that partner in the accounting system (system default or partner-specific configuration).
* The invoice lines you send only need **general accounts** (i.e., income, expenses).

💡 **Important nuance:**

The `Invoice` object is only created in the target accounting system **if** that system natively supports invoices.

If the accounting software does not manage invoices as standalone objects, the API abstracts the logic and posts the equivalent entries directly in the general ledger, following the same accounting rules.

*(In French systems, the `partner_id` may correspond to an **auxiliary account**.)*

***

### Fields

* **`partner_id`** *(required at invoice level)*
  * The ID of the customer or supplier in the accounting software.
  * Used to automatically create the receivable or payable line.
  * Retrieved via `GET /clients` or `GET /suppliers` (or from the response when creating a partner).

* **`account_number`** *(required at line level)*
  * Always a **general ledger account number** (never a partner ID).
  * For sales invoices: typically a revenue account (e.g., `701000`).
  * For purchase invoices: typically an expense or purchase account (e.g., `601000`).
  * These accounts are often linked to categories or products in upstream systems.

* **`tax_id`** *(required at line level, when applicable)*
  * The ID of the **tax object** (sometimes called tax code, VAT code, or tax rate) in the accounting software.
  * Determines the tax treatment of the line and ensures the correct tax entry is created.
  * Two possible scenarios, depending on the target software:
    1. If the software natively supports invoices with tax handling, we pass the `tax_id` to the invoice creation endpoint, and the software generates the tax line.
    2. If the software does not handle tax automatically, we retrieve the related tax account from the tax object and generate the tax line ourselves (this logic is abstracted for you).
  * In both cases, you only need to provide the correct `tax_id`; the Unified API ensures consistency in how tax lines are booked.
