Plan and approve trips for your own riders
Turn queued OUTLET orders into trips for your online riders, approve them in one call or in the portal, and read the trips back.
3 min readUpdated Developers
These endpoints are for orders created with delivery_mode: "OUTLET". They optimise the queued orders across your online riders with the same engine as the outlet portal and, by default, assign the trips at once. MINIDROP orders are never touched. All calls need your access token.
Set BASE_URL to the API address you were given. The examples below use $BASE_URL and $ACCESS_TOKEN.
Recommended flow#
POST /api/orders {..., "delivery_mode": "OUTLET"} repeat for each orderPOST /api/trips {} send an Idempotency-Key header<- webhooks: order.updated with status ASSIGNED, then PICKED_UP, DELIVERED ...Plan trips#
POST /api/trips. Every body field is optional.
Field | Default and meaning |
|---|---|
| All queued |
| All eligible riders. Restrict to these riders (they must belong to your outlet) |
|
|
Send the optional header Idempotency-Key: <string, max 100 chars>. Reusing a key within 24 hours returns the first response and creates nothing new, so a retry after a timeout is safe.
curl -X POST "$BASE_URL/api/trips" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: dispatch-2026-10-20-1" \ -d '{}'Response 201:
{ "success": true, "data": { "batch_id": "uuid", "status": "DISPATCHED", "is_optimized": true, "baseline_distance_km": 42.1, "optimized_distance_km": 27.4, "km_saved": 14.7, "trips": [ { "trip_id": "uuid", "status": "ASSIGNED", "distance_km": 13.2, "delivery_executive": { "id": "uuid", "name": "Ravi", "phone": "+9198..." }, "orders": [ { "order_id": "uuid", "order_number": "MD...", "reference_order_id": "POS-1", "sequence": 0, "status": "ASSIGNED", "track_url": null } ] } ], "unassigned_orders": [{ "order_id": "uuid", "reason": "UNKNOWN" }], "skipped_orders": [{ "order_id": "uuid", "reason": "NOT_QUEUED" }] }, "message": "Trips created and assigned"}statusisDISPATCHEDwhenauto_assignistrue, otherwisePENDING_APPROVAL.sequenceis the drop order inside the trip, starting at 0.track_urlis the customer tracking link of that order. It isnullwhile the batch isPENDING_APPROVAL.unassigned_ordersare valid orders the optimiser could not place. They stay queued for the next call.reasonis currently alwaysUNKNOWN.skipped_ordersare ids fromorder_idsthat were not eligible.reasonisNOT_FOUND(also used for another outlet’s order),NOT_OUTLET_MODE,NOT_QUEUEDorCANCELLED.
Errors#
Status and code | When |
|---|---|
| Bad body or header. Unknown |
| Another dispatch for your outlet is running. Retry shortly |
| A batch already waits for approval. |
| No eligible rider is online |
| A rider went offline before approval. The batch stays |
| Nothing eligible to dispatch ( |
Approve a batch#
If you used auto_assign: false, approve the batch in the outlet portal (see Review, adjust and approve each rider’s route) or with the API:
curl -X POST "$BASE_URL/api/trips/batches/$BATCH_ID/approve" \ -H "Authorization: Bearer $ACCESS_TOKEN"It approves a PENDING_APPROVAL batch of your outlet and returns the same data shape, with empty unassigned_orders and skipped_orders. 404 NOT_FOUND if the batch does not exist or was already processed.
Read trips#
GET /api/trips/:tripIdreturns one trip of your outlet:trip_id,batch_id,status,distance_km,delivery_executive,orders(in drop order, with status andtrack_url),created_at,started_at,completed_at.GET /api/tripslists your trips, newest first. Querystatus:active(the default:PENDING_APPROVAL,CREATED,ASSIGNED,STARTED),completedorall.limitis 1 to 100 (default 50).cursortakesdata.next_cursorfrom the previous page. The response hasdata.tripsanddata.next_cursor(nullon the last page).
Why do I get NO_RIDERS_ONLINE?
No eligible rider is online. A rider counts as online with work_online: true and a location received in the last 5 minutes. See Add and manage your riders from your system.
Can I run POST /api/trips twice safely?
Yes, if you send the same Idempotency-Key within 24 hours. You get the first response back and nothing new is created.
Was this page helpful?
Related guides
Test safely in the sandbox
Use the practice server to test orders, trips and webhooks without real riders: how the simulation runs and which scenarios exist.
3 min readDevelopers
Receive order updates with webhooks
Set your webhook URL, check the X-API-SECRET header, read the order.updated payload and handle retries.
4 min readDevelopers
Add and manage your riders from your system
Create, list, update and remove your own riders with the delivery-executives endpoints, and what the rider does next.
4 min readDevelopers
Get your API credentials
Create your API key in the outlet portal, hand it over safely to your software team and make a new one when needed.
3 min readDevelopers
