Create a guardrail

Create a new guardrail for the authenticated user. Management key required.

Authentication

AuthorizationBearer
API key as bearer token in Authorization header

Request

This endpoint expects an object.
namestringRequired1-200 characters
Name for the new guardrail
allowed_modelslist of strings or nullOptional

Array of model identifiers (slug or canonical_slug accepted)

allowed_providerslist of strings or nullOptional
List of allowed provider IDs
content_filter_builtinslist of objects or nullOptional

Builtin content filters to apply. Use slug “regex-prompt-injection” with action “block”, “flag”, or “redact” to enable heuristic prompt injection detection.

content_filterslist of objects or nullOptional
Custom regex content filters to apply to request messages
descriptionstring or nullOptional<=1000 characters
Description of the guardrail
enforce_zdrboolean or nullOptional
Whether to enforce zero data retention
ignored_modelslist of strings or nullOptional

Array of model identifiers to exclude from routing (slug or canonical_slug accepted)

ignored_providerslist of strings or nullOptional
List of provider IDs to exclude from routing
limit_usddouble or nullOptional
Spending limit in USD
reset_intervalenumOptional

Interval at which the limit resets (daily, weekly, monthly)

Allowed values:
workspace_idstringOptionalformat: "uuid"
The workspace to create the guardrail in. Defaults to the default workspace if not provided.

Response

Guardrail created successfully
dataobject
The created guardrail

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
500
Internal Server Error