> 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.

# Redact text

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

Replaces personal data in `text` with tags and keeps the mapping sealed under your key.

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

## 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 RedactRequest.

- `text` (string, required) — The text; at most 50,000 code points.
- `redaction_policy` (RedactionPolicy, optional) — A built-in name, a saved policy's id or an inline policy.
- `store_entity_mapping` (boolean, optional, default: true) — `false` stores nothing and answers the mapping instead.
- `detailed` (boolean, optional, default: false) — `true` adds the mapping, the spans and the model.

## Response

### 200

The redacted text.

- `redacted_text` (string, required) — The redacted text.
- `tokens` (integer, required) — The text's billed tokens.
- `expires_at` (datetime, optional) — When the stored mapping expires (24 hours).
- `entities` (list of Entity, optional) — The mapping, with `store_entity_mapping: false` or `detailed: true`.
- `spans` (list of Span, optional) — With `detailed: true`: every finding.
- `model` (enum, optional) — With `detailed: true`: the model that answered.
  - Allowed values: `outis-flash-1`, `outis-1`

## Errors

### 400 Bad Request Error

`invalid_context_key`, `invalid_request`, `invalid_rule`, `invalid_pattern`, `too_many_patterns`, `too_many_matches`.

- `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.

### 402 Payment Required Error

`quota_exceeded`.

- `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.

### 404 Not Found Error

`policy_not_found`.

- `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.

### 503 Service Unavailable Error

`model_busy`, `store_full`.

- `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

### RedactionPolicy

A built-in name, a saved policy's id or an inline policy.

- DefaultPolicy: enum
  - Allowed values: `standard`, `strict`, `light`
- PolicyId: string
- Policy: Policy

### Entity

A tag and the value it stands for.

- `tag` (string, required) — `[KIND_ID]`: the kind, then 8 Crockford base32 characters.
- `kind` (EntityKind, required) — The entity's kind.
- `value` (string, required) — The original value; case counts.

### Span

One finding, hidden or shown.

- `kind` (SpanKind, required) — What the span is.
- `original_range` (Range, required) — Where it is in `text`.
- `output_range` (Range, required) — Where it is in `redacted_text`.
- `hidden` (boolean, required) — `false` when shown: a kept part, a leave or an uncertain span.
- `uncertain` (boolean, required) — The model was unsure; `false` for a rule's span.
- `tag` (string, required, nullable) — The entity's tag; `null` for a kept part or with `replace: "kind"`.
- `parts` (list of Part, required) — The span's parts, in the original text.

### 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.

### Policy

What to hide and how; omitted fields take the defaults of `standard`.

- `detect` (list of enum, optional, default: ["person","username","location","organization","occupation","address","email","phone","ip","iban","fax","url","date_of_birth","age","credit_card","card_expiry","card_security_code","tax_id","social_security","health_insurance","passport","id_card","customer_number","password","pin","api_key","delivery_number","order_number","invoice_number","case_number","product_number","price","salary","balance","bank_account","driving_licence","vehicle_plate","employee_number","student_number","coordinates","nationality","gender","file_path","other_number"]) — The kinds to find; by default all but `date` and `product_name`.
  - Allowed values: `person`, `username`, `location`, `organization`, `occupation`, `address`, `email`, `phone`, `ip`, `iban`, `fax`, `url`, `date`, `date_of_birth`, `age`, `credit_card`, `card_expiry`, `card_security_code`, `tax_id`, `social_security`, `health_insurance`, `passport`, `id_card`, `customer_number`, `password`, `pin`, `api_key`, `delivery_number`, `order_number`, `invoice_number`, `case_number`, `product_number`, `price`, `salary`, `balance`, `bank_account`, `driving_licence`, `vehicle_plate`, `employee_number`, `student_number`, `coordinates`, `nationality`, `gender`, `file_path`, `other_number`, `product_name`
- `keep` (list of enum, optional, default: ["address.city","location.region"]) — Parts shown in clear; by default `address.city` and `location.region`.
  - Allowed values: `person.given`, `person.surname`, `address.street`, `address.city`, `location.region`, `organization.legal_form`
- `sensitivity` (enum, optional) — How sure the model must be to hide.
  - Allowed values: `normal`, `max`
- `model` (enum, optional) — The model that detects.
  - Allowed values: `outis-flash-1`, `outis-1`
- `replace` (enum, optional, default: tag) — `tag` writes a restorable `[PERSON_7K2QX9MB]`; `kind` writes `[PERSON]`, irreversibly.
  - Allowed values: `tag`, `kind`
- `overrides` (list of Rule, optional, default: []) — Rules that hide or leave by tag, pattern or range and beat the model; at most 50 patterns.

### EntityKind

The entity's kind.

- Kind: enum
  - Allowed values: `person`, `username`, `location`, `organization`, `occupation`, `address`, `email`, `phone`, `ip`, `iban`, `fax`, `url`, `date`, `date_of_birth`, `age`, `credit_card`, `card_expiry`, `card_security_code`, `tax_id`, `social_security`, `health_insurance`, `passport`, `id_card`, `customer_number`, `password`, `pin`, `api_key`, `delivery_number`, `order_number`, `invoice_number`, `case_number`, `product_number`, `price`, `salary`, `balance`, `bank_account`, `driving_licence`, `vehicle_plate`, `employee_number`, `student_number`, `coordinates`, `nationality`, `gender`, `file_path`, `other_number`, `product_name`
- enum
  - Allowed values: `custom`

### SpanKind

What the span is.

- Kind: enum
  - Allowed values: `person`, `username`, `location`, `organization`, `occupation`, `address`, `email`, `phone`, `ip`, `iban`, `fax`, `url`, `date`, `date_of_birth`, `age`, `credit_card`, `card_expiry`, `card_security_code`, `tax_id`, `social_security`, `health_insurance`, `passport`, `id_card`, `customer_number`, `password`, `pin`, `api_key`, `delivery_number`, `order_number`, `invoice_number`, `case_number`, `product_number`, `price`, `salary`, `balance`, `bank_account`, `driving_licence`, `vehicle_plate`, `employee_number`, `student_number`, `coordinates`, `nationality`, `gender`, `file_path`, `other_number`, `product_name`
- enum
  - Allowed values: `custom`

### 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.

### Part

A labelled part of a span, in the original text.

- `start` (integer, required) — The first code point, inclusive.
- `end` (integer, required) — The code point after the last, exclusive.
- `label` (enum, required) — The part's label.
  - Allowed values: `first_name`, `last_name`, `initials`, `suffix`, `placeholder`, `nickname`, `name_unclear`, `salutation`, `title`, `street`, `house_number`, `po_box`, `unit`, `postcode`, `district`, `city`, `region`, `country`, `landmark`, `address_unclear`, `natural_feature`, `location_unclear`, `org_name`, `legal_form`, `org_type`, `organization_unclear`

### Rule

One override; range beats tag beats pattern, and at a tie the later rule wins.

- `action` (enum, required) — Hide or leave what matches.
  - Allowed values: `hide`, `leave`
- `match` (Match, required) — What the rule matches.
- `kind` (RuleKind, optional) — The kind for a hide by pattern or range; default `custom`.

### Match

A tag, a pattern or a range, told apart by their key.

- TagMatch: TagMatch
- PatternMatch: PatternMatch
- RangeMatch: RangeMatch

### RuleKind

The kind for a hide by pattern or range; default `custom`.

- Kind: enum
  - Allowed values: `person`, `username`, `location`, `organization`, `occupation`, `address`, `email`, `phone`, `ip`, `iban`, `fax`, `url`, `date`, `date_of_birth`, `age`, `credit_card`, `card_expiry`, `card_security_code`, `tax_id`, `social_security`, `health_insurance`, `passport`, `id_card`, `customer_number`, `password`, `pin`, `api_key`, `delivery_number`, `order_number`, `invoice_number`, `case_number`, `product_number`, `price`, `salary`, `balance`, `bank_account`, `driving_licence`, `vehicle_plate`, `employee_number`, `student_number`, `coordinates`, `nationality`, `gender`, `file_path`, `other_number`, `product_name`
- enum
  - Allowed values: `custom`

### TagMatch

Every occurrence of an issued tag's value; inline policies only.

- `tag` (string, required) — An issued tag, e.g. `[PERSON_7K2QX9MB]`.

### PatternMatch

Every match of an RE2 pattern of at most 200 code points, without backreferences or lookaround.

- `pattern` (string, required) — The RE2 pattern; never logged.
- `flags` (enum, optional) — `i`: case-insensitive. The only flag.
  - Allowed values: `i`

### RangeMatch

One occurrence in this request's text; inline policies only.

- `range` (Range, required) — The occurrence in this request's text.

## Examples

### First turn, policy "standard"

**Request**

```json
{
  "text": "Anna Müller (anna@kanzlei.de) wohnt in der Hauptstr. 5, Berlin."
}
```

**Response**

```json
{
  "redacted_text": "[PERSON_7K2QX9MB] ([EMAIL_D3W8Q1TA]) wohnt in der [ADDRESS_P4N6V2RE], Berlin.",
  "tokens": 21,
  "expires_at": "2026-11-22T14:00:00Z"
}
```

**SDK Code**

```python First turn, policy "standard"
import requests

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

payload = { "text": "Anna Müller (anna@kanzlei.de) wohnt in der Hauptstr. 5, Berlin." }
headers = {
    "Authorization": "Bearer <apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript First turn, policy "standard"
const url = 'https://api.blende.dev/api/v1/redact';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <apiKey>', 'Content-Type': 'application/json'},
  body: '{"text":"Anna Müller (anna@kanzlei.de) wohnt in der Hauptstr. 5, Berlin."}'
};

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

### First turn, detailed

**Request**

```json
{
  "text": "Anna Müller (anna@kanzlei.de) wohnt in der Hauptstr. 5, Berlin.",
  "detailed": true
}
```

**Response**

```json
{
  "redacted_text": "[PERSON_7K2QX9MB] ([EMAIL_D3W8Q1TA]) wohnt in der [ADDRESS_P4N6V2RE], Berlin.",
  "tokens": 21,
  "expires_at": "2026-11-22T14:00:00Z",
  "entities": [
    {
      "tag": "[PERSON_7K2QX9MB]",
      "kind": "person",
      "value": "Anna Müller"
    },
    {
      "tag": "[EMAIL_D3W8Q1TA]",
      "kind": "email",
      "value": "anna@kanzlei.de"
    },
    {
      "tag": "[ADDRESS_P4N6V2RE]",
      "kind": "address",
      "value": "Hauptstr. 5"
    }
  ],
  "spans": [
    {
      "kind": "person",
      "original_range": {
        "start": 0,
        "end": 11
      },
      "output_range": {
        "start": 0,
        "end": 17
      },
      "hidden": true,
      "uncertain": false,
      "tag": "[PERSON_7K2QX9MB]",
      "parts": [
        {
          "start": 0,
          "end": 4,
          "label": "first_name"
        },
        {
          "start": 5,
          "end": 11,
          "label": "last_name"
        }
      ]
    },
    {
      "kind": "email",
      "original_range": {
        "start": 13,
        "end": 28
      },
      "output_range": {
        "start": 19,
        "end": 35
      },
      "hidden": true,
      "uncertain": false,
      "tag": "[EMAIL_D3W8Q1TA]",
      "parts": []
    },
    {
      "kind": "address",
      "original_range": {
        "start": 43,
        "end": 54
      },
      "output_range": {
        "start": 50,
        "end": 68
      },
      "hidden": true,
      "uncertain": false,
      "tag": "[ADDRESS_P4N6V2RE]",
      "parts": [
        {
          "start": 43,
          "end": 52,
          "label": "street"
        },
        {
          "start": 53,
          "end": 54,
          "label": "house_number"
        }
      ]
    },
    {
      "kind": "address",
      "original_range": {
        "start": 56,
        "end": 62
      },
      "output_range": {
        "start": 70,
        "end": 76
      },
      "hidden": false,
      "uncertain": false,
      "tag": null,
      "parts": [
        {
          "start": 56,
          "end": 62,
          "label": "city"
        }
      ]
    }
  ],
  "model": "outis-flash-1"
}
```

**SDK Code**

```python First turn, detailed
import requests

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

payload = {
    "text": "Anna Müller (anna@kanzlei.de) wohnt in der Hauptstr. 5, Berlin.",
    "detailed": True
}
headers = {
    "Authorization": "Bearer <apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript First turn, detailed
const url = 'https://api.blende.dev/api/v1/redact';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <apiKey>', 'Content-Type': 'application/json'},
  body: '{"text":"Anna Müller (anna@kanzlei.de) wohnt in der Hauptstr. 5, Berlin.","detailed":true}'
};

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

### First turn, nothing stored (the SDK path)

**Request**

```json
{
  "text": "Anna Müller (anna@kanzlei.de) wohnt in der Hauptstr. 5, Berlin.",
  "store_entity_mapping": false
}
```

**Response**

```json
{
  "redacted_text": "[PERSON_7K2QX9MB] ([EMAIL_D3W8Q1TA]) wohnt in der [ADDRESS_P4N6V2RE], Berlin.",
  "tokens": 21,
  "entities": [
    {
      "tag": "[PERSON_7K2QX9MB]",
      "kind": "person",
      "value": "Anna Müller"
    },
    {
      "tag": "[EMAIL_D3W8Q1TA]",
      "kind": "email",
      "value": "anna@kanzlei.de"
    },
    {
      "tag": "[ADDRESS_P4N6V2RE]",
      "kind": "address",
      "value": "Hauptstr. 5"
    }
  ]
}
```

**SDK Code**

```python First turn, nothing stored (the SDK path)
import requests

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

payload = {
    "text": "Anna Müller (anna@kanzlei.de) wohnt in der Hauptstr. 5, Berlin.",
    "store_entity_mapping": False
}
headers = {
    "Authorization": "Bearer <apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript First turn, nothing stored (the SDK path)
const url = 'https://api.blende.dev/api/v1/redact';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <apiKey>', 'Content-Type': 'application/json'},
  body: '{"text":"Anna Müller (anna@kanzlei.de) wohnt in der Hauptstr. 5, Berlin.","store_entity_mapping":false}'
};

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

### Next turn: leave by tag, hide by pattern, one range

**Request**

```json
{
  "text": "Anna Müller schickt Akte AZ-2291-K an Rosa, Anna Müller wartet.",
  "redaction_policy": {
    "overrides": [
      {
        "action": "leave",
        "match": {
          "tag": "[PERSON_7K2QX9MB]"
        }
      },
      {
        "action": "hide",
        "kind": "case_number",
        "match": {
          "pattern": "AZ-\\d{4}-[A-Z]",
          "tag": "[PERSON_7K2QX9MB]"
        }
      },
      {
        "action": "hide",
        "match": {
          "range": {
            "end": 42,
            "start": 38
          },
          "tag": "[PERSON_7K2QX9MB]"
        }
      }
    ]
  }
}
```

**Response**

```json
{
  "redacted_text": "Anna Müller schickt Akte [CASE_NUMBER_R2V7T9QC] an [PERSON_M5H8W3ZD], Anna Müller wartet.",
  "tokens": 24,
  "expires_at": "2026-11-22T14:00:00Z"
}
```

**SDK Code**

```python Next turn: leave by tag, hide by pattern, one range
import requests

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

payload = {
    "text": "Anna Müller schickt Akte AZ-2291-K an Rosa, Anna Müller wartet.",
    "redaction_policy": { "overrides": [
            {
                "action": "leave",
                "match": { "tag": "[PERSON_7K2QX9MB]" }
            },
            {
                "action": "hide",
                "kind": "case_number",
                "match": {
                    "pattern": "AZ-\d{4}-[A-Z]",
                    "tag": "[PERSON_7K2QX9MB]"
                }
            },
            {
                "action": "hide",
                "match": {
                    "range": {
                        "end": 42,
                        "start": 38
                    },
                    "tag": "[PERSON_7K2QX9MB]"
                }
            }
        ] }
}
headers = {
    "Authorization": "Bearer <apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Next turn: leave by tag, hide by pattern, one range
const url = 'https://api.blende.dev/api/v1/redact';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <apiKey>', 'Content-Type': 'application/json'},
  body: '{"text":"Anna Müller schickt Akte AZ-2291-K an Rosa, Anna Müller wartet.","redaction_policy":{"overrides":[{"action":"leave","match":{"tag":"[PERSON_7K2QX9MB]"}},{"action":"hide","kind":"case_number","match":{"pattern":"AZ-\\d{4}-[A-Z]","tag":"[PERSON_7K2QX9MB]"}},{"action":"hide","match":{"range":{"end":42,"start":38},"tag":"[PERSON_7K2QX9MB]"}}]}}'
};

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