For the complete documentation index, see llms.txt. This page is also available as Markdown.

Organization guardrail definitions

List Organization Guardrail Definitions

get

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.

Authorizations
Otari-KeystringRequired

Enter your API key here (sent as Otari-Key header).

Query parameters
skipintegerOptional

Number of records to skip

Default: 0
limitinteger · min: 1 · max: 1000Optional

Maximum number of records to return

Default: 100
Responses
200

Successful Response

application/json
countintegerRequired
get/api/v1/organizations/me/guardrail-definitions
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"
    }
  ]
}

Create Organization Guardrail Definition

post

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.

Authorizations
Otari-KeystringRequired

Enter your API key here (sent as Otari-Key header).

Body

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.

enabledbooleanOptional

False stops the guardrail everywhere it is mandated

Default: true
guardrail_namestring · min: 1 · max: 128Required

The any-guardrail class to build, as the built-in guardrail catalog names it

namestring · min: 1 · max: 128Required

The organization's own label for this definition, unique within the organization

Responses
201

Successful Response

application/json

The API-facing shape. Carries the names of the stored secrets and none of their values.

build_statestring · enumRequired

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

Possible values:
created_atstringRequired
enabledbooleanRequired
guardrail_namestringRequired
idstring · uuidRequired
namestringRequired
organization_idstring · uuidRequired
secrets_decryptablebooleanRequired

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

updated_atstringRequired
post/api/v1/organizations/me/guardrail-definitions
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"
}

Update Organization Guardrail Definition

patch

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.

Authorizations
Otari-KeystringRequired

Enter your API key here (sent as Otari-Key header).

Path parameters
definition_idstring · uuidRequired
Body

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.

enabledbooleanOptional
guardrail_namestring · min: 1 · max: 128Optional
namestring · min: 1 · max: 128Optional
Responses
200

Successful Response

application/json

The API-facing shape. Carries the names of the stored secrets and none of their values.

build_statestring · enumRequired

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

Possible values:
created_atstringRequired
enabledbooleanRequired
guardrail_namestringRequired
idstring · uuidRequired
namestringRequired
organization_idstring · uuidRequired
secrets_decryptablebooleanRequired

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

updated_atstringRequired
patch/api/v1/organizations/me/guardrail-definitions/{definition_id}
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"
}

Delete Organization Guardrail Definition

delete

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.

Authorizations
Otari-KeystringRequired

Enter your API key here (sent as Otari-Key header).

Path parameters
definition_idstring · uuidRequired
Responses
200

Successful Response

application/json

A human-readable acknowledgment for an operation with nothing to return.

messagestringRequired

What happened.

delete/api/v1/organizations/me/guardrail-definitions/{definition_id}
DELETE /api/v1/organizations/me/guardrail-definitions/{definition_id} HTTP/1.1
Otari-Key: YOUR_API_KEY
Accept: */*
{
  "message": "text"
}

Test Organization Guardrail Definition

post

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.

Authorizations
Otari-KeystringRequired

Enter your API key here (sent as Otari-Key header).

Path parameters
definition_idstring · uuidRequired
Body

Text to run one definition's guardrail over, as a request would.

textstring · min: 1 · max: 10000Required

The input to check, as a request's user text would reach it

Responses
200

Successful Response

application/json

The guardrail's own verdict on the text, in the fields a request's check reports.

explanationstring · nullableRequired

The vendor's reason, when it gives one

scorenumber · nullableRequired

The vendor's score, when it gives one

validbooleanRequired

False when the guardrail flagged the text

post/api/v1/organizations/me/guardrail-definitions/{definition_id}/test
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?