References¶
Assign a driver¶
The V2 assign driver endpoint allows a driver and/or vehicle to be assigned to a booking.
Note
Driver and vehicle can be assigned separately or together, and the endpoint can be called multiple times for the same booking to update driver/vehicle details.
Booking must be in either the ACCEPTED or DRIVER_ASSIGNED state.
Request¶
To assign a driver to a booking, you must provide at least one of the following: driver or vehicle. While each is optional on its own, successful assignment requires that at least one is provided.
Warning
On subsequent calls when providing vehicle details, all previously sent fields must be sent along with any new data. Omitting fields will cause the previous data to be overwritten with null.
| Field | Type | Description | Required |
|---|---|---|---|
| driver.firstName | String | Driver's first name. Limited to 255 characters. | Yes - but only when driver details are being provided |
| driver.lastName | String | Driver's last name. Limited to 255 characters. | Yes - but only when driver details are being provided |
| driver.telephoneNumber | String | Driver's telephone number. Limited to 255 characters. | Yes - but only when driver details are being provided |
| driver.photoURL | String | A URL for the driver's photo. Limited to 2000 characters. | No |
| vehicle.make | String | Vehicle brand. Limited to 50 characters. | No |
| vehicle.model | String | Vehicle model. Limited to 50 characters. | No |
| vehicle.registration | String | Vehicle registration. Limited to 50 characters. | No |
| vehicle.colour | String | Vehicle colour. Limited to 50 characters. | No |
| stateHash | String | The latest state hash for the booking. Must be alphanumeric characters only. | Yes |
Sample Request¶
{
"driver": {
"firstName": "Nick",
"lastName": "Samson",
"telephoneNumber": "+911234567898",
"photoURL": "https://example.com/driver.jpg"
},
"vehicle": {
"make": "Tesla",
"model": "Model S",
"registration": "B00K 1NG",
"colour": "Black"
},
"stateHash": "4b2c68f6c847284e73c73b26693d9905"
}
Response¶
HTTP 204 - No Content¶
HTTP 400 - Bad Request¶
Example 400 response:
{
"errorCode": "9e753833-36db-4922-9167-e5fed5f0cb7d",
"errorMessage": "stateHash: field is required"
}
HTTP 401 - Unauthorized¶
HTTP 404 - Not Found¶
Example 404 response:
{
"errorCode": "9e753833-36db-4922-9167-e5fed5f0cb7d",
"errorMessage": "Booking not found for bookingReference: xxx"
}
Further reading¶
- How can I Assign a Driver via API? — V2 context, V1 deprecation warning
- Why when I assign a driver the phone number is flagged as invalid? — Phone number validation (libphonenumber), unsupported number types