Create a personal access token for the signed-in user. A logto-verification-id in header and the personal-access-tokens scope are required. The token secret value is returned only in this response. The expiration time is required, must be in the future, and must be at most 365 days from now. A user can have at most 20 unexpired personal access tokens.
Responses
-
The personal access token was created successfully. The response includes the token secret value, which cannot be retrieved again.
-
The request body is invalid, the personal access token field is not editable in the account center, or the expiration time is not in the future or more than 365 days from now.
-
Permission denied, the verification record is invalid or the access token does not include the personal-access-tokens scope.
-
The request was made by a third-party application.
-
The token name already exists, or the user has reached the maximum number of unexpired personal access tokens.
curl \
--request POST 'https://[tenant_id].logto.app/api/my-account/personal-access-tokens' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"name": "string",
"expiresAt": 42.0
}'
{
"name": "string",
"expiresAt": 42.0
}
{
"name": "string",
"createdAt": 42.0,
"expiresAt": 42.0,
"value": "string"
}