API Tokens REST API


List tokens for a user


โš ๏ธ 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 API tokens for a user. Only the authenticated user themselves and server admins have access to this endpoint. By default, the tokens are sorted in alphabetical order by name. The HTTP response header `X-Total-Count` contains the total number of tokens.

Headers


Content-Type

string

Required

Set to application/json.


Authorization

string

Required

Set to Bearer BENCHER_API_TOKEN, where BENCHER_API_TOKEN is a vaild Bencher API token.

Path Parameters


user

string

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 token name, exact match.


search

string

Search by token name, slug, or UUID.

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

Bencher CLI

bencher token list USER

View OpenAPI Spec

Create a token


โš ๏ธ 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 an API token for a user. Only the authenticated user themselves and server admins have access to this endpoint.

Headers


Content-Type

string

Required

Set to application/json.


Authorization

string

Required

Set to Bearer BENCHER_API_TOKEN, where BENCHER_API_TOKEN is a vaild Bencher API token.

Path Parameters


user

string

Required

The slug or UUID for a user.

Body Parameters


name

string

Required

The name of the token. Maximum length is 64 characters.


ttl

integer

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

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

Bencher CLI

bencher token create USER

View OpenAPI Spec

View a token


โš ๏ธ 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 token for a user. Only the authenticated user themselves and server admins have access to this endpoint.

Headers


Content-Type

string

Required

Set to application/json.


Authorization

string

Required

Set to Bearer BENCHER_API_TOKEN, where BENCHER_API_TOKEN is a vaild Bencher API token.

Path Parameters


token
Required

The UUID for a token.


user

string

Required

The slug or UUID for a user.

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

Bencher CLI

bencher token view USER TOKEN

View OpenAPI Spec

Update a token


โš ๏ธ 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 token for a user. Only the authenticated user themselves and server admins have access to this endpoint.

Headers


Content-Type

string

Required

Set to application/json.


Authorization

string

Required

Set to Bearer BENCHER_API_TOKEN, where BENCHER_API_TOKEN is a vaild Bencher API token.

Path Parameters


token
Required

The UUID for a token.


user

string

Required

The slug or UUID for a user.

Body Parameters


name

string

The new name of the token. Maximum length is 64 characters.

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

Bencher CLI

bencher token update USER TOKEN

View OpenAPI Spec


Published: Mon, February 12, 2024 at 7:26:00 AM UTC | Last Updated: Fri, June 21, 2024 at 5:47:00 PM UTC