elasticsearch/docs/reference/rest-api/security/delete-service-token.asciidoc
Lisa Cawley d9c6b679da
[8.17] [DOCS] More links to new API site (#119380) (#119419)
* [DOCS] More links to new API site (#119380)

* Fix example test failure
2025-01-01 10:06:07 +11:00

67 lines
1.7 KiB
Text

[role="xpack"]
[[security-api-delete-service-token]]
=== Delete service account tokens API
++++
<titleabbrev>Delete service account token</titleabbrev>
++++
.New API reference
[sidebar]
--
For the most up-to-date API details, refer to {api-es}/group/endpoint-security[Security APIs].
--
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}
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
}
----