---
type: api
title: Update the API key of the Entity Store tasks
description: Replace the API key of every Entity Store background task with one owned by the user making this request, for example after the user who installed the Entity Store is removed. The tasks keep their schedules and state, and no entity data is changed. The user needs the same privileges as the install endpoint. Tasks that could not be updated are listed in `failed`; call the endpoint again to retry them.<br/><br/>[Required authorization] Route required privileges: securitySolution.
url: https://www.elastic.co/docs/api/doc/kibana/operation/operation-post-security-entity-store-update-api-key
resource: https://www.elastic.co/docs/api/doc/kibana/operation/operation-post-security-entity-store-update-api-key
products:
  - Kibana
---

# Update the API key of the Entity Store tasks

Authentication: required

Availability: Planned

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

## Paths

- `POST` `/api/security/entity_store/update_api_key`
- `POST` `/s/{space_id}/api/security/entity_store/update_api_key`

#### Path parameters

- `space_id` (string) — optional
  An identifier for the space. If `space_id` is not provided in the URL, the default space is used. Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

## Description

Replace the API key of every Entity Store background task with one owned by the user making this request, for example after the user who installed the Entity Store is removed. The tasks keep their schedules and state, and no entity data is changed. The user needs the same privileges as the install endpoint. Tasks that could not be updated are listed in `failed`; call the endpoint again to retry them.

## Required privileges

- Privileges: `securitySolution`

## Header parameters

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

## Request body

`application/json`

Type: `object`


## Response

Indicates that the request was processed. Check `ok` and `failed` to see whether every task was updated.

`application/json`

## Code examples

#### Console

```console
POST kbn://api/security/entity_store/update_api_key
{}
```

#### curl

```curl
curl -X POST -H "kbn-xsrf: true" -H "Authorization: ApiKey ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{}' \
  "${KIBANA_URL}/api/security/entity_store/update_api_key"
```

## Response examples

#### Some tasks could not be updated

`application/json`

Call the endpoint again to retry the tasks listed in `failed`.

```json
{
  "failed": [
    {
      "id": "entity_store:v2:status_report_task:default",
      "message": "Version conflict",
      "statusCode": 409
    }
  ],
  "ok": false,
  "updated": [
    "entity_store:v2:history_snapshot_task:default"
  ]
}
```

#### All tasks updated

`application/json`

Every Entity Store task now runs with an API key owned by the caller.

```json
{
  "failed": [],
  "ok": true,
  "updated": [
    "entity_store:v2:history_snapshot_task:default",
    "entity_store:v2:status_report_task:default"
  ]
}
```

