Skip to main content

Create a token for a service account.

POST <your-unleash-url>/api/admin/service-account/:id/token

Authorization

name: Authorizationtype: apiKeyin: header

Creates a new token for the service account identified by the id.

Request

Path Parameters

  • id string required

Body

required

patSchema

  • id integer

    Possible values: >= 1

    The unique identification number for this Personal Access Token. (This property is set by Unleash when the token is created and cannot be set manually: if you provide a value when creating a PAT, Unleash will ignore it.)

  • secret string

    The token used for authentication. (This property is set by Unleash when the token is created and cannot be set manually: if you provide a value when creating a PAT, Unleash will ignore it.)

  • expiresAt date-time

    The token's expiration date.

  • createdAt date-time

    When the token was created. (This property is set by Unleash when the token is created and cannot be set manually: if you provide a value when creating a PAT, Unleash will ignore it.)

  • seenAt date-time nullable

    When the token was last seen/used to authenticate with. null if it has not been used yet. (This property is set by Unleash when the token is created and cannot be set manually: if you provide a value when creating a PAT, Unleash will ignore it.)

Responses

The resource was successfully created.

Response Headers
  • location string

    The location of the newly created resource.

Schema
  • id integer

    Possible values: >= 1

    The unique identification number for this Personal Access Token. (This property is set by Unleash when the token is created and cannot be set manually: if you provide a value when creating a PAT, Unleash will ignore it.)

  • secret string

    The token used for authentication. (This property is set by Unleash when the token is created and cannot be set manually: if you provide a value when creating a PAT, Unleash will ignore it.)

  • expiresAt date-time

    The token's expiration date.

  • createdAt date-time

    When the token was created. (This property is set by Unleash when the token is created and cannot be set manually: if you provide a value when creating a PAT, Unleash will ignore it.)

  • seenAt date-time nullable

    When the token was last seen/used to authenticate with. null if it has not been used yet. (This property is set by Unleash when the token is created and cannot be set manually: if you provide a value when creating a PAT, Unleash will ignore it.)

Authorization

name: Authorizationtype: apiKeyin: header

Request

Base URL
<your-unleash-url>
apiKey
id — path required
Body required
{
"id": 1,
"secret": "user:xyzrandomstring",
"expiresAt": "2023-04-19T08:15:14.000Z",
"createdAt": "2023-04-19T08:15:14.000Z",
"seenAt": "2023-04-19T08:15:14.000Z"
}
curl / cURL
curl -L -X POST '<your-unleash-url>/api/admin/service-account/:id/token' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"id": 1,
"secret": "user:xyzrandomstring",
"expiresAt": "2023-04-19T08:15:14.000Z",
"createdAt": "2023-04-19T08:15:14.000Z",
"seenAt": "2023-04-19T08:15:14.000Z"
}'