> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ambientmeta.com/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /v1/rehydrate

> Restore original PII to a sanitized response

## Authentication

```
X-API-Key: am_live_your_key_here
```

## Request Body

| Field        | Type   | Required | Description                             |
| ------------ | ------ | -------- | --------------------------------------- |
| `text`       | string | Yes      | Text containing placeholders to restore |
| `session_id` | string | Yes      | Session ID from the sanitize response   |

### Example Request

```bash theme={null}
curl -X POST https://api.ambientmeta.com/v1/rehydrate \
  -H "X-API-Key: am_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{"text": "I will contact [PERSON_1] at [EMAIL_ADDRESS_1] tomorrow.", "session_id": "ses_a1b2c3d4e5f6"}'
```

## Response

| Field               | Type    | Description                          |
| ------------------- | ------- | ------------------------------------ |
| `text`              | string  | Text with original entities restored |
| `entities_restored` | integer | Number of placeholders replaced      |
| `processing_ms`     | float   | Processing time in milliseconds      |

### Example Response

```json theme={null}
{
  "text": "I will contact John Smith at john@acme.com tomorrow.",
  "entities_restored": 2,
  "processing_ms": 3
}
```

## Session Expiry

<Warning>
  **Sessions expire after 24 hours.** If you call rehydrate with an expired session, you'll receive a `session_expired` error. Re-sanitize the original text to create a new session.
</Warning>

## Errors

| Code                | HTTP Status | Description                         |
| ------------------- | ----------- | ----------------------------------- |
| `session_not_found` | 404         | Session ID doesn't exist            |
| `session_expired`   | 410         | Session has expired (24 hour limit) |
| `invalid_api_key`   | 401         | API key is missing or invalid       |

[View all error codes](/api-reference/errors)
