Convertir document entrant en document de compra
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.
Paràmetres
Paràmetres de ruta
stringobligatoriID del document entrant (ObjectId hexadecimal de 24 caràcters)
Petició
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())Respostes
Resposta
{
"id": "507f1f77bcf86cd799439011",
"draft": false
}Respostes exitoses
201Document creat a partir del document entrantapplication/jsonIdentifier of the created document
Whether the document was created as a draft and still has to be approved
Respostes d'error
400L'identificador del document entrant no és vàlidapplication/json401API key no vàlida o no proporcionadaapplication/json403Permisos insuficientsapplication/json404Document entrant no trobatapplication/json409El document entrant ja s'ha convertitapplication/json422El document entrant no es pot convertirapplication/json429Límit de sol·licituds exceditapplication/json