---
title: "[preview] Create auth token for a driver"
method: POST
path: "/preview/fleet/drivers/create-auth-token"
tags: ["Preview APIs"]
---

# \[preview\] Create auth token for a driver

`POST /preview/fleet/drivers/create-auth-token`

## Request

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

Creates a short-lived auth token for a driver.

 <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>

Endpoints in this section are in Preview. These APIs are not functional and are instead for soliciting feedback from our API users on the intended design of this API. Additionally, it is not guaranteed that we will be releasing an endpoint included in this section to production. This means that developers should **NOT** rely on these APIs to build business critical applications

- Samsara may change the structure of a preview API's interface without versioning or any notice to API users.

- When an endpoint becomes generally available, it will be announced in the API [changelog](https://developers.samsara.com/changelog).
 

 **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

- DriversAuthTokenCreateDriverAuthTokenRequestBody: 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.
  - `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.
  - `id` integer: Optional. Samsara ID of the driver. 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.

- DriversAuthTokenCreateDriverAuthTokenResponseBody
  - `data` CreateDriverAuthTokenResponseResponseBody, 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)
