Create Orders in Bulk
Create up to 50 orders in one call, or up to 500 in the background.
Create many orders in one request. Each item in orders uses the same body as Create New Order.
Use the synchronous endpoint for up to 50 orders. Use the asynchronous endpoint for up to 500 orders, then follow the batch with polling or a server-sent event stream.
Callers need the orders edit permission. Authorize with the same token from Generate Access Token.
Synchronous bulk create
POST /v4/orders/bulk/create
Waits until every order in the batch has been processed, then returns one result per item. The HTTP status is 200 even when some orders fail. Maximum 50 orders.
Headers
Content-Type
application/json
Authorization
<token>
Body
{
"orders": [
{
"instaShip": false,
"source": "s2s",
"orderType": "delivery",
"courierID": "64e14223c9780561589926c4",
"customerDetails": {
"name": "Ahmed Ali",
"phone": "0100000XXXX",
"address": {
"addressLine": "12 El Nasr St, Nasr City",
"city": "Cairo",
"area": "Nasr City"
}
},
"orderDetails": {
"referenceNumber": "S2S-260826-001",
"paymentType": "with_cash_collection",
"packageType": "parcel",
"amount": 350.5,
"noOfItems": 2,
"openPackageAllowed": false,
"description": "T-shirts x2"
}
}
]
}orders must contain at least 1 item and at most 50. A larger or empty batch is rejected with 400 and nothing is created.
Response
The batch still returns 200. The failed item has success: false and an error object. index is the position of that order in the orders array.
summary.total
Orders submitted
summary.succeeded
Orders that succeeded
summary.failed
Orders that failed
results[].index
Position in the submitted orders array
results[].success
true when that order was created or an existing pending order was returned
results[].status
Status from the single-order create flow. 201 for a new order, 200 when the reference number already exists
results[].data
Created order, present when success is true
results[].error.errorCode
Machine-readable failure code, present when success is false
Asynchronous bulk create
POST /v4/orders/bulk/create/async
Accepts up to 500 orders and returns immediately with a processId. The batch runs in the background. The body is the same orders array as the synchronous endpoint.
Response
Poll the result
GET /v4/orders/bulk/create/{processId}/result
While the batch is running, the response has counters only. After it finishes, summary and items are included.
items uses the same fields as results on the synchronous endpoint. A failed batch has "status": "failed" and may include errorMessage.
Listen for events
GET /v4/orders/bulk/create/{processId}/events
Server-sent events. Send Accept: text/event-stream and the same Authorization header. The stream closes after a terminal event.
progress
While the batch is running. Counters only, no per-order items.
done
The batch finished. Includes summary and items.
failed
The batch crashed. May include errorMessage.
result
You connected after the batch had already finished. One event with the full snapshot, then the stream closes.
The completion event is done. A different merchant receives 403. An unknown or expired process id returns 404.