---
title: "Rehydrate an Archive Search"
method: PATCH
path: "/api/v2/logs/archive_searches/{archive_search_id}"
tags: ["Logs Archive Searches"]
---

# Rehydrate an Archive Search

`PATCH /api/v2/logs/archive_searches/{archive_search_id}`

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/logs/archive_searches/{archive_search_id}`
- Auth: one of:
  - API key in header `DD-API-KEY` and API key in header `DD-APPLICATION-KEY`
  - OAuth 2
    - Authorization code: `/oauth2/v1/authorize`
    - Token URL: `/oauth2/v1/token`
- TypeScript: <https://skmtc.dev/datadog/apis/datadog-api-v2-collection/docs/api/v2/logs/archive_searches/:archive_search_id/patch.ts> (a function with typed inputs; its response is checked against the schema)

Turn a plain Archive Search into a Search & Rehydration by indexing the matched logs into a
retained historical view. Rehydration is the only thing this endpoint can change, and it only
applies to a search that has already finished scanning.

## Path parameters

- `archive_search_id` string, required

## Request body

- ArchiveSearchRehydrateRequest: Request to rehydrate an Archive Search.
  - `data` ArchiveSearchRehydrateRequestData, required: Archive Search object to rehydrate.
    - `attributes` ArchiveSearchRehydrateRequestAttributes, required: Attributes accepted when rehydrating an Archive Search.
      - `rehydration` ArchiveSearchRehydrateRequestRehydration, required: Rehydration settings to apply.
        - `retention_days` integer, required: Number of days the rehydrated logs are retained for.
        - `tier` 'standard' | 'flex', required: Storage tier the matched logs are rehydrated into.
    - `type` 'archive_search', required: Archive Search resource type.

## Response `200`

OK

- ArchiveSearchResponse: Response containing a single Archive Search.
  - `data` ArchiveSearchResponseData, required: Archive Search object.
    - `attributes` ArchiveSearchResponseAttributes, required: Attributes of an Archive Search.
      - `archive_id` string, required: ID of the archive being searched.
      - `bytes_scanned` integer, required: Number of bytes read from the archive at the end of the search.
      - `completed_at` string, date-time: Time the Archive Search finished, as an ISO 8601 timestamp. Absent while the search is still running.
      - `created_at` string, date-time, required: Time the Archive Search was created, as an ISO 8601 timestamp.
      - `description` string: Free-text description of the Archive Search.
      - `events_scanned` integer, required: Number of events read from the archive at the end of the search.
      - `expected_duration` integer: Estimated time left before the Archive Search completes, in seconds.
      - `from` string, date-time, required: Start of the searched time range, as an ISO 8601 timestamp.
      - `name` string, required: Name of the Archive Search.
      - `query` string, required: Log search query used to filter the archived logs.
      - `rehydration` ArchiveSearchRehydration: Rehydration settings of the Archive Search. Absent when the search only scans the archive without indexing the results.
        - `max_rehydrated_events` integer, required: Maximum number of events to rehydrate.
        - `retention_days` integer, required: Number of days the rehydrated logs are retained for.
        - `tier` 'standard' | 'flex', required: Storage tier the matched logs are rehydrated into.
      - `status` 'RUNNING' | 'COMPLETED' | 'FAILED' | 'CANCELLED' | 'QUOTA_REACHED' | 'EXPIRED', required: Current state of an Archive Search.
      - `to` string, date-time, required: End of the searched time range, as an ISO 8601 timestamp.
    - `id` string, required: Unique identifier of the Archive Search.
    - `type` 'archive_search', required: Archive Search resource type.

## Other responses

- `400`: Bad Request
- `403`: Forbidden
- `404`: Not Found
- `412`: Precondition Failed
- `429`: Too many requests

---

[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)
