Convert incoming document into a purchase document
inbox:inbox.writehttps://api.holded.com/api/v2/inbox/{incomingDocumentId}/exportConverts an incoming document into the purchase document its scan detected, with the data the scan extracted: supplier, dates, lines, taxes, totals and accounting account. The resulting document type is not chosen by the caller, it comes from the scan: a purchase invoice (`purchase`), a purchase refund (`purchaseRefund`), a purchase order (`purchaseOrder`) or a receipt (`receipt`). Read it on the incoming document before converting. The document is created as a draft when the account is configured to create documents in draft mode, when the incoming document came from a bank transaction, or when the fiscal validation (TicketBAI, VeriFactu) rejects a direct creation. The `draft` field of the response says which of the two happened, so a draft can be approved afterwards. Conversion needs a document type, an issued date and — for every type but `receipt` — a supplier already linked to the incoming document. When the scan could not resolve one of them the answer is 422: fill it in with `PUT /api/v2/inbox/{incomingDocumentId}` and convert again. An incoming document is converted once: converting an already converted one answers 409 instead of creating a second document. Two permissions are required: writing on the inbox, and writing on the area that owns the document the scan detected — `accounting:purchases` for `purchase`, `purchaseRefund` and `receipt`, `inventory:purchase-orders` for `purchaseOrder`. Holding only the inbox one answers 403.
Parameters
Path parameters
stringrequiredIncoming document identifier (24-char hex ObjectId)
Request
import requests
url = "https://api.holded.com/api/v2/inbox/507f1f77bcf86cd799439011/export"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
}
response = requests.post(url, headers=headers)
print(response.json())Responses
Response
{
"id": "507f1f77bcf86cd799439011",
"draft": false
}Success responses
201Document created from the incoming documentapplication/jsonIdentifier of the created document
Whether the document was created as a draft and still has to be approved
Error responses
400The incoming document id is not a valid identifierapplication/json401Invalid or missing API keyapplication/json403Insufficient permissionsapplication/json404Incoming document not foundapplication/json409The incoming document has already been convertedapplication/json422Validation errorapplication/json429Rate limit exceededapplication/json