Skip to main content
POST
Create Guardrail Policy
Create a new guardrail policy. Idempotent — the same Idempotency-Key header replays the same response. Creating a policy does not auto-bind it to a key. Use PUT /api/v1/keys//guardrails to opt a key in.

Authentication

Requires a Bearer token with the billing API key scope.

Body

string
required
Policy name. 1–128 chars. May not reference upstream provider names.
string
Free-text description. Up to 512 chars.
object[]
Up to 32 rule objects. Each rule has guardrail_id, phase, verdict, and an optional config bag.
string
"personal" (default) or "team". Team scope requires an active org and the manageWebhooks permission.
boolean
Mark this policy as the default for its scope. At most one default per scope.

Request Examples

Errors

  • 400 guardrail_policy_invalid — Unknown guardrail id, disallowed verdict for the builtin, vendor-named label, or rule cap exceeded.
  • 403 missing_scope — API key lacks the billing scope.
  • 409 conflictis_default: true already set for this scope.