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

# Change a policy

PATCH https://api.blende.dev/api/v1/policies/{id}
Content-Type: application/json

Renames a saved policy or replaces it whole; built-ins are read-only.

Reference: https://docs.blende.dev/api-reference/policies/change-a-policy

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

### Path parameters

- `id` (string, required) — A built-in's name or a saved policy's `pol_…` id.

### Headers

- `Idempotency-Key` (string, optional) — A unique key per call; a retry with it answers the first result.

### Body (application/json)

This endpoint expects a PolicyPatch.

- `name` (string, optional) — The new label.
- `policy` (Policy, optional) — The new policy, replacing the old one; its overrides must be patterns.

## Response

### 200

The changed policy, every field filled in.

- `id` (StoredPolicyId, required) — A built-in's name or a saved policy's `pol_…` id.
- `name` (string, required) — Your label; a built-in's is its id.
- `policy` (FullPolicy, required) — Every field filled in.
- `created_at` (datetime, required, nullable) — RFC 3339; `null` for a built-in.
- `updated_at` (datetime, required, nullable) — RFC 3339; `null` for a built-in.

## Errors

### 400 Bad Request Error

`invalid_request`, `invalid_rule`, `invalid_pattern`, `too_many_patterns`.

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

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

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

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

### StoredPolicyId

A built-in's name or a saved policy's `pol_…` id.

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

### FullPolicy

A policy with every field filled in.

- `detect` (list of enum, required) — 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, required) — 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, required) — How sure the model must be to hide; default `normal`.
  - Allowed values: `normal`, `max`
- `model` (enum, required) — The model that detects; default `outis-flash-1`.
  - Allowed values: `outis-flash-1`, `outis-1`
- `replace` (enum, required) — `tag` (default) writes a restorable `[PERSON_7K2QX9MB]`; `kind` writes `[PERSON]`, irreversibly.
  - Allowed values: `tag`, `kind`
- `overrides` (list of Rule, required) — Rules that hide or leave by tag, pattern or range and beat the model; at most 50 patterns.

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

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

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

**Request**

```json
{
  "name": "Court files"
}
```

**Response**

```json
{
  "id": "pol_4Tz9Kq2M",
  "name": "Court files",
  "policy": {
    "detect": [
      "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"
    ],
    "keep": [
      "address.city",
      "location.region"
    ],
    "sensitivity": "normal",
    "model": "outis-flash-1",
    "replace": "tag",
    "overrides": [
      {
        "action": "hide",
        "match": {
          "pattern": "AZ-\\d{4}-[A-Z]",
          "tag": "[PERSON_7K2QX9MB]"
        },
        "kind": "case_number"
      }
    ]
  },
  "created_at": "2026-11-21T09:30:00Z",
  "updated_at": "2026-11-21T10:05:00Z"
}
```

**SDK Code**

```python Renamed
import requests

url = "https://api.blende.dev/api/v1/policies/id"

payload = { "name": "Court files" }
headers = {
    "Authorization": "Bearer <apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Renamed
const url = 'https://api.blende.dev/api/v1/policies/id';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Court files"}'
};

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