beel_convert_proforma_to_invoice
Convert an accepted proforma into a real invoice, leaving the original as a converted record. Optionally issue the new invoice in the same call, with safeguards against duplicate conversions.
Instructions
Converts an accepted proforma of this company into a real invoice. The new invoice is
created as a STANDARD draft linked back through source_proforma_id.
What converts: only proformas in status
ACTIVE. One shown asEXPIREDis stillACTIVEunderneath and converts too.The proforma: preserved as the record of what the customer accepted — it keeps its
PRO-...number and PDF and moves to the terminal statusCONVERTED.issue: withtruethe new invoice is numbered and issued in the same atomic call. If issuing fails nothing is created and the proforma staysACTIVE.Errors:
422 CONVERSION_REQUIRES_PROFORMAwhen the document is not a proforma,422 PROFORMA_NOT_CONVERTIBLEwhen it is notACTIVE, and409 PROFORMA_ALREADY_CONVERTEDwhen it has already been converted — a second call never creates a second invoice.
Endpoint: POST /v1/companies/{company_id}/invoices/{invoice_id}/convert-to-invoice
⚠️ Fiscal guardrails — read before calling:
When an invoice can still be changed, and what to do once it cannot. (resource: beel://guardrails/invoice-state-machine)
For the exhaustive rules and worked examples, call beel_docs_search.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | No | ||
| company_id | Yes | Unique identifier (UUID) of the company the operation acts on — its identifier, not its NIF. 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 company you do not reach answers `403`, and so does a company that does not exist, so the existence of a company in another account is never disclosed. | |
| invoice_id | Yes | Invoice ID | |
| 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. |