Orders and booking
An order holds the purchase; each shipment is a parcel/leg. Save order_id, every shipment_id and the courier awb when assigned. A forward leg goes to the customer, rto returns an undelivered parcel, and dto is a customer return. Inspect all shipments: there is no single order-level shipping status.
Create and inspect
POST /v1/orders requires orders:write. Add ship: true and shipments:write only when you intend immediate booking. Creating an order may also book it when auto-allocation is enabled, even with ship: false. Check that setting and courier test arrangements first: a booking can incur charges and contact a courier.
This synthetic example requests immediate booking; it is not a read-only quickstart:
{
"channel_order_ref": "#SYN-1001",
"shipping_address": {
"name": "Synthetic Customer",
"phone": "9999999999",
"address1": "10 Example Street",
"city": "Bengaluru",
"state": "Karnataka",
"pincode": "560001"
},
"items": [
{
"sku": "SYN-TEE",
"name": "Synthetic cotton tee",
"quantity": 1,
"unit_price": 499,
"weight_kg": 0.5
}
],
"payment": { "method": "cod", "total": 499 },
"ship": true
}
Use a persistent Message-Id for the request. cod_amount defaults to total for COD payment. The schema also supports order_date, billing_address and warehouse_id. Read with GET /v1/orders/{order_id}; edit allowed fields with PATCH /v1/orders/{order_id}.
A repeated channel_order_ref returns 200 and Order-Existing: true: the original order is unchanged and never booked again, even with ship: true or a different body. A reference belonging to another channel returns 409 order-exists; choose a unique reference or fetch the existing order.
Read the outcome before acting
| Result | Next step |
|---|---|
201, awb assigned | Booking succeeded. Print its label. |
201, awb assigned, label_url: null, warnings | Booking stands; retrieve the label later. |
201, awb: null, booking_error | Order exists but booking failed. Resolve the reported cause. |
202 | Booking was still running at the 60-second deadline. Poll the order until the outcome is known. |
200, Order-Existing: true | Reuse the existing order; this did not change or book it. |
Book an existing order
POST /v1/orders/{order_id}/shipments (scope shipments:write) books unbooked shipments. Already booked AWBs are returned without another booking. 201 means at least one was booked; 200 means all were already booked; 202 means work is still pending.
503 booking-queue-full means nothing started: honour Retry-After. 409 booking-failed carries each shipment's booking_error. For allocation-failed, check wallet balance, serviceability and configuration before retrying. For manifest-failed, the courier refused the booking and it needs reallocation from the dashboard. Repeating API booking alone will not repair it. 409 shipment-cancelled requires a new order; never reuse a cancelled AWB.