BodyRequired
- id
string - ids
array[string] A list of API key ids. This parameter cannot be used with any of
name
,realm_name
, orusername
. - name
string - owner
boolean Query API keys owned by the currently authenticated user. The
realm_name
orusername
parameters cannot be specified when this parameter is set totrue
as they are assumed to be the currently authenticated ones.NOTE: At least one of
ids
,name
,username
, andrealm_name
must be specified ifowner
isfalse
. - realm_name
string The name of an authentication realm. This parameter cannot be used with either
ids
orname
, or whenowner
flag is set totrue
. - username
string
DELETE /_security/api_key
Console
DELETE /_security/api_key
{
"ids" : [ "VuaCfGcBCdbkQm-e5aOx" ]
}
curl \
--request DELETE 'http://api.example.com/_security/api_key' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '"{\n \"ids\" : [ \"VuaCfGcBCdbkQm-e5aOx\" ]\n}"'
Request examples
API keys by ID
Run `DELETE /_security/api_key` to invalidate the API keys identified by ID.
{
"ids" : [ "VuaCfGcBCdbkQm-e5aOx" ]
}
Run `DELETE /_security/api_key` to invalidate the API keys identified by name.
{
"name" : "my-api-key"
}
Run `DELETE /_security/api_key` to invalidate all API keys for the `native1` realm.
{
"realm_name" : "native1"
}
Run `DELETE /_security/api_key` to invalidate all API keys for the user `myuser` in all realms.
{
"username" : "myuser"
}
Run `DELETE /_security/api_key` to invalidate the API keys identified by ID if they are owned by the currently authenticated user.
{
"ids" : ["VuaCfGcBCdbkQm-e5aOx"],
"owner" : "true"
}
Run `DELETE /_security/api_key` to invalidate all API keys for the user `myuser` in the `native1` realm .
{
"username" : "myuser",
"realm_name" : "native1"
}
Response examples (200)
A successful response from `DELETE /_security/api_key`.
{
"invalidated_api_keys": [
"api-key-id-1"
],
"previously_invalidated_api_keys": [
"api-key-id-2",
"api-key-id-3"
],
"error_count": 2,
"error_details": [
{
"type": "exception",
"reason": "error occurred while invalidating api keys",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "invalid api key id"
}
},
{
"type": "exception",
"reason": "error occurred while invalidating api keys",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "invalid api key id"
}
}
]
}