---
type: api
title: Link entities
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana-serverless/operation/operation-post-security-entity-store-resolution-link
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana-serverless/operation/operation-post-security-entity-store-resolution-link
products:
  - Kibana
---

# Link entities

Availability:

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

## Paths

- `POST` `/api/security/entity_store/resolution/link`
- `POST` `/s/{space_id}/api/security/entity_store/resolution/link`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/kibana-serverless/authentication#apikeyauth)

## Description

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

Link one or more entities to a target entity, creating a resolution group. Changes become visible on subsequent reads after the next index refresh (typically <1s).<br/><br/>[Required authorization] Route required privileges: securitySolution AND securitySolution-entity-analytics.

## Request Body

`application/json`

- `entity_ids` ([] string · min: 1 · max: 1000) — required
  Entity identifiers to link to the target entity. Minimum 1, maximum 1000.
- `target_id` (string) — required
  The entity identifier to resolve the linked entities to.

## Responses

#### `200`

Indicates a successful response.

#### `400`

Bad request.

## Code Examples

#### Console

```console
POST kbn://api/security/entity_store/resolution/link
{
  "target_id": "user:jane.doe@example.com",
  "entity_ids": ["user:jdoe@example.com"]
}
```

#### curl

```curl
curl -X POST -H "kbn-xsrf: true" -H "Authorization: ApiKey ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"target_id":"user:jane.doe@example.com","entity_ids":["user:jdoe@example.com"]}' \
  "${KIBANA_URL}/api/security/entity_store/resolution/link"
```

## Response Examples

#### Entities linked

The entities were successfully linked to the target entity.

```json
{
  "entity_type": "user",
  "linked": [
    "user:jdoe@example.com",
    "user:j.doe@example.com"
  ],
  "skipped": [],
  "target_id": "user:jane.doe@example.com"
}
```

#### Mixed entity types

All entities in a resolution group must be of the same type.

```json
{
  "error": "Bad Request",
  "message": "Cannot link entities of different types",
  "statusCode": 400
}
```

#### Entities not found

One or more of the specified entity identifiers were not found.

```json
{
  "error": "Bad Request",
  "message": "Entities not found: [user:nonexistent@example.com, user:also-nonexistent@example.com]",
  "statusCode": 400
}
```

#### Self-link error

Cannot link an entity to itself.

```json
{
  "error": "Bad Request",
  "message": "Cannot link entity \u0027user:jane.doe@example.com\u0027 to itself.",
  "statusCode": 400
}
```

