Skip to content

Orders — intake

API reference

Submit documents or raw e-mails for extraction. All uploads return a request_id immediately; processing runs in the background — continue with the status endpoints. Guide: Submitting documents.

Upload document(s) as one order

POST/order/uploadintegration key

Upload one or more files (PDF, JPG, PNG, TXT, MD) that together form one purchase order. Files are stored and queued; extraction runs in the background.

  • Provide your own request_id (UUID v4) to make the call idempotent and to correlate the order in your own systems.
  • Any additional multipart form field is stored as metadata on the order and echoed back by the status endpoints — use it for your own references.
  • Multiple files are never split into multiple orders on this endpoint. Use /order/raw/upload for e-mails that may contain several orders.

Request bodymultipart/form-data

FieldTypeRequiredDescription
filesarray of stringyes
request_idstring | null

Responses

StatusDescriptionBody
200Files accepted and queuedOrderUploadResponse
400Invalid request (malformed UUID, unsupported file, …)ErrorResponse
401Missing or invalid API keyErrorResponse
404Resource not foundErrorResponse
415Unsupported media typeErrorResponse
422Validation ErrorHTTPValidationError
503Tenant not initialised yet (no configuration deployed)ErrorResponse
bash
curl -X POST "https://acme.aiotic.ai/order/upload" -H "X-API-Key: $AIOTIC_API_KEY"
python
up = client.orders.upload(["PO-4711.pdf"], request_id=uuid.uuid4(), metadata={"my_ref": "TICKET-1"})
status = client.orders.wait(up.request_id)
json
{
  "request_id": "550e8400-e29b-41d4-a716-446655440000",
  "split": false
}

Upload a raw e-mail (.eml)

POST/order/raw/uploadintegration key

Submit a complete e-mail (.eml). AIOTIC classifies it; if it is a purchase order the attachments and body are extracted. If the tenant has order splitting enabled and the e-mail carries several orders, the response has split: true and one child order per detected order — poll the children, not the source request_id.

A non-purchase-order e-mail is rejected with 400 and a structured detail object (error: not_a_purchase_order, the detected category, …) and is recorded in the rejected-e-mails list so an operator can override the decision.

Request bodymultipart/form-data

FieldTypeRequiredDescription
filestringyes
request_idstring | null

Responses

StatusDescriptionBody
200Accepted (single order or split children)OrderUploadResponse
400Invalid file, or the e-mail is not a purchase order (structured detail)RawUploadRejection
401Missing or invalid API keyErrorResponse
404Resource not foundErrorResponse
422A split was predicted but no child order could be preparedErrorResponse
503Classification not configured on this tenant yetErrorResponse
bash
curl -X POST "https://acme.aiotic.ai/order/raw/upload" -H "X-API-Key: $AIOTIC_API_KEY"
python
up = client.orders.upload_raw_email("mail.eml")       # AioticValidationError with structured detail for non-orders
for rid in up.request_ids:                             # children when split
    client.orders.wait(rid)
json
{
  "request_id": "550e8400-e29b-41d4-a716-446655440000",
  "split": false
}

Classify a raw e-mail without processing it

POST/order/raw/classifyintegration key

Returns the category the classifier would assign (purchase_order, invoice, quotation, …). Nothing is stored or queued.

Request bodymultipart/form-data

FieldTypeRequiredDescription
filestringyes

Responses

StatusDescriptionBody
200Successful ResponseEmailClassificationResponse
404Resource not foundErrorResponse
422Validation ErrorHTTPValidationError
bash
curl -X POST "https://acme.aiotic.ai/order/raw/classify" -H "X-API-Key: $AIOTIC_API_KEY"
python
client.orders.classify_raw_email("mail.eml").category   # 'purchase_order' | 'quotation' | …

Get all orders from one source e-mail

GET/order/group/{email_group_id}integration key

Aggregate view of a split e-mail — the correlation id, the message id and every child order's status.

Parameters

NameInTypeRequiredDescription
email_group_idpathstringyesCorrelation id shared by all child orders of one split e-mail

Responses

StatusDescriptionBody
200Group with child ordersOrderGroup
404Resource not foundErrorResponse
422Validation ErrorHTTPValidationError
bash
curl -X GET "https://acme.aiotic.ai/order/group/<email_group_id>" -H "X-API-Key: $AIOTIC_API_KEY"
python
group = client.orders.group(email_group_id)      # .orders: list[OrderStatus]

Download an order file

GET/order/{request_id}/{filename}integration key

Returns one file belonging to the order: an original upload (by its file name) or a generated artifact such as latest_result.json (the extracted purchase order). The Content-Type follows the file extension.

Parameters

NameInTypeRequiredDescription
request_idpathstringyesThe order's id (UUID) as returned by the upload endpoints
filenamepathstringyesFile name as listed in the order's attachments, or latest_result.json

Responses

StatusDescriptionBody
200Successful Responseobject
404Resource not foundErrorResponse
422Validation ErrorHTTPValidationError
bash
curl -X GET "https://acme.aiotic.ai/order/<request_id>/<filename>" -H "X-API-Key: $AIOTIC_API_KEY"
python
pdf = client.orders.download_file(request_id, "PO-4711.pdf")
result = client.orders.download_file(request_id, "latest_result.json")

Preview an order file

GET/order/{request_id}/{filename}/previewintegration key

Same as the download endpoint but with an inline Content-Disposition, for showing a PDF or image inside your own review UI.

Parameters

NameInTypeRequiredDescription
request_idpathstringyesThe order's id (UUID) as returned by the upload endpoints
filenamepathstringyesFile name as listed in the order's attachments, or latest_result.json

Responses

StatusDescriptionBody
200Successful Responseobject
404Resource not foundErrorResponse
422Validation ErrorHTTPValidationError
bash
curl -X GET "https://acme.aiotic.ai/order/<request_id>/<filename>/preview" -H "X-API-Key: $AIOTIC_API_KEY"
python
data = client.orders.download_file(request_id, "PO-4711.pdf", preview=True)

Retry a failed order

POST/order/retry/{request_id}integration key

Re-runs processing for an order in FAILED status by creating a new order with the same files. The original moves to REPROCESSED; the response carries the new request_id — track that one from now on.

Parameters

NameInTypeRequiredDescription
request_idpathstringyesThe order's id (UUID) as returned by the upload endpoints

Request bodyapplication/x-www-form-urlencoded

FieldTypeRequiredDescription
hil_promptstring | null

Responses

StatusDescriptionBody
200New order queuedOrderUploadResponse
400Order is not in FAILED status, or has no files to retryErrorResponse
401Missing or invalid API keyErrorResponse
404Resource not foundErrorResponse
422Validation ErrorHTTPValidationError
bash
curl -X POST "https://acme.aiotic.ai/order/retry/<request_id>" -H "X-API-Key: $AIOTIC_API_KEY"
python
new = client.orders.retry(request_id)            # track new.request_id from now on

Documentation revision 3 · Published 8 September 2026 · commit 6862d5e. Verified against AIOTIC API v1.0.0. AIOTIC is a product of DevOps Company.