---
title: Cancel a batch recovery request
description: Cancel pending work for a batch recovery request.
breadcrumbs: Docs > API > Cancel a batch recovery request
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Cancel a batch recovery request

## v2 (latest)

| Datadog site      | API endpoint                                                                 |
| ----------------- | ---------------------------------------------------------------------------- |
| app.datadoghq.com | PATCH https://api.datadoghq.com/api/v2/rum/recover/requests/{request_id}     |
| us3.datadoghq.com | PATCH https://api.us3.datadoghq.com/api/v2/rum/recover/requests/{request_id} |
| us5.datadoghq.com | PATCH https://api.us5.datadoghq.com/api/v2/rum/recover/requests/{request_id} |
| app.datadoghq.eu  | PATCH https://api.datadoghq.eu/api/v2/rum/recover/requests/{request_id}      |
| ap1.datadoghq.com | PATCH https://api.ap1.datadoghq.com/api/v2/rum/recover/requests/{request_id} |
| ap2.datadoghq.com | PATCH https://api.ap2.datadoghq.com/api/v2/rum/recover/requests/{request_id} |
| uk1.datadoghq.com | PATCH https://api.uk1.datadoghq.com/api/v2/rum/recover/requests/{request_id} |
| app.ddog-gov.com  | PATCH https://api.ddog-gov.com/api/v2/rum/recover/requests/{request_id}      |
| us2.ddog-gov.com  | PATCH https://api.us2.ddog-gov.com/api/v2/rum/recover/requests/{request_id}  |

### Overview

Cancel pending work for a batch recovery request. Work already in progress can finish, and recovered data is not removed. Requests in a terminal state return `409`.

This endpoint requires the `rum_rehydration_index` permission.

### Arguments

#### Path Parameters

| Field                   | Type   | Description            |
| ----------------------- | ------ | ---------------------- |
| request_id [*required*] | string | Recovery request UUID. |

### Request

#### Body Data (required)

JSON:API request body.

{% tabs %}
{% tab label="Model" %}
| Parent field | Field                   | Type   | Description                                                     |
| ------------ | ----------------------- | ------ | --------------------------------------------------------------- |
|              | data [*required*]       | object | JSON:API resource.                                              |
| data         | attributes [*required*] | object | Batch cancellation.                                             |
| attributes   | status [*required*]     | enum   | Requested cancellation state. Allowed enum values: `cancelled`. |
| data         | id                      | string | Optional resource identifier.                                   |
| data         | type                    | string | JSON:API resource type.                                         |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "status": "cancelled"
    },
    "id": "11111111-1111-4111-8111-111111111111",
    "type": "rum_recovery_request"
  }
}
```
{% /tab %}
{% /tabs %}

### Response

{% tabs %}
{% tab label="200" %}
OK

{% tabs %}
{% tab label="Model" %}
JSON:API document.

| Parent field | Field                         | Type      | Description                                                                                                                                                                                                       |
| ------------ | ----------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|              | data [*required*]             | object    | JSON:API resource.                                                                                                                                                                                                |
| data         | attributes [*required*]       | object    | Batch cancellation acknowledgment.                                                                                                                                                                                |
| attributes   | cancelled_at [*required*]     | date-time | Cancellation time.                                                                                                                                                                                                |
| attributes   | cancelled_by [*required*]     | string    | Handle of the user who canceled the batch.                                                                                                                                                                        |
| attributes   | discovery_status [*required*] | enum      | Batch discovery state. QUEUED indicates that the request is waiting for processing capacity. Allowed enum values: `QUEUED`, `PENDING`, `SLICING`, `DISCOVERED`, `PROCESSING`, `COMPLETED`, `FAILED`, `CANCELLED`. |
| data         | id [*required*]               | string    | Resource identifier.                                                                                                                                                                                              |
| data         | type [*required*]             | enum      | JSON:API resource type. Allowed enum values: `rum_recovery_request`.                                                                                                                                              |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "cancelled_at": "2026-09-21T12:00:00Z",
      "cancelled_by": "user@example.com",
      "discovery_status": "QUEUED"
    },
    "id": "11111111-1111-4111-8111-111111111111",
    "type": "rum_recovery_request"
  }
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="400" %}
Bad Request

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="401" %}
Unauthorized

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type  | Description                                                                                   |
| ------------------- | ----- | --------------------------------------------------------------------------------------------- |
| errors [*required*] | [any] | Errors as plain-text messages or JSON:API error objects containing status, title, and detail. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Forbidden"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="403" %}
Forbidden

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type  | Description                                                                                   |
| ------------------- | ----- | --------------------------------------------------------------------------------------------- |
| errors [*required*] | [any] | Errors as plain-text messages or JSON:API error objects containing status, title, and detail. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Forbidden"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="404" %}
Not Found

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="409" %}
Conflict

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="429" %}
Too Many Requests

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type  | Description                                                                                   |
| ------------------- | ----- | --------------------------------------------------------------------------------------------- |
| errors [*required*] | [any] | Errors as plain-text messages or JSON:API error objects containing status, title, and detail. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Forbidden"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}
{% /tabs %}

### Code Example

{% tabs %}
{% tab label="Curl" %}
```bash
## default

# Path parameters
export request_id="11111111-1111-4111-8111-111111111111"

# Set your Datadog site and credentials
export DD_SITE="datadoghq.com" # Or us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com, ddog-gov.com, us2.ddog-gov.com
export DD_API_KEY="<DD_API_KEY>"
export DD_APP_KEY="<DD_APP_KEY>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/rum/recover/requests/${request_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "status": "cancelled"
    },
    "type": "rum_recovery_request"
  }
}
EOF

## minimal

# Path parameters
export request_id="11111111-1111-4111-8111-111111111111"

# Set your Datadog site and credentials
export DD_SITE="datadoghq.com" # Or us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com, ddog-gov.com, us2.ddog-gov.com
export DD_API_KEY="<DD_API_KEY>"
export DD_APP_KEY="<DD_APP_KEY>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/rum/recover/requests/${request_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "status": "cancelled"
    }
  }
}
EOF
```
{% /tab %}
{% /tabs %}
