Skip to content

Sending to the ERP ​

Driving orders via the API

POST/erp/send/{request_id}integration key

Hands a sendable order to your ERP receive endpoint. Synchronous: AIOTIC calls your endpoint, waits for the answer (30 s timeout by default) and returns its outcome.

Your receive endpointAIOTICYour integration serviceloop[poll with backoff]PROCESSED → inspect result, run your own rules (SDK pipeline)ATTENTION → hand to a person · FAILED → POST /order/retry once, then alertPOST /order/upload (files, request_id, metadata…)1200 { request_id, split: false }2GET /order_status/{request_id}3QUEUED → PROCESSING → PROCESSED | ATTENTION | FAILED4POST /erp/send/{request_id}5POST ‹ERP URL› {request_id, purchase_order}6{ success: true, order_number }7200 { success: true, data: { order_number } } · status SENT8
Your receive endpointAIOTICYour integration serviceloop[poll with backoff]PROCESSED → inspect result, run your own rules (SDK pipeline)ATTENTION → hand to a person · FAILED → POST /order/retry once, then alertPOST /order/upload (files, request_id, metadata…)1200 { request_id, split: false }2GET /order_status/{request_id}3QUEUED → PROCESSING → PROCESSED | ATTENTION | FAILED4POST /erp/send/{request_id}5POST ‹ERP URL› {request_id, purchase_order}6{ success: true, order_number }7200 { success: true, data: { order_number } } · status SENT8

A fully API-driven flow: upload, poll, decide, send.

Preconditions ​

  • Status is PROCESSED, MODIFIED or ATTENTION — otherwise 409.
  • The tenant has an ERP endpoint configured — otherwise 503.
  • No other send is in progress for this order — otherwise 409 (the order is locked as SENDING).

Outcomes ​

Your endpoint answeredAIOTIC returnsOrder status
{"success": true, "order_number": "SO-981"}200 {"success": true, "request_id": "…", "data": {…your body…}}SENT, erp_ref = "SO-981"
{"success": false, "error": "…"}422 {"detail": "ERP error: …"}rolled back (e.g. PROCESSED)
non-JSON / timeout / unreachable500 {"detail": "ERP server error …"}rolled back
bash
curl -X POST https://acme.aiotic.ai/erp/send/7f0c2b6e-1c2a-4f0e-9d4c-2c1a0b7e5a11 -H "X-API-Key: $KEY"
# {"success":true,"request_id":"7f0c…","data":{"success":true,"order_number":"SO-2026-00981"}}
python
from aiotic import AioticErpRejectedError, AioticConflictError

try:
    res = client.erp.send(request_id)
    print("booked as", res.erp_order_number)
except AioticErpRejectedError as e:
    print("ERP said no:", e.erp_error)          # the text your endpoint returned
except AioticConflictError:
    print("not sendable right now (status or concurrent send)")

Automating the decision (model C) ​

python
status = client.orders.get(request_id)
po = status.result
safe = (
    status.status == "PROCESSED"
    and po.customer and po.customer.customer_id in trusted_customers
    and not po.unresolved_items
    and all(i.quantity for i in po.items)
)
if safe:
    client.erp.send(request_id)
else:
    route_to_human(status)

Put the real checks in your receive endpoint (the pipeline) rather than here: the endpoint sees the final payload, and a rejection there shows up for operators as a clear message. The send decision above only needs to answer "is a human required first?".

Overriding ATTENTION ​

Allowed, logged on the AIOTIC side as an explicit override. Your endpoint then receives null article numbers or customer — make sure it rejects those unless a person confirmed.

Sending from your own UI ​

Show the order (from result), let the user confirm, call send. Remember that corrections cannot be submitted through the API today; if your user changes a value, apply the change in your ERP after receiving the payload (match on request_id), or make the correction in the AIOTIC app. See Headless limits today.

Revision 28-051026-58cfad3 · API v1.0.0 · AIOTIC is a product of DevOps Company.