Skip to main content

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

POST <your-unleash-url>/api/admin/user/tokens

Authorization

name: Authorizationtype: apiKeyin: headerdescription: API key needed to access this API

Creates a new personal access token (PAT) belonging to the current user.

Request

Body

required

#/components/schemas/createPatSchema

  • description string required

    The PAT's description.

  • expiresAt date-time required

    The PAT's expiration date.

Responses

The resource was successfully created.

Response Headers
  • location string

    The location of the newly created resource.

Schema
  • id integer required

    Possible values: >= 1

    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.

  • secret string

    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.

  • createdAt date-time required

    The date and time of when the PAT was created.

  • seenAt date-time nullable

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

  • userId integer

    The ID of the user this PAT belongs to.

  • description string required

    The PAT's description.

  • expiresAt date-time required

    The PAT's expiration date.

Authorization

name: Authorizationtype: apiKeyin: headerdescription: API key needed to access this API

Request

Base URL
<your-unleash-url>
Security Scheme
apiKey
Body required
{
"description": "user:xyzrandomstring",
"expiresAt": "2023-04-19T08:15:14.000Z"
}
curl / cURL
curl -L -X POST '<your-unleash-url>/api/admin/user/tokens' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"description": "user:xyzrandomstring",
"expiresAt": "2023-04-19T08:15:14.000Z"
}'