v7

latestOpenAPI 3.0.3raw.githubusercontent.com2026-08-013764062.2 MB
Personal access tokens

Create a new personal access token (PAT) for the current user.

Creates a new [personal access token](https://docs.getunleash.io/concepts/api-tokens-and-client-keys#personal-access-tokens (PAT) belonging to the current user.

post/api/admin/user/tokens

Request body

descriptionstring required

The PAT's description.

expiresAtstring date-time required

The PAT's expiration date.

Example request

{
  "description": "user:xyzrandomstring",
  "expiresAt": "2023-04-19T08:15:14.000Z"
}

Response

The resource was successfully created.

idinteger required

The PAT's ID. PAT IDs are incrementing integers. In other words, a more recently created PAT will always have a higher ID than an older one.

secretstring

The token used for authentication. It is automatically generated by Unleash when the PAT is created and that is the only time this property is returned.

createdAtstring date-time required

The date and time of when the PAT was created.

seenAtstring date-time nullable

When the PAT was last seen/used to authenticate with. null if it has not been used yet.

userIdinteger

The ID of the user this PAT belongs to.

descriptionstring required

The PAT's description.

expiresAtstring date-time required

The PAT's expiration date.

Example response

{
  "id": 1,
  "secret": "user:xyzrandomstring",
  "createdAt": "2023-04-19T08:15:14.000Z",
  "seenAt": "2023-04-19T08:15:14.000Z",
  "userId": 1337,
  "description": "user:xyzrandomstring",
  "expiresAt": "2023-04-19T08:15:14.000Z"
}