Saltar al contenido principal
POST

Convertir documento entrante en documento de compra

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.

Parámetros

Parámetros de ruta

incomingDocumentIdstringobligatorio

ID del documento entrante (ObjectId hexadecimal de 24 caracteres)

Petición

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())

Respuestas

Respuesta

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

Respuestas exitosas

201Documento creado a partir del documento entranteapplication/json
object
idstring

Identifier of the created document

draftboolean

Whether the document was created as a draft and still has to be approved

Respuestas de error

400El identificador del documento entrante no es válidoapplication/json
401API key inválida o no proporcionadaapplication/json
403Permisos insuficientesapplication/json
404Documento entrante no encontradoapplication/json
409El documento entrante ya ha sido convertidoapplication/json
object
typestring
titlestring
statusinteger
detailstring
422El documento entrante no se puede convertirapplication/json
429Límite de solicitudes excedidoapplication/json