---
title: "Create a recovery request"
method: POST
path: "/api/v2/rum/recover/requests"
tags: ["RUM Recovery"]
---

# Create a recovery request

`POST /api/v2/rum/recover/requests`

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/rum/recover/requests`
- Auth: API key in header `DD-API-KEY` and API key in header `DD-APPLICATION-KEY`
- TypeScript: <https://skmtc.dev/datadog/apis/datadog-api-v2-collection/docs/api/v2/rum/recover/requests/post.ts> (a function with typed inputs; its response is checked against the schema)

Start targeted or query-based batch recovery. Use the returned `data.id` to poll the recovery request for progress. Batch creation checks a fresh recoverable-session estimate against the configured maximum (100,000 by default), accepting estimates equal to the maximum. Use the count operation to check the current maximum; creation can still reject a changed estimate. Narrow the query or time range if the maximum is exceeded.

Creation is not idempotent. After an uncertain response, check session search or batch listing before retrying.

## Request body

- RumRecoveryCreateRequest: JSON:API document.
  - `data` RumRecoveryCreateData, required: JSON:API resource.
    - `attributes` union, required: Targeted recovery (the default) or query-based batch recovery.
      - RumRecoverySessionsCreateAttributes: Recover 1 to 100 explicit archived sessions. Session IDs must be unique within the request.
        - `request_type` 'sessions': Targeted recovery. Omitted request_type defaults to sessions.
        - `sessions` RumRecoverySessionInput[], required: Sessions to recover.
          - `application_id` string, uuid, required: Application UUID.
          - `session_id` string, uuid, required: Session UUID.
      - RumRecoveryBatchCreateAttributes: Recover sessions selected by a query. 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.
        - `estimated_count` integer: Optional client estimate. Creation validates and stores a fresh server estimate instead of this value.
        - `from` integer, required: Start of the range in Unix milliseconds. Must be positive and earlier than to.
        - `query` string, required: RUM search query. Not blank, at most 4096 bytes for batch creation and count.
        - `request_type` 'batch', required: Query-based batch recovery.
        - `to` integer, required: End of the range in Unix milliseconds.
    - `type` string: JSON:API resource type.

## Response `202`

Accepted

- RumRecoveryCreateResponse: JSON:API document.
  - `data` RumRecoveryCreateResponseData, required: JSON:API resource.
    - `attributes` RumRecoveryCreateResponseAttributes, required: Accepted recovery request.
      - `created_at` string, date-time, required: Creation time.
      - `discovery_status` 'QUEUED' | 'PENDING' | 'SLICING' | 'DISCOVERED' | 'PROCESSING' | 'COMPLETED' | 'FAILED' | 'CANCELLED': Batch discovery state. QUEUED indicates that the request is waiting for processing capacity.
      - `estimated_count` integer: Batch estimate stored at creation, when present. New batches use a fresh server estimate; older batches may contain a client-supplied estimate.
      - `failed_sessions` integer, required: Failed session count.
      - `processed_sessions` integer, required: Processed session count.
      - `status` 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'FAILED' | 'CANCELLED' | 'EXPIRED', required: Recovery request state.
      - `total_sessions` integer: Total targeted sessions. Omitted while a batch total is unknown.
    - `id` string, required: Resource identifier.
    - `type` 'rum_recovery_request', required: JSON:API resource type.

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `409`: Conflict. Targeted sessions are already retained, in flight, or previously failed, or a concurrent batch was created.
- `429`: Too many requests, or the batch recovery queue is full.

---

[API](https://skmtc.dev/datadog/apis/datadog-api-v2-collection.md) - [All operations](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/llms.txt) - [OpenAPI document](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/revisions/3f70db624329?raw)
