Gets a list of data deletion requests

GET https://api.ap1.datadoghq.com/api/v2/deletion/requestshttps://api.ap2.datadoghq.com/api/v2/deletion/requestshttps://api.datadoghq.eu/api/v2/deletion/requestshttps://api.ddog-gov.com/api/v2/deletion/requestshttps://api.us2.ddog-gov.com/api/v2/deletion/requestshttps://api.uk1.datadoghq.com/api/v2/deletion/requestshttps://api.datadoghq.com/api/v2/deletion/requestshttps://api.us3.datadoghq.com/api/v2/deletion/requestshttps://api.us5.datadoghq.com/api/v2/deletion/requests

Overview

Gets a list of data deletion requests based on several filter parameters. This endpoint requires the logs_delete_data permission.

Arguments

Query Strings

Name

Type

Description

next_page

string

The next page of the previous search. If the next_page parameter is included, the rest of the query elements are ignored.

product

string

Retrieve only the requests related to the given product.

query

string

Retrieve only the requests that matches the given query.

status

string

Retrieve only the requests with the given status.

page_size

integer

Sets the page size of the search.

Response

OK

The response from the get data deletion requests endpoint.

Expand All

Field

Type

Description

data

[object]

The list of data deletion requests that matches the query.

attributes [required]

object

Deletion attribute for data deletion response.

created_at [required]

string

Creation time of the deletion request.

created_by [required]

string

User who created the deletion request.

customer_message

string

A message for the customer regarding the deletion request, if any.

displayed_total [required]

int64

Total number of elements to be deleted as displayed to the user.

error_category

string

The category of the error for the deletion request, if any.

from_time [required]

int64

Start of requested time window, milliseconds since Unix epoch.

indexes

[string]

List of indexes for the search. If not provided, the search is performed in all indexes.

is_created [required]

boolean

Whether the deletion request is fully created or not. It can take several minutes to fully create a deletion request depending on the target query and timeframe.

org_id [required]

int64

Organization ID.

product [required]

string

Product name.

query [required]

string

Query for creating a data deletion request.

starting_at [required]

string

Starting time of the process to delete the requested data.

status [required]

string

Status of the deletion request.

to_time [required]

int64

End of requested time window, milliseconds since Unix epoch.

total_unrestricted [required]

int64

Total number of elements to be deleted. Only the data accessible to the current user that matches the query and timeframe provided will be deleted.

updated_at [required]

string

Update time of the deletion request.

id [required]

string

The ID of the created data deletion request.

type [required]

string

The type of the request created.

meta

object

The metadata of the data deletion response.

count_product

object

The total deletion requests created by product.

<any-key>

int64

count_status

object

The total deletion requests created by status.

<any-key>

int64

next_page

string

The next page when searching deletion requests created in the current organization.

product

string

The product of the deletion request.

request_status

string

The status of the executed request.

{
  "data": [
    {
      "attributes": {
        "created_at": "2024-01-01T00:00:00.000000Z",
        "created_by": "test.user@datadoghq.com",
        "customer_message": "Your deletion request is being processed.",
        "displayed_total": 100,
        "error_category": "validation_error",
        "from_time": 1672527600000,
        "indexes": [
          "test-index",
          "test-index-2"
        ],
        "is_created": true,
        "org_id": 321813,
        "product": "logs",
        "query": "service:xyz host:abc",
        "starting_at": "2024-01-01T02:00:00.000000Z",
        "status": "pending",
        "to_time": 1704063600000,
        "total_unrestricted": 100,
        "updated_at": "2024-01-01T00:00:00.000000Z"
      },
      "id": "1",
      "type": "deletion_request"
    }
  ],
  "meta": {
    "count_product": {
      "<any-key>": "integer"
    },
    "count_status": {
      "<any-key>": "integer"
    },
    "next_page": "cGFnZTI=",
    "product": "logs",
    "request_status": "canceled"
  }
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

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

Internal server error

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

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

Code Example

                  # Curl command
curl -X GET "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/v2/deletion/requests" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Gets a list of data deletion requests returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.data_deletion_api import DataDeletionApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = DataDeletionApi(api_client)
    response = api_instance.get_data_deletion_requests()

    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_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Gets a list of data deletion requests returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::DataDeletionAPI.new
p api_instance.get_data_deletion_requests()

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"
// Gets a list of data deletion requests returns "OK" response

package main

import (
	"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"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewDataDeletionApi(apiClient)
	resp, r, err := api.GetDataDeletionRequests(ctx, *datadogV2.NewGetDataDeletionRequestsOptionalParameters())

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `DataDeletionApi.GetDataDeletionRequests`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `DataDeletionApi.GetDataDeletionRequests`:\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_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Gets a list of data deletion requests returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.DataDeletionApi;
import com.datadog.api.client.v2.model.GetDataDeletionsResponseBody;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    DataDeletionApi apiInstance = new DataDeletionApi(defaultClient);

    try {
      GetDataDeletionsResponseBody result = apiInstance.getDataDeletionRequests();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling DataDeletionApi#getDataDeletionRequests");
      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_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// Gets a list of data deletion requests returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_data_deletion::DataDeletionAPI;
use datadog_api_client::datadogV2::api_data_deletion::GetDataDeletionRequestsOptionalParams;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = DataDeletionAPI::with_config(configuration);
    let resp = api
        .get_data_deletion_requests(GetDataDeletionRequestsOptionalParams::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
/**
 * Gets a list of data deletion requests returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.DataDeletionApi(configuration);

apiInstance
  .getDataDeletionRequests()
  .then((data: v2.GetDataDeletionsResponseBody) => {
    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_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"