Authentication
¶ Overview
The Traffic & Incidents APIs are private APIs. Every request requires an OAuth 2.0 bearer token issued to an application that has been explicitly granted the API’s scope.
Authorization: Bearer {access_token}
| API | Scope |
|---|---|
| Current Traffic | maps.traffic |
| Traffic Snapshot | maps.traffic |
| Active Incidents | maps.incidents |
| Report Incident | maps.partner.incidents |
| Report Status | maps.partner.incidents |
¶ Access and credentials
- Create an application in the Uber Developer Dashboard.
- Ask Uber’s scope owner for the API to grant its scope (
maps.traffic,maps.incidents,maps.partner.incidents, or a combination) to the application’s client ID. - Verify in the Developer Dashboard that the scope is granted/enabled.
- Copy the application’s client ID and client secret from its authentication/settings page.
Store the client secret only in a server-side secret manager. Do not put it in browsers, mobile apps, source code, logs, or tickets.
¶ Token generation
- Production Auth URL:
https://auth.uber.com/oauth/v2/token - Testing Auth URL:
https://sandbox-login.uber.com/oauth/v2/token
Use the auth URL that matches your application’s environment. A sandbox application that requests a token from the production auth URL gets HTTP 401 unauthorized_client, and its tokens work only against https://test-api.uber.com.
Use the OAuth 2.0 client_credentials grant. Request every scope your application needs, separated by spaces, for example scope=maps.traffic maps.incidents. The endpoint expects multipart/form-data or application/x-www-form-urlencoded; JSON request bodies are not supported.
Example cURL API request:
curl -X POST \
-F "client_id=${UBER_CLIENT_ID}" \
-F "client_secret=${UBER_CLIENT_SECRET}" \
-F "grant_type=client_credentials" \
-F "scope=maps.incidents" \
https://auth.uber.com/oauth/v2/token
Example JSON response; the token lifetime is illustrative:
{
"access_token": "<ACCESS_TOKEN>",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "maps.incidents"
}
Read expires_in, cache the token server-side, and renew it before expiration. Do not assume a fixed token lifetime.