Convert a document to another type
sales:invoices.writehttps://api.holded.com/api/v2/documents/convertConverts an existing document into a new document of a different type. For example, convert an estimate into an invoice or a sales order into a waybill. The source document remains unchanged; a new document of the target type is created and linked to the source. Not all conversion pairs are supported — the available conversions depend on the document types configured in your account. This is the only way to create a document that preserves the parent-child relationship with the source. For partial conversions (e.g. invoicing only a portion of a proforma), use this endpoint to create the linked document and then update the resulting document's line quantities or prices accordingly.
Request body
Type of the source document to convert from
invoicecreditnoteestimatesalesordersalesreceiptpurchaseorderproformwaybillIdentifier of the source document
Type of the target document to convert to
invoicecreditnoteestimatesalesordersalesreceiptpurchaseorderproformwaybillIssue date for the new document in ISO 8601 format
Due date for the new document in ISO 8601 format
Identifier of the numbering series to use
Description for the new document
Internal notes for the new document
Whether to create the new document as a draft
Request
import requests
url = "https://api.holded.com/api/v2/documents/convert"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
}
payload = {
"source_type": "invoice",
"source_id": "507f1f77bcf86cd799439011",
"target_type": "invoice",
"date": "2024-01-15",
"due_date": "2024-02-15",
"number_line_id": "string",
"description": "string",
"notes": "string",
"draft": false
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())Responses
Response
{
"id": "507f1f77bcf86cd799439011"
}Success responses
201Document convertedapplication/jsonError responses
400Bad requestapplication/json401Invalid or missing API keyapplication/json403Insufficient permissionsapplication/json404Source document not foundapplication/json422Conversion not supportedapplication/json429Rate limit exceededapplication/json