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

# New Expense

> Structure used when recording a new expense.

| Field              | Type   | Details                                                                                 |
| ------------------ | ------ | --------------------------------------------------------------------------------------- |
| id                 | string | Expense identifier.                                                                     |
| name               | string | Expense name or label.                                                                  |
| amount             | number | Total expense amount.                                                                   |
| main\_type         | string | Primary expense category.                                                               |
| expense\_type      | string | Resolved type from `company.expenseTypes` when provided; otherwise uses `payload.type`. |
| sub\_type          | string | Secondary category (`payload.other`).                                                   |
| details            | string | Optional description.                                                                   |
| branch\_data       | object | Branch context (`id`, `name`) when available.                                           |
| expense\_line\_ids | array  | Itemized expense lines.                                                                 |
| payments           | array  | Payments tied to the expense.                                                           |

<Note>
  `expenseItems` and `expenseTypes` are parsed from JSON strings when supplied;
  empty arrays are used when no items are present.
</Note>

### Expense line schema

| Field       | Type   | Details                 |
| ----------- | ------ | ----------------------- |
| price\_unit | number | Unit price of the item. |
| name        | string | Item name.              |
| quantity    | number | Item quantity.          |

### Expense payment schema

| Field        | Type   | Details                        |
| ------------ | ------ | ------------------------------ |
| id           | string | Payment identifier.            |
| amount       | number | Payment amount.                |
| treasury\_id | string | Treasury used for the payment. |

```json theme={null}
{
  "id": "exp_301",
  "name": "Lab supplies",
  "amount": 240,
  "main_type": "supplies",
  "expense_type": "consumables",
  "sub_type": "gloves and masks",
  "details": "Monthly restock",
  "branch_data": {
    "id": "br_01",
    "name": "Main Branch"
  },
  "expense_line_ids": [
    {
      "price_unit": 40,
      "name": "Gloves box",
      "quantity": 3
    },
    {
      "price_unit": 30,
      "name": "Masks pack",
      "quantity": 2
    }
  ],
  "payments": [
    {
      "id": "exp_pay_01",
      "amount": 120,
      "treasury_id": "treasury_01"
    }
  ]
}
```
