Create Bulk Orders API
This endpoint allows you to create multiple fulfillment orders in a single request. This is efficient for high-volume processing.
POST
https://api-fulfillment.bosta.co/api/v1/orders/bulkSend an object containing an array of orders to be processed and a smart flag controlling how failures are handled. Each order follows the same validation rules as the single create order endpoint.
REQUEST BODY
{
"smart": true,
"orders": [
{
"type": "FORWARD",
"orderAlias": "bulk_order_01",
"uniqueOrderReference": "STORE-ORD-100246", // unique per order, used as the idempotency key
"items": [
{ "skuCode": "product-1",
"quantity": 2,
"price": 100
}
],
"shippingAddress": {
"firstLine": "102 street, Alexandria",
"cityId": "Jrb6X6ucjiYgMP4T7"
},
"shipment": {
"codAmount":"100",
"note":"deliver am",
"allowToOpenPackage":false
},
"customer": {
"firstName": "Ahmed",
"lastName":"Mohamed",
"mobile": "01012101410"
},
"externalPlatform": {
"platform": "custom_api", // it will be static
"webhookUrl": "http://your-system.com/webhook" // implement this to receive status updates
}
}
]
}
🔄 WEBHOOK CALLBACK (POST)
Bosta will send this data to your webhookUrl when the order status changes:
{
"id": "order.id",
"status": "status_string",
"type": "order.type",
"trackingNumber": "tracking_number",
"orderAlias": "your_alias",
"reason": "failure_reason"
}
Responses
201Bulk orders accepted
400Validation error in one or more orders, and smart is false
Request Body Params
- orders (array, required): The array of order objects to create. Each order follows the same schema and validation rules as the single create order endpoint.
- orders[].uniqueOrderReference (string): A unique identifier for each order, generated by your system. It is the idempotency key for that order — see Idempotency below.
- smart (boolean, required): Controls how the request behaves when some orders in the array fail validation.
true: The request is processed in partial success mode. Valid orders are created, and failed orders are skipped. The failure reason for each skipped order is sent to you via the webhook.false: The request is processed all-or-nothing. If any single order in the array fails validation, no orders are created and the entire request returns a400error.
Important Notes
- Partial Success: When
smartistrueand one order in the array fails validation, the remaining valid orders are still created. - All-or-Nothing: When
smartisfalseand one order in the array fails validation, the entire request will return a 400 error and none of the orders will be created.
Idempotency with uniqueOrderReference
Each order in the orders array should carry its own uniqueOrderReference: a unique ID from your system (for example, your store's order number or a UUID). Bosta uses it as the idempotency key for that order, so re-sending an order with a reference that was already used will not create a duplicate order.
This makes bulk requests safe to retry:
- If a bulk request times out or fails with a
5xxerror, you can resend the same batch with the same references. Orders that were already created are not created again. - With
smart: true, you can fix the failed orders reported via the webhook and resend them with their original references, without duplicating the orders that already succeeded. - Every order in the array must have a different
uniqueOrderReference. Never reuse a reference for a different order. - Generate the reference once per order on your side, store it, and reuse it on every retry of that order.