curl --request PATCH \
--url https://openrouter.ai/api/v1/guardrails/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "Updated description",
"limit_usd": 75,
"name": "Updated Guardrail Name",
"reset_interval": "weekly"
}
'import requests
url = "https://openrouter.ai/api/v1/guardrails/{id}"
payload = {
"description": "Updated description",
"limit_usd": 75,
"name": "Updated Guardrail Name",
"reset_interval": "weekly"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
description: 'Updated description',
limit_usd: 75,
name: 'Updated Guardrail Name',
reset_interval: 'weekly'
})
};
fetch('https://openrouter.ai/api/v1/guardrails/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://openrouter.ai/api/v1/guardrails/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'description' => 'Updated description',
'limit_usd' => 75,
'name' => 'Updated Guardrail Name',
'reset_interval' => 'weekly'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://openrouter.ai/api/v1/guardrails/{id}"
payload := strings.NewReader("{\n \"description\": \"Updated description\",\n \"limit_usd\": 75,\n \"name\": \"Updated Guardrail Name\",\n \"reset_interval\": \"weekly\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://openrouter.ai/api/v1/guardrails/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"Updated description\",\n \"limit_usd\": 75,\n \"name\": \"Updated Guardrail Name\",\n \"reset_interval\": \"weekly\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openrouter.ai/api/v1/guardrails/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"description\": \"Updated description\",\n \"limit_usd\": 75,\n \"name\": \"Updated Guardrail Name\",\n \"reset_interval\": \"weekly\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"allowed_models": null,
"allowed_providers": [
"openai"
],
"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"
}
}{
"error": {
"code": 400,
"message": "Invalid request parameters"
}
}{
"error": {
"code": 401,
"message": "Missing Authentication header"
}
}{
"error": {
"code": 404,
"message": "Resource not found"
}
}{
"error": {
"code": 500,
"message": "Internal Server Error"
}
}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.
curl --request PATCH \
--url https://openrouter.ai/api/v1/guardrails/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "Updated description",
"limit_usd": 75,
"name": "Updated Guardrail Name",
"reset_interval": "weekly"
}
'import requests
url = "https://openrouter.ai/api/v1/guardrails/{id}"
payload = {
"description": "Updated description",
"limit_usd": 75,
"name": "Updated Guardrail Name",
"reset_interval": "weekly"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
description: 'Updated description',
limit_usd: 75,
name: 'Updated Guardrail Name',
reset_interval: 'weekly'
})
};
fetch('https://openrouter.ai/api/v1/guardrails/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://openrouter.ai/api/v1/guardrails/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'description' => 'Updated description',
'limit_usd' => 75,
'name' => 'Updated Guardrail Name',
'reset_interval' => 'weekly'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://openrouter.ai/api/v1/guardrails/{id}"
payload := strings.NewReader("{\n \"description\": \"Updated description\",\n \"limit_usd\": 75,\n \"name\": \"Updated Guardrail Name\",\n \"reset_interval\": \"weekly\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://openrouter.ai/api/v1/guardrails/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"Updated description\",\n \"limit_usd\": 75,\n \"name\": \"Updated Guardrail Name\",\n \"reset_interval\": \"weekly\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openrouter.ai/api/v1/guardrails/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"description\": \"Updated description\",\n \"limit_usd\": 75,\n \"name\": \"Updated Guardrail Name\",\n \"reset_interval\": \"weekly\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"allowed_models": null,
"allowed_providers": [
"openai"
],
"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"
}
}{
"error": {
"code": 400,
"message": "Invalid request parameters"
}
}{
"error": {
"code": 401,
"message": "Missing Authentication header"
}
}{
"error": {
"code": 404,
"message": "Resource not found"
}
}{
"error": {
"code": 500,
"message": "Internal Server Error"
}
}Authorizations
API key as bearer token in Authorization header
Path Parameters
The unique identifier of the guardrail to update
"550e8400-e29b-41d4-a716-446655440000"
Body
Data regions through which requests governed by this guardrail must arrive. global is https://openrouter.ai, europe is https://eu.openrouter.ai, and us is https://us.openrouter.ai. Requests arriving through any other region are rejected. null leaves the ingress region unrestricted. When several guardrails apply (workspace default, member, API key), the effective regions are the intersection of every non-null value. An empty array is rejected.
1An OpenRouter data region: global (https://openrouter.ai), europe (https://eu.openrouter.ai), or us (https://us.openrouter.ai)
global, europe, us ["europe"]
Array of model identifiers (slug or canonical_slug accepted)
1["openai/gpt-5.2"]
New list of allowed provider IDs
1["openai", "anthropic", "deepseek"]
Builtin content filters to apply. Set to null to remove. Every builtin slug supports "block", "redact", and the detect-only "flag" action.
Show child attributes
Show child attributes
[
{
"action": "block",
"slug": "regex-prompt-injection"
}
]
Custom regex content filters to apply. Set to null to remove.
Show child attributes
Show child attributes
null
New description for the guardrail
1000"Updated description"
Whether this guardrail allows free endpoints that publish prompts.
false
Whether this guardrail allows free endpoints that train on request data.
true
Whether this guardrail allows paid endpoints that train on request data.
true
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.
true
Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided.
true
Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided.
true
Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided.
true
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.
true
Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided.
true
Array of model identifiers to exclude from routing (slug or canonical_slug accepted)
1["openai/gpt-4o-mini"]
List of provider IDs to exclude from routing
1["azure"]
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.
true
New spending limit in USD
75
New name for the guardrail
1 - 200"Updated Guardrail Name"
Interval at which the limit resets (daily, weekly, monthly)
daily, weekly, monthly, null "monthly"
Response
Guardrail updated successfully
The updated guardrail
Show child attributes
Show child attributes
{
"allowed_data_regions": null,
"allowed_models": null,
"allowed_providers": ["openai", "anthropic", "google"],
"content_filter_builtins": [
{
"action": "redact",
"label": "[EMAIL]",
"slug": "email"
}
],
"content_filters": null,
"created_at": "2025-08-24T10:30:00Z",
"description": "Guardrail for production environment",
"enable_free_model_publication": false,
"enable_free_model_training": true,
"enable_paid_model_training": true,
"enforce_zdr": null,
"enforce_zdr_anthropic": true,
"enforce_zdr_google": false,
"enforce_zdr_openai": true,
"enforce_zdr_other": false,
"enforce_zdr_xai": false,
"id": "550e8400-e29b-41d4-a716-446655440000",
"ignored_models": null,
"ignored_providers": null,
"include_byok_in_budgets": false,
"limit_usd": 100,
"name": "Production Guardrail",
"reset_interval": "monthly",
"updated_at": "2025-08-24T15:45:00Z",
"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"
}