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
Set to application/json.
Authorization string
Set to Bearer BENCHER_API_KEY, where BENCHER_API_KEY is a valid Bencher API key (or a deprecated API token).
Path Parameters
userThe slug or UUID for a user.
Query Parameters
directionstring
The direction to sort by. If not specified, the default sort direction is used.
Default: asc
One of: asc, desc
pageinteger
The page number to return. If not specified, the first page is returned.
Default: 1
per_pageinteger
The number of items to return per page. If not specified, the default number of items per page (8) is used.
Default: 8
sortstring
The field to sort by. If not specified, the default sort field is used.
Default: name
One of: name
namestring
Filter by key name, exact match.
revokedboolean
If set to `true`, only returns revoked keys. If not set or set to `false`, only returns non-revoked keys.
searchstring
Search by key name or UUID.
/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
Set to application/json.
Authorization string
Set to Bearer BENCHER_API_KEY, where BENCHER_API_KEY is a valid Bencher API key (or a deprecated API token).
Path Parameters
userThe slug or UUID for a user.
Body Parameters
namestring
The name of the user key. Maximum length is 64 characters.
ttlinteger
The time-to-live (TTL) for the key in seconds. If not provided, the key will not expire for over 128 years.
/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
Set to application/json.
Authorization string
Set to Bearer BENCHER_API_KEY, where BENCHER_API_KEY is a valid Bencher API key (or a deprecated API token).
Path Parameters
keystring
The UUID for a user key.
userThe slug or UUID for a user.
/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
Set to application/json.
Authorization string
Set to Bearer BENCHER_API_KEY, where BENCHER_API_KEY is a valid Bencher API key (or a deprecated API token).
Path Parameters
keystring
The UUID for a user key.
userThe slug or UUID for a user.
Body Parameters
namestring
The new name of the user key. Maximum length is 64 characters.
/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
Set to application/json.
Authorization string
Set to Bearer BENCHER_API_KEY, where BENCHER_API_KEY is a valid Bencher API key (or a deprecated API token).
Path Parameters
keystring
The UUID for a user key.
userThe slug or UUID for a user.
/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