Headers
-
The version of the API to use
Value is
2023-10-31
. Default value is2023-10-31
. -
A required header to protect against CSRF attacks
Body Required
-
Agent name
-
Privileges configuration
Values are
event:write
orconfig_agent:read
.
Responses
-
200 application/json; Elastic-Api-Version=2023-10-31
Agent key created successfully
-
400 application/json; Elastic-Api-Version=2023-10-31
Bad Request response
-
401 application/json; Elastic-Api-Version=2023-10-31
Unauthorized response
-
403 application/json; Elastic-Api-Version=2023-10-31
Forbidden response
-
500 application/json; Elastic-Api-Version=2023-10-31
Internal Server Error response
POST /api/apm/agent_keys
curl \
-X POST https://localhost:5601/api/apm/agent_keys \
-H "Content-Type: application/json; Elastic-Api-Version=2023-10-31" \
-H "elastic-api-version: 2023-10-31" \
-H "kbn-xsrf: true"
Request examples
# Headers
elastic-api-version: 2023-10-31
kbn-xsrf: true
# Payload
{
"name": "string",
"privileges": [
"event:write"
]
}
Response examples (200)
{
"agentKey": {
"api_key": "string",
"encoded": "string",
"expiration": 42,
"id": "string",
"name": "string"
}
}
Response examples (400)
{
"error": "Not Found",
"message": "Not Found",
"statusCode": 400
}
Response examples (401)
{
"error": "Unauthorized",
"message": "string",
"statusCode": 401
}
Response examples (403)
{
"error": "Forbidden",
"message": "string",
"statusCode": 403
}
Response examples (500)
{
"error": "Internal Server Error",
"message": "string",
"statusCode": 500
}