beel_convert_proforma_to_invoice
Convert an active proforma into a standard draft invoice, optionally issuing it and assigning a fiscal number in one call.
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. That includes400 SERIES_NUMBER_COLLISION: the number the series would assign is already used by another invoice of the same company, and the series needs review, so contact support.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
⚠️ Read before calling:
The status names, the proforma lifecycle, and which tool performs each operation. (resource: beel://guardrails/invoice-state-machine)
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. |