beel_create_invoice
Creates and issues Spanish invoices for a company, handling VeriFactu AEAT submission, PDF generation, and email delivery. Supports standard, simplified, and proforma types.
Instructions
Creates an invoice under this company (NIF); the issuer data is taken from the company in
the path. With issue_directly: true the invoice is numbered and issued in the same call,
and verifactu.submission_status comes back as PENDING, since submission to AEAT is
asynchronous: a 2xx means accepted for submission, never registered with AEAT.
A proforma (type: PROFORMA) is a non-fiscal document: it is created directly in its only
working state ACTIVE, numbered PRO-... from the non-fiscal series, and issue_directly
does not apply to it. To copy an existing invoice into a new draft use
POST …/invoices/derivations, which carries neither type, nor recipient, nor lines.
Endpoint: POST /v1/companies/{company_id}/invoices
⚠️ Fiscal guardrails — read before calling:
How BeeL derives the AEAT invoice type, and the rules each type imposes. (resource: beel://guardrails/invoice-types)
How a line states its price, and which field combinations are rejected. (resource: beel://guardrails/invoice-lines)
What regime_key means, where it lives, and which combinations are rejected. (resource: beel://guardrails/regime-keys)
Why a name that does not match the census makes an invoice unsubmittable. (resource: beel://guardrails/nif-validation)
Why an issued invoice may never reach AEAT, and how to tell before issuing. (resource: beel://guardrails/verifactu-gates)
How invoice numbers are formed, and why numbering can never be rewritten. (resource: beel://guardrails/series-and-numbering)
For the exhaustive rules and worked examples, call beel_docs_search.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | Yes | ||
| company_id | Yes | NIF (company) the operation acts on. It is the only source of context: the account that owns it is derived from it, and the `BeeL-Active-Company` header plays no part. A NIF you do not reach answers `403`, and so does a NIF that does not exist, so the existence of a NIF in another account is never disclosed. | |
| wait_for_pdf | No | Same flag as `options.wait_for_pdf`. Only applies when the invoice is issued in this call (`options.issue_directly: true`). | |
| idempotency_key | No | Optional idempotency key for this operation. Omit it and one is derived from the request itself, which makes a blind retry safe but also collapses a SECOND, deliberately identical operation into the first for 24 hours. Set it — to an order id, or anything unique per intended operation — whenever you mean to create something that may look identical to what you just created. |