User Keys REST API


List user API keys


โš ๏ธ Breaking Changes: The Bencher API is in beta and under active development. We may introduce breaking changes in future releases. We will announce any breaking changes in the release notes.

List all `bencher_user_*` API keys for a user. Only the authenticated user themselves and server admins have access to this endpoint. When authenticated with a user API key, only that key itself is listed: a key cannot enumerate the user's other keys. By default, the keys are sorted in alphabetical order by name. The HTTP response header `X-Total-Count` contains the total number of keys.

Headers


Content-Type

string

Required

Set to application/json.


Authorization

string

Required

Set to Bearer BENCHER_API_KEY, where BENCHER_API_KEY is a valid Bencher API key (or a deprecated API token).

Path Parameters


user
Required

The slug or UUID for a user.

Query Parameters


direction

string

The direction to sort by. If not specified, the default sort direction is used.

Default: asc

One of: asc, desc


page

integer

The page number to return. If not specified, the first page is returned.

Default: 1


per_page

integer

The number of items to return per page. If not specified, the default number of items per page (8) is used.

Default: 8


sort

string

The field to sort by. If not specified, the default sort field is used.

Default: name

One of: name


name

string

Filter by key name, exact match.


revoked

boolean

If set to `true`, only returns revoked keys. If not set or set to `false`, only returns non-revoked keys.


search

string

Search by key name or UUID.

GET
/v0/users/{user}/keys
Bencher Cloud https://api.bencher.dev
Bencher Self-Hosted http://localhost:61016

Bencher CLI

bencher user key list USER

View OpenAPI Spec

Create a user API key


โš ๏ธ Breaking Changes: The Bencher API is in beta and under active development. We may introduce breaking changes in future releases. We will announce any breaking changes in the release notes.

Create a new `bencher_user_*` API key for a user. The plaintext key is only returned once in the response. Only the authenticated user themselves and server admins have access to this endpoint. This endpoint cannot be called with a user API key: a key cannot be used to create another key, so revoking a key also cuts off any credentials that could have been derived from it. Authenticate with a JWT (user session token) instead.

Headers


Content-Type

string

Required

Set to application/json.


Authorization

string

Required

Set to Bearer BENCHER_API_KEY, where BENCHER_API_KEY is a valid Bencher API key (or a deprecated API token).

Path Parameters


user
Required

The slug or UUID for a user.

Body Parameters


name

string

Required

The name of the user key. Maximum length is 64 characters.


ttl

integer

The time-to-live (TTL) for the key in seconds. If not provided, the key will not expire for over 128 years.

POST
/v0/users/{user}/keys
Bencher Cloud https://api.bencher.dev
Bencher Self-Hosted http://localhost:61016

Bencher CLI

bencher user key create USER

View OpenAPI Spec

View a user API key


โš ๏ธ Breaking Changes: The Bencher API is in beta and under active development. We may introduce breaking changes in future releases. We will announce any breaking changes in the release notes.

View an API key for a user. Only the authenticated user themselves and server admins have access to this endpoint. When authenticated with a user API key, only that key itself may be viewed: a key cannot inspect the user's other keys. Authenticate with a JWT (user session token) to view other keys.

Headers


Content-Type

string

Required

Set to application/json.


Authorization

string

Required

Set to Bearer BENCHER_API_KEY, where BENCHER_API_KEY is a valid Bencher API key (or a deprecated API token).

Path Parameters


key

string

Required

The UUID for a user key.


user
Required

The slug or UUID for a user.

GET
/v0/users/{user}/keys/{key}
Bencher Cloud https://api.bencher.dev
Bencher Self-Hosted http://localhost:61016

Bencher CLI

bencher user key view USER KEY

View OpenAPI Spec

Update a user API key


โš ๏ธ Breaking Changes: The Bencher API is in beta and under active development. We may introduce breaking changes in future releases. We will announce any breaking changes in the release notes.

Update an API key for a user (rename only). Only the authenticated user themselves and server admins have access to this endpoint. When authenticated with a user API key, only that key itself may be updated: a key cannot modify the user's other keys. Authenticate with a JWT (user session token) to update other keys.

Headers


Content-Type

string

Required

Set to application/json.


Authorization

string

Required

Set to Bearer BENCHER_API_KEY, where BENCHER_API_KEY is a valid Bencher API key (or a deprecated API token).

Path Parameters


key

string

Required

The UUID for a user key.


user
Required

The slug or UUID for a user.

Body Parameters


name

string

The new name of the user key. Maximum length is 64 characters.

PATCH
/v0/users/{user}/keys/{key}
Bencher Cloud https://api.bencher.dev
Bencher Self-Hosted http://localhost:61016

Bencher CLI

bencher user key update USER KEY

View OpenAPI Spec

Revoke a user API key


โš ๏ธ Breaking Changes: The Bencher API is in beta and under active development. We may introduce breaking changes in future releases. We will announce any breaking changes in the release notes.

Revoke an API key for a user. Revocation is terminal: a revoked key can no longer authenticate any request, and the revocation cannot be undone. Only the authenticated user themselves and server admins have access to this endpoint. When authenticated with a user API key, only that key itself may be revoked: a key can always destroy itself, but it cannot revoke the user's other keys. Authenticate with a JWT (user session token) to revoke other keys.

Headers


Content-Type

string

Required

Set to application/json.


Authorization

string

Required

Set to Bearer BENCHER_API_KEY, where BENCHER_API_KEY is a valid Bencher API key (or a deprecated API token).

Path Parameters


key

string

Required

The UUID for a user key.


user
Required

The slug or UUID for a user.

DELETE
/v0/users/{user}/keys/{key}
Bencher Cloud https://api.bencher.dev
Bencher Self-Hosted http://localhost:61016

Bencher CLI

bencher user key revoke USER KEY

View OpenAPI Spec


Published: Mon, February 12, 2024 at 7:26:00 AM UTC | Last Updated: Sat, May 9, 2026 at 12:00:00 AM UTC