Create a guardrail
/v1/guardrailsCreate a guardrail.
Creates a guardrail in a workspace and returns it with a new slug (gr-...). Each check names a validator from GET /v1/guardrail-validators and its settings. Requires an organization admin, or an admin of the workspace in workspace_id.
Errors: 400 when a check's type is not a validator id or its config is rejected; 402 when the plan's guardrail limit for the workspace is reached, or a check uses an LLM_JUDGE validator on a plan without AI guardrails; 403 without access; 409 when the organization already has a guardrail with this name.
Authorization
AuthorizationBearer va_A platform API key (
va_...), created under Settings > API keys. Scoped to an organization or one workspace, with an admin or member role. Used by the management API.
Request body application/json
the guardrail to create
namestringrequiredDisplay name, unique within the organization (409 if taken).
organizationstringrequiredSlug of the organization that will own the guardrail.
workspace_idstring<uuid>requiredId (UUID) of the workspace the guardrail belongs to. It must belong to
organization.checksobject[]requiredThe checks to run. Every check's
typemust be a validator id and itsconfigmust be accepted by that validator (400 otherwise).Child attributes
typestringrequiredThe validator's id, from
GET /v1/guardrail-validators, for examplePII_DETECTOR,REGEX_MATCH,banned_wordsorprompt_injection. An unknown id is a 400. A validator of kindLLM_JUDGEneeds a plan with AI guardrails (402 otherwise).targetenum<string>requiredWhere the check runs:
INPUT(the request's messages, before the provider is called),OUTPUT(the provider's answer, before it is returned) orBOTH.One of
"INPUT","OUTPUT","BOTH"actionenum<string>requiredWhat a finding does:
BLOCK(the request fails with 422),REDACT(the match is replaced with a placeholder and the request continues) orMONITOR(logged only). Use an action the validator lists insupported_actions.One of
"BLOCK","REDACT","MONITOR"configmap<string, object>The validator's settings, as a JSON object matching its
config_schema(itsdefault_configis a starting point). A config the validator rejects is a 400. Default: an empty object.
descriptionstringFree-text description. Optional.
enabledbooleanWhether the guardrail runs. Default
true.
Responses
Created
idstring<uuid>The guardrail's unique id (UUID).
slugstringThe guardrail's identifier in URLs, on virtual keys and in the
x-guardrailheader:gr-and 16 hex characters. It never changes.namestringDisplay name, unique within the organization.
descriptionstringFree-text description. Null when none is set.
organizationstringSlug of the organization that owns the guardrail.
workspace_idstring<uuid>Id (UUID) of the workspace the guardrail belongs to.
enabledbooleanWhether the guardrail runs. A disabled guardrail is skipped wherever it is applied.
checksobject[]The guardrail's checks.
Child attributes
typestringrequiredThe validator's id, from
GET /v1/guardrail-validators, for examplePII_DETECTOR,REGEX_MATCH,banned_wordsorprompt_injection. An unknown id is a 400. A validator of kindLLM_JUDGEneeds a plan with AI guardrails (402 otherwise).targetenum<string>requiredWhere the check runs:
INPUT(the request's messages, before the provider is called),OUTPUT(the provider's answer, before it is returned) orBOTH.One of
"INPUT","OUTPUT","BOTH"actionenum<string>requiredWhat a finding does:
BLOCK(the request fails with 422),REDACT(the match is replaced with a placeholder and the request continues) orMONITOR(logged only). Use an action the validator lists insupported_actions.One of
"BLOCK","REDACT","MONITOR"configmap<string, object>The validator's settings, as a JSON object matching its
config_schema(itsdefault_configis a starting point). A config the validator rejects is a 400. Default: an empty object.
attached_keysobject[]The virtual keys that apply this guardrail. Filled by
GET /v1/guardrails/{slug}; empty in the other responses.Child attributes
slugstringThe virtual key's slug.
namestringThe virtual key's display name.
statusstringThe virtual key's status:
ACTIVE,DISABLED,EXHAUSTEDorEXPIRED.workspace_idstring<uuid>Id (UUID) of the virtual key's workspace. Null for a key with no workspace.
attached_key_countinteger<int32>How many virtual keys apply this guardrail. Filled by
GET /v1/guardrails/{slug}; null in the other responses.created_bystringIdentifier of the caller (user or API key) that created the guardrail.
created_atstring<date-time>When the guardrail was created (ISO 8601).
updated_atstring<date-time>When the guardrail was last changed (ISO 8601).