Delete an API token.
DELETE/v1/api-tokens/:id
Deletes an API token of the account that owns the API token in the request or of one of its sub accounts, and returns the deleted token.
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.
An API token can't delete itself. To delete the token you're calling with, use a different Admin API token.
Deleting a token affects any integrations that use that token. Make sure you update integrations that use a token you deleted.
Please ensure to change the region in the URL to match your account's region.
Request
Path Parameters
The ID of the API token to delete. Get it from List the API tokens of an account.
Responses
- 200
- 400
- 403
- 404
successful operation. Returns the deleted token.
- application/json
- Schema
- Example (from schema)
Schema
ID of the API token. Use it to delete the token.
The name of the API token
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",
"token": "c498fbc3-a3ac-4676-ad09-689854b5cbbd",
"createdAt": 1621858311,
"lastUsed": 1729850405,
"role": "ADMIN"
}
Bad Request
- application/json
- Schema
- Example (from schema)
Schema
The API token in the request tried to delete itself.
{
"errorCode": "api-tokens/CANNOT_DELETE_CALLING_TOKEN",
"message": "API token 2050070 cannot delete itself. Use another API token to delete it"
}
Forbidden
- application/json
- Schema
- Example (from schema)
Schema
Forbidden. The API token in the request does not have the Admin role.
{
"message": "Insufficient privileges"
}
Not Found
- application/json
- Schema
- Example (from schema)
Schema
Not Found. No API token with this ID exists in the account that owns the API token in the request or in any of its sub accounts.
{
"message": "API token with id 2050070 not found for account 12345"
}