elasticsearch/docs/reference/rest-api/security/delete-service-token.asciidoc
James Rodewig 255c9a7f95
[DOCS] Move x-pack docs to docs/reference dir (#99209)
**Problem:**
For historical reasons, source files for the Elasticsearch Guide's security, watcher, and Logstash API docs are housed in the `x-pack/docs` directory. This can confuse new contributors who expect Elasticsearch Guide docs to be located in `docs/reference`. 

**Solution:**
- Move the security, watcher, and Logstash API doc source files to the `docs/reference` directory
- Update doc snippet tests to use security

Rel: https://github.com/elastic/platform-docs-team/issues/208
2023-09-12 14:53:41 -04:00

61 lines
1.6 KiB
Text

[role="xpack"]
[[security-api-delete-service-token]]
=== Delete service account tokens API
++++
<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}
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
}
----