Permission required: create-personal-access-tokens.
This endpoint requires two-factor authentication.
Note that the generated access tokens are irrecoverable, so storing them safely is essential. If a token is lost or forgotten, it can be regenerated or deleted.
When making calls to the API that mandate authentication, include the generated token in the
X-Auth-Tokenheader and your user ID in theX-User-Idheader to authenticate the requests. Visit the Personal Access Token user guide for more details.
Changelog
| Version | Description |
|---|---|
| 3.1.0 | Added bypassTwoFactor param |
| 0.69.0 | Added |
The authenticated user token.
The authenticated user ID.
Enter the 2FA code. This parameter is required if 2FA is enabled in your workspace. See the Introduction to Two-Factor Authentication document for details.
Enter the method with which you get the 2FA code. It can be email, totp, or password. This parameter is required if 2FA is enabled in your workspace.
{
"tokenName": "mypersonaltoken",
"bypassTwoFactor": false
}The name of the token.
If 2FA requirement should be ignored when using this token.
OK
{
"token": "2jdk99wuSjXPO201XlAks9sjDjAhSJmskAKW301mSuj9Sk",
"success": true
}Bad Request
{
"success": false,
"error": "TOTP Required [totp-required]",
"errorType": "totp-required",
"details": {
"method": "password",
"codeGenerated": false,
"availableMethods": []
}
}{
"success": false,
"error": "The 'tokenName' param is required"
}{
"success": false,
"error": "Not Authorized [not-authorized]",
"errorType": "not-authorized",
"details": {
"method": "personalAccessTokens:generateToken"
}
}Unauthorized
{
"status": "error",
"message": "You must be logged in to do this."
}