Authentication

edit

Delete API keys

edit

Delete or invalidate API keys.

Request

edit

DELETE /api/v1/users/auth/keys

Request body

edit

(DeleteApiKeysRequest) (required) The request to delete API keys

Responses

edit
200

(EmptyResponse)

The API keys are deleted.

Request example

edit
curl -XDELETE https://api.elastic-cloud.com/api/v1/users/auth/keys \
-H "Authorization: ApiKey $EC_API_KEY" \
-H 'Content-Type: application/json' \
-d '
{
   "keys" : [
      "string"
   ]
}
'

Get all API keys

edit

Retrieves the metadata for all of the API keys that the user generated.

Request

edit

GET /api/v1/users/auth/keys

Responses

edit
200

(ApiKeysResponse)

The metadata for the API keys is retrieved.

Request example

edit
curl -XGET https://api.elastic-cloud.com/api/v1/users/auth/keys \
-H "Authorization: ApiKey $EC_API_KEY"

Create API key

edit

Creates a new API key.

Request

edit

POST /api/v1/users/auth/keys

Request body

edit

(CreateApiKeyRequest) (required) The request to create the API key

Responses

edit
201

(ApiKeyResponse)

The API key is created and returned in the body of the response.

400

(BasicFailedReply)

The request is invalid. Specify a different request, then try again. (code: api_keys.invalid_input)

Headers

x-cloud-error-codes (string; allowed values: [api_keys.invalid_input])
The error codes associated with the response

Request example

edit
curl -XPOST https://api.elastic-cloud.com/api/v1/users/auth/keys \
-H "Authorization: ApiKey $EC_API_KEY" \
-H 'Content-Type: application/json' \
-d '
{
   "description" : "string",
   "expiration" : "string",
   "role_assignments" : {
      "deployment" : [
         {
            "all" : true,
            "application_roles" : [
               "string"
            ],
            "deployment_ids" : [
               "string"
            ],
            "organization_id" : "string",
            "role_id" : "string"
         }
      ],
      "organization" : [
         {
            "organization_id" : "string",
            "role_id" : "string"
         }
      ],
      "platform" : [
         {
            "role_id" : "string"
         }
      ],
      "project" : {
         "elasticsearch" : [
            {
               "all" : true,
               "application_roles" : [
                  "string"
               ],
               "organization_id" : "string",
               "project_ids" : [
                  "string"
               ],
               "role_id" : "string"
            }
         ],
         "observability" : [
            {
               "all" : true,
               "application_roles" : [
                  "string"
               ],
               "organization_id" : "string",
               "project_ids" : [
                  "string"
               ],
               "role_id" : "string"
            }
         ],
         "security" : [
            {
               "all" : true,
               "application_roles" : [
                  "string"
               ],
               "organization_id" : "string",
               "project_ids" : [
                  "string"
               ],
               "role_id" : "string"
            }
         ]
      }
   }
}
'

Delete API key

edit

Delete or invalidate the API key.

Request

edit

DELETE /api/v1/users/auth/keys/{api_key_id}

Path parameters

edit
Name Type Required Description

api_key_id

string

Y

The API Key ID.

Responses

edit
200

(EmptyResponse)

The API key is deleted.

404

(BasicFailedReply)

The {api_key_id} can't be found. (code: api_keys.key_not_found)

Headers

x-cloud-error-codes (string; allowed values: [api_keys.key_not_found])
The error codes associated with the response

Request example

edit
curl -XDELETE https://api.elastic-cloud.com/api/v1/users/auth/keys/{api_key_id} \
-H "Authorization: ApiKey $EC_API_KEY"

Get API key

edit

Retrieves the metadata for an API key.

Request

edit

GET /api/v1/users/auth/keys/{api_key_id}

Path parameters

edit
Name Type Required Description

api_key_id

string

Y

The API Key ID.

Responses

edit
200

(ApiKeyResponse)

The API key metadata is retrieved.

404

(BasicFailedReply)

The {api_key_id} can't be found. (code: api_keys.key_not_found)

Headers

x-cloud-error-codes (string; allowed values: [api_keys.key_not_found])
The error codes associated with the response

Request example

edit
curl -XGET https://api.elastic-cloud.com/api/v1/users/auth/keys/{api_key_id} \
-H "Authorization: ApiKey $EC_API_KEY"