> For the complete documentation index, see [llms.txt](https://docs.otari.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.otari.ai/api-reference/organization-guardrails.md).

# Organization guardrails

## List Organization Guardrails

> List the guardrails the caller's organization mandates.\
> \
> Organization owners and admins only, unlike the pricing overrides next door\
> that any member may read: these rows name the endpoints this gateway\
> connects to and say which of them carry a credential. A credential is never\
> returned, only whether one is set.

```json
{"openapi":"3.1.0","info":{"title":"otari","version":"0.33.0"},"security":[{"ApiKeyAuth":[]},{"XApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"description":"Enter your API key here (sent as Otari-Key header).","in":"header","name":"Otari-Key","type":"apiKey"},"XApiKeyAuth":{"description":"Anthropic-native clients send credentials here (no Bearer prefix).","in":"header","name":"x-api-key","type":"apiKey"}},"schemas":{"OrganizationGuardrailsPublic":{"properties":{"count":{"title":"Count","type":"integer"},"data":{"items":{"$ref":"#/components/schemas/OrganizationGuardrailPublic"},"title":"Data","type":"array"}},"required":["data","count"],"title":"OrganizationGuardrailsPublic","type":"object"},"OrganizationGuardrailPublic":{"description":"The API-facing shape. Never carries the credential, nor a credential-shaped parameter.\n\n``validate_kwargs`` is the second place a credential lives on this row, and\nthe one with no column of its own: a guardrail class can take a vendor key\nas a parameter, so the form offers a box for it and whatever is typed there\nis stored as plain JSON. It is masked the way\n``org_provider_keys.client_args`` is, by the *name* of the entry rather than\nby what the guardrail catalog says about it, so the mask still applies when\nthe guardrails service is down and no catalog can be read.","properties":{"applies_to_all_workspaces":{"title":"Applies To All Workspaces","type":"boolean"},"created_at":{"title":"Created At","type":"string"},"definition_id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}],"title":"Definition Id"},"enabled":{"title":"Enabled","type":"boolean"},"has_credential":{"title":"Has Credential","type":"boolean"},"id":{"format":"uuid","title":"Id","type":"string"},"mode":{"title":"Mode","type":"string"},"on_unavailable":{"title":"On Unavailable","type":"string"},"organization_id":{"format":"uuid","title":"Organization Id","type":"string"},"profile":{"title":"Profile","type":"string"},"updated_at":{"title":"Updated At","type":"string"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"validate_kwargs":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"description":"Extra kwargs for the check itself, sent to the guardrails service or handed to the guardrail this entry's definition builds. A parameter whose name looks credential-shaped comes back as *** rather than its stored value; sending that *** back keeps what is stored","title":"Validate Kwargs"},"workspace_ids":{"items":{"format":"uuid","type":"string"},"title":"Workspace Ids","type":"array"}},"required":["id","organization_id","profile","url","has_credential","definition_id","mode","on_unavailable","validate_kwargs","enabled","applies_to_all_workspaces","workspace_ids","created_at","updated_at"],"title":"OrganizationGuardrailPublic","type":"object"},"HTTPValidationError":{"properties":{"code":{"const":"invalid_request","description":"Stable error code, also sent as the Otari-Error-Code header.","title":"Code","type":"string"},"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"title":"Detail","type":"array"}},"title":"HTTPValidationError","type":"object"},"ValidationError":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"}}},"paths":{"/api/v1/organizations/me/guardrails":{"get":{"description":"List the guardrails the caller's organization mandates.\n\nOrganization owners and admins only, unlike the pricing overrides next door\nthat any member may read: these rows name the endpoints this gateway\nconnects to and say which of them carry a credential. A credential is never\nreturned, only whether one is set.","operationId":"organization-guardrails-list_organization_guardrails","parameters":[{"description":"Number of records to skip","in":"query","name":"skip","required":false,"schema":{"default":0,"description":"Number of records to skip","minimum":0,"title":"Skip","type":"integer"}},{"description":"Maximum number of records to return","in":"query","name":"limit","required":false,"schema":{"default":100,"description":"Maximum number of records to return","maximum":1000,"minimum":1,"title":"Limit","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationGuardrailsPublic"}}},"description":"Successful Response"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Validation Error"}},"summary":"List Organization Guardrails","tags":["organization-guardrails"]}}}}
```

## Create Organization Guardrail

> Mandate a guardrail across the organization. Organization owners and admins only.\
> \
> The guardrail runs on every request from the workspaces it is scoped to, in\
> addition to whatever the caller asked for, with the stricter of the two\
> settings applying to a profile both name. Set\
> \`\`applies\_to\_all\_workspaces\`\` for it to cover workspaces created later;\
> otherwise a new workspace inherits nothing and the entry runs only in the\
> workspaces \`\`workspace\_ids\`\` lists.

```json
{"openapi":"3.1.0","info":{"title":"otari","version":"0.33.0"},"security":[{"ApiKeyAuth":[]},{"XApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"description":"Enter your API key here (sent as Otari-Key header).","in":"header","name":"Otari-Key","type":"apiKey"},"XApiKeyAuth":{"description":"Anthropic-native clients send credentials here (no Bearer prefix).","in":"header","name":"x-api-key","type":"apiKey"}},"schemas":{"OrganizationGuardrailCreate":{"description":"Request body for mandating a guardrail across an organization.\n\n``credential`` is never stored as sent: it is encrypted with\n``OTARI_SECRET_KEY`` and only the ciphertext is kept, the same convention\n`tools.WorkspaceMcpServer` and `providers.ProviderCredential` use. It is\nsent to the endpoint as ``Authorization: Bearer`` when the guardrail runs,\nso it authenticates this gateway to the guardrails service the entry names.\nA guardrail *vendor's* own key is not this: the guardrails service builds\nits guardrails from the operator's YAML and holds those itself.\n\nA credential therefore requires ``url``. The deployment's ``guardrails_url``\nis not necessarily encrypted (the shipped compose file makes it a same-host\n``http://`` sidecar) and this row cannot see what it is set to, so an entry\nthat fell back to it could not promise the bearer was sent over https. See\n`_require_url_for_credential`.\n\n``on`` is not offered. This plane mandates input-direction checks, which is\nthe only direction the request path enforces\n(`services.guardrails.run_input_guardrails`); an organization that could\nstore an output-direction mandate would be storing one nothing runs.","properties":{"applies_to_all_workspaces":{"default":false,"description":"True runs this in every workspace of the organization, including one created later; false runs it only in the workspaces named by workspace_ids","title":"Applies To All Workspaces","type":"boolean"},"credential":{"anyOf":[{"maxLength":8192,"type":"string"},{"type":"null"}],"description":"Bearer credential for this entry's endpoint. Requires url to be set, and https: an entry with no endpoint of its own falls back to the deployment's guardrails_url, which is commonly a same-host http sidecar. Encrypted at rest, never returned","title":"Credential"},"definition_id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}],"description":"A guardrail definition of this organization for Otari to build and run itself, instead of calling a profile on a guardrails service. Mutually exclusive with url and credential, which name a service","title":"Definition Id"},"enabled":{"default":true,"description":"False stops the guardrail everywhere without discarding it","title":"Enabled","type":"boolean"},"mode":{"default":"monitor","description":"block rejects a flagged request with 403; monitor annotates the response and forwards it","enum":["block","monitor"],"title":"Mode","type":"string"},"on_unavailable":{"default":"block","description":"What a block-mode entry does when the guardrails service cannot be reached at all","enum":["block","monitor"],"title":"On Unavailable","type":"string"},"profile":{"description":"Profile name configured on the guardrails service, unique within the organization","maxLength":128,"minLength":1,"title":"Profile","type":"string"},"url":{"anyOf":[{"maxLength":2048,"type":"string"},{"type":"null"}],"description":"Guardrails endpoint for this entry; null uses the deployment's guardrails_url","title":"Url"},"validate_kwargs":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"description":"Extra kwargs for the check itself, sent to the guardrails service or handed to the guardrail this entry's definition builds","title":"Validate Kwargs"},"workspace_ids":{"description":"Workspaces this guardrail runs in. Must be empty when applies_to_all_workspaces is true","items":{"format":"uuid","type":"string"},"maxItems":500,"title":"Workspace Ids","type":"array"}},"required":["profile"],"title":"OrganizationGuardrailCreate","type":"object"},"OrganizationGuardrailPublic":{"description":"The API-facing shape. Never carries the credential, nor a credential-shaped parameter.\n\n``validate_kwargs`` is the second place a credential lives on this row, and\nthe one with no column of its own: a guardrail class can take a vendor key\nas a parameter, so the form offers a box for it and whatever is typed there\nis stored as plain JSON. It is masked the way\n``org_provider_keys.client_args`` is, by the *name* of the entry rather than\nby what the guardrail catalog says about it, so the mask still applies when\nthe guardrails service is down and no catalog can be read.","properties":{"applies_to_all_workspaces":{"title":"Applies To All Workspaces","type":"boolean"},"created_at":{"title":"Created At","type":"string"},"definition_id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}],"title":"Definition Id"},"enabled":{"title":"Enabled","type":"boolean"},"has_credential":{"title":"Has Credential","type":"boolean"},"id":{"format":"uuid","title":"Id","type":"string"},"mode":{"title":"Mode","type":"string"},"on_unavailable":{"title":"On Unavailable","type":"string"},"organization_id":{"format":"uuid","title":"Organization Id","type":"string"},"profile":{"title":"Profile","type":"string"},"updated_at":{"title":"Updated At","type":"string"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"validate_kwargs":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"description":"Extra kwargs for the check itself, sent to the guardrails service or handed to the guardrail this entry's definition builds. A parameter whose name looks credential-shaped comes back as *** rather than its stored value; sending that *** back keeps what is stored","title":"Validate Kwargs"},"workspace_ids":{"items":{"format":"uuid","type":"string"},"title":"Workspace Ids","type":"array"}},"required":["id","organization_id","profile","url","has_credential","definition_id","mode","on_unavailable","validate_kwargs","enabled","applies_to_all_workspaces","workspace_ids","created_at","updated_at"],"title":"OrganizationGuardrailPublic","type":"object"},"HTTPValidationError":{"properties":{"code":{"const":"invalid_request","description":"Stable error code, also sent as the Otari-Error-Code header.","title":"Code","type":"string"},"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"title":"Detail","type":"array"}},"title":"HTTPValidationError","type":"object"},"ValidationError":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"}}},"paths":{"/api/v1/organizations/me/guardrails":{"post":{"description":"Mandate a guardrail across the organization. Organization owners and admins only.\n\nThe guardrail runs on every request from the workspaces it is scoped to, in\naddition to whatever the caller asked for, with the stricter of the two\nsettings applying to a profile both name. Set\n``applies_to_all_workspaces`` for it to cover workspaces created later;\notherwise a new workspace inherits nothing and the entry runs only in the\nworkspaces ``workspace_ids`` lists.","operationId":"organization-guardrails-create_organization_guardrail","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationGuardrailCreate"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationGuardrailPublic"}}},"description":"Successful Response"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Validation Error"}},"summary":"Create Organization Guardrail","tags":["organization-guardrails"]}}}}
```

## Update Organization Guardrail

> Change a guardrail's profile, endpoint, credential, modes, or scope.\
> \
> Organization owners and admins only. Omitted fields are left as they are;\
> \`\`workspace\_ids\`\` replaces the scope whole when sent, and \`\`url\`\` and\
> \`\`credential\`\` are cleared by sending an empty string rather than null.

```json
{"openapi":"3.1.0","info":{"title":"otari","version":"0.33.0"},"security":[{"ApiKeyAuth":[]},{"XApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"description":"Enter your API key here (sent as Otari-Key header).","in":"header","name":"Otari-Key","type":"apiKey"},"XApiKeyAuth":{"description":"Anthropic-native clients send credentials here (no Bearer prefix).","in":"header","name":"x-api-key","type":"apiKey"}},"schemas":{"OrganizationGuardrailUpdate":{"description":"Partial update. Only the fields the caller sets are applied.\n\n``credential`` and ``url`` have three states rather than two, which is what\na write-only field and its nullable partner need: omit to leave the stored\nvalue alone, send ``\"\"`` to clear it, send a value to replace it. An\nexplicit ``null`` also leaves them alone, matching\n`WorkspaceMcpServerUpdate`: a client that serializes its whole form back,\nwith an empty credential box it never filled in, must not destroy a\ncredential it was never shown.\n\n``workspace_ids`` replaces the scope whole when sent; ``[]`` clears it.\n\n``definition_id`` diverges: an explicit ``null`` **clears** it. The rule\nabove protects a field the client was never shown, and this one is returned\non every read, so a form sending ``null`` is sending back a field it was\ngiven rather than an empty box it never filled in. Omitting it still leaves\nthe link alone.","properties":{"applies_to_all_workspaces":{"title":"Applies To All Workspaces","type":"boolean"},"credential":{"anyOf":[{"maxLength":8192,"type":"string"},{"type":"null"}],"title":"Credential"},"definition_id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}],"description":"The organization's own definition this mandate runs. Unlike url and credential, an explicit null clears the link; omit the field to leave it as it is","title":"Definition Id"},"enabled":{"title":"Enabled","type":"boolean"},"mode":{"enum":["block","monitor"],"title":"Mode","type":"string"},"on_unavailable":{"enum":["block","monitor"],"title":"On Unavailable","type":"string"},"profile":{"maxLength":128,"minLength":1,"title":"Profile","type":"string"},"url":{"anyOf":[{"maxLength":2048,"type":"string"},{"type":"null"}],"title":"Url"},"validate_kwargs":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"description":"Replaces the stored kwargs whole. A parameter sent as *** keeps the value stored under that name, which is how a credential-shaped one survives an edit of the rest of the entry","title":"Validate Kwargs"},"workspace_ids":{"anyOf":[{"items":{"format":"uuid","type":"string"},"maxItems":500,"type":"array"},{"type":"null"}],"title":"Workspace Ids"}},"title":"OrganizationGuardrailUpdate","type":"object"},"OrganizationGuardrailPublic":{"description":"The API-facing shape. Never carries the credential, nor a credential-shaped parameter.\n\n``validate_kwargs`` is the second place a credential lives on this row, and\nthe one with no column of its own: a guardrail class can take a vendor key\nas a parameter, so the form offers a box for it and whatever is typed there\nis stored as plain JSON. It is masked the way\n``org_provider_keys.client_args`` is, by the *name* of the entry rather than\nby what the guardrail catalog says about it, so the mask still applies when\nthe guardrails service is down and no catalog can be read.","properties":{"applies_to_all_workspaces":{"title":"Applies To All Workspaces","type":"boolean"},"created_at":{"title":"Created At","type":"string"},"definition_id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}],"title":"Definition Id"},"enabled":{"title":"Enabled","type":"boolean"},"has_credential":{"title":"Has Credential","type":"boolean"},"id":{"format":"uuid","title":"Id","type":"string"},"mode":{"title":"Mode","type":"string"},"on_unavailable":{"title":"On Unavailable","type":"string"},"organization_id":{"format":"uuid","title":"Organization Id","type":"string"},"profile":{"title":"Profile","type":"string"},"updated_at":{"title":"Updated At","type":"string"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"validate_kwargs":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"description":"Extra kwargs for the check itself, sent to the guardrails service or handed to the guardrail this entry's definition builds. A parameter whose name looks credential-shaped comes back as *** rather than its stored value; sending that *** back keeps what is stored","title":"Validate Kwargs"},"workspace_ids":{"items":{"format":"uuid","type":"string"},"title":"Workspace Ids","type":"array"}},"required":["id","organization_id","profile","url","has_credential","definition_id","mode","on_unavailable","validate_kwargs","enabled","applies_to_all_workspaces","workspace_ids","created_at","updated_at"],"title":"OrganizationGuardrailPublic","type":"object"},"HTTPValidationError":{"properties":{"code":{"const":"invalid_request","description":"Stable error code, also sent as the Otari-Error-Code header.","title":"Code","type":"string"},"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"title":"Detail","type":"array"}},"title":"HTTPValidationError","type":"object"},"ValidationError":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"}}},"paths":{"/api/v1/organizations/me/guardrails/{guardrail_id}":{"patch":{"description":"Change a guardrail's profile, endpoint, credential, modes, or scope.\n\nOrganization owners and admins only. Omitted fields are left as they are;\n``workspace_ids`` replaces the scope whole when sent, and ``url`` and\n``credential`` are cleared by sending an empty string rather than null.","operationId":"organization-guardrails-update_organization_guardrail","parameters":[{"in":"path","name":"guardrail_id","required":true,"schema":{"format":"uuid","title":"Guardrail Id","type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationGuardrailUpdate"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationGuardrailPublic"}}},"description":"Successful Response"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Validation Error"}},"summary":"Update Organization Guardrail","tags":["organization-guardrails"]}}}}
```

## Delete Organization Guardrail

> Stop mandating a guardrail, discarding its credential and scope.\
> \
> Organization owners and admins only. Use \`\`enabled: false\`\` instead to stop\
> it everywhere while keeping both.

```json
{"openapi":"3.1.0","info":{"title":"otari","version":"0.33.0"},"security":[{"ApiKeyAuth":[]},{"XApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"description":"Enter your API key here (sent as Otari-Key header).","in":"header","name":"Otari-Key","type":"apiKey"},"XApiKeyAuth":{"description":"Anthropic-native clients send credentials here (no Bearer prefix).","in":"header","name":"x-api-key","type":"apiKey"}},"schemas":{"Message":{"description":"A human-readable acknowledgment for an operation with nothing to return.","properties":{"message":{"description":"What happened.","title":"Message","type":"string"}},"required":["message"],"title":"Message","type":"object"},"HTTPValidationError":{"properties":{"code":{"const":"invalid_request","description":"Stable error code, also sent as the Otari-Error-Code header.","title":"Code","type":"string"},"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"title":"Detail","type":"array"}},"title":"HTTPValidationError","type":"object"},"ValidationError":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"}}},"paths":{"/api/v1/organizations/me/guardrails/{guardrail_id}":{"delete":{"description":"Stop mandating a guardrail, discarding its credential and scope.\n\nOrganization owners and admins only. Use ``enabled: false`` instead to stop\nit everywhere while keeping both.","operationId":"organization-guardrails-delete_organization_guardrail","parameters":[{"in":"path","name":"guardrail_id","required":true,"schema":{"format":"uuid","title":"Guardrail Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}},"description":"Successful Response"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Validation Error"}},"summary":"Delete Organization Guardrail","tags":["organization-guardrails"]}}}}
```

## Test Organization Guardrail

> Post some text to the guardrails service a mandate names and return its verdict.\
> \
> Organization owners and admins only. Uses the mandate's own endpoint and\
> credential, or the deployment's guardrails URL when it names none, and\
> faces the same safety check a request does. Nothing is stored.\
> \`\`validate\_kwargs\`\` replaces the stored arguments for this call, a\
> \`\`\*\*\*\`\` in it keeps the value stored under that name, and omitting it\
> sends the stored arguments.\
> \
> A mandate that runs a configured guardrail answers 409: test that\
> guardrail through \`\`/api/v1/organizations/me/guardrail-definitions\`\`. So\
> does one with nowhere to send the check. A service that cannot be reached,\
> or answers something malformed, answers 502, and the reason is in the\
> gateway's log only.

```json
{"openapi":"3.1.0","info":{"title":"otari","version":"0.33.0"},"security":[{"ApiKeyAuth":[]},{"XApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"description":"Enter your API key here (sent as Otari-Key header).","in":"header","name":"Otari-Key","type":"apiKey"},"XApiKeyAuth":{"description":"Anthropic-native clients send credentials here (no Bearer prefix).","in":"header","name":"x-api-key","type":"apiKey"}},"schemas":{"OrganizationGuardrailTest":{"additionalProperties":false,"description":"Text to run one mandate's check over, as a request would.","properties":{"text":{"description":"The input to check, as a request's user text would reach it","maxLength":10000,"minLength":1,"title":"Text","type":"string"},"validate_kwargs":{"additionalProperties":true,"description":"Per-check arguments to send in place of the stored ones; omitted sends the stored ones. A *** keeps the value stored under that name","title":"Validate Kwargs","type":"object"}},"required":["text"],"title":"OrganizationGuardrailTest","type":"object"},"OrganizationGuardrailTestResult":{"description":"The guardrails service's verdict on the text, in the fields a request's check reports.","properties":{"explanation":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The service's reason, when it gives one","title":"Explanation"},"score":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The service's score, when it gives one","title":"Score"},"valid":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"False when the guardrail flagged the text, null when it gave no verdict","title":"Valid"}},"required":["valid","explanation","score"],"title":"OrganizationGuardrailTestResult","type":"object"},"HTTPValidationError":{"properties":{"code":{"const":"invalid_request","description":"Stable error code, also sent as the Otari-Error-Code header.","title":"Code","type":"string"},"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"title":"Detail","type":"array"}},"title":"HTTPValidationError","type":"object"},"ValidationError":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"}}},"paths":{"/api/v1/organizations/me/guardrails/{guardrail_id}/test":{"post":{"description":"Post some text to the guardrails service a mandate names and return its verdict.\n\nOrganization owners and admins only. Uses the mandate's own endpoint and\ncredential, or the deployment's guardrails URL when it names none, and\nfaces the same safety check a request does. Nothing is stored.\n``validate_kwargs`` replaces the stored arguments for this call, a\n``***`` in it keeps the value stored under that name, and omitting it\nsends the stored arguments.\n\nA mandate that runs a configured guardrail answers 409: test that\nguardrail through ``/api/v1/organizations/me/guardrail-definitions``. So\ndoes one with nowhere to send the check. A service that cannot be reached,\nor answers something malformed, answers 502, and the reason is in the\ngateway's log only.","operationId":"organization-guardrails-test_organization_guardrail","parameters":[{"in":"path","name":"guardrail_id","required":true,"schema":{"format":"uuid","title":"Guardrail Id","type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationGuardrailTest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationGuardrailTestResult"}}},"description":"Successful Response"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Validation Error"}},"summary":"Test Organization Guardrail","tags":["organization-guardrails"]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.otari.ai/api-reference/organization-guardrails.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
