---
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/4641/api/doc/kibana/v8/operation/operation-alertsmigrationcleanup
resource: https://www.elastic.co/elastic/docs-builder/docs/4641/api/doc/kibana/v8/operation/operation-alertsmigrationcleanup
products:
  - Kibana
---

# Clean up detection alert migrations

deprecated

Authentication: required

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

## Paths

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

#### 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

Migrations favor data integrity over shard size. Consequently, unused or orphaned indices are artifacts of
the migration process. A successful migration will result in both the old and new indices being present.
As such, the old, orphaned index can (and likely should) be deleted.

While you can delete these indices manually,
the endpoint accomplishes this task by applying a deletion policy to the relevant index, causing it to be deleted
after 30 days. It also deletes other artifacts specific to the migration implementation.

## Request body

Array of `migration_id`s to cleanup

`application/json`

- `migration_ids` (string[] · min items: 1) — required

## Responses

#### `200`

Successful response

`application/json`

Type: `object[]`

An array; each item has these fields:

- `destinationIndex` (string)
- `error` (object)
  - `message` (string)
  - `status_code` (integer)
- `id` (string)
- `sourceIndex` (string)
- `status` (enum)
  Values: `success`, `failure`, `pending`
- `updated` (string · format: date-time)
- `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 kbn:/api/detection_engine/signals/migration
{
  "migration_ids": [
    "string"
  ]
}
```

#### curl

```curl
curl -X DELETE "${KIBANA_URL}/api/detection_engine/signals/migration" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "migration_ids": [
      "string"
    ]
  }'
```

## Response examples

#### 200

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
[
  {
    "destinationIndex": "string",
    "error": {
      "message": "string",
      "status_code": 0
    },
    "id": "string",
    "sourceIndex": "string",
    "status": "success",
    "updated": "string",
    "version": "string"
  }
]
```

#### 400

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "error": "string",
  "message": "string",
  "statusCode": 0
}
```

#### 401

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "error": "string",
  "message": "string",
  "statusCode": 0
}
```

#### 500

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "message": "string",
  "status_code": 0
}
```

