[role="xpack"]
[[security-api-delete-service-token]]
=== Delete service account tokens API

beta::[]

++++
<titleabbrev>Delete service account token</titleabbrev>
++++

Deletes  <<service-accounts,service account>> tokens for a `service` in a
specified `namespace`.

[[security-api-delete-service-token-request]]
==== {api-request-title}

`DELETE /_security/service/<namespace>/<service>/credential/token/<token_name>`

[[security-api-delete-service-token-prereqs]]
==== {api-prereq-title}

* To use this API, you must have at least the `manage_service_account`
<<privileges-list-cluster,cluster privilege>>.

[[security-api-delete-service-token-desc]]
==== {api-description-title}
include::../../security/authentication/service-accounts.asciidoc[tag=service-accounts-tls]

The API response indicates whether the specified service account token is found
and deleted or it is not found.

[[security-api-delete-service-token-path-params]]
==== {api-path-parms-title}

`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.

[[security-api-delete-service-token-example]]
==== {api-examples-title}

The following request deletes the `token1` service account token from the
`elastic/fleet-server` service account:

[source,console]
----
DELETE /_security/service/elastic/fleet-server/credential/token/token42
----
// TEST[setup:service_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`.

[source,console-result]
----
{
  "found" : true
}
----
