Three lines

Uber

Developers

Sandbox

The Uber API sandbox provides development endpoints for testing the functionality of an application without making calls to the production Uber platform. All requests made to the sandbox environment will be ephemeral.

Requests to the sandbox environment should be made to:

https://sandbox-api.uber.com/<version>

At this time, most of the endpoints in the sandbox environment are proxied straight to the production environment. The Request endpoint is the primary exception. It allows you to exercise the flow of ordering an Uber in your application without worrying about a real world trip being created.

All OAuth users and their tokens that are available in the production Uber API environment will also be valid to make requests to the sandbox API.

Note that not all errors can be tested in the sandbox. For example, pickup requests from certain locations are restricted in production but will go through in the sandbox. Similarly users with no payment details on file may request sandbox rides but not real ones.

Modify sandbox products (optional)

You can modify product attributes to set availability or surge pricing. Use this to simulate surging products or no drivers being available to ensure that your application handles these scenarios properly.

Base URL https://sandbox-api.uber.com/<version>
Resource PUT /sandbox/products/{product_id}
Authorization OAuth 2.0 bearer token

PUT body parameters

Name Type Description
surge_multiplier float The surge multiplier a product should have when making a request in the sandbox. A multiplier greater than or equal to 2.0 will require the two stage confirmation screen.
drivers_available boolean If false, attempts to make a request in the sandbox will return a no_drivers_available error.

Changes to the surge_multiplier is also reflected in the GET /estimates/price and POST /requests/estimate endpoints.

Payload

This example sets a surge multiplier of 2.2 while drivers are available:

{
  "surge_multiplier": 2.2,
  "drivers_available": true
}

Example Request

Try It Modify a sandbox product.

curl -X PUT 'https://sandbox-api.uber.com/v1.2/sandbox/products/{product_id}' \
     -H 'Content-Type: application/json' \
     -H 'Authorization: Bearer <TOKEN>' \
     -d '{ "surge_multiplier": 2.2, "drivers_available": true }'

Response

Status-Code: 204 No Content

Step 1: Create sandbox Request

To create a new ride request, call POST /requests in the sandbox environment.

Base URL https://sandbox-api.uber.com/<version>
Resource POST /requests
Authorization OAuth 2.0 bearer token with the request scope

Parameters

Name Type Description
fare_id string The key for the upfront fare of a ride.
start_latitude float The beginning or “pickup” latitude. Either this or start_place_id must be specified.
start_longitude float The beginning or “pickup” longitude. Either this or start_place_id must be specified.
end_latitude float The final or destination latitude. Either this or end_place_id may be specified.
end_longitude float The final or destination longitude. Either this or end_place_id may be specified.

Other optional parameters can be found in the production endpoint description.

Payload

{
  "fare_id": "abcd",
	"product_id": "a1111c8c-c720-46c3-8534-2fcdd730040d",
	"start_latitude": 37.761492,
	"start_longitude": -122.423941,
	"end_latitude": 37.775393,
	"end_longitude": -122.417546
}

Example Request

Try It Create a new sandbox ride request.

curl -X POST 'https://sandbox-api.uber.com/v1.2/requests' \
     -H 'Content-Type: application/json' \
     -H 'Authorization: Bearer <TOKEN>' \
     -d '{ "fare_id": "abcd", "product_id": "a1111c8c-c720-46c3-8534-2fcdd730040d", "start_latitude": 37.761492, "start_longitude": -122.423941, "end_latitude": 37.775393, "end_longitude": -122.417546 }'

Response

Status-Code: 202 Accepted

{
   "request_id": "852b8fdd-4369-4659-9628-e122662ad257",
   "product_id": "a1111c8c-c720-46c3-8534-2fcdd730040d",
   "status": "processing",
   "vehicle": null,
   "driver": null,
   "location": null,
   "eta": 5,
   "surge_multiplier": null
}

Step 2: Modify sandbox Request

Currently, the sandbox does not change states automatically the way a real production request would. This endpoint gives the ability to walk an application through the different states of a ride request.

This endpoint effectively modifies the status of an ongoing sandbox request by accepting a JSON body indicating how you would like to manipulate the status of a request.

Status changes must be made in the order listed in this status table. For example, if a request has status: accepted, you can only change it to status: arriving since that is the next valid trip status. The exception to this rule is status: driver_canceled, since the driver can cancel a request anytime.

To have the rider cancel a request, take a look at DELETE /requests/{request_id}.

Base URL https://sandbox-api.uber.com/<version>
Resource PUT /sandbox/requests/{request_id}
Authorization OAuth 2.0 bearer token with the request scope

Parameters

Name Type Description
status string Desired ride status

Statuses

Status Description
processing The request is matching to the most efficient available driver
accepted The request has been accepted by a driver and is “en route” to the start location (i.e. start_latitude and start_longitude)
arriving The driver has arrived or will be arriving shortly
in_progress The request is “en route” from the start location to the end location
driver_canceled The request has been canceled by the driver
completed The request has been completed by the driver

Payload

To indicate that a sandbox ride request was matched with a driver, set the status to accepted:

{"status": "accepted"}

Example Request

Try It Modify an existing sandbox ride request.

curl -X PUT 'https://sandbox-api.uber.com/v1.2/sandbox/requests/{REQUEST_ID}' \
     -H 'Content-Type: application/json' \
     -H 'Authorization: Bearer <TOKEN>' \
     -d '{"status":"accepted"}'

Response

Status-Code: 204 No Content

No drivers available

If you modify the sandbox products and set drivers_available to false, sandbox requests will terminate with the status no_drivers_available.

Step 3: Delete sandbox Request

You can delete existing sandbox ride requests by issuing a DELETE HTTP call to the sandbox environment. When issued, the sandbox ride will transition into the rider_canceled status.

Base URL https://sandbox-api.uber.com/<version>
Resource DELETE /requests/{request_id}
Authorization OAuth 2.0 bearer token with the request scope

DELETE body parameters

None

Example Request

Try It Delete an existing sandbox ride request.

curl -X DELETE 'https://sandbox-api.uber.com/v1.2/requests/{REQUEST_ID}' \
     -H 'Content-Type: application/json' \
     -H 'Authorization: Bearer <TOKEN>'

Response

Status-Code: 204 No Content

Uber

Developers
© 2023 Uber Technologies Inc.