POST /api/security/entity_store/entities/{entityType}

Spaces method and path for this operation:

post /s/{space_id}/api/security/entity_store/entities/{entityType}

Refer to Spaces for more information.

Create a new entity record in the Entity Store for the specified entity type.

[Required authorization] Route required privileges: securitySolution.

Headers

  • kbn-xsrf string Required

    A required header to protect against CSRF attacks

Path parameters

  • entityType string Required

    The entity type to create.

    Values are user, host, service, or generic.

application/json

Body object

Any of:

Responses

  • 200 application/json

    Indicates the entity was successfully created.

  • 400 application/json

    Bad request.

  • 409 application/json

    Conflict.

POST /api/security/entity_store/entities/{entityType}
curl -X POST -H "kbn-xsrf: true" -H "Authorization: ApiKey ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"entity":{"id":"host:web-server-prod-01","name":"web-server-prod-01","type":"host","source":["manual"],"attributes":{"asset":true}},"host":{"name":"web-server-prod-01","ip":["10.0.1.42"]}}' \
  "${KIBANA_URL}/api/security/entity_store/entities/host"
POST kbn://api/security/entity_store/entities/host
{
  "entity": {
    "id": "host:web-server-prod-01",
    "name": "web-server-prod-01",
    "type": "host",
    "source": ["manual"],
    "attributes": { "asset": true }
  },
  "host": {
    "name": "web-server-prod-01",
    "ip": ["10.0.1.42"]
  }
}
Request example
Create a new host entity record with basic host and entity fields. The entity identifier must match the auto-generated format for the entity type.
{
  "asset": {
    "business_unit": "Engineering",
    "criticality": "high_impact",
    "environment": "production"
  },
  "entity": {
    "attributes": {
      "asset": true,
      "managed": true
    },
    "id": "host:web-server-prod-01",
    "name": "web-server-prod-01",
    "source": [
      "manual"
    ],
    "type": "host"
  },
  "host": {
    "hostname": [
      "web-server-prod-01.example.com"
    ],
    "ip": [
      "10.0.1.42"
    ],
    "name": "web-server-prod-01"
  }
}
Response examples (200)
The entity record was successfully created in the Entity Store.
{
  "ok": true
}
Response examples (400)
The supplied entity identifier does not match the auto-generated identifier derived from the entity fields.
{
  "error": "Bad Request",
  "message": "Bad request: Supplied ID my-custom-id does not match generated EUID host:web-server-prod-01",
  "statusCode": 400
}
Response examples (409)
An entity with the specified identifier already exists.
{
  "error": "Conflict",
  "message": "Entity ID 'host:web-server-prod-01' already exists",
  "statusCode": 409
}