Create a guardrail
Create a new guardrail for the authenticated user. Management key required.
Authorizations
API key as bearer token in Authorization header
Body
Name for the new guardrail
1 - 200"My New Guardrail"
Array of model identifiers (slug or canonical_slug accepted)
1[
"openai/gpt-5.2",
"anthropic/claude-4.5-opus-20251124",
"deepseek/deepseek-r1-0528:free"
]List of allowed provider IDs
1["openai", "anthropic", "deepseek"]Builtin content filters to apply. The "flag" action is only supported for "regex-prompt-injection"; PII slugs (email, phone, ssn, credit-card, ip-address, person-name, address) accept "block" or "redact" only.
[
{
"action": "block",
"slug": "regex-prompt-injection"
}
]Custom regex content filters to apply to request messages
[
{
"action": "redact",
"label": "[API_KEY]",
"pattern": "\\b(sk-[a-zA-Z0-9]{48})\\b"
}
]Description of the guardrail
1000"A guardrail for limiting API usage"
Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, 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.
false
Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided.
false
Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided.
false
Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided.
false
Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided.
false
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"]Spending limit in USD
50
Interval at which the limit resets (daily, weekly, monthly)
daily, weekly, monthly, null "monthly"
The workspace to create the guardrail in. Defaults to the default workspace if not provided.
"0df9e665-d932-5740-b2c7-b52af166bc11"
Response
Guardrail created successfully
The created guardrail
{
"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",
"enforce_zdr": null,
"enforce_zdr_anthropic": true,
"enforce_zdr_google": false,
"enforce_zdr_openai": true,
"enforce_zdr_other": false,
"id": "550e8400-e29b-41d4-a716-446655440000",
"ignored_models": null,
"ignored_providers": null,
"limit_usd": 100,
"name": "Production Guardrail",
"reset_interval": "monthly",
"updated_at": "2025-08-24T15:45:00Z",
"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"
}