---
title: "Cancel a deployment"
method: POST
path: "/api/v2/fleet/deployments/{deployment_id}/cancel"
tags: ["Fleet Automation"]
---

# Cancel a deployment

`POST /api/v2/fleet/deployments/{deployment_id}/cancel`

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/fleet/deployments/{deployment_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`
- TypeScript: <https://skmtc.dev/datadog/apis/datadog-api-v2-collection/docs/api/v2/fleet/deployments/:deployment_id/cancel/post.ts> (a function with typed inputs; its response is checked against the schema)

Cancel an active deployment and stop all pending operations.
When you cancel a deployment:
- All pending operations on hosts that haven't started yet are stopped.
- Operations currently in progress on hosts may complete or be interrupted, depending on their current status.
- Configuration changes or package upgrades already applied to hosts are not rolled back.

After cancellation, you can view the final state of the deployment using the GET endpoint to see which hosts
were successfully updated before the cancellation.

Only deployments with a `pending` or `running` status can be canceled. Returns a 400 if the deployment is not in a cancelable status. Returns a 404 if no deployment matches the specified ID or if you do not have access to it.

## Path parameters

- `deployment_id` string, required

## Response `200`

OK

- FleetDeploymentV2CancelResponse: Response containing the result of a deployment cancellation request.
  - `data` FleetDeploymentV2Cancel, required: A deployment cancellation response.
    - `attributes` FleetDeploymentV2CancelAttributes, required: Attributes of a deployment cancellation response.
      - `message` string: Human-readable message describing the outcome of the cancellation request.
      - `status` string: Status of the deployment after the cancellation request.
    - `id` string, required: Unique identifier for the deployment.
    - `type` 'deployment', required: The type of deployment resource.

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `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)
