List moderation policies
curl --request GET \
--url https://openrouter.ai/api/v1/guardrails/policies/moderation \
--header 'Authorization: Bearer <token>'import requests
url = "https://openrouter.ai/api/v1/guardrails/policies/moderation"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://openrouter.ai/api/v1/guardrails/policies/moderation', 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/policies/moderation",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://openrouter.ai/api/v1/guardrails/policies/moderation"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://openrouter.ai/api/v1/guardrails/policies/moderation")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://openrouter.ai/api/v1/guardrails/policies/moderation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"api_key_count": 1,
"config": {
"content_filter_builtins": [
{
"action": "block",
"slug": "secrets"
}
]
},
"id": "550e8400-e29b-41d4-a716-446655440000",
"member_count": 1,
"name": "Engineering monthly budget",
"policy_type": "moderation",
"updated_at": "<string>",
"is_legacy_mapped": true,
"is_workspace_default": true,
"legacy_guardrail_ids": [
"<string>"
],
"replaced_legacy_guardrail_ids": [
"<string>"
]
}
],
"total_count": 1
}{
"error": {
"code": 400,
"message": "Invalid request parameters"
}
}{
"error": {
"code": 401,
"message": "Missing Authentication header"
}
}{
"error": {
"code": 403,
"message": "Only management keys can perform this operation"
}
}{
"error": {
"code": 404,
"message": "Resource not found"
}
}{
"error": {
"code": 500,
"message": "Internal Server Error"
}
}Guardrail Policies
List moderation policies
List the moderation policies in a workspace. Management key required.
GET
/
guardrails
/
policies
/
moderation
List moderation policies
curl --request GET \
--url https://openrouter.ai/api/v1/guardrails/policies/moderation \
--header 'Authorization: Bearer <token>'import requests
url = "https://openrouter.ai/api/v1/guardrails/policies/moderation"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://openrouter.ai/api/v1/guardrails/policies/moderation', 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/policies/moderation",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://openrouter.ai/api/v1/guardrails/policies/moderation"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://openrouter.ai/api/v1/guardrails/policies/moderation")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://openrouter.ai/api/v1/guardrails/policies/moderation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"api_key_count": 1,
"config": {
"content_filter_builtins": [
{
"action": "block",
"slug": "secrets"
}
]
},
"id": "550e8400-e29b-41d4-a716-446655440000",
"member_count": 1,
"name": "Engineering monthly budget",
"policy_type": "moderation",
"updated_at": "<string>",
"is_legacy_mapped": true,
"is_workspace_default": true,
"legacy_guardrail_ids": [
"<string>"
],
"replaced_legacy_guardrail_ids": [
"<string>"
]
}
],
"total_count": 1
}{
"error": {
"code": 400,
"message": "Invalid request parameters"
}
}{
"error": {
"code": 401,
"message": "Missing Authentication header"
}
}{
"error": {
"code": 403,
"message": "Only management keys can perform this operation"
}
}{
"error": {
"code": 404,
"message": "Resource not found"
}
}{
"error": {
"code": 500,
"message": "Internal Server Error"
}
}Authorizations
API key as bearer token in Authorization header
Query Parameters
Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned
Required range:
x >= 0Example:
0
Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned
Required range:
1 <= x <= 100Example:
50
Workspace the policy belongs to
Example:
"0df9e665-d932-5740-b2c7-b52af166bc11"
Was this page helpful?