For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/api/latest/monitors/delete-a-monitor.md. A documentation index is available at /llms.txt.

Delete a monitor

DELETE https://api.ap1.datadoghq.com/api/v1/monitor/{monitor_id}https://api.ap2.datadoghq.com/api/v1/monitor/{monitor_id}https://api.datadoghq.eu/api/v1/monitor/{monitor_id}https://api.ddog-gov.com/api/v1/monitor/{monitor_id}https://api.us2.ddog-gov.com/api/v1/monitor/{monitor_id}https://api.uk1.datadoghq.com/api/v1/monitor/{monitor_id}https://api.datadoghq.com/api/v1/monitor/{monitor_id}https://api.us3.datadoghq.com/api/v1/monitor/{monitor_id}https://api.us5.datadoghq.com/api/v1/monitor/{monitor_id}

Overview

Delete the specified monitor This endpoint requires any of the following permissions:

  • monitors_write
  • monitors_draft_write

  • OAuth apps require the monitors_draft_write authorization scope to access this endpoint.

    Arguments

    Path Parameters

    Name

    Type

    Description

    monitor_id [required]

    integer

    The ID of the monitor.

    Query Strings

    Name

    Type

    Description

    force

    string

    Delete the monitor even if it’s referenced by other resources (for example SLO, composite monitor).

    Response

    OK

    Response from the delete monitor call.

    Expand All

    Field

    Type

    Description

    deleted_monitor_id

    int64

    ID of the deleted monitor.

    {
      "deleted_monitor_id": 666486743
    }

    Bad Request

    Error response object.

    Expand All

    Field

    Type

    Description

    errors [required]

    [string]

    Array of errors returned by the API.

    {
      "errors": [
        "Bad Request"
      ]
    }

    Authentication error

    Error response object.

    Expand All

    Field

    Type

    Description

    errors [required]

    [string]

    Array of errors returned by the API.

    {
      "errors": [
        "Bad Request"
      ]
    }

    Forbidden

    Error response object.

    Expand All

    Field

    Type

    Description

    errors [required]

    [string]

    Array of errors returned by the API.

    {
      "errors": [
        "Bad Request"
      ]
    }

    Item not found error

    Error response object.

    Expand All

    Field

    Type

    Description

    errors [required]

    [string]

    Array of errors returned by the API.

    {
      "errors": [
        "Bad Request"
      ]
    }

    Too many requests

    Error response object.

    Expand All

    Field

    Type

    Description

    errors [required]

    [string]

    Array of errors returned by the API.

    {
      "errors": [
        "Bad Request"
      ]
    }

    Code Example

                      # Path parameters
    export monitor_id="6.66486743e+08"
    # Use a Personal Access Token or Service Access Token
    export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

    # Curl command
    curl -X DELETE "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.uk1.datadoghq.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/monitor/${monitor_id}" \ -H "Accept: application/json" \ -H "Authorization: Bearer ${DD_BEARER_TOKEN}"
    """
    Delete a monitor returns "OK" response
    """
    
    from os import environ
    from datadog_api_client import ApiClient, Configuration
    from datadog_api_client.v1.api.monitors_api import MonitorsApi
    
    # there is a valid "monitor" in the system
    MONITOR_ID = environ["MONITOR_ID"]
    
    configuration = Configuration()
    configuration.access_token = environ["DD_BEARER_TOKEN"]
    with ApiClient(configuration) as api_client:
        api_instance = MonitorsApi(api_client)
        response = api_instance.delete_monitor(
            monitor_id=int(MONITOR_ID),
        )
    
        print(response)
    

    Instructions

    First install the library and its dependencies and then save the example to example.py and run following commands:

        
    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"
    # Delete a monitor returns "OK" response
    
    require "datadog_api_client"
    DatadogAPIClient.configure do |config|
      config.access_token = ENV["DD_BEARER_TOKEN"]
    end
    api_instance = DatadogAPIClient::V1::MonitorsAPI.new
    
    # there is a valid "monitor" in the system
    MONITOR_ID = ENV["MONITOR_ID"]
    p api_instance.delete_monitor(MONITOR_ID.to_i)
    

    Instructions

    First install the library and its dependencies and then save the example to example.rb and run following commands:

        
    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"
    require 'dogapi'
    
    api_key = '<DATADOG_API_KEY>'
    app_key = '<DATADOG_APPLICATION_KEY>'
    
    dog = Dogapi::Client.new(api_key, app_key)
    
    # Delete a monitor
    dog.delete_monitor(62_625)
    

    Instructions

    First install the library and its dependencies and then save the example to example.rb and run following commands:

        
    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>" rb "example.rb"
    // Delete a monitor returns "OK" response
    
    package main
    
    import (
    	"context"
    	"encoding/json"
    	"fmt"
    	"os"
    	"strconv"
    
    	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
    	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1"
    )
    
    func main() {
    	// there is a valid "monitor" in the system
    	MonitorID, _ := strconv.ParseInt(os.Getenv("MONITOR_ID"), 10, 64)
    
    	ctx := datadog.NewDefaultContext(context.Background())
    	ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
    	configuration := datadog.NewConfiguration()
    	apiClient := datadog.NewAPIClient(configuration)
    	api := datadogV1.NewMonitorsApi(apiClient)
    	resp, r, err := api.DeleteMonitor(ctx, MonitorID, *datadogV1.NewDeleteMonitorOptionalParameters())
    
    	if err != nil {
    		fmt.Fprintf(os.Stderr, "Error when calling `MonitorsApi.DeleteMonitor`: %v\n", err)
    		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    	}
    
    	responseContent, _ := json.MarshalIndent(resp, "", "  ")
    	fmt.Fprintf(os.Stdout, "Response from `MonitorsApi.DeleteMonitor`:\n%s\n", responseContent)
    }
    

    Instructions

    First install the library and its dependencies and then save the example to main.go and run following commands:

        
    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"
    // Delete a monitor returns "OK" response
    
    import com.datadog.api.client.ApiClient;
    import com.datadog.api.client.ApiException;
    import com.datadog.api.client.v1.api.MonitorsApi;
    import com.datadog.api.client.v1.model.DeletedMonitor;
    
    public class Example {
      public static void main(String[] args) {
        ApiClient defaultClient = ApiClient.getDefaultApiClient();
        defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
        MonitorsApi apiInstance = new MonitorsApi(defaultClient);
    
        // there is a valid "monitor" in the system
        Long MONITOR_ID = Long.parseLong(System.getenv("MONITOR_ID"));
    
        try {
          DeletedMonitor result = apiInstance.deleteMonitor(MONITOR_ID);
          System.out.println(result);
        } catch (ApiException e) {
          System.err.println("Exception when calling MonitorsApi#deleteMonitor");
          System.err.println("Status code: " + e.getCode());
          System.err.println("Reason: " + e.getResponseBody());
          System.err.println("Response headers: " + e.getResponseHeaders());
          e.printStackTrace();
        }
      }
    }
    

    Instructions

    First install the library and its dependencies and then save the example to Example.java and run following commands:

        
    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"
    from datadog import initialize, api
    
    options = {
        'api_key': '<DATADOG_API_KEY>',
        'app_key': '<DATADOG_APPLICATION_KEY>'
    }
    
    initialize(**options)
    
    # Delete a monitor
    api.Monitor.delete(2081)
    
    # Force delete a monitor to override warnings
    api.Monitor.delete(2081, force=True)
    

    Instructions

    First install the library and its dependencies and then save the example to example.py and run following commands:

        
    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>" python "example.py"
    // Delete a monitor returns "OK" response
    use datadog_api_client::datadog;
    use datadog_api_client::datadogV1::api_monitors::DeleteMonitorOptionalParams;
    use datadog_api_client::datadogV1::api_monitors::MonitorsAPI;
    
    #[tokio::main]
    async fn main() {
        // there is a valid "monitor" in the system
        let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
        let configuration = datadog::Configuration::new();
        let api = MonitorsAPI::with_config(configuration);
        let resp = api
            .delete_monitor(monitor_id.clone(), DeleteMonitorOptionalParams::default())
            .await;
        if let Ok(value) = resp {
            println!("{:#?}", value);
        } else {
            println!("{:#?}", resp.unwrap_err());
        }
    }
    

    Instructions

    First install the library and its dependencies and then save the example to src/main.rs and run following commands:

        
    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
    /**
     * Delete a monitor returns "OK" response
     */
    
    import { client, v1 } from "@datadog/datadog-api-client";
    
    const configuration = client.createConfiguration({
      authMethods: {
        AuthZ: {
          accessToken: process.env.DD_BEARER_TOKEN as string,
        },
      },
    });
    const apiInstance = new v1.MonitorsApi(configuration);
    
    // there is a valid "monitor" in the system
    const MONITOR_ID = parseInt(process.env.MONITOR_ID as string);
    
    const params: v1.MonitorsApiDeleteMonitorRequest = {
      monitorId: MONITOR_ID,
    };
    
    apiInstance
      .deleteMonitor(params)
      .then((data: v1.DeletedMonitor) => {
        console.log(
          "API called successfully. Returned data: " + JSON.stringify(data)
        );
      })
      .catch((error: any) => console.error(error));
    

    Instructions

    First install the library and its dependencies and then save the example to example.ts and run following commands:

        
    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"