---
title: "Update a guardrail rule"
method: PATCH
path: "/v2/guardrail-rules/{guardrail_rule_id}"
tags: ["Guardrail Rules"]
---

# Update a guardrail rule

`PATCH /v2/guardrail-rules/{guardrail_rule_id}`

## Request

- Base URL: `https://my.orq.ai`
- URL: `https://my.orq.ai/v2/guardrail-rules/{guardrail_rule_id}`
- Auth: HTTP bearer

Partially updates guardrail-rule metadata or configuration. Project scope is immutable.

## Path parameters

- `guardrail_rule_id` string, required

## Request body

- UpdateGuardrailRuleRequest
  - `display_name` string
  - `description` string
  - `enabled` boolean
  - `expression` GuardrailRuleExpression
    - `config` object
    - `cel` string: CEL expression used to match requests. Empty means the rule always matches.
  - `guardrails` GuardrailRuleGuardrail[]
    - `id` string, required
    - `execute_on` string, required
    - `sample_rate` number, double
    - `is_guardrail` boolean
    - `options` object
  - `plugins` GuardrailRulePlugin[]
    - `id` string: Plugin discriminator.
    - `language` string: Languages, regions and entity types are checked against the live pii-detection capabilities catalog when the rule is saved, not pinned here, so a language or region the detector gains becomes writable without a future update.
    - `entities` string[]: Entity types to redact. On their own a strict allowlist; alongside regions they add to the region coverage.
    - `on_failure` string
    - `threshold` number, double
    - `regions` string[]: Regions of coverage by ISO 3166-1 alpha-2 code, or ["all"]. Combines with entities: the two selections are unioned.
    - `entity_thresholds` object: Per-entity-type confidence cutoff. Every key must also appear in entities.

## Response `200`

OK

- UpdateGuardrailRuleResponse
  - `guardrail_rule` GuardrailRule, required
    - `id` string, required
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, required
    - `created_by_id` string, required
    - `updated_by_id` string, required
    - `project_id` string, required: Project that contains the rule. Empty for workspace-wide rules.
    - `display_name` string, required: Human-readable guardrail-rule name.
    - `description` string, required
    - `enabled` boolean, required
    - `expression` GuardrailRuleExpression
      - `config` object
      - `cel` string: CEL expression used to match requests. Empty means the rule always matches.
    - `guardrails` GuardrailRuleGuardrail[], required
      - `id` string, required
      - `execute_on` string, required
      - `sample_rate` number, double
      - `is_guardrail` boolean
      - `options` object
    - `plugins` GuardrailRulePlugin[], required
      - `id` string: Plugin discriminator.
      - `language` string: Languages, regions and entity types are checked against the live pii-detection capabilities catalog when the rule is saved, not pinned here, so a language or region the detector gains becomes writable without a future update.
      - `entities` string[]: Entity types to redact. On their own a strict allowlist; alongside regions they add to the region coverage.
      - `on_failure` string
      - `threshold` number, double
      - `regions` string[]: Regions of coverage by ISO 3166-1 alpha-2 code, or ["all"]. Combines with entities: the two selections are unioned.
      - `entity_thresholds` object: Per-entity-type confidence cutoff. Every key must also appear in entities.

## Other responses

- `401`: Authentication required. See https://docs.orq.ai/reference/errors for the error codes.

## Changes

> 554 revisions in range; 71 not diffed.

- **2026-10-23** `0b4e519a544f`: 1 info
  - added the non-success response with the status `401`
- **2026-10-23** `732aed62833a`: 1 info
  - removed the non-success response with the status `401`
- **2026-10-22** `4f826b2c3a0e`: 1 info
  - added the non-success response with the status `401`
- **2026-10-22** `8f0dc569f247`: 1 info
  - removed the non-success response with the status `401`
- **2026-10-21** `08b800d640e6`: 1 info
  - added the non-success response with the status `401`

[Operation history](https://skmtc.dev/orq-ai/apis/orq-ai-api/changes/v2/guardrail-rules/:guardrail_rule_id/patch.md)

---

[API](https://skmtc.dev/orq-ai/apis/orq-ai-api.md) - [All operations](https://skmtc.dev/orq-ai/apis/orq-ai-api/llms.txt) - [OpenAPI document](https://skmtc.dev/orq-ai/apis/orq-ai-api/revisions/928a71e92252?raw)
