[API][V2] Upsert shift
The Upsert API is designed for suppliers to share shift information for their earners with Uber.
¶ Use case
By using the Upsert Shift API, suppliers will enable Uber to better manage their earners such as improving driver-vehicle utilization near end of shift by providing trips that takes them near the vehicle drop-off location, and many other features.
¶ Support for Hierarchical Data
The API operates within the hierarchical structure of the organization linked to the developer’s account at the time of setup.
¶ Supported supplier types
Fleets
¶ Scopes
vehicle_suppliers.shifts.management
¶ Required Internal Permissions
In addition to the OAuth scope above, the user that the access token represents must be granted the following Identity permission for the supplier organization that owns the earner. Permissions are assigned via Uber Admin Portal by a supplier-org admin.
| Permission | Required for |
|---|---|
supplier.driver.shift.upsert |
Upserting earner shifts |
If this permission is missing, the request will fail with 401 unauthorized / permission denied even when the OAuth scope is correctly authorized for the application.
¶ Resource
/v2/vehicle-supplier/shifts/earner/:earner_uuid
¶ HTTP Method
POST
¶ Authorization
¶ Example Request
curl -X POST "https://api.uber.com/v2/vehicle-supplier/shifts/earner/:earner_uuid" \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
--data '{
"shift": {
"start_time_utc": {
"value": "1795578688000"
},
"end_time_utc": {
"value": "1795593088000"
},
"zone_id": "us-east-1",
"marketplace_type": "MARKETPLACE_TYPE_EATS", // MARKETPLACE_TYPE_RIDES or MARKETPLACE_TYPE_EATS
"metadata": {
"start_location": {
"point": {
"latitude": 37.7749,
"longitude": -122.4194
},
"name": "Start Depot",
"address": "123 Main St, San Francisco, CA"
},
"end_location": {
"point": {
"latitude": 37.7849,
"longitude": -122.4094
},
"name": "End Depot",
"address": "456 Market St, San Francisco, CA"
}
}
}
}'
¶ Request Path Parameters
| Name | Type | Description |
|---|---|---|
earner_uuid |
string | UUID of the earner for whom the shift is planned |
¶ Request Body Parameters
| Name | Type | Description |
|---|---|---|
shift |
object | Details for the planned shift |
¶ Example Response
Status-code: 200
{
"shift_upserted": true
}
¶ Response Body Parameters
| Name | Type | Description |
|---|---|---|
shift_upserted |
bool | Flag representing that the operation was successful |
¶ Shift
| Name | Type | Description |
|---|---|---|
start_time_utc |
object | Start time of the shift. Object with value field containing epoch milliseconds as a string |
end_time_utc |
object | End time of the shift. Object with value field containing epoch milliseconds as a string |
zone_id |
string | Zone identifier for the shift |
marketplace_type |
string | Type of marketplace. One of: MARKETPLACE_TYPE_RIDES, MARKETPLACE_TYPE_EATS |
metadata |
object | Additional metadata related to the shift |
¶ Metadata
| Name | Type | Description |
|---|---|---|
start_location |
object | Start location of the shift |
end_location |
object | End location of the shift |
¶ Location
| Name | Type | Description |
|---|---|---|
point |
object | Geographic point of the location |
name |
string | Name of the location |
address |
string | Address of the location |
¶ Point
| Name | Type | Description |
|---|---|---|
latitude |
double | Latitude of the location |
longitude |
double | Longitude of the location |
¶ Rate limit
- The rate limit for this endpoint is 1 request per second.
¶ Endpoint Specific Errors
| Http Status Code | Code | Message |
|---|---|---|
400 |
bad_request | The request parameters are invalid, rate limited, code cancelled etc. |
401 |
unauthorized/permission denied | |
500 |
internal_server_error | Internal server error |
Note
- Shifts are expected to be provided near the time driver goes offline or online
- Any shift overlapping the new shift’s
[start_time_utc, end_time_utc)time range will be deleted before the new shift is stored. Use the Get Earner Shifts API to verify the resulting state. - All the parameters in the request body are mandatory
- Resolution of shifts will be reduced to minutes