/v1/guardrailsCreate a guardrail
A guardrail matches when any of its rules matches. A new guardrail starts in observe mode unless you set mode: it counts matches, and never blocks, delays or fails a request. timing, max_wait_ms and on_error take effect in enforce mode. A tag, model or identity that does not exist answers 422.
Authentication: Bearer API key in the Authorization header
Request body
namestringrequiredA name for people.
modeenumobservecounts matches and never blocks, delays or fails a request.enforceblocks matching requests.offstops checking.timingenumparallelchecks while the model generates and holds the response until the check passes.before_dispatchfinishes the check before the request is sent to a model.rulesarray<object>requiredThe guardrail matches when any rule matches.
rules
tagstringrequiredA tag id from
GET /v1/tags.thresholdnumberThe rule matches when the tag's probability for any message in the request is at or above this value.
modelsarray | nullThe only model slugs the guardrail covers, compared with the model that serves the request.
nulldoes not limit it.exclude_modelsarray | nullModel slugs the guardrail leaves out, so it covers every other model.
nullleaves none out. Setmodelsorexclude_models, not both.identity_idsarray | nullThe only identities the guardrail covers.
nullcovers every identity. A request is covered when both its model and its identity are.max_wait_msintegerThe longest a request waits for the check, in milliseconds: 0 to 5,000 for
parallel, 100 to 5,000 forbefore_dispatch. Defaults to 250 forparalleland 2,000 forbefore_dispatch.on_errorenumrequiredWhat happens when the check does not finish in time, or the request carries content it cannot read.
allowlets the request through.blockrefuses it:503 gateway_unavailablewhen the check did not finish,400 content_filterfor content it cannot read.
Responses
201The created guardrail.
Response
idstringrequirednamestringrequiredA name for people.
managedbooleanrequiredtrueon a platform guardrail, which is read-only and shows only its name, tags and models.modeenumobservecounts matches and never blocks, delays or fails a request.enforceblocks matching requests.offstops checking.timingenumparallelchecks while the model generates and holds the response until the check passes.before_dispatchfinishes the check before the request is sent to a model.rulesarray<object>requiredThe guardrail matches when any rule matches.
rules
tagstringrequiredA tag id from
GET /v1/tags.thresholdnumberThe rule matches when the tag's probability for any message in the request is at or above this value.
modelsarray | nullrequiredThe only model slugs the guardrail covers, compared with the model that serves the request.
nulldoes not limit it.exclude_modelsarray | nullModel slugs the guardrail leaves out, so it covers every other model.
nullleaves none out. Setmodelsorexclude_models, not both.identity_idsarray | nullThe only identities the guardrail covers.
nullcovers every identity. A request is covered when both its model and its identity are.max_wait_msintegerThe longest a request waits for the check, in milliseconds.
on_errorenumWhat happens when the check does not finish in time, or the request carries content it cannot read.
allowlets the request through.blockrefuses it:503 gateway_unavailablewhen the check did not finish,400 content_filterfor content it cannot read.created_atstringupdated_atstring
401Missing, unknown or revoked API key.
403The key is not a provisioning key, or the resource is read-only (
tag_read_only,guardrail_read_only).Response
errorstringrequiredHuman-readable message.
codestringStable machine reason, when the route defines one.
404The resource does not exist or belongs to another organization. An organization without access gets this answer on every route.
Response
errorstringrequiredHuman-readable message.
codestringStable machine reason, when the route defines one.
422The body failed validation, or it names something that does not exist or cannot be used (
unknown_tag,unknown_model,unknown_identity,model_not_allowed).Response
errorstringrequiredHuman-readable message.
codestringStable machine reason, when the route defines one.
Request
curl -X POST 'https://api.experientiallabs.ai/v1/guardrails' \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"name": "Keep confidential data off external models",
"timing": "before_dispatch",
"rules": [
{
"tag": "internalConfidential",
"threshold": 0.5
}
],
"exclude_models": [
"my-local-model"
],
"on_error": "block"
}'Response
{
"id": "00000000-0000-4000-8000-000000000011",
"name": "Keep confidential data off external models",
"managed": false,
"mode": "observe",
"timing": "before_dispatch",
"rules": [
{
"tag": "internalConfidential",
"threshold": 0.5
}
],
"models": null,
"exclude_models": [
"my-local-model"
],
"identity_ids": null,
"max_wait_ms": 2000,
"on_error": "block",
"created_at": "2026-11-20T00:00:00Z",
"updated_at": "2026-11-20T00:00:00Z"
}https://api.experientiallabs.ai/v1/guardrails