---
type: api
title: Get enrollment API key by ID
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v8/operation/operation-get-enrollment-api-key
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v8/operation/operation-get-enrollment-api-key
products:
  - Kibana
---

# Get enrollment API key by ID

- Server: `https://{kibana_url}`

## Paths

- `GET` `/api/fleet/enrollment_api_keys/{keyId}`
- `GET` `/s/{space_id}/api/fleet/enrollment_api_keys/{keyId}`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/kibana/v8/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/kibana/v8/authentication#basicauth)

## Description

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

## Responses

#### `200`

OK

`application/json`

- `item` ({})
  - `active` (boolean)
    When false, the enrollment API key is revoked and cannot be used for enrolling Elastic Agents.
  - `api_key` (string)
    The enrollment API key (token) used for enrolling Elastic Agents.
  - `api_key_id` (string)
    The ID of the API key in the Security API.
  - `created_at` (string)
  - `id` (string)
  - `name` (string)
    The name of the enrollment API key.
  - `policy_id` (string)
    The ID of the agent policy the Elastic Agent will be enrolled in.
#### `400`

Generic Error

`application/json`

- `error` (string)
- `message` (string)
- `statusCode` (number)
## Code Examples

#### Console

```console
GET /api/fleet/enrollment_api_keys/{keyId}
```

#### curl

```curl
curl -X GET "https://{kibana_url}/api/fleet/enrollment_api_keys/{keyId}"
```

