---
type: api
title: Update the Entity Store
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana-serverless/operation/operation-put-security-entity-store
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana-serverless/operation/operation-put-security-entity-store
products:
  - Kibana
---

# Update the Entity Store

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

## Paths

- `PUT` `/api/security/entity_store`
- `PUT` `/s/{space_id}/api/security/entity_store`

## Description

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

Update the Entity Store configuration without reinstalling. Send `logExtraction` to change log extraction settings. Omitting a log extraction field leaves it unchanged. Sending `null` for a log extraction field clears that override and reverts to the entity type default (for `frequency`: 1m for `host` and `user`, 10m for `service`, 30m for `generic`). Send `historySnapshot.frequency` to change the snapshot interval (at least 1 hour) and `historySnapshot.retentionDays` to change how long snapshots are kept. Omitting either history snapshot field leaves it unchanged. At least one of `logExtraction`, `excludedUserNames` or `historySnapshot` is required.

## Required authorization

- Privileges: `securitySolution`

## Authentication

- Api key: `Authorization: <value>`
  You must create an API key and use the encoded value in the request header. To learn about creating keys, go to [API keys](https://www.elastic.co/docs/current/serverless/api-keys).

## Header parameters

- `kbn-xsrf` (string) — required
  A required header to protect against CSRF attacks

## Request body

`application/json`

- `excludedUserNames` (string[] · max items: 200) — optional
- `historySnapshot` (object) — optional
  - `frequency` (string · max length: 32 · pattern: [smdh]$) — optional
  - `retentionDays` (integer · min: 1 · max: 3650) — optional
- `logExtraction` (object) — optional
  - `additionalIndexPatterns` (string[] · max items: 1000) — optional — nullable
  - `delay` (string · max length: 32 · pattern: [smdh]$) — optional — nullable
  - `docsLimit` (integer · min: 1 · max: 9007199254740991) — optional — nullable
  - `excludedIndexPatterns` (string[] · max items: 1000) — optional — nullable
  - `fieldHistoryLength` (integer · min: -9007199254740991 · max: 9007199254740991) — optional — nullable
  - `frequency` (string · max length: 32 · pattern: [smdh]$) — optional — nullable
  - `lookbackPeriod` (string · max length: 32 · pattern: [smdh]$) — optional — nullable
  - `maxLogsPerPage` (integer · min: 1 · max: 9007199254740991) — optional — nullable
  - `maxLogsPerWindow` (integer · min: 0 · max: 9007199254740991) — optional — nullable
  - `maxLogsPerWindowCapBehavior` (enum) — optional — nullable
    Values: `defer`, `drop`
  - `maxTimeWindowSize` (string · max length: 32 · pattern: [smdh]$) — optional — nullable

## Responses

#### `200`

Indicates a successful response.

`application/json`

#### `400`

Bad request.

`application/json`

#### `404`

Entity Store not found.

`application/json`

## Code examples

#### Console

```console
PUT kbn://api/security/entity_store
{
  "logExtraction": {
    "lookbackPeriod": "6h",
    "frequency": "10m",
    "fieldHistoryLength": 15
  }
}
```

#### Console

```console
PUT kbn://api/security/entity_store
{
  "historySnapshot": {
    "frequency": "12h",
    "retentionDays": 90
  }
}
```

#### curl

```curl
curl -X PUT -H "kbn-xsrf: true" -H "Authorization: ApiKey ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"logExtraction":{"lookbackPeriod":"6h","frequency":"10m","fieldHistoryLength":15}}' \
  "${KIBANA_URL}/api/security/entity_store"
```

#### curl

```curl
curl -X PUT -H "kbn-xsrf: true" -H "Authorization: ApiKey ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"historySnapshot":{"frequency":"12h","retentionDays":90}}' \
  "${KIBANA_URL}/api/security/entity_store"
```

## Response examples

#### Entity Store updated

The Entity Store configuration was successfully updated.

```json
{
  "ok": true
}
```

#### Invalid duration parameter

A log extraction parameter has an invalid duration format.

```json
{
  "error": "Bad Request",
  "message": "[request body]: logExtraction.frequency: must be a valid duration of at least 30 seconds (e.g. 1m, 30s)",
  "statusCode": 400
}
```

#### Invalid history snapshot interval

The history snapshot interval must be at least 1 hour.

```json
{
  "error": "Bad Request",
  "message": "[request body]: historySnapshot.frequency: must be a valid duration of at least 1 hour (e.g. 1h, 24h)",
  "statusCode": 400
}
```

#### Entity Store not installed

The Entity Store has not been installed yet.

```json
{
  "error": "Not Found",
  "message": "Entity store is not installed",
  "statusCode": 404
}
```

