> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.blende.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.blende.dev/_mcp/server.

# Restore an answer

POST https://api.blende.dev/api/v1/restore
Content-Type: application/json

Puts the originals back into an LLM's answer; altered tags still restore, unknown ones stay as they are.

Reference: https://docs.blende.dev/api-reference/redact-and-restore/restore-an-answer

## Authentication

- `Authorization` header (bearer token, required) — An API key: `Authorization: Bearer bl_live_…`.
- `Authorization` header (bearer token, required) — Blende's apps: a sign-in JWT, sent with `Blende-Context-Key`.

## Request

### Headers

- `Blende-Context-Key` (string, optional) — JWT only: the user's context key, 43 base64url characters.

### Body (application/json)

This endpoint expects a RestoreRequest.

- `text` (string, required) — The complete answer, tags whole; at most 50,000 code points.
- `detailed` (boolean, optional, default: false) — `true` adds the tags found.

## Response

### 200

The restored text; with `detailed`, each tag found.

- `restored_text` (string, required) — The restored text.
- `tags` (list of RestoredTag, optional) — With `detailed: true`: one per tag found.

## Errors

### 400 Bad Request Error

`invalid_context_key`, `invalid_request`.

- `type` (string, required) — `https://blende.dev/errors/<code>`.
- `title` (string, required) — A short summary of the code.
- `status` (integer, required) — The HTTP status.
- `code` (enum, required) — The stable error code.
  - Allowed values: `invalid_request`, `invalid_context_key`, `invalid_rule`, `invalid_pattern`, `too_many_patterns`, `too_many_matches`, `unauthenticated`, `key_expired`, `quota_exceeded`, `insufficient_scope`, `context_key_mismatch`, `policy_read_only`, `not_found`, `policy_not_found`, `text_too_large`, `unsupported_media_type`, `rate_limited`, `internal`, `model_busy`, `store_full`
- `request_id` (string, required) — The request's id, also in the `Request-Id` header.
- `detail` (string, optional) — What went wrong; never echoes input.
- `errors` (list of ProblemErrorsItems, optional) — Field errors, each pointing to a field of the schema.

### 401 Unauthorized Error

`unauthenticated`, `key_expired`.

- `type` (string, required) — `https://blende.dev/errors/<code>`.
- `title` (string, required) — A short summary of the code.
- `status` (integer, required) — The HTTP status.
- `code` (enum, required) — The stable error code.
  - Allowed values: `invalid_request`, `invalid_context_key`, `invalid_rule`, `invalid_pattern`, `too_many_patterns`, `too_many_matches`, `unauthenticated`, `key_expired`, `quota_exceeded`, `insufficient_scope`, `context_key_mismatch`, `policy_read_only`, `not_found`, `policy_not_found`, `text_too_large`, `unsupported_media_type`, `rate_limited`, `internal`, `model_busy`, `store_full`
- `request_id` (string, required) — The request's id, also in the `Request-Id` header.
- `detail` (string, optional) — What went wrong; never echoes input.
- `errors` (list of ProblemErrorsItems, optional) — Field errors, each pointing to a field of the schema.

### 403 Forbidden Error

`insufficient_scope`, `context_key_mismatch`.

- `type` (string, required) — `https://blende.dev/errors/<code>`.
- `title` (string, required) — A short summary of the code.
- `status` (integer, required) — The HTTP status.
- `code` (enum, required) — The stable error code.
  - Allowed values: `invalid_request`, `invalid_context_key`, `invalid_rule`, `invalid_pattern`, `too_many_patterns`, `too_many_matches`, `unauthenticated`, `key_expired`, `quota_exceeded`, `insufficient_scope`, `context_key_mismatch`, `policy_read_only`, `not_found`, `policy_not_found`, `text_too_large`, `unsupported_media_type`, `rate_limited`, `internal`, `model_busy`, `store_full`
- `request_id` (string, required) — The request's id, also in the `Request-Id` header.
- `detail` (string, optional) — What went wrong; never echoes input.
- `errors` (list of ProblemErrorsItems, optional) — Field errors, each pointing to a field of the schema.

### 413 Content Too Large Error

`text_too_large`.

- `type` (string, required) — `https://blende.dev/errors/<code>`.
- `title` (string, required) — A short summary of the code.
- `status` (integer, required) — The HTTP status.
- `code` (enum, required) — The stable error code.
  - Allowed values: `invalid_request`, `invalid_context_key`, `invalid_rule`, `invalid_pattern`, `too_many_patterns`, `too_many_matches`, `unauthenticated`, `key_expired`, `quota_exceeded`, `insufficient_scope`, `context_key_mismatch`, `policy_read_only`, `not_found`, `policy_not_found`, `text_too_large`, `unsupported_media_type`, `rate_limited`, `internal`, `model_busy`, `store_full`
- `request_id` (string, required) — The request's id, also in the `Request-Id` header.
- `detail` (string, optional) — What went wrong; never echoes input.
- `errors` (list of ProblemErrorsItems, optional) — Field errors, each pointing to a field of the schema.

### 415 Unsupported Media Type Error

`unsupported_media_type`.

- `type` (string, required) — `https://blende.dev/errors/<code>`.
- `title` (string, required) — A short summary of the code.
- `status` (integer, required) — The HTTP status.
- `code` (enum, required) — The stable error code.
  - Allowed values: `invalid_request`, `invalid_context_key`, `invalid_rule`, `invalid_pattern`, `too_many_patterns`, `too_many_matches`, `unauthenticated`, `key_expired`, `quota_exceeded`, `insufficient_scope`, `context_key_mismatch`, `policy_read_only`, `not_found`, `policy_not_found`, `text_too_large`, `unsupported_media_type`, `rate_limited`, `internal`, `model_busy`, `store_full`
- `request_id` (string, required) — The request's id, also in the `Request-Id` header.
- `detail` (string, optional) — What went wrong; never echoes input.
- `errors` (list of ProblemErrorsItems, optional) — Field errors, each pointing to a field of the schema.

### 429 Too Many Requests Error

`rate_limited`.

- `type` (string, required) — `https://blende.dev/errors/<code>`.
- `title` (string, required) — A short summary of the code.
- `status` (integer, required) — The HTTP status.
- `code` (enum, required) — The stable error code.
  - Allowed values: `invalid_request`, `invalid_context_key`, `invalid_rule`, `invalid_pattern`, `too_many_patterns`, `too_many_matches`, `unauthenticated`, `key_expired`, `quota_exceeded`, `insufficient_scope`, `context_key_mismatch`, `policy_read_only`, `not_found`, `policy_not_found`, `text_too_large`, `unsupported_media_type`, `rate_limited`, `internal`, `model_busy`, `store_full`
- `request_id` (string, required) — The request's id, also in the `Request-Id` header.
- `detail` (string, optional) — What went wrong; never echoes input.
- `errors` (list of ProblemErrorsItems, optional) — Field errors, each pointing to a field of the schema.

### 500 Internal Server Error

`internal`.

- `type` (string, required) — `https://blende.dev/errors/<code>`.
- `title` (string, required) — A short summary of the code.
- `status` (integer, required) — The HTTP status.
- `code` (enum, required) — The stable error code.
  - Allowed values: `invalid_request`, `invalid_context_key`, `invalid_rule`, `invalid_pattern`, `too_many_patterns`, `too_many_matches`, `unauthenticated`, `key_expired`, `quota_exceeded`, `insufficient_scope`, `context_key_mismatch`, `policy_read_only`, `not_found`, `policy_not_found`, `text_too_large`, `unsupported_media_type`, `rate_limited`, `internal`, `model_busy`, `store_full`
- `request_id` (string, required) — The request's id, also in the `Request-Id` header.
- `detail` (string, optional) — What went wrong; never echoes input.
- `errors` (list of ProblemErrorsItems, optional) — Field errors, each pointing to a field of the schema.

## Types

### RestoredTag

One tag found in the answer.

- `original_range` (Range, required) — Where the tag is in `text`.
- `output_range` (Range, required) — Where the original is in `restored_text`.
- `tag` (string, required, nullable) — The issued tag it matched; `null` when unknown.
- `status` (enum, required) — `exact`, `altered` (read despite changes) or `unknown` (left as is).
  - Allowed values: `exact`, `altered`, `unknown`

### ProblemErrorsItems

One field error.

- `pointer` (string, required) — The schema field, e.g. `#/redaction_policy/overrides/0/match/pattern`.
- `detail` (string, required) — What is wrong with it.

### Range

A half-open `[start, end)` range in code points of the text as sent.

- `start` (integer, required) — The first code point, inclusive.
- `end` (integer, required) — The code point after the last, exclusive.

## Examples

### The answer restored

**Request**

```json
{
  "text": "Danke, ich schreibe [PERSON_7K2QX9MB]."
}
```

**Response**

```json
{
  "restored_text": "Danke, ich schreibe Anna Müller."
}
```

**SDK Code**

```python The answer restored
import requests

url = "https://api.blende.dev/api/v1/restore"

payload = { "text": "Danke, ich schreibe [PERSON_7K2QX9MB]." }
headers = {
    "Authorization": "Bearer <apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript The answer restored
const url = 'https://api.blende.dev/api/v1/restore';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <apiKey>', 'Content-Type': 'application/json'},
  body: '{"text":"Danke, ich schreibe [PERSON_7K2QX9MB]."}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

### Detailed, with an altered tag

**Request**

```json
{
  "text": "Danke, ich schreibe [person_7k2qx9mb} und an [EMAIL_D3W8Q1TA] noch heute.",
  "detailed": true
}
```

**Response**

```json
{
  "restored_text": "Danke, ich schreibe Anna Müller und an anna@kanzlei.de noch heute.",
  "tags": [
    {
      "original_range": {
        "start": 20,
        "end": 37
      },
      "output_range": {
        "start": 20,
        "end": 31
      },
      "tag": "[PERSON_7K2QX9MB]",
      "status": "altered"
    },
    {
      "original_range": {
        "start": 45,
        "end": 61
      },
      "output_range": {
        "start": 39,
        "end": 54
      },
      "tag": "[EMAIL_D3W8Q1TA]",
      "status": "exact"
    }
  ]
}
```

**SDK Code**

```python Detailed, with an altered tag
import requests

url = "https://api.blende.dev/api/v1/restore"

payload = {
    "text": "Danke, ich schreibe [person_7k2qx9mb} und an [EMAIL_D3W8Q1TA] noch heute.",
    "detailed": True
}
headers = {
    "Authorization": "Bearer <apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Detailed, with an altered tag
const url = 'https://api.blende.dev/api/v1/restore';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <apiKey>', 'Content-Type': 'application/json'},
  body: '{"text":"Danke, ich schreibe [person_7k2qx9mb} und an [EMAIL_D3W8Q1TA] noch heute.","detailed":true}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```