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

# Overview

> An itemized record of goods sold or services provided to a customer.

**The Invoices Data Model** represents an itemized record of goods sold or services provided to a customer. This unified model simplifies handling invoice-related information across different accounting platforms.

* **Unified invoice properties**: Essential invoice details like document number, due date, currency, status, and total amounts are standardized across different accounting platforms
* **Linked entities**: Invoices can be associated with contacts, line items, payments, and sales orders, providing a complete view of the invoicing process and related transactions
* **Flexible status tracking**: The model supports a range of invoice statuses, such as draft, submitted, partially paid, and overdue, for better organisation and reporting

## Attributes

### Invoices Attributes

| Property                  | Type    | Description                                                                 |
| ------------------------- | ------- | --------------------------------------------------------------------------- |
| `rootfi_id`               | integer | Unique identifier assigned by Commenda for this invoice                     |
| `rootfi_created_at`       | string  | Timestamp when this record was created in Commenda's system (ISO 8601)      |
| `rootfi_updated_at`       | string  | Timestamp when this record was last updated in Commenda's system (ISO 8601) |
| `rootfi_integration_type` | enum    |                                                                             |
| `platform_id`             | string  | Unique identifier for this invoice in the source accounting platform        |
| `contact_id`              | string  | The contact ID of the invoice                                               |
| `currency_id`             | enum    | ISO 4217 currency code                                                      |
| `currency_rate`           | double  | The currency rate of the invoice                                            |
| `document_number`         | string  | The document number of the invoice                                          |
| `posted_date`             | string  | The posted date of the invoice                                              |
| `due_date`                | string  | The due date of the invoice                                                 |
| `status`                  | enum    | The status of the invoice                                                   |
| `sub_total`               | double  | The sub total of the invoice                                                |
| `tax_amount`              | double  | The tax amount of the invoice                                               |
| `total_discount`          | double  | The total discount of the invoice                                           |
| `shipping_amount`         | double  |                                                                             |
| `total_amount`            | double  | The total amount of the invoice                                             |
| `amount_paid`             | double  |                                                                             |
| `amount_refunded`         | double  |                                                                             |
| `amount_credited`         | double  |                                                                             |
| `amount_due`              | double  | The amount due of the invoice                                               |
| `memo`                    | string  | The memo or notes of the invoice                                            |
| `subscription_id`         | string  |                                                                             |
| `payment_link`            | string  |                                                                             |
| `payment_link_expires_at` | string  |                                                                             |
| `transaction_ids`         | array   |                                                                             |
| `order_ids`               | array   |                                                                             |
| `sales_order_ids`         | array   | The sales order IDs associated with the invoice                             |
| `created_at`              | string  |                                                                             |
| `updated_at`              | string  | The date and time the invoice was last updated                              |

### Status Enum Values

| Value            | Description                                           |
| ---------------- | ----------------------------------------------------- |
| `DRAFT`          | Invoice is in draft status and has not been finalized |
| `SUBMITTED`      | Invoice has been submitted but not yet paid           |
| `PARTIALLY_PAID` | Invoice has received partial payment                  |
| `PAID`           | Invoice has been fully paid                           |
| `OVERDUE`        | Invoice has passed its due date without payment       |
| `VOID`           | Invoice has been voided or canceled                   |
| `UNKNOWN`        | Status cannot be determined from the platform         |

## Expandable Attributes

Use the `expand` query parameter to include related objects:

* `expand=line_items` — includes the related Line Items object(s).
* `expand=addresses` — includes the related Addresses object(s).
* `expand=documents` — includes the related Documents object(s).

## Properties Supported

Fields accepted when creating or updating a record:

| Property                  | Type   | Description                                                          |
| ------------------------- | ------ | -------------------------------------------------------------------- |
| `platform_id`             | string | Unique identifier for this invoice in the source accounting platform |
| `contact_id`              | string | The contact ID of the invoice                                        |
| `currency_id`             | enum   | ISO 4217 currency code                                               |
| `currency_rate`           | double | The currency rate of the invoice                                     |
| `document_number`         | string | The document number of the invoice                                   |
| `posted_date`             | string | The posted date of the invoice                                       |
| `due_date`                | string | The due date of the invoice                                          |
| `status`                  | enum   | The status of the invoice                                            |
| `sub_total`               | double | The sub total of the invoice                                         |
| `tax_amount`              | double | The tax amount of the invoice                                        |
| `total_discount`          | double | The total discount of the invoice                                    |
| `shipping_amount`         | double |                                                                      |
| `total_amount`            | double | The total amount of the invoice                                      |
| `amount_paid`             | double |                                                                      |
| `amount_refunded`         | double |                                                                      |
| `amount_credited`         | double |                                                                      |
| `amount_due`              | double | The amount due of the invoice                                        |
| `memo`                    | string | The memo or notes of the invoice                                     |
| `subscription_id`         | string |                                                                      |
| `payment_link`            | string |                                                                      |
| `payment_link_expires_at` | string |                                                                      |
| `transaction_ids`         | array  |                                                                      |
| `order_ids`               | array  |                                                                      |
| `sales_order_ids`         | array  | The sales order IDs associated with the invoice                      |
| `created_at`              | string |                                                                      |
| `updated_at`              | string | The date and time the invoice was last updated                       |
