Organization guardrail definitions
List the guardrails the caller's organization has defined.
Organization owners and admins only. A stored vendor credential is never returned: each one comes back as *** under its own name, which is what a form resubmits to keep it.
build_state answers for the worker that served this request, so a read taken moments after a write may still report pending on a sibling that has not caught up.
Enter your API key here (sent as Otari-Key header).
Number of records to skip
0Maximum number of records to return
100Successful Response
Validation Error
GET /api/v1/organizations/me/guardrail-definitions HTTP/1.1
Otari-Key: YOUR_API_KEY
Accept: */*
{
"count": 1,
"data": [
{
"build_state": "built",
"create_kwargs": {
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"create_secrets": {
"ANY_ADDITIONAL_PROPERTY": "text"
},
"created_at": "text",
"enabled": true,
"guardrail_name": "text",
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "text",
"organization_id": "123e4567-e89b-12d3-a456-426614174000",
"secrets_decryptable": true,
"updated_at": "text"
}
]
}Define a guardrail this deployment will build and call itself. Organization owners and admins only.
guardrail_name must be one the built-in guardrail catalog lists (GET /api/v1/tool-settings/guardrails/catalog), and create_kwargs must satisfy that guardrail's constructor as the catalog describes it: no argument it does not declare, nothing it types as a live object rather than configuration, and every required argument no environment variable can supply. Arguments the catalog marks secret are encrypted at rest.
A definition on its own changes no request. Mandate it through /api/v1/organizations/me/guardrails for it to run.
The definition is saved first and built second, so a guardrail this deployment cannot construct is still stored and answers build_state: "failed" rather than refusing the write. Why it failed is not reported: a vendor library may put the arguments it was handed, which are your credentials, into its own error message. The reason is in the gateway's log.
Enter your API key here (sent as Otari-Key header).
Request body for defining a guardrail Otari will build and call itself.
create_kwargs carries both halves of the form: the plain arguments and
the vendor credentials. Which is which is the catalog's answer, not this
schema's, so a credential lands in the encrypted map whatever it is called
and a caller cannot move one into the plain column by naming it oddly.
Per-call arguments are not offered. This row says what a guardrail is built
with; what travels with each check is the mandate's validate_kwargs.
False stops the guardrail everywhere it is mandated
trueThe any-guardrail class to build, as the built-in guardrail catalog names it
The organization's own label for this definition, unique within the organization
Successful Response
The API-facing shape. Carries the names of the stored secrets and none of their values.
Whether the worker that answered this request holds a guardrail built from this version of the definition. built means it does and the check runs; failed means that worker tried these exact arguments and could not build them, so every mandate pointing here is unevaluable; pending means it holds nothing for this version yet, which is the answer right after a write and on any worker that has not caught up within the refresh interval; disabled means the definition is switched off and nothing is built on purpose. It answers for one worker, so two reads can disagree while a write propagates. Why a build failed is never reported here: the reason is in the gateway's log
False when the stored secrets cannot be read with the current OTARI_SECRET_KEY, in which case create_secrets is empty and the definition needs its credentials sent again
Validation Error
POST /api/v1/organizations/me/guardrail-definitions HTTP/1.1
Otari-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 145
{
"create_kwargs": {
"api_key": "lakera-...",
"endpoint": "https://api.lakera.ai"
},
"enabled": true,
"guardrail_name": "lakera_guard",
"name": "prod-lakera"
}{
"build_state": "built",
"create_kwargs": {
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"create_secrets": {
"ANY_ADDITIONAL_PROPERTY": "text"
},
"created_at": "text",
"enabled": true,
"guardrail_name": "text",
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "text",
"organization_id": "123e4567-e89b-12d3-a456-426614174000",
"secrets_decryptable": true,
"updated_at": "text"
}Change a definition's name, guardrail, build arguments, or enabled flag.
Organization owners and admins only. Omitted fields are left as they are. create_kwargs replaces the arguments whole when sent, an argument sent as *** keeps the value stored under that name, and omitting the field entirely leaves the stored credentials untouched and unread.
The guardrail is rebuilt afterwards and the response reports the outcome in build_state, so repairing a credential shows the definition running again in the same response, and enabled: false stops it here rather than on the next refresh.
Enter your API key here (sent as Otari-Key header).
Partial update. Only the fields the caller sets are applied.
create_kwargs replaces the arguments whole when sent, and an argument the
catalog marks secret keeps its stored value where the caller echoes back the
*** a read gave them. Omitting it leaves both columns untouched and
reads neither, which is what lets an admin on a deployment whose
OTARI_SECRET_KEY has moved still flip enabled and repair the row by
typing the credential again.
Changing guardrail_name without sending create_kwargs re-splits the
stored arguments under the new class, because the plain/secret split is the
old class's answer and would otherwise go stale.
Successful Response
The API-facing shape. Carries the names of the stored secrets and none of their values.
Whether the worker that answered this request holds a guardrail built from this version of the definition. built means it does and the check runs; failed means that worker tried these exact arguments and could not build them, so every mandate pointing here is unevaluable; pending means it holds nothing for this version yet, which is the answer right after a write and on any worker that has not caught up within the refresh interval; disabled means the definition is switched off and nothing is built on purpose. It answers for one worker, so two reads can disagree while a write propagates. Why a build failed is never reported here: the reason is in the gateway's log
False when the stored secrets cannot be read with the current OTARI_SECRET_KEY, in which case create_secrets is empty and the definition needs its credentials sent again
Validation Error
PATCH /api/v1/organizations/me/guardrail-definitions/{definition_id} HTTP/1.1
Otari-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 89
{
"create_kwargs": {
"api_key": "***",
"endpoint": "https://eu.api.lakera.ai"
},
"enabled": false
}{
"build_state": "built",
"create_kwargs": {
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"create_secrets": {
"ANY_ADDITIONAL_PROPERTY": "text"
},
"created_at": "text",
"enabled": true,
"guardrail_name": "text",
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "text",
"organization_id": "123e4567-e89b-12d3-a456-426614174000",
"secrets_decryptable": true,
"updated_at": "text"
}Drop a definition and the credentials it holds.
Organization owners and admins only. Use enabled: false instead to stop the guardrail everywhere while keeping both.
Enter your API key here (sent as Otari-Key header).
Successful Response
A human-readable acknowledgment for an operation with nothing to return.
What happened.
Validation Error
DELETE /api/v1/organizations/me/guardrail-definitions/{definition_id} HTTP/1.1
Otari-Key: YOUR_API_KEY
Accept: */*
{
"message": "text"
}Run a definition's guardrail over some text and return its verdict.
Organization owners and admins only. The guardrail is the one the worker that answered already holds built, so this tests what is running rather than building it again. Nothing is stored and no mandate is involved; validate_kwargs stands in for what a mandate would pass with each check.
A definition this worker does not hold built answers 409, and its build_state says why. A vendor call that fails answers 502, and the reason is in the gateway's log only: a vendor library may put the credentials it was handed into its own message.
Enter your API key here (sent as Otari-Key header).
Text to run one definition's guardrail over, as a request would.
The input to check, as a request's user text would reach it
Successful Response
The guardrail's own verdict on the text, in the fields a request's check reports.
The vendor's reason, when it gives one
The vendor's score, when it gives one
False when the guardrail flagged the text
Validation Error
POST /api/v1/organizations/me/guardrail-definitions/{definition_id}/test HTTP/1.1
Otari-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 72
{
"text": "text",
"validate_kwargs": {
"ANY_ADDITIONAL_PROPERTY": "anything"
}
}{
"explanation": "text",
"score": 1,
"valid": true
}Last updated
Was this helpful?
