Delete service account tokens API
Deletes service account tokens for a service in a specified namespace.
Request
DELETE /_security/service/<namespace>/<service>/credential/token/<token_name>
Prerequisites
- To use this API, you must have at least the
manage_service_accountcluster privilege.
Description
The API response indicates whether the specified service account token is found and deleted or it is not found.
Path parameters
-
namespace - (Required, string) Name of the namespace.
-
service - (Required, string) Name of the service name.
-
token_name - (Required, string) Name of the service account token.
Examples
The following request deletes the token1 service account token from the elastic/fleet-server service account:
resp = client.security.delete_service_token(
namespace="elastic",
service="fleet-server",
name="token42",
)
print(resp) const response = await client.security.deleteServiceToken({
namespace: "elastic",
service: "fleet-server",
name: "token42",
});
console.log(response); DELETE /_security/service/elastic/fleet-server/credential/token/token42
If the service account token is successfully deleted, the request returns {"found": true}. Otherwise, the response will have status code 404 and found` will be set to false.
{
"found" : true
}
© 2023-2025 Elasticsearch
As of September 2024, Elasticsearch is available under a choice of three licenses: the Server Side Public License (SSPL), the Elastic License, or the AGPLv3 (OSI approved).
Elasticsearch and the Elasticsearch logo are trademarks of Elasticsearch B.V., registered in the U.S. and in other countries.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-delete-service-token.html