Skip to main content

Create a Personal-Access-Token (PAT)

Generates a new PAT for the user. Currently only available for machine users. The token will be returned in the response, make sure to store it. PATs are ready-to-use tokens and can be sent directly in the authentication header.

Path Parameters
  • userId string required
Header Parameters
  • x-zitadel-orgid string

    The default is always the organization of the requesting user. If you like to update a user from another organization include the header. Make sure the requesting user has permission in the requested organization.

Request Body required
  • expirationDate date-time

    The date the token will expire and no logins will be possible

Responses

OK


Schema
  • tokenId string
  • token string
  • details object
  • sequence uint64

    on read: the sequence of the last event reduced by the projection

    on manipulation: the timestamp of the event(s) added by the manipulation

  • creationDate date-time

    on read: the timestamp of the first event of the object

    on create: the timestamp of the event(s) added by the manipulation

  • changeDate date-time

    on read: the timestamp of the last event reduced by the projection

    on manipulation: the

  • resourceOwner resource_owner is the organization an object belongs to
POST /users/:userId/pats

Authorization

type: oauth2flow: authorizationCodescopes: openid,urn:zitadel:iam:org:project:id:zitadel:aud

Request

Base URL
https://$ZITADEL_DOMAIN/management/v1
Bearer Token
userId — path required
x-zitadel-orgid — header
Content-Type
Body required
{
"expirationDate": "2519-04-01T08:45:00.000000Z"
}
Accept
curl -L -X POST 'https://$ZITADEL_DOMAIN/management/v1/users/:userId/pats' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
--data-raw '{
"expirationDate": "2519-04-01T08:45:00.000000Z"
}'