For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
ModelsChatRankingsDocs
DocsAPI ReferenceClient SDKsAgent SDKCookbookChangelog
DocsAPI ReferenceClient SDKsAgent SDKCookbookChangelog
  • API Guides
    • Overview
    • Streaming
    • Embeddings
    • Limits
    • Authentication
    • Parameters
    • Errors and Debugging
  • API Reference
      • GETList guardrails
      • POSTCreate a guardrail
      • GETGet a guardrail
      • DELDelete a guardrail
      • PATCHUpdate a guardrail
      • GETList key assignments for a guardrail
      • POSTBulk assign keys to a guardrail
      • POSTBulk unassign keys from a guardrail
      • GETList member assignments for a guardrail
      • POSTBulk assign members to a guardrail
      • POSTBulk unassign members from a guardrail
      • GETList all key assignments
      • GETList all member assignments
LogoLogo
ModelsChatRankingsDocs
API ReferenceGuardrails

Update a guardrail

PATCH
https://openrouter.ai/api/v1/guardrails/:id
PATCH
/api/v1/guardrails/:id
$curl -X PATCH https://openrouter.ai/api/v1/guardrails/550e8400-e29b-41d4-a716-446655440000 \
> -H "Authorization: Bearer <token>" \
> -H "Content-Type: application/json" \
> -d '{
> "description": "Updated description",
> "limit_usd": 75,
> "name": "Updated Guardrail Name",
> "reset_interval": "weekly"
>}'
1{
2 "data": {
3 "created_at": "2025-08-24T10:30:00Z",
4 "id": "550e8400-e29b-41d4-a716-446655440000",
5 "name": "Updated Guardrail Name",
6 "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11",
7 "allowed_models": null,
8 "allowed_providers": [
9 "openai"
10 ],
11 "description": "Updated description",
12 "enforce_zdr_anthropic": true,
13 "enforce_zdr_google": true,
14 "enforce_zdr_openai": true,
15 "enforce_zdr_other": true,
16 "ignored_models": null,
17 "ignored_providers": null,
18 "limit_usd": 75,
19 "reset_interval": "weekly",
20 "updated_at": "2025-08-24T16:00:00Z",
21 "enforce_zdr": null
22 }
23}

Update an existing guardrail. Management key required.

Was this page helpful?
Previous

List key assignments for a guardrail

Next
Built with

Authentication

AuthorizationBearer
API key as bearer token in Authorization header

Path parameters

idstringRequiredformat: "uuid"
The unique identifier of the guardrail to update

Request

This endpoint expects an object.
allowed_modelslist of strings or nullOptional

Array of model identifiers (slug or canonical_slug accepted)

allowed_providerslist of strings or nullOptional
New list of allowed provider IDs
content_filter_builtinslist of objects or nullOptional

Builtin content filters to apply. Set to null to remove. The “flag” action is only supported for “regex-prompt-injection”; PII slugs (email, phone, ssn, credit-card, ip-address, person-name, address) accept “block” or “redact” only.

content_filterslist of objects or nullOptional
Custom regex content filters to apply. Set to null to remove.
descriptionstring or nullOptional<=1000 characters
New description for the guardrail
enforce_zdr_anthropicboolean or nullOptional

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

enforce_zdr_googleboolean or nullOptional

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

enforce_zdr_openaiboolean or nullOptional

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

enforce_zdr_otherboolean or nullOptional

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

ignored_modelslist of strings or nullOptional

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

ignored_providerslist of strings or nullOptional
List of provider IDs to exclude from routing
limit_usddouble or nullOptional
New spending limit in USD
namestringOptional1-200 characters
New name for the guardrail
reset_intervalenumOptional

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

Allowed values:
enforce_zdrboolean or nullOptionalDeprecated

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, 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.

Response

Guardrail updated successfully
dataobject
The updated guardrail

Errors

400
Bad Request Error
401
Unauthorized Error
404
Not Found Error
500
Internal Server Error