---
title: "Create a token"
method: POST
path: "/v0/users/{user}/tokens"
tags: ["users", "tokens"]
deprecated: true
---

# Create a token

`POST /v0/users/{user}/tokens`

> **Deprecated.**

DEPRECATED: User API tokens have been deprecated in favor of user API keys, so this endpoint always fails with a `403 Forbidden` error. Create a [user API key](https://bencher.dev/docs/explanation/bencher-run/#--key-key) instead. Existing API tokens continue to work and can still be viewed, updated, and revoked.

## Path parameters

- `user` string, required

## Request body

- JsonNewToken — DEPRECATED: User API tokens have been deprecated in favor of user API keys, so creating a new token always fails with a `403 Forbidden` error. Create a user API key instead.
  - `name` string, required
  - `ttl` integer, nullable — The time-to-live (TTL) for the token in seconds. If not provided, the token will not expire for over 128 years.

## Response `201`

successful creation

- JsonToken
  - `creation` string, date-time, required
  - `expiration` string, date-time, required
  - `name` string, required
  - `revoked` string, date-time
  - `token` string, required
  - `user` string, uuid, required
  - `uuid` string, uuid, required

## Other responses

- `4XX` — Error
- `5XX` — Error

## Changes

- **2026-06-14** `814ceb2390ab` — 1 info
  - endpoint deprecated
- **2026-04-20** `384ed3e1ff89` — 1 info
  - added the optional property `revoked` to the response with the `201` status
- **2026-03-20** `36c8ad753527` — 1 warning, 1 info
  - removed the optional property `revoked` from the response with the `201` status
  - endpoint reactivated

[Change history](https://skmtc.dev/bencherdev/apis/bencher-api/changes/v0/users/:user/tokens/post.md)

---

[API](https://skmtc.dev/bencherdev/apis/bencher-api.md) · [All operations](https://skmtc.dev/bencherdev/apis/bencher-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/bencherdev/bencher-api/revisions/74e9728a444e/schema)
