POST
/v2/patsCreate a personal access token
Creates a personal access token (PAT) for the authenticated user. Supply a non-empty description and optionally set expiresAt to an expiration time in epoch milliseconds; use null for a token that does not expire. Store the returned token securely because the response contains its value.
- IdempotentThe SDK sends
Idempotency-Key, so a retried request is only applied once.
Personal access token details, including a description and optional expiration time.
descriptionstringrequired
Description of the PAT
expiresAtintegeroptional
Expiration date in epoch format (milliseconds). When null, token never expires.
201Returns the created token record, including its identifier, description, creation and update times, and token value; expiration and last-used times are included when available.
createdAtintegerrequired
descriptionstringrequired
expiresAtintegeroptional
idintegerrequired
lastUsedAtintegeroptional
tokenstringrequired
updatedAtintegerrequired
400Returned when `description` is missing or empty, or a body value fails validation.
codestringrequired
paramsarray<object>optional
401Returned when the request is not authenticated.
codestringrequired
paramsarray<object>optional
403Returned when the authenticated user is not permitted to create a personal access token.
codestringrequired
paramsarray<object>optional
404Returned when a resource required by the request cannot be found.
codestringrequired
paramsarray<object>optional
Error handling
A 400 is returned when description is missing or empty, or when the request body is invalid. A 401 is returned when the request is not authenticated, and a 403 when the authenticated user cannot create a token. A 404 is returned when a resource required by the request cannot be found. expiresAt, when provided, must be an epoch timestamp in milliseconds.