Skip to main content
POST

Convert incoming document into a purchase document

Scope:inbox:inbox.write
https://api.holded.com/api/v2/inbox/{incomingDocumentId}/export

Converts 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

incomingDocumentIdstringrequired

Incoming document identifier (24-char hex ObjectId)

Request

python
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

json
{
  "id": "507f1f77bcf86cd799439011",
  "draft": false
}

Success responses

201Document created from the incoming documentapplication/json
object
idstring

Identifier of the created document

draftboolean

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/json
401Invalid or missing API keyapplication/json
403Insufficient permissionsapplication/json
404Incoming document not foundapplication/json
409The incoming document has already been convertedapplication/json
object
typestring
titlestring
statusinteger
detailstring
422Validation errorapplication/json
429Rate limit exceededapplication/json