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 containing the result of a deployment cancellation request.
Expand All
Field
Type
Description
data [required]
object
A deployment cancellation response.
attributes [required]
object
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 [required]
string
Unique identifier for the deployment.
type [required]
enum
The type of deployment resource.
Allowed enum values: deployment
default: deployment
{"data":{"attributes":{"message":"Cancellation has been requested; the deployment is stopping.","status":"stopping"},"id":"k7Q-3mX-p9Z","type":"deployment"}}
# Path parameters exportdeployment_id="k7Q-3mX-p9Z" # Use a Personal Access Token or Service Access Token exportDD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
"""
Cancel a deployment returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.fleet_automation_apiimportFleetAutomationApi# there is a valid "deployment" in the systemDEPLOYMENT_ID=environ["DEPLOYMENT_ID"]configuration=Configuration()configuration.access_token=environ["DD_BEARER_TOKEN"]withApiClient(configuration)asapi_client:api_instance=FleetAutomationApi(api_client)response=api_instance.cancel_fleet_deployment_v2(deployment_id=DEPLOYMENT_ID,)print(response)
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"python3"example.py"
# Cancel a deployment returns "OK" responserequire"datadog_api_client"DatadogAPIClient.configuredo|config|config.access_token=ENV["DD_BEARER_TOKEN"]endapi_instance=DatadogAPIClient::V2::FleetAutomationAPI.new# there is a valid "deployment" in the systemDEPLOYMENT_ID=ENV["DEPLOYMENT_ID"]papi_instance.cancel_fleet_deployment_v2(DEPLOYMENT_ID)
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"rb"example.rb"
// Cancel a deployment returns "OK" responsepackagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){// there is a valid "deployment" in the systemDeploymentID:=os.Getenv("DEPLOYMENT_ID")ctx:=datadog.NewDefaultContext(context.Background())ctx=context.WithValue(ctx,datadog.ContextAccessToken,os.Getenv("DD_BEARER_TOKEN"))configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewFleetAutomationApi(apiClient)resp,r,err:=api.CancelFleetDeploymentV2(ctx,DeploymentID)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `FleetAutomationApi.CancelFleetDeploymentV2`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `FleetAutomationApi.CancelFleetDeploymentV2`:\n%s\n",responseContent)}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"go run"main.go"
// Cancel a deployment returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.FleetAutomationApi;importcom.datadog.api.client.v2.model.FleetDeploymentV2CancelResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));FleetAutomationApiapiInstance=newFleetAutomationApi(defaultClient);// there is a valid "deployment" in the systemStringDEPLOYMENT_ID=System.getenv("DEPLOYMENT_ID");try{FleetDeploymentV2CancelResponseresult=apiInstance.cancelFleetDeploymentV2(DEPLOYMENT_ID);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling FleetAutomationApi#cancelFleetDeploymentV2");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"java"Example.java"
// Cancel a deployment returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_fleet_automation::FleetAutomationAPI;#[tokio::main]asyncfnmain(){// there is a valid "deployment" in the system
letdeployment_id=std::env::var("DEPLOYMENT_ID").unwrap();letconfiguration=datadog::Configuration::new();letapi=FleetAutomationAPI::with_config(configuration);letresp=api.cancel_fleet_deployment_v2(deployment_id.clone()).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Cancel a deployment returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration({authMethods:{AuthZ:{accessToken: process.env.DD_BEARER_TOKENasstring,},},});constapiInstance=newv2.FleetAutomationApi(configuration);// there is a valid "deployment" in the system
constDEPLOYMENT_ID=process.env.DEPLOYMENT_IDasstring;constparams: v2.FleetAutomationApiCancelFleetDeploymentV2Request={deploymentId: DEPLOYMENT_ID,};apiInstance.cancelFleetDeploymentV2(params).then((data: v2.FleetDeploymentV2CancelResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"tsc"example.ts"
Request a personalized demo
Get Started with Datadog
Ask AI
AI-generated responses may be inaccurate. Verify important info.