Skip to main content
POST
/
users
/
auth
/
keys
Create API key
curl --request POST \
  --url https://api.elastic-cloud.com/api/v1/users/auth/keys \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "description": "<string>",
  "expiration": "<string>",
  "role_assignments": {
    "deployment": [
      {
        "all": "<boolean>",
        "application_roles": [
          "<string>",
          "<string>"
        ],
        "deployment_ids": [
          "<string>",
          "<string>"
        ],
        "organization_id": "<string>",
        "role_id": "<string>"
      },
      {
        "all": "<boolean>",
        "application_roles": [
          "<string>",
          "<string>"
        ],
        "deployment_ids": [
          "<string>",
          "<string>"
        ],
        "organization_id": "<string>",
        "role_id": "<string>"
      }
    ],
    "organization": [
      {
        "organization_id": "<string>",
        "role_id": "<string>"
      },
      {
        "organization_id": "<string>",
        "role_id": "<string>"
      }
    ],
    "platform": [
      {
        "role_id": "<string>"
      },
      {
        "role_id": "<string>"
      }
    ],
    "project": {
      "elasticsearch": [
        {
          "all": "<boolean>",
          "application_roles": [
            "<string>",
            "<string>"
          ],
          "organization_id": "<string>",
          "project_ids": [
            "<string>",
            "<string>"
          ],
          "role_id": "<string>"
        },
        {
          "all": "<boolean>",
          "application_roles": [
            "<string>",
            "<string>"
          ],
          "organization_id": "<string>",
          "project_ids": [
            "<string>",
            "<string>"
          ],
          "role_id": "<string>"
        }
      ],
      "observability": [
        {
          "all": "<boolean>",
          "application_roles": [
            "<string>",
            "<string>"
          ],
          "organization_id": "<string>",
          "project_ids": [
            "<string>",
            "<string>"
          ],
          "role_id": "<string>"
        },
        {
          "all": "<boolean>",
          "application_roles": [
            "<string>",
            "<string>"
          ],
          "organization_id": "<string>",
          "project_ids": [
            "<string>",
            "<string>"
          ],
          "role_id": "<string>"
        }
      ],
      "security": [
        {
          "all": "<boolean>",
          "application_roles": [
            "<string>",
            "<string>"
          ],
          "organization_id": "<string>",
          "project_ids": [
            "<string>",
            "<string>"
          ],
          "role_id": "<string>"
        },
        {
          "all": "<boolean>",
          "application_roles": [
            "<string>",
            "<string>"
          ],
          "organization_id": "<string>",
          "project_ids": [
            "<string>",
            "<string>"
          ],
          "role_id": "<string>"
        }
      ]
    }
  }
}'
{
  "creation_date": "<dateTime>",
  "description": "<string>",
  "expiration_date": "<dateTime>",
  "id": "<string>",
  "key": "<string>",
  "organization_id": "<string>",
  "role_assignments": {
    "deployment": [
      {
        "all": "<boolean>",
        "application_roles": [
          "<string>",
          "<string>"
        ],
        "deployment_ids": [
          "<string>",
          "<string>"
        ],
        "organization_id": "<string>",
        "role_id": "<string>"
      },
      {
        "all": "<boolean>",
        "application_roles": [
          "<string>",
          "<string>"
        ],
        "deployment_ids": [
          "<string>",
          "<string>"
        ],
        "organization_id": "<string>",
        "role_id": "<string>"
      }
    ],
    "organization": [
      {
        "organization_id": "<string>",
        "role_id": "<string>"
      },
      {
        "organization_id": "<string>",
        "role_id": "<string>"
      }
    ],
    "platform": [
      {
        "role_id": "<string>"
      },
      {
        "role_id": "<string>"
      }
    ],
    "project": {
      "elasticsearch": [
        {
          "all": "<boolean>",
          "application_roles": [
            "<string>",
            "<string>"
          ],
          "organization_id": "<string>",
          "project_ids": [
            "<string>",
            "<string>"
          ],
          "role_id": "<string>"
        },
        {
          "all": "<boolean>",
          "application_roles": [
            "<string>",
            "<string>"
          ],
          "organization_id": "<string>",
          "project_ids": [
            "<string>",
            "<string>"
          ],
          "role_id": "<string>"
        }
      ],
      "observability": [
        {
          "all": "<boolean>",
          "application_roles": [
            "<string>",
            "<string>"
          ],
          "organization_id": "<string>",
          "project_ids": [
            "<string>",
            "<string>"
          ],
          "role_id": "<string>"
        },
        {
          "all": "<boolean>",
          "application_roles": [
            "<string>",
            "<string>"
          ],
          "organization_id": "<string>",
          "project_ids": [
            "<string>",
            "<string>"
          ],
          "role_id": "<string>"
        }
      ],
      "security": [
        {
          "all": "<boolean>",
          "application_roles": [
            "<string>",
            "<string>"
          ],
          "organization_id": "<string>",
          "project_ids": [
            "<string>",
            "<string>"
          ],
          "role_id": "<string>"
        },
        {
          "all": "<boolean>",
          "application_roles": [
            "<string>",
            "<string>"
          ],
          "organization_id": "<string>",
          "project_ids": [
            "<string>",
            "<string>"
          ],
          "role_id": "<string>"
        }
      ]
    }
  },
  "user_id": "<string>"
}

Authorizations

Authorization
string
header
required

Body

application/json
description
string
Example:

"<string>"

expiration
string
Example:

"<string>"

role_assignments
object

Response

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

creation_date
string
Example:

"<dateTime>"

description
string
Example:

"<string>"

expiration_date
string
Example:

"<dateTime>"

id
string
Example:

"<string>"

key
string
Example:

"<string>"

organization_id
string
Example:

"<string>"

role_assignments
object
user_id
string
Example:

"<string>"

I