grant-api-key.asciidoc 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. --
  2. :api: grant-api-key
  3. :request: GrantApiKeyRequest
  4. :response: CreateApiKeyResponse
  5. --
  6. [role="xpack"]
  7. [id="{upid}-{api}"]
  8. === Grant API key API
  9. Creates an API key on behalf of another user.
  10. [id="{upid}-{api}-request"]
  11. ==== Grant API key request
  12. This API is similar to <<java-rest-high-security-create-api-key>>, however it
  13. creates the API key for a user that is different than the user that runs the API.
  14. A +{request}+ contains authentication credentials for the user on whose behalf
  15. the API key will be created, a grant type (which indicates whether the
  16. credentials are an access token or a user ID and password), and API key details.
  17. The API key details include a name for the API key, an optional list of role
  18. descriptors to define permissions, and an optional expiration for the
  19. generated API key. If expiration is not provided, by default the API keys do not
  20. expire.
  21. ["source","java",subs="attributes,callouts,macros"]
  22. --------------------------------------------------
  23. include-tagged::{doc-tests-file}[{api}-request]
  24. --------------------------------------------------
  25. include::../execution.asciidoc[]
  26. [id="{upid}-{api}-response"]
  27. ==== Grant API key response
  28. The returned +{response}+ contains an ID, API key, name for the API key, and
  29. optional expiration.
  30. ["source","java",subs="attributes,callouts,macros"]
  31. --------------------------------------------------
  32. include-tagged::{doc-tests-file}[{api}-response]
  33. --------------------------------------------------
  34. <1> The API key that can be used to authenticate to Elasticsearch.
  35. <2> Expiration details, if the API keys expire.