List the API tokens of an account.
GET/v1/api-tokens
Returns the API tokens of the account that owns the API token in the request, or of one of its sub accounts. To list the API tokens of a sub account, pass its ID in the accountId query parameter.
The response does not include the token values.
Must be run with an API token that has the Admin role. API tokens created before token roles were introduced have the same permissions as Admin.
Please ensure to change the region in the URL to match your account's region.
Request
Query Parameters
The ID of the account whose API tokens to list. It must be the account that owns the API token in the request or one of its sub accounts. Defaults to the account that owns the API token in the request.
Responses
- 200
- 403
successful operation. The token values are not returned.
- application/json
- Schema
- Example (from schema)
Schema
- Array [
- ]
ID of the API token. Use it to delete the token.
The name of the API token
The time at which the API token was created, in epoch seconds
The time at which the API token was last used, in epoch seconds, or null if it was never used
Possible values: [ADMIN, REGULAR, READ_ONLY, CUSTOM]
The role of the API token. REGULAR is shown as User in the app.
[
{
"id": 2050070,
"name": "ci-pipeline",
"createdAt": 1621858311,
"lastUsed": 1729850405,
"role": "ADMIN"
}
]
Forbidden
- application/json
- Schema
- Example (from schema)
Schema
Returned when accountId is not the account that owns the API token in the request or one of its sub accounts. Not returned when the API token does not have the Admin role.
Forbidden. Either the API token in the request does not have the Admin role ("Insufficient privileges"), or accountId is not the account that owns the API token in the request or one of its sub accounts.
{
"errorCode": "api-tokens/ACCOUNT_NOT_ACCESSIBLE",
"message": "Account 12345 is not this account or one of its sub accounts"
}