delete-service-token.asciidoc 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. .New API reference
  8. [sidebar]
  9. --
  10. For the most up-to-date API details, refer to {api-es}/group/endpoint-security[Security APIs].
  11. --
  12. Deletes <<service-accounts,service account>> tokens for a `service` in a
  13. specified `namespace`.
  14. [[security-api-delete-service-token-request]]
  15. ==== {api-request-title}
  16. `DELETE /_security/service/<namespace>/<service>/credential/token/<token_name>`
  17. [[security-api-delete-service-token-prereqs]]
  18. ==== {api-prereq-title}
  19. * To use this API, you must have at least the `manage_service_account`
  20. <<privileges-list-cluster,cluster privilege>>.
  21. [[security-api-delete-service-token-desc]]
  22. ==== {api-description-title}
  23. The API response indicates whether the specified service account token is found
  24. and deleted or it is not found.
  25. [[security-api-delete-service-token-path-params]]
  26. ==== {api-path-parms-title}
  27. `namespace`::
  28. (Required, string) Name of the namespace.
  29. `service`::
  30. (Required, string) Name of the service name.
  31. `token_name`::
  32. (Required, string) Name of the service account token.
  33. [[security-api-delete-service-token-example]]
  34. ==== {api-examples-title}
  35. The following request deletes the `token1` service account token from the
  36. `elastic/fleet-server` service account:
  37. [source,console]
  38. ----
  39. DELETE /_security/service/elastic/fleet-server/credential/token/token42
  40. ----
  41. // TEST[setup:service_token42]
  42. If the service account token is successfully deleted, the request returns
  43. `{"found": true}`. Otherwise, the response will have status code `404` and
  44. found` will be set to `false`.
  45. [source,console-result]
  46. ----
  47. {
  48. "found" : true
  49. }
  50. ----