Guardrail Policies
Create a moderation policy
Changed onCreate a moderation policy in a workspace. Management key required.
post/guardrails/policies/moderation
Request
- Base URLhttps://openrouter.ai/api/v1
- AuthHTTP bearer
Request body
Create Moderation Guardrail Policy Request required
api_key_hashes, string[]
API key hashes
config, Guardrail Moderation Policy Config required
is_workspace_default, boolean
Make this the workspace default for its policy type. Defaults to false.
member_ids, string[]
Organization member user IDs
name, string required
Policy name
opted_out_api_key_hashes, string[]
API keys that should not inherit the policy when it is the workspace default
opted_out_member_ids, string[]
Members that should not inherit the policy when it is the workspace default
policy_type, 'moderation' required
workspace_id, string uuid
Workspace the policy belongs to. Required for an organization management key; a workspace-scoped key defaults to its own workspace and gets 403 for any other.
Example request
{
"api_key_hashes": [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
],
"config": {
"content_filter_builtins": [
{
"action": "block",
"slug": "secrets"
}
]
},
"member_ids": [
"user_2abcDEFghiJKLmnoPQRstu"
],
"name": "Engineering monthly budget",
"opted_out_api_key_hashes": [
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
],
"opted_out_member_ids": [
"user_2abcDEFghiJKLmnoPQRstu"
],
"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"
}Response
moderation policy created
Moderation Guardrail Policy Response required
data, Moderation Guardrail Policy required
Example response
{
"data": {
"config": {
"content_filter_builtins": [
{
"action": "block",
"slug": "secrets"
}
]
},
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Engineering monthly budget"
}
}Changes
- info
the request property
workspace_idbecame optional
- info
- info
endpoint added
- info