delete-service-token.asciidoc 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. [role="xpack"]
  2. [[security-api-delete-service-token]]
  3. === Delete service account tokens API
  4. ++++
  5. <titleabbrev>Delete service account token</titleabbrev>
  6. ++++
  7. Deletes <<service-accounts,service account>> tokens for a `service` in a
  8. specified `namespace`.
  9. [[security-api-delete-service-token-request]]
  10. ==== {api-request-title}
  11. `DELETE /_security/service/<namespace>/<service>/credential/token/<token_name>`
  12. [[security-api-delete-service-token-prereqs]]
  13. ==== {api-prereq-title}
  14. * To use this API, you must have at least the `manage_service_account`
  15. <<privileges-list-cluster,cluster privilege>>.
  16. [[security-api-delete-service-token-desc]]
  17. ==== {api-description-title}
  18. The API response indicates whether the specified service account token is found
  19. and deleted or it is not found.
  20. [[security-api-delete-service-token-path-params]]
  21. ==== {api-path-parms-title}
  22. `namespace`::
  23. (Required, string) Name of the namespace.
  24. `service`::
  25. (Required, string) Name of the service name.
  26. `token_name`::
  27. (Required, string) Name of the service account token.
  28. [[security-api-delete-service-token-example]]
  29. ==== {api-examples-title}
  30. The following request deletes the `token1` service account token from the
  31. `elastic/fleet-server` service account:
  32. [source,console]
  33. ----
  34. DELETE /_security/service/elastic/fleet-server/credential/token/token42
  35. ----
  36. // TEST[setup:service_token42]
  37. If the service account token is successfully deleted, the request returns
  38. `{"found": true}`. Otherwise, the response will have status code `404` and
  39. found` will be set to `false`.
  40. [source,console-result]
  41. ----
  42. {
  43. "found" : true
  44. }
  45. ----