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: headerdescription: API key needed to access this API

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

Request

Path Parameters

  • id string required

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
id — path required
Body required
{
"description": "user:xyzrandomstring",
"expiresAt": "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 '{
"description": "user:xyzrandomstring",
"expiresAt": "2023-04-19T08:15:14.000Z"
}'