Spaces method and path for this operation:
post /s/{space_id}/api/fleet/enrollment_api_keys
Refer to Spaces for more information.
Create an enrollment API key for a given agent policy.
[Required authorization] Route required privileges: fleet-agents-all.
POST
/api/fleet/enrollment_api_keys
curl \
--request POST 'https://<KIBANA_URL>/api/fleet/enrollment_api_keys' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--header "kbn-xsrf: true" \
--data '{"expiration":"2025-01-01T00:00:00.000Z","name":"My enrollment key","policy_id":"policy-id-1"}'
Request example
Create an enrollment API key for an agent policy
{
"expiration": "2025-01-01T00:00:00.000Z",
"name": "My enrollment key",
"policy_id": "policy-id-1"
}
Response examples (200)
The created enrollment API key
{
"action": "created",
"item": {
"active": true,
"api_key": "api-key-value-1",
"api_key_id": "api-key-id-1",
"created_at": "2024-01-01T00:00:00.000Z",
"id": "key-id-1",
"name": "My enrollment key",
"policy_id": "policy-id-1"
}
}
Response examples (400)
Example of a generic error response
{
"error": "Bad Request",
"message": "An error message describing what went wrong",
"statusCode": 400
}