Create expense
create_expenseRegister an expense (gasto) from data. Requires description, subtotal and total. Always pass the supplier (proveedor) as supplier_name/supplier_nif or supplier_id, an expense without a supplier cannot appear in Modelo 347/349. OCR ticket scanning stays in the web app. Returns the new expense's id, description and total. To attach the receipt image or PDF afterwards, use attach_expense_receipt.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| notes | No | ||
| total | Yes | ||
| category | No | expense category slug (see web app) | |
| subtotal | Yes | ||
| tax_rate | No | ||
| tax_lines | No | Only for a receipt carrying MORE THAN ONE VAT rate (e.g. a Correos ticket: 21% on postage, exempt on the stamp). One entry per rate. When given, subtotal/tax_amount/tax_rate/total are derived from it, do not compute them yourself. Leave it out for the normal single-rate receipt. | |
| tax_amount | No | ||
| description | Yes | ||
| supplier_id | No | existing supplier id from list_suppliers | |
| invoice_date | No | YYYY-MM-DD, defaults to today | |
| supplier_nif | No | supplier NIF/CIF/VAT as printed on the document | |
| is_deductible | No | false keeps the expense out of the deductible totals entirely | |
| supplier_name | No | supplier (proveedor) name, matched against existing suppliers by NIF or name, created if new | |
| invoice_number | No | ||
| supplier_country | No | supplier country, ISO-2 (ES, FR, DE...). Drives Modelo 349 intra-EU acquisitions | |
| deductible_percent | No | porcentaje imputable: share of this expense (0-100) the user allocates to the business, e.g. a shared car or a home office. Enter the FULL receipt amounts in subtotal/tax_amount/total and the percentage here, not pre-reduced amounts; the IVA and income-tax modelos count only that share. Default 100. Use only a percentage the user states, contix never proposes one. |