Mint access token
POST
/v1/vehicles/tokens
const url = 'https://api.example.yas/v1/vehicles/tokens';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"partnerId":"partner","driverId":"drv_example","vehicleId":"veh_example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.example.yas/v1/vehicles/tokens \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "partnerId": "partner", "driverId": "drv_example", "vehicleId": "veh_example" }'The partner backend mints a bearer with the server key. The SDK can use that bearer for 24 hours. Mint it for the partnerId, driverId, and vehicleId from setup. POST /v1/tokens is deprecated. Use this path.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
partnerId
required
Partner id from setup. It must match the server key.
string
driverId
required
Driver id from setup.
string
vehicleId
required
Vehicle id from setup.
string
Example
{ "partnerId": "partner", "driverId": "drv_example", "vehicleId": "veh_example"}Responses
Section titled “Responses”A bearer for tokenProvider to return.
Media typeapplication/json
object
accessToken
required
string
expiresAt
required
ISO-8601 UTC. The token lasts 24 hours.
string format: date-time
tokenType
required
string
Example
{ "accessToken": "eyJexample", "expiresAt": "2026-10-16T12:00:00.000Z", "tokenType": "Bearer"}400The body is not a JSON object, `partnerId` does not match `^[a-z0-9-]{1,64}$`, or `driverId` or `vehicleId` is missing or empty. This check runs after authentication and before the partner match, so a malformed `partnerId` is 400, not 403.
Media typeapplication/json
object
error
required
Stable error code. No stack trace.
string
Example
{ "error": "invalid_body"}401The server key is missing or wrong.
Media typeapplication/json
object
error
required
Stable error code. No stack trace.
string
Example
{ "error": "invalid_credentials"}403A server key may be limited to vehicles, robots, or both. A call outside that limit is 403 `forbidden` and stores nothing. `identity_mismatch` means `partnerId` does not match the server key.
Media typeapplication/json
object
error
required
Stable error code. No stack trace.
string
Example
{ "error": "forbidden"}