---
title: Estimate recoverable sessions
description: Return the full estimated number of recoverable sessions and the configured maximum per batch.
breadcrumbs: Docs > API > Estimate recoverable sessions
---

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

# Estimate recoverable sessions

## v2 (latest)

| Datadog site      | API endpoint                                                |
| ----------------- | ----------------------------------------------------------- |
| app.datadoghq.com | POST https://api.datadoghq.com/api/v2/rum/recover/count     |
| us3.datadoghq.com | POST https://api.us3.datadoghq.com/api/v2/rum/recover/count |
| us5.datadoghq.com | POST https://api.us5.datadoghq.com/api/v2/rum/recover/count |
| app.datadoghq.eu  | POST https://api.datadoghq.eu/api/v2/rum/recover/count      |
| ap1.datadoghq.com | POST https://api.ap1.datadoghq.com/api/v2/rum/recover/count |
| ap2.datadoghq.com | POST https://api.ap2.datadoghq.com/api/v2/rum/recover/count |
| uk1.datadoghq.com | POST https://api.uk1.datadoghq.com/api/v2/rum/recover/count |
| app.ddog-gov.com  | POST https://api.ddog-gov.com/api/v2/rum/recover/count      |
| us2.ddog-gov.com  | POST https://api.us2.ddog-gov.com/api/v2/rum/recover/count  |

### Overview

Return the full estimated number of recoverable sessions and the configured maximum per batch. The estimate is not capped at that maximum. This endpoint does not create a recovery request. Narrow the query or time range if the estimate exceeds max_recoverable_sessions. Creation checks a fresh estimate and returns 400 if it exceeds the configured maximum.

This endpoint requires the `rum_rehydration_index` permission.

### 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 | Query for a recovery estimate. The range cannot exceed 180 days; from cannot be more than 4 years ago and to cannot be more than 1 hour in the future. Session availability depends on the configured archive retention. |
| attributes   | from [*required*]       | int64  | Start of the range in Unix milliseconds. Must be positive and earlier than to.                                                                                                                                           |
| attributes   | query [*required*]      | string | RUM search query. Not blank, at most 4096 bytes for batch creation and count.                                                                                                                                            |
| attributes   | to [*required*]         | int64  | End of the range in Unix milliseconds.                                                                                                                                                                                   |
| data         | id                      | string | Optional resource identifier.                                                                                                                                                                                            |
| data         | type                    | string | JSON:API resource type.                                                                                                                                                                                                  |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "type": "rum_recovery_count",
    "attributes": {
      "query": "service:rum18600-fixture",
      "from": 1621077071000,
      "to": 1636629071000
    }
  }
}
```
{% /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 | Approximate recoverable count.                                                                                                                             |
| attributes   | estimated_count [*required*]          | int64  | Estimated distinct recoverable sessions not already retained in hot storage. The full estimate is returned without capping it at max_recoverable_sessions. |
| attributes   | max_recoverable_sessions [*required*] | int64  | Configured maximum estimated recoverable sessions per batch (100,000 by default). Estimates equal to this value are accepted at creation.                  |
| data         | id [*required*]                       | string | Resource identifier.                                                                                                                                       |
| data         | type [*required*]                     | enum   | JSON:API resource type. Allowed enum values: `rum_recovery_count`.                                                                                         |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "estimated_count": 0,
      "max_recoverable_sessions": 100000
    },
    "id": "count",
    "type": "rum_recovery_count"
  }
}
```
{% /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="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
# 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 POST "https://api.${DD_SITE}/api/v2/rum/recover/count" \
-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": {
    "type": "rum_recovery_count",
    "attributes": {
      "query": "service:rum18600-fixture",
      "from": 1621077071000,
      "to": 1636629071000
    }
  }
}
EOF
```
{% /tab %}
{% /tabs %}
