Alladdin

Work in progress

Site en construction

الموقع قيد الإنشاء

Alladdin
POST

Convert incoming document into a purchase document

Scope: inbox:inbox.write https://api.alladdin.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

incomingDocumentId string required

Incoming document identifier (24-char hex ObjectId)

Request

python
import requests

url = "https://api.alladdin.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

201 Document created from the incoming document application/json object id string

Identifier of the created document

draft boolean

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

Error responses

400 The incoming document id is not a valid identifier application/json 401 Invalid or missing API key application/json 403 Insufficient permissions application/json 404 Incoming document not found application/json 409 The incoming document has already been converted application/json object type string title string status integer detail string 422 Validation error application/json 429 Rate limit exceeded application/json

← PreviousAttach incoming document to a document →

Next →Update an incoming document →