---
title: "Create auth token for a driver"
method: POST
path: "/fleet/drivers/auth-token"
tags: ["Auth Token for Driver"]
---

# Create auth token for a driver

`POST /fleet/drivers/auth-token`

## Request

- Base URL: `https://api.samsara.com`
- URL: `https://api.samsara.com/fleet/drivers/auth-token`
- Auth: HTTP bearer

Creates a short-lived auth token a driver can use to login.

 <b>Rate limit:</b> 100 requests/min (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).

To use this endpoint, select **Write Driver Auth Token** under the Drivers category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
 

 **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.

## Request body

- AuthTokenAuthTokenRequestBody: Request body for creating a driver auth token. One of `id`, `externalId`, or `username` is required.
  - `code` string, required: Required. Random 12+ character string, used with the auth token to help secure the client from intercepted tokens.
  - `driverId` integer: Optional. Samsara ID of the driver. One of `id`, `externalId`, or `username` is required.
  - `externalId` string: Optional. External ID of the driver, in the format `key:value` (e.g., `payrollId:ABFS18600`). One of `id`, `externalId`, or `username` is required.
  - `username` string: Optional. Username of the driver. This is the login identifier configured when the driver is created. One of `id`, `externalId`, or `username` is required.

## Response `200`

OK response.

- AuthTokenAuthTokenResponseBody
  - `data` AuthTokenForDriverResponseResponseBody, required: Response object for create driver auth token
    - `expirationTime` integer, required: Expiration time of the token in Unix milliseconds since epoch. Clients must redeem the token before this timestamp.
    - `token` string, required: A one-time-use authentication token. Must be paired with the original code and driver identity in a separate request to exchange for a session.

## Other responses

- `401`: Unauthorized response.
- `404`: Not Found response.
- `405`: Method Not Allowed response.
- `413`: Content Too Large response.
- `429`: Too Many Requests response.
- `500`: Internal Server Error response.
- `501`: Not Implemented response.
- `502`: Bad Gateway response.
- `503`: Service Unavailable response.
- `504`: Gateway Timeout response.
- `default`: Bad Request response.

---

[API](https://skmtc.dev/samsara/apis/samsara-api.md) - [All operations](https://skmtc.dev/samsara/apis/samsara-api/llms.txt) - [OpenAPI document](https://skmtc.dev/samsara/apis/samsara-api/revisions/a9e35d4999be?raw)
