Create Invoice
create_invoiceGenerate an invoice by providing client name and line items. Invoice number auto-generated, defaults to draft status and today's date.
Instructions
Create a new invoice. Requires client name and at least one line item. The invoice number is auto-generated. Defaults to draft status and today's date. Example: clientName='Acme Corp', items=[{description:'Consulting', quantity:10, unitPrice:150}], taxRate=21, irpfRate=15 / Crea una nueva factura. Requiere nombre del cliente y al menos un concepto. El numero se genera automaticamente. Por defecto estado borrador y fecha de hoy. Soporta retencion IRPF (autonomos ES), recargo de equivalencia, serie, anticipo y descuento global.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| items | Yes | Line items (each with description, quantity, unitPrice) / Conceptos de la factura | |
| notes | No | Additional notes shown on the invoice / Notas adicionales | |
| status | No | Invoice status (default: draft) / Estado de la factura | |
| dueDate | No | Due date in ISO 8601 format (YYYY-MM-DD) / Fecha de vencimiento | |
| taxRate | No | Tax rate percentage (e.g. 21 for 21% IVA, 7 for IGIC) / Porcentaje de impuesto | |
| clientId | No | Existing client ID — server back-fills taxId/address / ID de cliente existente | |
| irpfRate | No | IRPF withholding % (retencion autonomo ES, e.g. 15 or 7) / Retencion IRPF % | |
| poNumber | No | Client purchase-order reference / Numero de pedido del cliente | |
| seriesId | No | Invoice numbering series ID / ID de serie de numeracion | |
| issueDate | No | Issue date in ISO 8601 format (YYYY-MM-DD), defaults to today / Fecha de emision | |
| clientName | Yes | Client/customer name / Nombre del cliente | |
| prepayment | No | Prepaid/advance amount already collected in EUR / Anticipo cobrado en EUR | |
| clientTaxId | No | Client tax ID (NIF/CIF/VAT) shown on the invoice / NIF/CIF del cliente | |
| discountRate | No | Global discount % applied to the invoice / Descuento global % | |
| clientAddress | No | Client billing address shown on the invoice / Direccion fiscal del cliente | |
| operationType | No | Operation type (service or goods) / Tipo de operacion | |
| clientLocation | No | Fiscal zone driving IVA vs IGIC vs exempt / Zona fiscal (IVA/IGIC/exento) | |
| documentNumber | No | Externally-issued number for import (honored verbatim) / Numero externo para importacion | |
| equivalenceSurchargeRate | No | Recargo de equivalencia % (ES retail regime) / Recargo de equivalencia % |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| items | Yes | ||
| notes | No | ||
| total | No | ||
| status | No | ||
| dueDate | No | ||
| taxRate | No | ||
| createdAt | No | ||
| issueDate | No | ||
| updatedAt | No | ||
| clientName | Yes |