create_document
Create invoices, estimates, purchase orders, and similar documents in Holded. Supports drafts and auto-numbering overrides on sales documents.
Instructions
Create a new document (invoice, estimate, purchase, etc.). By default the document is approved (finalized) so it appears in the Holded UI; pass approveDoc:false to create a draft instead. Set the expense/income account at document level via expAccountId (it cascades to all lines); a per-line account is rejected because Holded ignores it. On SALES documents an auto-incrementing numbering series may OVERRIDE the requested invoiceNum — the tool re-reads the created document and returns a _warnings note if that happened. On purchases the supplier number in invoiceNum is preserved. retention (IRPF) is accepted on sales but rejected on purchases (Holded ignores it there).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"docType": "<docType>",
"contactId": "<contactId>",
"items": "<items>",
"date": "<date>"
},
"name": "create_document"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | Yes | Document date as Unix timestamp | |
| items | Yes | Array of line items | |
| notes | No | Notes for the document | |
| docType | Yes | Type of document to create | |
| currency | No | Currency code (e.g., EUR, USD) | |
| contactId | Yes | Contact ID for the document | |
| retention | No | IRPF retention percentage. Accepted on SALES documents only; rejected on purchases because Holded silently ignores it there. | |
| approveDoc | No | Whether to immediately approve (finalize) the document instead of saving it as a draft. Defaults to true so the document is visible in the Holded UI. When the Holded API receives no value it defaults to draft, and drafts do not appear in Sales > Invoices, the contact Sales tab or global search. Pass false only when you intentionally want a draft. Note: approved documents are permanently locked by Holded. | |
| invoiceNum | No | Document reference number (e.g. invoice number from supplier) | |
| expAccountId | No | Expense account ID for expense documents | |
| salesChannelId | No | Sales channel ID to associate with the document |