Clone an API key
- POST also PUT /_security/api_key/clone
Create a copy of an existing API key with a new ID. The cloned key inherits the role descriptors of the source key. This is intended for applications (such as Kibana) that need to create API keys on behalf of a user using an existing API key credential, since derived API keys (API keys created by API keys) are not otherwise supported.
- Cluster privileges:
clone_api_key
Query Parameters
-
refreshRefresh If
true(the default) then refresh the affected shards to make this operation visible to search, ifwait_forthen wait for a refresh to make this operation visible to search, iffalsethen do nothing with refreshes.-
Values:
truefalsewait_for
Request
-
api_keystringrequired -
The credentials of the API key to clone. This is the secret value returned when the key was originally created.
-
namestring Name -
A name for the cloned API key. If not provided, the name of the source key is used.
-
expirationstring Duration -
The expiration time for the cloned API key. By default, API keys never expire. Set to
nullto explicitly create a key with no expiration. -
metadataMetadata -
Arbitrary metadata to associate with the cloned API key. It supports nested data structure. Within the metadata object, keys beginning with
_are reserved for system usage.
Response
-
api_keystringrequired -
The generated API key value for the cloned key.
-
expirationnumber -
Expiration in milliseconds for the API key.
-
idstring Idrequired -
The unique ID of the cloned API key.
-
namestring Namerequired -
The name of the cloned API key.
-
encodedstringrequired -
API key credentials which is the base64-encoding of the UTF-8 representation of
idandapi_keyjoined by a colon (:).