Skip to main content

Orders

5 API calls in this section.

Create Order

Customer Portal / Delivery Management / Orders
POST/customer/delivery/orders

Creates a delivery order from the authenticated customer portal. The backend enforces customer_id from the access token and calculates unit size from package items. Warehouse staging: - The frontend does not send requires_warehouse_staging or staging_warehouse_id. - The backend resolves the selected delivery service's effective warehouse policy. - When warehouse_policies.pickup_delivery_required=true, the backend selects the configured default staging warehouse or applies staging_selection_strategy. - A staged order creates a parent delivery and two child legs: pickup to warehouse, then warehouse to delivery. - At least one package item is required because staged items are registered for warehouse receiving. Payment: Use payment.method_id (UUID from GET /customer/delivery/payment-methods). - Wallet: method_id = wallet UUID. Customer pays upfront (payer_type=sender). - COD: method_id = cod UUID, cod_amount REQUIRED. Receiver pays on delivery (payer_type=receiver). - Gateway (e.g. Nass): method_id = gateway UUID, back_ref REQUIRED (return URL). Frontend integration contract: - Submit delivery_service_id and the normal pickup, dropoff, payment, and package fields. - Do not prompt for or submit a staging warehouse. - Use data.order.id as the parent order ID and data.children for staged leg details. - Handle HTTP 400 for missing package items, incompatible delivery type, unresolved warehouse, ambiguous warehouse selection, or unavailable route segments.

Send a bearer token in the Authorization header for an authenticated OnDi user session.
Request
curl
1curl --request POST "$ONDI_BASE_URL/customer/delivery/orders" \2  --header "Authorization: Bearer {{access_token}}" \3  --header "Content-Type: application/json" \4  --header "Content-Type: application/json" \5  --data '{6  "pickup": {7    "location": {8      "full_address": "123 Main St, New York, NY 10001, US",9      "latitude": 40.7128,10      "longitude": -74.006,11      "country": "US",12      "city": "New York",13      "state": "NY",14      "postal_code": "10001",15      "contact_info": {16        "name": "John Doe",17        "phone": "+1234567890"18      }19    },20    "scheduled_pickup_time": "2026-02-05T10:00:00Z"21  },22  "dropoff": {23    "location": {24      "full_address": "456 Oak Ave, Brooklyn, NY 11201, US",25      "latitude": 40.7589,26      "longitude": -73.9851,27      "country": "US",28      "city": "Brooklyn",29      "state": "NY",30      "postal_code": "11201",31      "contact_info": {32        "name": "Jane Smith",33        "phone": "+1987654321"34      }35    },36    "scheduled_delivery_time": "2026-02-05T14:00:00Z"37  },38  "delivery_service_id": "uuid",39  "payment": {40    "method_id": "0760f75f-4aee-4776-afc0-4057d7ad458f",41    "cod_amount": 10042  },43  "external_reference_id": "ORD-12345",44  "notes": "Handle with care",45  "special_instructions": "Fragile items",46  "package": {47    "items": [48      {49        "name": "Product A",50        "quantity": 2,51        "description": "Electronics",52        "weight": 1.5,53        "length": 30,54        "width": 20,55        "height": 1556      },57      {58        "name": "Product B",59        "quantity": 1,60        "description": "Clothing",61        "weight": 0.5,62        "length": 25,63        "width": 15,64        "height": 1065      }66    ]67  }68}'
Request body
json
1{2  "pickup": {3    "location": {4      "full_address": "123 Main St, New York, NY 10001, US",5      "latitude": 40.7128,6      "longitude": -74.006,7      "country": "US",8      "city": "New York",9      "state": "NY",10      "postal_code": "10001",11      "contact_info": {12        "name": "John Doe",13        "phone": "+1234567890"14      }15    },16    "scheduled_pickup_time": "2026-02-05T10:00:00Z"17  },18  "dropoff": {19    "location": {20      "full_address": "456 Oak Ave, Brooklyn, NY 11201, US",21      "latitude": 40.7589,22      "longitude": -73.9851,23      "country": "US",24      "city": "Brooklyn",25      "state": "NY",26      "postal_code": "11201",27      "contact_info": {28        "name": "Jane Smith",29        "phone": "+1987654321"30      }31    },32    "scheduled_delivery_time": "2026-02-05T14:00:00Z"33  },34  "delivery_service_id": "uuid",35  "payment": {36    "method_id": "0760f75f-4aee-4776-afc0-4057d7ad458f",37    "cod_amount": 10038  },39  "external_reference_id": "ORD-12345",40  "notes": "Handle with care",41  "special_instructions": "Fragile items",42  "package": {43    "items": [44      {45        "name": "Product A",46        "quantity": 2,47        "description": "Electronics",48        "weight": 1.5,49        "length": 30,50        "width": 20,51        "height": 1552      },53      {54        "name": "Product B",55        "quantity": 1,56        "description": "Clothing",57        "weight": 0.5,58        "length": 25,59        "width": 15,60        "height": 1061      }62    ]63  }64}

Request body fields

pickupExample
object

Example field from the request body.

pickup.locationExample
object

Example field from the request body.

pickup.location.full_addressExample
string

Example field from the request body.

pickup.location.latitudeExample
number

Example field from the request body.

pickup.location.longitudeExample
number

Example field from the request body.

pickup.location.countryExample
string

Example field from the request body.

pickup.location.cityExample
string

Example field from the request body.

pickup.location.stateExample
string

Example field from the request body.

pickup.location.postal_codeExample
string

Example field from the request body.

pickup.location.contact_infoExample
object

Example field from the request body.

pickup.scheduled_pickup_timeExample
string

Example field from the request body.

dropoffExample
object

Example field from the request body.

dropoff.locationExample
object

Example field from the request body.

dropoff.location.full_addressExample
string

Example field from the request body.

dropoff.location.latitudeExample
number

Example field from the request body.

dropoff.location.longitudeExample
number

Example field from the request body.

dropoff.location.countryExample
string

Example field from the request body.

dropoff.location.cityExample
string

Example field from the request body.

dropoff.location.stateExample
string

Example field from the request body.

dropoff.location.postal_codeExample
string

Example field from the request body.

dropoff.location.contact_infoExample
object

Example field from the request body.

dropoff.scheduled_delivery_timeExample
string

Example field from the request body.

delivery_service_idExample
string

Example field from the request body.

paymentExample
object

Example field from the request body.

payment.method_idExample
string

Example field from the request body.

payment.cod_amountExample
number

Example field from the request body.

external_reference_idExample
string

Example field from the request body.

notesExample
string

Example field from the request body.

special_instructionsExample
string

Example field from the request body.

packageExample
object

Example field from the request body.

package.itemsExample
array<object>

Example field from the request body.

package.items.nameExample
string

Example field from the request body.

package.items.quantityExample
number

Example field from the request body.

package.items.descriptionExample
string

Example field from the request body.

package.items.weightExample
number

Example field from the request body.

package.items.lengthExample
number

Example field from the request body.

package.items.widthExample
number

Example field from the request body.

package.items.heightExample
number

Example field from the request body.

Headers

AuthorizationOptional
header string

Bearer {{access_token}}

Content-TypeOptional
header string

application/json

Responses

Success201Created
Response body
json
1{2  "success": true,3  "data": {4    "order": {5      "id": "parent-delivery-uuid",6      "delivery_code": "DEL-12345",7      "status": "pending",8      "payment_status": "pending",9      "payment_method": "cod",10      "cod_amount": 100,11      "delivery_fee": 25.5,12      "requires_warehouse_staging": true,13      "staging_warehouse_id": "warehouse-uuid",14      "created_at": "2026-02-04T10:00:00Z"15    },16    "children": [17      {18        "id": "inbound-leg-uuid",19        "direction": "inbound",20        "status": "pending"21      },22      {23        "id": "outbound-leg-uuid",24        "direction": "outbound",25        "status": "draft"26      }27    ],28    "redirectUrl": null29  }30}
Wallet Payment Example201Created
Response body
json
1{2  "success": true,3  "data": {4    "order": {5      "id": "uuid",6      "delivery_code": "DEL-12345",7      "status": "pending",8      "payment_status": "paid",9      "payment_method": "wallet",10      "cod_amount": null,11      "delivery_fee": 25.5,12      "requires_warehouse_staging": false,13      "staging_warehouse_id": null,14      "created_at": "2026-02-04T10:00:00Z"15    },16    "children": [],17    "redirectUrl": null18  }19}
Staged Order Missing Package Items400Bad Request
Response body
json
1{2  "success": false,3  "message": "package_items_required_for_staged_delivery"4}
Staging Warehouse Cannot Be Resolved400Bad Request
Response body
json
1{2  "success": false,3  "message": "no_staging_warehouse_available"4}

List Orders

Customer Portal / Delivery Management / Orders
GET/customer/delivery/orders?page=1&limit=10&status=pending

Lists customer's delivery orders with filters and pagination.

Send a bearer token in the Authorization header for an authenticated OnDi user session.
Request
curl
1curl --request GET "$ONDI_BASE_URL/customer/delivery/orders?page=1&limit=10&status=pending" \2  --header "Authorization: Bearer {{access_token}}"

Query parameters

pageOptional
query string

1

Page number (>=1)

limitOptional
query string

10

Items per page (1-50)

statusOptional
query string

pending

Filter by status

Headers

AuthorizationOptional
header string

Bearer {{access_token}}

Responses

Success200OK
Response body
json
1{2  "success": true,3  "data": {4    "orders": [5      {6        "id": "uuid",7        "delivery_code": "DEL-12345",8        "status": "pending",9        "payment_status": "paid",10        "payment_method": "wallet",11        "delivery_fee": 25.5,12        "from": "123 Main St",13        "to": "456 Oak Ave",14        "created_at": "2026-02-04T10:00:00Z",15        "updated_at": "2026-02-04T10:00:00Z"16      }17    ],18    "pagination": {19      "page": 1,20      "limit": 10,21      "total": 2522    }23  }24}

Export Orders (CSV)

Customer Portal / Delivery Management / Orders
GET/customer/delivery/orders/export

Streams a CSV export of the customer's orders using the same filters as List Orders. Supports realtime progress (stream) and abort by canceling the HTTP request. Response headers: - Content-Disposition (filename) - X-Total-Rows (for progress) - X-Export-Tenant-Id - X-Export-Customer-Id Request Body: text/csv

Send a bearer token in the Authorization header for an authenticated OnDi user session.
Request
curl
1curl --request GET "$ONDI_BASE_URL/customer/delivery/orders/export" \2  --header "Authorization: Bearer {{access_token}}"

Headers

AuthorizationOptional
header string

Bearer {{access_token}}

Responses

No response example is available for this endpoint yet.

Get Order

Customer Portal / Delivery Management / Orders
GET/customer/delivery/orders/:id

Gets full order details for a specific delivery.

Send a bearer token in the Authorization header for an authenticated OnDi user session.
Request
curl
1curl --request GET "$ONDI_BASE_URL/customer/delivery/orders/:id" \2  --header "Authorization: Bearer {{access_token}}"

Path parameters

idRequired
path string

uuid

Delivery order ID

Headers

AuthorizationOptional
header string

Bearer {{access_token}}

Responses

Success200OK
Response body
json
1{2  "success": true,3  "data": {4    "order": {5      "id": "uuid",6      "delivery_code": "DEL-12345",7      "status": "in_transit",8      "payment_status": "paid",9      "payment_method": "wallet",10      "cod_amount": null,11      "delivery_fee": 25.5,12      "created_at": "2026-02-04T10:00:00Z",13      "pickup": {14        "location": {15          "full_address": "123 Main St, New York, NY 10001, US",16          "latitude": 40.7128,17          "longitude": -74.006,18          "country": "US",19          "city": "New York",20          "state": "NY",21          "postal_code": "10001",22          "contact_info": {23            "name": "John Doe",24            "phone": "+1234567890"25          }26        },27        "scheduled_time": "2026-02-05T10:00:00Z"28      },29      "dropoff": {30        "location": {31          "full_address": "456 Oak Ave, Brooklyn, NY 11201, US",32          "latitude": 40.7589,33          "longitude": -73.9851,34          "country": "US",35          "city": "Brooklyn",36          "state": "NY",37          "postal_code": "11201",38          "contact_info": {39            "name": "Jane Smith",40            "phone": "+1987654321"41          }42        },43        "scheduled_time": "2026-02-05T14:00:00Z"44      },45      "service": {46        "id": "uuid",47        "name": "Standard Delivery",48        "code": "STD",49        "delivery_type": {50          "id": "uuid",51          "name": "Delivery",52          "code": "delivery"53        }54      },55      "unit_size": 3,56      "package": {57        "items": [58          {59            "id": "uuid",60            "name": "Product A",61            "quantity": 2,62            "description": "Electronics",63            "weight": 1.5,64            "length": 30,65            "width": 20,66            "height": 15,67            "item_code": "DEL-12345-1",68            "label_url": null,69            "created_at": "2026-02-04T10:00:00Z",70            "updated_at": "2026-02-04T10:00:00Z"71          }72        ],73        "total_items": 1,74        "total_quantity": 275      },76      "status_updates": [77        {78          "status": "pending",79          "timestamp": "2026-02-04T10:00:00Z"80        },81        {82          "status": "assigned",83          "timestamp": "2026-02-04T10:30:00Z",84          "location": {85            "latitude": 40.7128,86            "longitude": -74.00687          },88          "notes": "Assigned to driver"89        },90        {91          "status": "in_transit",92          "timestamp": "2026-02-04T11:00:00Z"93        }94      ],95      "tracking": {96        "driver": {97          "name": "John Doe",98          "phone": "+1234567890"99        },100        "last_location": {101          "latitude": 40.75,102          "longitude": -73.99,103          "updated_at": "2026-02-04T11:00:00Z"104        }105      }106    }107  }108}

Cancel Order

Customer Portal / Delivery Management / Orders
POST/customer/delivery/orders/:id/cancel

Cancels a delivery order (if allowed by status).

Send a bearer token in the Authorization header for an authenticated OnDi user session.
Request
curl
1curl --request POST "$ONDI_BASE_URL/customer/delivery/orders/:id/cancel" \2  --header "Authorization: Bearer {{access_token}}" \3  --header "Content-Type: application/json" \4  --header "Content-Type: application/json" \5  --data '{6  "reason": "Customer requested cancellation"7}'
Request body
json
1{2  "reason": "Customer requested cancellation"3}

Path parameters

idRequired
path string

uuid

Delivery order ID

Request body fields

reasonExample
string

Example field from the request body.

Headers

AuthorizationOptional
header string

Bearer {{access_token}}

Content-TypeOptional
header string

application/json

Responses

Success200OK
Response body
json
1{2  "success": true,3  "data": {4    "order": {5      "id": "uuid",6      "status": "cancelled",7      "updated_at": "2026-02-04T12:00:00Z"8    }9  }10}