---
type: api
title: Clean up detection alert migrations
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v9/operation/operation-alertsmigrationcleanup
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v9/operation/operation-alertsmigrationcleanup
products:
  - Kibana
---

# Clean up detection alert migrations

deprecated

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

## Paths

- `DELETE` `/api/detection_engine/signals/migration`
- `DELETE` `/s/{space_id}/api/detection_engine/signals/migration`

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

## Description

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

**DEPRECATED.** Cleanup API for old migration artifacts. Do not add new call sites.
**WARNING:** This schedules deletions; ensure no production reads still point at the source index.

Migrations favor data integrity over shard size. Consequently, unused or orphaned indices are artifacts of
the migration process. A successful migration can leave both the old and new indices present, so the old
index may be deleted. While you can delete these indices manually, the endpoint applies a deletion policy
to the relevant index, causing it to be deleted after 30 days, and removes other migration-specific artifacts.

## Request Body

`application/json`

Array of `migration_id`s to cleanup

- `migration_ids` ([] string · min: 1) — required
  Array of `migration_id`s to cleanup.

## Responses

#### `200`

Successful response

`application/json`

Type: `[] object`

- `destinationIndex` (string)
- `error` (object)
  - `message` (string)
  - `status_code` (integer)
- `id` (string)
- `sourceIndex` (string)
- `status` (enum)
  Values: `success`, `failure`, `pending`
- `updated` (string)
- `version` (string)
#### `400`

Invalid input data response

`application/json`

One of:
- **PlatformErrorResponse**
  - `error` (string)
  - `message` (string)
  - `statusCode` (integer)
- **SiemErrorResponse**
  - `message` (string)
  - `status_code` (integer)
#### `401`

Unsuccessful authentication 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
DELETE /api/detection_engine/signals/migration
{
  "migration_ids": [
    "924f7c50-505f-11eb-ae0a-3fa2e626a51d"
  ]
}
```

#### curl

```curl
curl -X DELETE "https://{kibana_url}/api/detection_engine/signals/migration" \
  -H "Content-Type: application/json" \
  -d '{
  "migration_ids": [
    "924f7c50-505f-11eb-ae0a-3fa2e626a51d"
  ]
}'
```

## Response Examples

#### Success

```json
{
  "migrations": [
    {
      "destinationIndex": ".siem-signals-default-000002-r000016",
      "id": "924f7c50-505f-11eb-ae0a-3fa2e626a51d",
      "sourceIndex": ".siem-signals-default-000002",
      "status": "success",
      "updated": "2021-01-06T22:05:56.859Z",
      "version": 16
    }
  ]
}
```

#### Bad

```json
{
  "error": "Bad Request",
  "message": "[request body].migration_ids: at least one migration id is required to run cleanup",
  "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
}
```

#### Server error

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

