v126

OpenAPI 3.1.0MITraw.githubusercontent.com2026-08-04957391.2 MB
Guardrails

Update a guardrail

Update an existing guardrail, or materialize an unconfigured workspace default guardrail. Collection fields use replace semantics: send the full desired set on every update. Management key required.

patch/guardrails/{id}

Path parameters

idstring uuid required

The unique identifier of the guardrail to update

Example:550e8400-e29b-41d4-a716-446655440000

The unique identifier of the guardrail to update

Request body

allowed_modelsstring[] nullable

Array of model identifiers (slug or canonical_slug accepted)

allowed_providersstring[] nullable

New list of allowed provider IDs

descriptionstring nullable

New description for the guardrail

enable_free_model_publicationboolean nullable

Whether this guardrail allows free endpoints that publish prompts.

enable_free_model_trainingboolean nullable

Whether this guardrail allows free endpoints that train on request data.

enable_paid_model_trainingboolean nullable

Whether this guardrail allows paid endpoints that train on request data.

enforce_zdrboolean nullable

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request.

enforce_zdr_anthropicboolean nullable

Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided.

enforce_zdr_googleboolean nullable

Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided.

enforce_zdr_openaiboolean nullable

Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided.

enforce_zdr_otherboolean nullable

Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided.

enforce_zdr_xaiboolean nullable

Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided.

ignored_modelsstring[] nullable

Array of model identifiers to exclude from routing (slug or canonical_slug accepted)

ignored_providersstring[] nullable

List of provider IDs to exclude from routing

include_byok_in_budgetsboolean

Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Omit to leave unchanged.

limit_usdnumber double nullable

New spending limit in USD

namestring

New name for the guardrail

reset_interval'daily' | 'weekly' | 'monthly' | 'null' nullable

Interval at which the limit resets (daily, weekly, monthly)

Example request

{
  "description": "Updated description",
  "limit_usd": 75,
  "name": "Updated Guardrail Name",
  "reset_interval": "weekly"
}

Response

Guardrail updated successfully

Example response

{
  "data": {
    "allowed_models": null,
    "allowed_providers": [
      "openai"
    ],
    "content_filter_builtins": [
      {
        "action": "redact",
        "label": "[EMAIL]",
        "slug": "email"
      }
    ],
    "content_filters": null,
    "created_at": "2025-08-24T10:30:00Z",
    "description": "Updated description",
    "enforce_zdr": null,
    "enforce_zdr_anthropic": true,
    "enforce_zdr_google": true,
    "enforce_zdr_openai": true,
    "enforce_zdr_other": true,
    "enforce_zdr_xai": true,
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "ignored_models": null,
    "ignored_providers": null,
    "include_byok_in_budgets": true,
    "limit_usd": 75,
    "name": "Updated Guardrail Name",
    "reset_interval": "weekly",
    "updated_at": "2025-08-24T16:00:00Z",
    "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"
  }
}