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

# Publish a batch migration

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

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/security_monitoring/batch-migrations/{batch_id}/publish`
- 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/publish/post.ts> (a function with typed inputs; its response is checked against the schema)

Create a Cloud SIEM detection rule from the `output` of each selected `completed`
resource of a batch migration. Completed resources can be published while the rest of
the batch migration is still being translated. When `resourceIds` is omitted or empty,
every `completed` resource is published. Published rules are created disabled.

Every requested resource must be publishable: `completed`, or left in `publishing` for
more than one minute after an uncertain result. Otherwise, the request returns
`409 Conflict` and nothing is published. Already published resources are not publishable.

The response reports the outcome of each resource, and some resources can be published
while others fail. A `failed` result that contains a `ruleId` means the rule was created:
do not retry that resource. Publishing a rule with a `block_ip` or `block_user` action
requires the `appsec_protect_write` permission.

## Path parameters

- `batch_id` string, uuid, required

## Request body

- SecurityMonitoringBatchMigrationPublishRequest: Request to publish the resources of a batch migration.
  - `data` SecurityMonitoringBatchMigrationPublishData, required: Data of the batch migration publish request.
    - `attributes` SecurityMonitoringBatchMigrationPublishAttributes, required: Attributes of the batch migration publish request.
      - `resourceIds` string[]: Unique UUIDs of the resources to publish. Up to 1000 IDs. When omitted or empty, every `completed` resource of the batch migration is published.
    - `type` 'batchMigrationPublish', required: The type of resource for a batch migration publish request.

## Response `200`

OK

- SecurityMonitoringBatchMigrationPublishResponse: Response containing the publication outcome of each resource.
  - `data` SecurityMonitoringBatchMigrationPublishedResourceData[], required: The publication outcome of each resource.
    - `attributes` SecurityMonitoringBatchMigrationPublishedResourceAttributes, required: Attributes of the publication outcome of a batch migration resource.
      - `error` string: The reason why the resource could not be published.
      - `ruleId` string: The ID of the created Cloud SIEM detection rule.
      - `status` 'published' | 'failed', required: The outcome of publishing a batch migration resource.
    - `id` string, uuid, required: The UUID of the batch migration resource.
    - `type` 'batchMigrationPublishedResource', required: The type of resource for a published batch migration resource.

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