---
type: api
title: Assign and unassign users from detection alerts
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/operation/operation-setalertassignees
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/operation/operation-setalertassignees
products:
  - Kibana
---

# Assign and unassign users from detection alerts

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

## Paths

- `POST` `/api/detection_engine/signals/assignees`
- `POST` `/s/{space_id}/api/detection_engine/signals/assignees`

## Description

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

Assign users to detection alerts, and unassign them from alerts.
> info
> You cannot add and remove the same assignee in the same request.

## Authentication

- Api key: `Authorization: <value>`
  These APIs use key-based authentication. You must create an API key and use the encoded value in the request header. For example: `Authorization: ApiKey base64AccessApiKey`
- Basic: `Authorization: Basic <credentials>`

## Request body

User profile IDs to add or remove on each listed alert document ID.

`application/json`

- `assignees` (object) — required
  - `add` (string[] · format: nonempty) — required
  - `remove` (string[] · format: nonempty) — required
- `ids` (string[] · format: nonempty · min items: 1) — required
  A list of alerts `id`s.

## Responses

#### `200`

Indicates a successful call. The body matches an Elasticsearch update-by-query response
(for example `took`, `updated`, `failures`).

`application/json`

Type: `object`

#### `400`

Invalid input data response

`application/json`

One of:
- **{ error, statusCode }**
  - `error` (string)
  - `message` (string)
  - `statusCode` (integer)
- **{ status_code }**
  - `message` (string)
  - `status_code` (integer)
#### `401`

Unsuccessful authentication response

`application/json`

- `error` (string)
- `message` (string)
- `statusCode` (integer)
#### `403`

Not enough privileges response

`application/json`

- `error` (string)
- `message` (string)
- `statusCode` (integer)
#### `500`

Internal server error response

`application/json`

- `message` (string)
- `status_code` (integer)
## Code examples

#### Console

```console
POST kbn:/api/detection_engine/signals/assignees
{
  "assignees": {
    "add": [
      "u_MxY0jbrft7EcfC6iNZSUGeI_n6iYrSwZj5mWF5EqmSU_0"
    ],
    "remove": []
  },
  "ids": [
    "681c2a707335aa7df5f349b70013d87254746191712ecf0ced9b3e2d538503a6"
  ]
}
```

#### curl

```curl
curl -X POST "${KIBANA_URL}/api/detection_engine/signals/assignees" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "assignees": {
      "add": [
        "u_MxY0jbrft7EcfC6iNZSUGeI_n6iYrSwZj5mWF5EqmSU_0"
      ],
      "remove": []
    },
    "ids": [
      "681c2a707335aa7df5f349b70013d87254746191712ecf0ced9b3e2d538503a6"
    ]
  }'
```

## Response examples

#### Add

```json
{
  "batches": 1,
  "deleted": 0,
  "failures": [],
  "noops": 0,
  "requests_per_second": -1,
  "retries": {
    "bulk": 0,
    "search": 0
  },
  "throttled_millis": 0,
  "throttled_until_millis": 0,
  "timed_out": false,
  "took": 76,
  "total": 1,
  "updated": 1,
  "version_conflicts": 0
}
```

#### Bad

```json
{
  "error": "Bad Request",
  "message": "[request body].ids: at least one alert id is required to update assignees",
  "statusCode": 400
}
```

#### Unauthorized

```json
{
  "error": "Unauthorized",
  "message": "[security_exception\n\tRoot causes:\n\t\tsecurity_exception: unable to authenticate user [elastic] for REST request [/_security/_authenticate]]: unable to authenticate user [elastic] for REST request [/_security/_authenticate]",
  "statusCode": 401
}
```

#### Forbidden

```json
{
  "error": "Forbidden",
  "message": "API [POST /api/detection_engine/signals/assignees] is unauthorized for the current user, this action is granted by the Kibana Security Solution privileges for cases and detections",
  "statusCode": 403
}
```

#### Server error

```json
{
  "message": "Internal Server Error",
  "status_code": 500
}
```

