For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/api/latest/fleet-automation/cancel-a-deployment.md. A documentation index is available at /llms.txt.
Language
Datadog site

Cancel a deployment

POSThttps://api.datadoghq.com/api/v2/fleet/deployments/{deployment_id}/cancelhttps://api.us3.datadoghq.com/api/v2/fleet/deployments/{deployment_id}/cancelhttps://api.us5.datadoghq.com/api/v2/fleet/deployments/{deployment_id}/cancelhttps://api.datadoghq.eu/api/v2/fleet/deployments/{deployment_id}/cancelhttps://api.ap1.datadoghq.com/api/v2/fleet/deployments/{deployment_id}/cancelhttps://api.ap2.datadoghq.com/api/v2/fleet/deployments/{deployment_id}/cancelhttps://api.uk1.datadoghq.com/api/v2/fleet/deployments/{deployment_id}/cancelhttps://api.ddog-gov.com/api/v2/fleet/deployments/{deployment_id}/cancelhttps://api.us2.ddog-gov.com/api/v2/fleet/deployments/{deployment_id}/cancel

Overview

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.

This endpoint requires all of the following permissions:

  • agent_upgrade_write
  • fleet_policies_write

Arguments

Path Parameters

Name
Type
Description
deployment_id [required]
string

The unique identifier of the deployment to cancel.

Response

OK

Response containing the result of a deployment cancellation request.

Field
Type
Description
data [required]
object

A deployment cancellation response.

Code Example

Cancel a deployment
# Path parameters
export deployment_id="k7Q-3mX-p9Z"

# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/fleet/deployments/${deployment_id}/cancel" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Path parameters
export deployment_id="k7Q-3mX-p9Z"

# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/fleet/deployments/${deployment_id}/cancel" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Path parameters
export deployment_id="k7Q-3mX-p9Z"

# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/fleet/deployments/${deployment_id}/cancel" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Path parameters
export deployment_id="k7Q-3mX-p9Z"

# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/fleet/deployments/${deployment_id}/cancel" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Path parameters
export deployment_id="k7Q-3mX-p9Z"

# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/fleet/deployments/${deployment_id}/cancel" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Path parameters
export deployment_id="k7Q-3mX-p9Z"

# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/fleet/deployments/${deployment_id}/cancel" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Path parameters
export deployment_id="k7Q-3mX-p9Z"

# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/fleet/deployments/${deployment_id}/cancel" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Path parameters
export deployment_id="k7Q-3mX-p9Z"

# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/fleet/deployments/${deployment_id}/cancel" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Path parameters
export deployment_id="k7Q-3mX-p9Z"

# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/fleet/deployments/${deployment_id}/cancel" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"