Appearance
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.
Rendering diagram…
A fully API-driven flow: upload, poll, decide, send.
Preconditions
- Status is
PROCESSED,MODIFIEDorATTENTION— otherwise409. - The tenant has an ERP endpoint configured — otherwise
503. - No other send is in progress for this order — otherwise
409(the order is locked asSENDING).
Outcomes
| Your endpoint answered | AIOTIC returns | Order 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 / unreachable | 500 {"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.