Skip to main content

Drivers

11 API calls in this section.

List Drivers

Delivery & Last-Mile / Drivers
GET/delivery/drivers?page=1&limit=10&search=&status=&vehicle_id=&zone_id=&column_filters={"status":"active","is_online":true,"created_at":{"from":"2025-01-01","to":"2025-12-31"},"vehicle_id":"uuid1,uuid2","zone_id":"uuid3,uuid4","license_number":"DL123"}&sort_by=created_at&sort_order=desc&tenant_id=&language=en

Get a paginated list of drivers with optional filtering. Requires view:tenant permission or system admin privileges. Authentication: - Type: JWT Bearer Token - Header: Authorization: Bearer {{access_token}} - Permissions: Requires view:tenant or user must be a system admin. Path Parameters: - None Query Parameters: - page (integer, optional, default: 1): Page number for pagination. Example: 1 - limit (integer, optional, default: 10): Number of items per page. Example: 10 - status (string, optional): Filter by driver status (e.g., 'active', 'inactive', 'on_break'). Example: active - vehicle_id (string, UUID, optional): Filter by vehicle ID. Example: a1b2c3d4-e5f6-7890-1234-567890abcdef - zone_id (string, UUID, optional): Filter by delivery zone ID. Example: b2c3d4e5-f6a7-8901-2345-67890abcdef0 - tenant_id (string, UUID, optional): Tenant ID. If not provided, it's taken from the authenticated user's context. Example: c3d4e5f6-a7b8-9012-3456-7890abcdef01 - search (string, optional): Search term to filter by driver's full name or license number. Example: John - language (string, optional, default: 'en'): Preferred language for response messages. Example: en Request Body: - None Responses: Returns a list of drivers. Response Fields: - success (boolean): Indicates if the request was successful. - message (string): Localized success message. - drivers (array): List of driver objects. - id (string, UUID): Driver's unique ID. - tenant_id (string, UUID): Tenant ID. - status (string): Current status of the driver. - created_at (string, ISO8601 DateTime): Timestamp of creation. - license_number (string): Driver's license number. - vehicle (object): Assigned vehicle details. - id (string, UUID): Vehicle ID. - name (string): Vehicle name. - zones (array of objects): Assigned delivery zones. - id (string, UUID): Zone ID. - name (string): Zone name. - user (object): Associated user details. - id (string, UUID): User ID. - full_name (string): User's full name. - page (integer): Current page number. - limit (integer): Number of items per page. - total (integer): Total number of drivers found. If tenant_id is missing and not available in context. Standard unauthorized response if token is missing or invalid. User does not have the required permissions. If there's an issue with the database query or an unexpected server error.

Send a bearer token in the Authorization header for an authenticated OnDi user session.
Request
curl
1curl --request GET "$ONDI_BASE_URL/delivery/drivers?page=1&limit=10&search=&status=&vehicle_id=&zone_id=&column_filters={"status":"active","is_online":true,"created_at":{"from":"2025-01-01","to":"2025-12-31"},"vehicle_id":"uuid1,uuid2","zone_id":"uuid3,uuid4","license_number":"DL123"}&sort_by=created_at&sort_order=desc&tenant_id=&language=en" \2  --header "Authorization: Bearer {{access_token}}"

Query parameters

pageOptional
query string

1

Page number for pagination

limitOptional
query string

10

Number of items per page

searchOptional
query string

Search by driver full name, phone, email, or license number

statusOptional
query string

Filter by driver status (active, inactive, on_break, etc.)

vehicle_idOptional
query string

Filter by vehicle ID

zone_idOptional
query string

Filter by delivery zone ID

column_filtersOptional
query string

{"status":"active","is_online":true,"created_at":{"from":"2025-01-01","to":"2025-12-31"},"vehicle_id":"uuid1,uuid2","zone_id":"uuid3,uuid4","license_number":"DL123"}

JSON string for column filters. Supported keys: status, is_online, created_at, vehicle_id, zone_id, license_number

sort_byOptional
query string

created_at

Sort column. Supported values: created_at, license_number

sort_orderOptional
query string

desc

Sort order. Supported values: asc, desc

tenant_idOptional
query string

Tenant ID (optional if in auth token)

languageOptional
query string

en

Preferred language for response messages

Headers

AuthorizationOptional
header string

Bearer {{access_token}}

Responses

Success Response200OK
Response body
json
1{2  "success": true,3  "message": "Drivers retrieved successfully",4  "drivers": [5    {6      "id": "driver-uuid-123",7      "tenant_id": "tenant-uuid-456",8      "status": "active",9      "created_at": "2023-10-26T10:00:00Z",10      "license_number": "XYZ12345",11      "vehicle": {12        "id": "vehicle-uuid-789",13        "name": "Van 101"14      },15      "zones": [16        {17          "id": "zone-uuid-abc",18          "name": "Downtown"19        }20      ],21      "user": {22        "id": "user-uuid-def",23        "full_name": "John Driver"24      }25    }26  ],27  "page": 1,28  "limit": 10,29  "total": 130}
Error (400 Bad Request - Invalid Request)400
Response body
json
1{2  "success": false,3  "message": "Invalid request"4}
Standard unauthorized response if token is missing or invalid.401
Response body
json
1{2  "error": "Unauthorized",3  "message": "Authentication token is missing or invalid",4  "status": 4015}
Error (403 Forbidden - Insufficient Permissions)403
Response body
json
1{2  "success": false,3  "message": "Insufficient permissions"4}
Error (500 Internal Server Error)500
Response body
json
1{2  "success": false,3  "message": "Internal server error",4  "error": {5    "message": "database error details"6  }7}

Get Driver

Delivery & Last-Mile / Drivers
GET/delivery/drivers/:driverId?tenant_id=&language=en

Get details for a specific driver. Requires view:tenant or manage:operations:tenant permission or system admin privileges. Authentication: - Type: JWT Bearer Token - Header: Authorization: Bearer {{access_token}} - Permissions: Requires view:tenant, manage:operations:tenant, or user must be a system admin. Path Parameters: - driverId (string, UUID, required): The unique identifier of the driver to retrieve. Example: driver-uuid-123 Query Parameters: - tenant_id (string, UUID, optional): Tenant ID. If not provided, it's taken from the authenticated user's context. Example: c3d4e5f6-a7b8-9012-3456-7890abcdef01 - language (string, optional, default: 'en'): Preferred language for response messages. Example: en Request Body: - None Responses: Returns details of the specified driver. Response Fields: - success (boolean): Indicates if the request was successful. - message (string): Localized success message. - driver (object): Driver details. - id (string, UUID): Driver's unique ID. - user (object): Associated user details. - id (string, UUID): User ID. - full_name (string): User's full name. - vehicle (object): Assigned vehicle details. - id (string, UUID): Vehicle ID. - name (string): Vehicle name. - license_number (string): Driver's license number. - zones (array of objects): Assigned delivery zones. - id (string, UUID): Zone ID. - name (string): Zone name. - preferred_zones (array of objects): Preferred delivery zones for auto-assignment priority. Contains zone details with id, name, and code. Empty array if no preferred zones are set. - id (string, UUID): Zone ID. - name (string): Zone name. - code (string): Zone code. - driver_details (object): Additional JSON details about the driver. - status (string): Current status of the driver. If tenant_id is missing and not available in context. Standard unauthorized response. User does not have the required permissions. If the driver with the specified ID does not exist or does not belong to the tenant. If there's an issue with the database query or an unexpected server error.

Send a bearer token in the Authorization header for an authenticated OnDi user session.
Request
curl
1curl --request GET "$ONDI_BASE_URL/delivery/drivers/:driverId?tenant_id=&language=en" \2  --header "Authorization: Bearer {{access_token}}"

Path parameters

driverIdRequired
path string

uuid

ID of the driver to retrieve

Query parameters

tenant_idOptional
query string

Tenant ID (optional if in auth token)

languageOptional
query string

en

Preferred language for response messages

Headers

AuthorizationOptional
header string

Bearer {{access_token}}

Responses

Success Response200OK
Response body
json
1{2  "success": true,3  "message": "Driver retrieved successfully",4  "driver": {5    "id": "driver-uuid-123",6    "user": {7      "id": "user-uuid-def",8      "full_name": "John Driver"9    },10    "vehicle": {11      "id": "vehicle-uuid-789",12      "name": "Van 101"13    },14    "license_number": "XYZ12345",15    "zones": [16      {17        "id": "zone-uuid-abc",18        "name": "Downtown"19      }20    ],21    "preferred_zones": [22      {23        "id": "zone-uuid-abc",24        "name": "Downtown",25        "code": "DT"26      }27    ],28    "driver_details": {29      "rating": 4.5,30      "experience_years": 331    },32    "status": "active"33  }34}
Error - Driver Not Found404Not Found
Response body
json
1{2  "success": false,3  "message": "Driver not found"4}
Error (400 Bad Request - Invalid Request)400
Response body
json
1{2  "success": false,3  "message": "Invalid request"4}
Standard unauthorized response.401
Response body
json
1{2  "error": "Unauthorized",3  "message": "Authentication token is missing or invalid",4  "status": 4015}
Error (403 Forbidden - Insufficient Permissions)403
Response body
json
1{2  "success": false,3  "message": "Insufficient permissions"4}
Error (500 Internal Server Error)500
Response body
json
1{2  "success": false,3  "message": "Internal server error"4}

Create Driver

Delivery & Last-Mile / Drivers
POST/delivery/drivers?tenant_id=&language=en

Create a new driver. Requires manage:users:tenant permission. Request Body Fields: - user_id (string, UUID, required): User ID to assign as driver - vehicle_id (string, UUID, required): Vehicle ID to assign to driver - license_number (string, optional): Driver's license number - all_zones (boolean, optional, default: false): If true, driver can operate in all zones. If false, driver can only operate in zones specified in zone_ids - zone_ids (array of UUIDs, required if all_zones is false): Array of delivery zone IDs the driver can operate in. Cannot be provided if all_zones is true - preferred_zone_ids (array of UUIDs, optional): Array of preferred delivery zone IDs for auto-assignment priority. Must be subset of zone_ids if all_zones is false. Empty array or omitted means no zone preference - status (string, optional, default: "active"): Driver status - driver_details (object, optional): Additional driver-specific information (legacy bag; bank_info, national_id, address are stripped here and stored in DB columns when provided) - bank_info (object, optional): Bank fields — bank_name, account_name, account_number, iban, swift_code, branch_name (persisted in drivers.bank_info JSONB) - national_id (string, optional): National ID (persisted in drivers.national_id) - address (object or string, optional): Structured address JSON (persisted in drivers.address); string values are normalized to { line1: "..." } Validation Rules: - If all_zones is true, zone_ids must not be provided - If all_zones is false, zone_ids must be provided with at least one zone - preferred_zone_ids must be a subset of zone_ids when all_zones is false - preferred_zone_ids zones must exist in the delivery_zones table

Send a bearer token in the Authorization header for an authenticated OnDi user session.
Request
curl
1curl --request POST "$ONDI_BASE_URL/delivery/drivers?tenant_id=&language=en" \2  --header "Authorization: Bearer {{access_token}}" \3  --header "Content-Type: application/json" \4  --header "Content-Type: application/json" \5  --data '{6  "user_id": "uuid",7  "vehicle_ids": [8    "vehicle-uuid-1",9    "vehicle-uuid-2"10  ],11  "primary_vehicle_id": "vehicle-uuid-1",12  "license_number": "DL12345678",13  "all_zones": false,14  "zone_ids": [15    "uuid1",16    "uuid2"17  ],18  "preferred_zone_ids": [19    "uuid1"20  ],21  "status": "active",22  "identity_card_photos": [23    "https://example.com/id-front.jpg",24    "https://example.com/id-back.jpg"25  ],26  "driving_licence_photos": [27    "https://example.com/licence-front.jpg"28  ],29  "vehicle_photos": [30    "https://example.com/car-front.jpg",31    "https://example.com/car-side.jpg"32  ],33  "national_id": "1234567890",34  "bank_info": {35    "bank_name": "Example Bank",36    "account_name": "John Driver",37    "account_number": "000111",38    "iban": "IQ00XXXX",39    "swift_code": "EXAMIQB0",40    "branch_name": "Main"41  },42  "address": {43    "line1": "Street 1",44    "city": "Baghdad",45    "country": "IQ"46  },47  "driver_details": {48    "rating": null49  }50}'
Request body
json
1{2  "user_id": "uuid",3  "vehicle_ids": [4    "vehicle-uuid-1",5    "vehicle-uuid-2"6  ],7  "primary_vehicle_id": "vehicle-uuid-1",8  "license_number": "DL12345678",9  "all_zones": false,10  "zone_ids": [11    "uuid1",12    "uuid2"13  ],14  "preferred_zone_ids": [15    "uuid1"16  ],17  "status": "active",18  "identity_card_photos": [19    "https://example.com/id-front.jpg",20    "https://example.com/id-back.jpg"21  ],22  "driving_licence_photos": [23    "https://example.com/licence-front.jpg"24  ],25  "vehicle_photos": [26    "https://example.com/car-front.jpg",27    "https://example.com/car-side.jpg"28  ],29  "national_id": "1234567890",30  "bank_info": {31    "bank_name": "Example Bank",32    "account_name": "John Driver",33    "account_number": "000111",34    "iban": "IQ00XXXX",35    "swift_code": "EXAMIQB0",36    "branch_name": "Main"37  },38  "address": {39    "line1": "Street 1",40    "city": "Baghdad",41    "country": "IQ"42  },43  "driver_details": {44    "rating": null45  }46}

Query parameters

tenant_idOptional
query string

Tenant ID (optional if in auth token)

languageOptional
query string

en

Preferred language for response messages

Request body fields

user_idExample
string

Example field from the request body.

vehicle_idsExample
array<string>

Example field from the request body.

primary_vehicle_idExample
string

Example field from the request body.

license_numberExample
string

Example field from the request body.

all_zonesExample
boolean

Example field from the request body.

zone_idsExample
array<string>

Example field from the request body.

preferred_zone_idsExample
array<string>

Example field from the request body.

statusExample
string

Example field from the request body.

identity_card_photosExample
array<string>

Example field from the request body.

driving_licence_photosExample
array<string>

Example field from the request body.

vehicle_photosExample
array<string>

Example field from the request body.

national_idExample
string

Example field from the request body.

bank_infoExample
object

Example field from the request body.

bank_info.bank_nameExample
string

Example field from the request body.

bank_info.account_nameExample
string

Example field from the request body.

bank_info.account_numberExample
string

Example field from the request body.

bank_info.ibanExample
string

Example field from the request body.

bank_info.swift_codeExample
string

Example field from the request body.

bank_info.branch_nameExample
string

Example field from the request body.

addressExample
object

Example field from the request body.

address.line1Example
string

Example field from the request body.

address.cityExample
string

Example field from the request body.

address.countryExample
string

Example field from the request body.

driver_detailsExample
object

Example field from the request body.

driver_details.ratingExample
null

Example field from the request body.

Headers

AuthorizationOptional
header string

Bearer {{access_token}}

Content-TypeOptional
header string

application/json

Responses

Success Response201Created

Create Driver (Wizard)

Delivery & Last-Mile / Drivers
POST/delivery/drivers/wizard?tenant_id=&language=en

Create driver wizard. Always creates user from user object. Use vehicle_ids + primary_vehicle_id for existing vehicles, or use inline vehicle to create a new primary vehicle. Optional profile fields (stored on drivers): bank_info (object), national_id (string), address (object or string). Same semantics as create driver.

Send a bearer token in the Authorization header for an authenticated OnDi user session.
Request
curl
1curl --request POST "$ONDI_BASE_URL/delivery/drivers/wizard?tenant_id=&language=en" \2  --header "Authorization: Bearer {{access_token}}" \3  --header "Content-Type: application/json" \4  --header "Content-Type: application/json" \5  --data '{6  "user": {7    "email": "driver@example.com",8    "phone": "+1234567890",9    "password": "SecurePass123!",10    "first_name": "John",11    "last_name": "Driver"12  },13  "vehicle_ids": [14    "vehicle-uuid-1",15    "vehicle-uuid-2"16  ],17  "primary_vehicle_id": "vehicle-uuid-1",18  "license_number": "DL12345678",19  "all_zones": false,20  "zone_ids": [21    "uuid1",22    "uuid2"23  ],24  "preferred_zone_ids": [25    "uuid1"26  ],27  "status": "active",28  "national_id": "1234567890",29  "bank_info": {30    "bank_name": "Example Bank",31    "iban": "IQ00XXXX"32  },33  "address": {34    "line1": "Street 1",35    "city": "Baghdad"36  },37  "identity_card_photos": [38    "https://example.com/id-front.jpg",39    "https://example.com/id-back.jpg"40  ],41  "driving_licence_photos": [42    "https://example.com/licence-front.jpg"43  ],44  "vehicle_photos": [45    "https://example.com/car-front.jpg",46    "https://example.com/car-side.jpg"47  ]48}'
Request body
json
1{2  "user": {3    "email": "driver@example.com",4    "phone": "+1234567890",5    "password": "SecurePass123!",6    "first_name": "John",7    "last_name": "Driver"8  },9  "vehicle_ids": [10    "vehicle-uuid-1",11    "vehicle-uuid-2"12  ],13  "primary_vehicle_id": "vehicle-uuid-1",14  "license_number": "DL12345678",15  "all_zones": false,16  "zone_ids": [17    "uuid1",18    "uuid2"19  ],20  "preferred_zone_ids": [21    "uuid1"22  ],23  "status": "active",24  "national_id": "1234567890",25  "bank_info": {26    "bank_name": "Example Bank",27    "iban": "IQ00XXXX"28  },29  "address": {30    "line1": "Street 1",31    "city": "Baghdad"32  },33  "identity_card_photos": [34    "https://example.com/id-front.jpg",35    "https://example.com/id-back.jpg"36  ],37  "driving_licence_photos": [38    "https://example.com/licence-front.jpg"39  ],40  "vehicle_photos": [41    "https://example.com/car-front.jpg",42    "https://example.com/car-side.jpg"43  ]44}

Query parameters

tenant_idOptional
query string

Tenant ID (optional if in auth token)

languageOptional
query string

en

Preferred language for response messages

Request body fields

userExample
object

Example field from the request body.

user.emailExample
string

Example field from the request body.

user.phoneExample
string

Example field from the request body.

user.passwordExample
string

Example field from the request body.

user.first_nameExample
string

Example field from the request body.

user.last_nameExample
string

Example field from the request body.

vehicle_idsExample
array<string>

Example field from the request body.

primary_vehicle_idExample
string

Example field from the request body.

license_numberExample
string

Example field from the request body.

all_zonesExample
boolean

Example field from the request body.

zone_idsExample
array<string>

Example field from the request body.

preferred_zone_idsExample
array<string>

Example field from the request body.

statusExample
string

Example field from the request body.

national_idExample
string

Example field from the request body.

bank_infoExample
object

Example field from the request body.

bank_info.bank_nameExample
string

Example field from the request body.

bank_info.ibanExample
string

Example field from the request body.

addressExample
object

Example field from the request body.

address.line1Example
string

Example field from the request body.

address.cityExample
string

Example field from the request body.

identity_card_photosExample
array<string>

Example field from the request body.

driving_licence_photosExample
array<string>

Example field from the request body.

vehicle_photosExample
array<string>

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  "message": "Driver created successfully",4  "driver": {5    "id": "uuid"6  }7}

Update Driver

Delivery & Last-Mile / Drivers
PUT/delivery/drivers/:driverId?tenant_id=&language=en

Update an existing driver with both user and driver information in a single API call. Optimized for driver mobile applications. Requires manage:operations:tenant permission. Authentication: - Type: JWT Bearer Token - Header: Authorization: Bearer {{access_token}} - Permissions: Requires manage:operations:tenant or user must be a system admin. Path Parameters: - driverId (string, UUID, required): The unique identifier of the driver to update. User Information (optional): - first_name (string): Driver's first name - last_name (string): Driver's last name - phone (string): Driver's phone number - avatar_url (string): Driver's profile picture URL - profile_data (object): Additional user profile information Driver Information (optional): - vehicle_id (string, UUID): Assign different vehicle to driver - vehicle_ids (array of UUIDs): Full vehicle assignment list; omit all of vehicle_id, vehicle_ids, and primary_vehicle_id to update profile only without touching vehicle assignments - primary_vehicle_id (string, UUID): Primary vehicle; must be included in vehicle_ids when both are sent - license_number (string): Driver's license number - all_zones (boolean): If true, driver can operate in all zones. If false, driver can only operate in zones specified in zone_ids. Cannot be set to true if zone_ids is provided - zone_ids (array of UUIDs): Delivery zones for the driver. Required if all_zones is false. Cannot be provided if all_zones is true - preferred_zone_ids (array of UUIDs): Preferred zones for auto-assignment. Omitted = unchanged; [] = clear. When the driver does not have all-zones access (see below), every id must belong to the driver’s selected zones: same-request zone_ids if provided, otherwise current delivery_zone_drivers assignments. When all_zones is true (from body or already on the driver if body omits it), subset check is skipped. - status (string): Driver status (active, inactive, etc.) - driver_details (object): Additional driver-specific information (nested bank_info, national_id, address are written to columns and stripped from stored JSON) - bank_info (object): Bank fields → drivers.bank_info - national_id (string): → drivers.national_id - address (object or string): → drivers.address JSONB - current_latitude (number): Current latitude position - current_longitude (number): Current longitude position - is_online (boolean): Driver's online status Validation Rules: - preferred_zone_ids must be tenant delivery_zones ids - Subset rule: required only when effective all_zones is false (request all_zones: true overrides; if all_zones omitted, uses stored drivers.all_zones) - Assigned set for subset: request zone_ids when present, else existing zone assignments - When updating zone_ids while all_zones is false: 409 if the driver has an assigned delivery that is not terminal (delivered / cancelled / returned) and has pickup_zone_id or dropoff_zone_id set to a zone not in the new zone_ids (legs with null zone id are ignored) Note: used_capacity_unit is read-only and managed automatically by the backend.

Send a bearer token in the Authorization header for an authenticated OnDi user session.
Request
curl
1curl --request PUT "$ONDI_BASE_URL/delivery/drivers/:driverId?tenant_id=&language=en" \2  --header "Authorization: Bearer {{access_token}}" \3  --header "Content-Type: application/json" \4  --header "Content-Type: application/json" \5  --data '{6  "first_name": "John",7  "last_name": "Smith",8  "phone": "+1234567890",9  "avatar_url": "https://example.com/new-avatar.jpg",10  "profile_data": {11    "bio": "Experienced driver with 5 years experience"12  },13  "vehicle_ids": [14    "new-vehicle-uuid",15    "backup-vehicle-uuid"16  ],17  "primary_vehicle_id": "new-vehicle-uuid",18  "license_number": "DL87654321",19  "all_zones": false,20  "zone_ids": [21    "zone-uuid-1",22    "zone-uuid-2"23  ],24  "preferred_zone_ids": [25    "zone-uuid-1"26  ],27  "status": "active",28  "national_id": "1234567890",29  "bank_info": {30    "bank_name": "Example Bank",31    "account_number": "000111"32  },33  "address": {34    "line1": "Street 1",35    "city": "Baghdad"36  },37  "identity_card_photos": [38    "https://example.com/id-front.jpg",39    "https://example.com/id-back.jpg"40  ],41  "driving_licence_photos": [42    "https://example.com/licence-front.jpg"43  ],44  "vehicle_photos": [45    "https://example.com/car-front.jpg"46  ],47  "driver_details": {48    "rating": 4.949  },50  "current_latitude": 37.7849,51  "current_longitude": -122.4094,52  "is_online": true53}'
Request body
json
1{2  "first_name": "John",3  "last_name": "Smith",4  "phone": "+1234567890",5  "avatar_url": "https://example.com/new-avatar.jpg",6  "profile_data": {7    "bio": "Experienced driver with 5 years experience"8  },9  "vehicle_ids": [10    "new-vehicle-uuid",11    "backup-vehicle-uuid"12  ],13  "primary_vehicle_id": "new-vehicle-uuid",14  "license_number": "DL87654321",15  "all_zones": false,16  "zone_ids": [17    "zone-uuid-1",18    "zone-uuid-2"19  ],20  "preferred_zone_ids": [21    "zone-uuid-1"22  ],23  "status": "active",24  "national_id": "1234567890",25  "bank_info": {26    "bank_name": "Example Bank",27    "account_number": "000111"28  },29  "address": {30    "line1": "Street 1",31    "city": "Baghdad"32  },33  "identity_card_photos": [34    "https://example.com/id-front.jpg",35    "https://example.com/id-back.jpg"36  ],37  "driving_licence_photos": [38    "https://example.com/licence-front.jpg"39  ],40  "vehicle_photos": [41    "https://example.com/car-front.jpg"42  ],43  "driver_details": {44    "rating": 4.945  },46  "current_latitude": 37.7849,47  "current_longitude": -122.4094,48  "is_online": true49}

Path parameters

driverIdRequired
path string

uuid

ID of the driver to update

Query parameters

tenant_idOptional
query string

Tenant ID (optional if in auth token)

languageOptional
query string

en

Preferred language for response messages

Request body fields

first_nameExample
string

Example field from the request body.

last_nameExample
string

Example field from the request body.

phoneExample
string

Example field from the request body.

avatar_urlExample
string

Example field from the request body.

profile_dataExample
object

Example field from the request body.

profile_data.bioExample
string

Example field from the request body.

vehicle_idsExample
array<string>

Example field from the request body.

primary_vehicle_idExample
string

Example field from the request body.

license_numberExample
string

Example field from the request body.

all_zonesExample
boolean

Example field from the request body.

zone_idsExample
array<string>

Example field from the request body.

preferred_zone_idsExample
array<string>

Example field from the request body.

statusExample
string

Example field from the request body.

national_idExample
string

Example field from the request body.

bank_infoExample
object

Example field from the request body.

bank_info.bank_nameExample
string

Example field from the request body.

bank_info.account_numberExample
string

Example field from the request body.

addressExample
object

Example field from the request body.

address.line1Example
string

Example field from the request body.

address.cityExample
string

Example field from the request body.

identity_card_photosExample
array<string>

Example field from the request body.

driving_licence_photosExample
array<string>

Example field from the request body.

vehicle_photosExample
array<string>

Example field from the request body.

driver_detailsExample
object

Example field from the request body.

driver_details.ratingExample
number

Example field from the request body.

current_latitudeExample
number

Example field from the request body.

current_longitudeExample
number

Example field from the request body.

is_onlineExample
boolean

Example field from the request body.

Headers

AuthorizationOptional
header string

Bearer {{access_token}}

Content-TypeOptional
header string

application/json

Responses

Success Response200OK
Conflict - zone shrink blocked by active delivery409Conflict
Error - Insufficient Permissions403Forbidden

Delete Driver

Delivery & Last-Mile / Drivers
DELETE/delivery/drivers/:driverId?tenant_id=&language=en

Soft delete a driver (changes status to inactive). The driver can delete themselves, or this can be done by a user with manage:users:tenant permission.

Send a bearer token in the Authorization header for an authenticated OnDi user session.
Request
curl
1curl --request DELETE "$ONDI_BASE_URL/delivery/drivers/:driverId?tenant_id=&language=en" \2  --header "Authorization: Bearer {{access_token}}"

Path parameters

driverIdRequired
path string

uuid

ID of the driver to delete

Query parameters

tenant_idOptional
query string

Tenant ID (optional if in auth token)

languageOptional
query string

en

Preferred language for response messages

Headers

AuthorizationOptional
header string

Bearer {{access_token}}

Responses

Success Response200OK

Update Driver Location

Delivery & Last-Mile / Drivers
POST/delivery/drivers/:driverId/location?tenant_id=&language=en

Update a driver's current location. The driver can update their own location, or this can be done by a user with manage:operations:tenant permission.

Send a bearer token in the Authorization header for an authenticated OnDi user session.
Request
curl
1curl --request POST "$ONDI_BASE_URL/delivery/drivers/:driverId/location?tenant_id=&language=en" \2  --header "Authorization: Bearer {{access_token}}" \3  --header "Content-Type: application/json" \4  --header "Content-Type: application/json" \5  --data '{6  "latitude": 37.7749,7  "longitude": -122.41948}'
Request body
json
1{2  "latitude": 37.7749,3  "longitude": -122.41944}

Path parameters

driverIdRequired
path string

uuid

ID of the driver whose location to update

Query parameters

tenant_idOptional
query string

Tenant ID (optional if in auth token)

languageOptional
query string

en

Preferred language for response messages

Request body fields

latitudeExample
number

Example field from the request body.

longitudeExample
number

Example field from the request body.

Headers

AuthorizationOptional
header string

Bearer {{access_token}}

Content-TypeOptional
header string

application/json

Responses

Success Response200OK
Error - Missing Location Data400Bad Request

Switch Primary Vehicle (Driver)

Delivery & Last-Mile / Drivers
POST/delivery/driver/primary-vehicle?tenant_id=&language=en

Switch the logged-in driver's primary vehicle. The driver can only switch among vehicles already assigned to them. The switch will be rejected if the driver's current used capacity exceeds the target vehicle's capacity. Authentication: - Type: JWT Bearer Token - Header: Authorization: Bearer {{access_token}} - The driver is resolved from the authenticated user; no driverId path parameter is required. Request Body Fields: - vehicle_id (string, UUID, required): The ID of the vehicle to make primary. Must be already assigned to the driver. Validation Rules: - vehicle_id is required and must be a string. - The vehicle must be assigned to the current driver. - The vehicle must be active and not soft-deleted. - The driver's used_capacity_unit must be less than or equal to the vehicle's capacity_unit. If used_capacity_unit is greater, the request fails with a capacity error. Responses: Returns the updated driver profile with new primary vehicle information. When the driver's used capacity is greater than the target vehicle's capacity. If the vehicle is not assigned to the driver or does not exist. If the authenticated user is not a driver in the tenant. For unexpected server or database issues.

Send a bearer token in the Authorization header for an authenticated OnDi user session.
Request
curl
1curl --request POST "$ONDI_BASE_URL/delivery/driver/primary-vehicle?tenant_id=&language=en" \2  --header "Authorization: Bearer {{access_token}}" \3  --header "Content-Type: application/json" \4  --header "Content-Type: application/json" \5  --data '{6  "vehicle_id": "vehicle-uuid-1"7}'
Request body
json
1{2  "vehicle_id": "vehicle-uuid-1"3}

Query parameters

tenant_idOptional
query string

Tenant ID (optional if in auth token)

languageOptional
query string

en

Preferred language for response messages

Request body fields

vehicle_idExample
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  "message": "Driver updated successfully",4  "driver": {5    "driver_id": "driver-uuid-123",6    "primary_vehicle_id": "vehicle-uuid-1",7    "vehicle": {8      "id": "vehicle-uuid-1",9      "name": "Van 101",10      "capacity_unit": 50,11      "is_primary": true12    },13    "vehicles": [14      {15        "id": "vehicle-uuid-1",16        "name": "Van 101",17        "capacity_unit": 50,18        "is_primary": true19      },20      {21        "id": "vehicle-uuid-2",22        "name": "Small Car",23        "capacity_unit": 10,24        "is_primary": false25      }26    ],27    "used_capacity_unit": 2028  }29}
Error (400 Bad Request - Capacity Exceeded)400
Response body
json
1{2  "success": false,3  "message": "Driver used capacity exceeds selected vehicle capacity"4}
Error (404 Not Found - Vehicle Not Assigned)404
Response body
json
1{2  "success": false,3  "message": "Vehicle not found"4}
Error (404 Not Found - Driver Not Found)404
Response body
json
1{2  "success": false,3  "message": "Driver not found"4}
Error (500 Internal Server Error)500
Response body
json
1{2  "success": false,3  "message": "Internal server error"4}

Get Driver Wallet Transactions

Delivery & Last-Mile / Drivers
GET/delivery/drivers/:driverId/wallet-transactions?tenant_id=&page=1&limit=15&search=&from_date=&to_date=&type=&source=&payment_method=&language=en

Get a driver's wallet ledger with filters for search, date range, type, source, and payment method.

Send a bearer token in the Authorization header for an authenticated OnDi user session.
Request
curl
1curl --request GET "$ONDI_BASE_URL/delivery/drivers/:driverId/wallet-transactions?tenant_id=&page=1&limit=15&search=&from_date=&to_date=&type=&source=&payment_method=&language=en" \2  --header "Authorization: Bearer {{access_token}}"

Path parameters

driverIdRequired
path string

uuid

Query parameters

tenant_idOptional
query string
pageOptional
query string

1

limitOptional
query string

15

searchOptional
query string
from_dateOptional
query string
to_dateOptional
query string
typeOptional
query string
sourceOptional
query string
payment_methodOptional
query string
languageOptional
query string

en

Headers

AuthorizationOptional
header string

Bearer {{access_token}}

Responses

Success200OK
Response body
json
1{2  "success": true,3  "message": "Driver wallet transactions retrieved successfully",4  "data": {5    "transactions": [],6    "pagination": {7      "page": 1,8      "limit": 15,9      "total": 010    },11    "summary": {12      "current_balance": 0,13      "total_credited": 0,14      "total_debited": 0,15      "currency": "IQD"16    }17  }18}

Get Driver Accounting

Delivery & Last-Mile / Drivers
GET/delivery/drivers/:driverId/accounting?tenant_id=&from_date=&to_date=&language=en

Get a driver's accounting summary for the selected period.

Send a bearer token in the Authorization header for an authenticated OnDi user session.
Request
curl
1curl --request GET "$ONDI_BASE_URL/delivery/drivers/:driverId/accounting?tenant_id=&from_date=&to_date=&language=en" \2  --header "Authorization: Bearer {{access_token}}"

Path parameters

driverIdRequired
path string

uuid

Query parameters

tenant_idOptional
query string
from_dateOptional
query string
to_dateOptional
query string
languageOptional
query string

en

Headers

AuthorizationOptional
header string

Bearer {{access_token}}

Responses

Success200OK
Response body
json
1{2  "success": true,3  "message": "Driver accounting retrieved successfully",4  "data": {5    "period": {6      "from_date": null,7      "to_date": null8    },9    "currency": "IQD",10    "balance_summary": {11      "amount": 0,12      "type": "creditor",13      "description": "Driver wallet is settled."14    },15    "cash_collected": {16      "total": 0,17      "breakdown": {18        "cod": 0,19        "order_fee": 020      }21    },22    "earnings": {23      "total": 0,24      "breakdown": {25        "cash": 0,26        "online_credit": 027      }28    },29    "order_costs": {30      "total": 0,31      "breakdown": {32        "cash": 0,33        "paid_by_receiver": 0,34        "card": 0,35        "wallet": 036      }37    },38    "company_earnings": 0,39    "paid_withdrawals": 0,40    "from_support": {41      "cod_type_creditor": 0,42      "cod_type_debtor": 0,43      "support_type_creditor": 0,44      "support_type_debtor": 045    }46  }47}

Get Driver Operation Status History

Delivery & Last-Mile / Drivers
GET/delivery/drivers/:driverId/operation-status-history?tenant_id=&page=1&limit=20

Get paginated history of a driver's operation_status changes (available / on_leave / idle). Each record includes old_status, new_status, changed_by, and changed_at.

Send a bearer token in the Authorization header for an authenticated OnDi user session.
Request
curl
1curl --request GET "$ONDI_BASE_URL/delivery/drivers/:driverId/operation-status-history?tenant_id=&page=1&limit=20" \2  --header "Authorization: Bearer {{access_token}}"

Path parameters

driverIdRequired
path string

uuid

Query parameters

tenant_idOptional
query string
pageOptional
query string

1

limitOptional
query string

20

Headers

AuthorizationOptional
header string

Bearer {{access_token}}

Responses

Success200OK
Response body
json
1{2  "success": true,3  "history": [4    {5      "id": "uuid",6      "driver_id": "uuid",7      "tenant_id": "uuid",8      "old_status": "available",9      "new_status": "on_leave",10      "changed_by": "uuid",11      "changed_at": "2026-04-27T12:00:00Z"12    }13  ],14  "page": 1,15  "limit": 20,16  "total": 117}