---
title: "Cancel a batch migration"
method: POST
path: "/api/v2/security_monitoring/batch-migrations/{batch_id}/cancel"
tags: ["Security Monitoring"]
---

# Cancel a batch migration

`POST /api/v2/security_monitoring/batch-migrations/{batch_id}/cancel`

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/security_monitoring/batch-migrations/{batch_id}/cancel`
- Auth: one of:
  - API key in header `DD-API-KEY` and API key in header `DD-APPLICATION-KEY`
  - OAuth 2
    - Authorization code: `/oauth2/v1/authorize`
    - Token URL: `/oauth2/v1/token` scopes: `security_monitoring_rules_write`
- TypeScript: <https://skmtc.dev/datadog/apis/datadog-api-v2-collection/docs/api/v2/security_monitoring/batch-migrations/:batch_id/cancel/post.ts> (a function with typed inputs; its response is checked against the schema)

Cancel an `in_progress` batch migration. Resources that are `pending` or `in_progress`
become `canceled`. Resources that are already `completed` or `failed` keep their status
and output, so completed resources can still be published. Canceling a `canceled` batch
migration succeeds, so the request can be safely retried. Returns `409 Conflict` if the
batch migration is `draft` or `completed`.

## Path parameters

- `batch_id` string, uuid, required

## Response `202`

Accepted

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `409`: Conflict
- `429`: Too many requests

---

[API](https://skmtc.dev/datadog/apis/datadog-api-v2-collection.md) - [All operations](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/llms.txt) - [OpenAPI document](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/revisions/3f70db624329?raw)
