Create a guardrail or a custom Cedar policy
Saves a guardrail (key networks, everyone networks or a model allowlist) or a custom Cedar policy and returns it, enabled unless you send enabled: false. Requires a signed-in session. Guardrails that apply to API keys only need guardrail.manage; the everyone_networks guardrail and every custom policy can block sessions and need policy.manage (owners). A policy that would take policy.manage or member.manage from the saving owner is refused with 409 WOULD_LOCK_OUT.
Required permission
Checked against the guardrail.manage permission for the resource it acts on. See Permissions for the roles and API key permissions that include it.
Command line
The orl CLI wraps this endpoint:
orl authz policy create --kind <kind> --name <name>apiKeyAuthorizationBearer <token>OpenRelay API key. Send it as Authorization: Bearer or_… (legacy vl_… keys still work).
application/json- body
name*stringlength <= 64description?stringlength <= 256kind*string"guardrail""custom"enabled?booleanDefaults to true.
guardrail?string"key_networks""everyone_networks""model_allowlist"ipRanges?array<string>models?array<string>endpoints?array<string>cedarText?stringlength <= 10240Created
application/json- response
id*stringname*stringdescription?stringkind*string"guardrail""custom"enabled*booleanguardrail?stringkey_networks limits API keys to ipRanges; everyone_networks limits sessions and keys (owners only); model_allowlist limits inference to models and endpoints.
"key_networks""everyone_networks""model_allowlist"ipRanges?array<string>models?array<string>endpoints?array<string>cedarText?stringA custom policy's Cedar source.
cedar?stringThe Cedar a guardrail generates.
stale?stringSet when an enabled policy names something this version of OpenRelay does not know, or can no longer be read: what it does now and what to change.
createdBy?stringcreatedAt?stringupdatedBy?stringupdatedAt?stringcurl -X POST 'https://api.openrelay.inc/v1/authz/policies' \ -H 'Content-Type: application/json' \ -d '{ "name": "string", "kind": "guardrail"}'{ "id": "string", "name": "string", "description": "string", "kind": "guardrail", "enabled": true, "guardrail": "key_networks", "ipRanges": [ "string" ], "models": [ "string" ], "endpoints": [ "string" ], "cedarText": "string", "cedar": "string", "stale": "string", "createdBy": "string", "createdAt": "string", "updatedBy": "string", "updatedAt": "string"}List the org's guardrails and custom policies GET
Returns every guardrail and custom Cedar policy in the organization, enabled or disabled, with its networks, models, endpoints and Cedar text.
Validate a policy without saving it POST
Returns line and column diagnostics and the lockout check for a candidate policy. Requires a signed-in session and the permission saving it would need.