Guardrails
Package: agentrouter.guardrails.v1 Service: GuardrailsService
Endpoints
List guardrails
What it does: Returns guardrails matching the specified filters.
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Owning customer scope; defaults to caller's session customer when empty. |
project_id | no | Owning project scope; defaults to caller's session project when empty. |
page | no | Cursor-pagination inputs. |
search | no | Optional substring search on guardrail name. |
types | no | Filter to guardrails of these types. |
exclude_types | no | Exclude guardrails of these types. |
statuses | no | Filter to guardrails in these statuses. |
severities | no | Filter to guardrails with these severity levels. |
categories | no | Filter to guardrails in these categories. |
include_templates | no | When true, include platform template rows (is_template=true). |
Response fields:
| Field | Required | Description |
|---|---|---|
guardrails | no | Guardrails matching the request filters, one page's worth. |
page | no | Cursor-pagination outputs. |
total | no | Total count of matching guardrails across all pages. |
{"signatures":{"go":"c.Guardrails().ListGuardrails(ctx, \u0026guardrailsv1.ListGuardrailsRequest{...})","python":"client.guardrails.listguardrails(...)","typescript":"client.guardrails.listguardrails({...})","cli":"tare api guardrails list","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"examples":{"go":"// No Go SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","cli":"tare api guardrails list","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"persona":"Admin","httpVerb":"GET","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/guardrails","slug":"list-guardrails"}
Get a guardrail
What it does: Returns a single guardrail by id.
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Owning customer scope; defaults to caller's session customer when empty. |
project_id | no | Owning project scope; defaults to caller's session project when empty. |
id | yes | Required: uuid of the guardrail to fetch. |
Response fields:
| Field | Required | Description |
|---|---|---|
guardrail | no | The requested guardrail. |
{"signatures":{"go":"c.Guardrails().GetGuardrail(ctx, \u0026guardrailsv1.GetGuardrailRequest{...})","python":"client.guardrails.getguardrail(...)","typescript":"client.guardrails.getguardrail({...})","cli":"tare api guardrails get \u003cid\u003e","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/01H...\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"examples":{"go":"// No Go SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","cli":"tare api guardrails get \u003cid\u003e","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/01H...\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"persona":"Admin","httpVerb":"GET","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/guardrails/{id}","slug":"get-a-guardrail"}
Create a guardrail
What it does: Creates a new guardrail.
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Owning customer scope; defaults to caller's session customer when empty. |
project_id | no | Owning project scope; defaults to caller's session project when empty. |
guardrail | yes | Required: guardrail to create. id must be absent or empty (server-assigned). |
Response fields:
| Field | Required | Description |
|---|---|---|
guardrail | no | The created guardrail with server-assigned fields populated. |
{"signatures":{"go":"c.Guardrails().CreateGuardrail(ctx, \u0026guardrailsv1.CreateGuardrailRequest{...})","python":"client.guardrails.createguardrail(...)","typescript":"client.guardrails.createguardrail({...})","cli":"tare api guardrails create --guardrail $GUARDRAIL","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"guardrail\": {}\n }'"},"examples":{"go":"// No Go SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","cli":"tare api guardrails create --guardrail $GUARDRAIL","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"guardrail\": {}\n }'"},"persona":"Admin","httpVerb":"POST","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/guardrails","slug":"create-a-guardrail"}
Update a guardrail
What it does: Updates mutable guardrail fields. Omitted/empty scalar string fields leave the existing value untouched. Enum fields set to *_UNSPECIFIED leave the existing value untouched. Absent message fields (triggered_response) leave the existing value untouched; a present triggered_response replaces it wholesale. The guardrail id must be set inside the guardrail field. Returns PERMISSION_DENIED when the target guardrail is a template (is_template=true); templates are instantiated via CreateGuardrailFromTemplate, never mutated.
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Owning customer scope; defaults to caller's session customer when empty. |
project_id | no | Owning project scope; defaults to caller's session project when empty. |
guardrail | yes | Required: guardrail to update. guardrail.id must be set. Partial update semantics: omitted/empty scalar string fields leave the existing value untouched; enum fields set to *_UNSPECIFIED leave the existing value untouched; absent message fields (triggered_response) leave the existing value untouched. |
Response fields:
| Field | Required | Description |
|---|---|---|
guardrail | no | The updated guardrail with server-assigned fields populated. |
{"signatures":{"go":"c.Guardrails().UpdateGuardrail(ctx, \u0026guardrailsv1.UpdateGuardrailRequest{...})","python":"client.guardrails.updateguardrail(...)","typescript":"client.guardrails.updateguardrail({...})","cli":"tare api guardrails update --guardrail $GUARDRAIL","curl":"curl -X PATCH \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/01H...\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"guardrail\": {}\n }'"},"examples":{"go":"// No Go SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","cli":"tare api guardrails update --guardrail $GUARDRAIL","curl":"curl -X PATCH \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/01H...\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"guardrail\": {}\n }'"},"persona":"Admin","httpVerb":"PATCH","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/guardrails/{guardrail.id}","slug":"update-a-guardrail"}
Delete a guardrail
What it does: Soft-deletes a guardrail (sets deleted_at; the row disappears from List/Get). Child rules of the soft-deleted guardrail are no longer served. Historical trigger records referencing this guardrail REMAIN queryable. Returns PERMISSION_DENIED when the target guardrail is a template (is_template=true); templates are instantiated via CreateGuardrailFromTemplate, never mutated.
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Owning customer scope; defaults to caller's session customer when empty. |
project_id | no | Owning project scope; defaults to caller's session project when empty. |
id | yes | Required: uuid of the guardrail to delete. |
{"signatures":{"go":"c.Guardrails().DeleteGuardrail(ctx, \u0026guardrailsv1.DeleteGuardrailRequest{...})","python":"client.guardrails.deleteguardrail(...)","typescript":"client.guardrails.deleteguardrail({...})","cli":"tare api guardrails delete \u003cid\u003e","curl":"curl -X DELETE \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/01H...\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"examples":{"go":"// No Go SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","cli":"tare api guardrails delete \u003cid\u003e","curl":"curl -X DELETE \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/01H...\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"persona":"Admin","httpVerb":"DELETE","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/guardrails/{id}","slug":"delete-a-guardrail"}
Set guardrail status
What it does: Updates the status and/or enabled flag of a guardrail. At least one of status/enabled must be provided; otherwise INVALID_ARGUMENT. Returns PERMISSION_DENIED when the target guardrail is a template (is_template=true); templates are instantiated via CreateGuardrailFromTemplate, never mutated.
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Owning customer scope; defaults to caller's session customer when empty. |
project_id | no | Owning project scope; defaults to caller's session project when empty. |
id | yes | Required: uuid of the guardrail to update. |
status | no | New operational status for the guardrail. GUARDRAIL_STATUS_UNSPECIFIED leaves the stored status unchanged. |
enabled | no | New enabled state. When absent the enabled field is left unchanged. |
Response fields:
| Field | Required | Description |
|---|---|---|
guardrail | no | The guardrail with the updated status. |
{"signatures":{"go":"c.Guardrails().SetGuardrailStatus(ctx, \u0026guardrailsv1.SetGuardrailStatusRequest{...})","python":"client.guardrails.setguardrailstatus(...)","typescript":"client.guardrails.setguardrailstatus({...})","cli":"tare api guardrails set-status --id $ID","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/01H.../status\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"status\": \"...\",\n \"enabled\": false\n }'"},"examples":{"go":"// No Go SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","cli":"tare api guardrails set-status --id $ID","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/01H.../status\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"status\": \"...\",\n \"enabled\": false\n }'"},"persona":"Admin","httpVerb":"POST","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/guardrails/{id}/status","slug":"set-guardrail-status"}
Create a guardrail from a template
What it does: Instantiates a new guardrail from a platform template row (is_template=true). The resulting guardrail is editable and scoped to (customer_id, project_id). Returns NOT_FOUND when template_id does not reference an existing template guardrail (non-template ids are treated as not found).
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Owning customer scope; defaults to caller's session customer when empty. |
project_id | no | Owning project scope; defaults to caller's session project when empty. |
template_id | yes | Required: id of the template guardrail (is_template=true) to clone. |
name | yes | Required: display name for the new guardrail. |
description | no | Optional description for the new guardrail. |
Response fields:
| Field | Required | Description |
|---|---|---|
guardrail | no | The newly created guardrail instantiated from the template. |
{"signatures":{"go":"c.Guardrails().CreateGuardrailFromTemplate(ctx, \u0026guardrailsv1.CreateGuardrailFromTemplateRequest{...})","python":"client.guardrails.createguardrailfromtemplate(...)","typescript":"client.guardrails.createguardrailfromtemplate({...})","cli":"tare api guardrails create-from-template --template-id $TEMPLATE_ID --name $NAME","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/from-template\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"template_id\": \"...\",\n \"name\": \"...\",\n \"description\": \"...\"\n }'"},"examples":{"go":"// No Go SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","cli":"tare api guardrails create-from-template --template-id $TEMPLATE_ID --name $NAME","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/from-template\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"template_id\": \"...\",\n \"name\": \"...\",\n \"description\": \"...\"\n }'"},"persona":"Admin","httpVerb":"POST","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/guardrails/from-template","slug":"create-a-guardrail-from-a-template"}
Get guardrail statistics
What it does: Returns aggregate statistics for guardrails in scope.
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Owning customer scope; defaults to caller's session customer when empty. |
project_id | no | Owning project scope; defaults to caller's session project when empty. |
Response fields:
| Field | Required | Description |
|---|---|---|
total | no | Total number of guardrails in scope. |
active | no | Number of guardrails with status ACTIVE. |
by_type | no | Count of guardrails per GuardrailType. Keys are the stored lowercase domain values (e.g. security, compliance), not enum value names. |
by_severity | no | Count of guardrails per GuardrailSeverity. Keys are the stored lowercase domain values (e.g. critical, high), not enum value names. |
by_category | no | Count of guardrails per GuardrailCategory. Keys are the stored lowercase domain values (e.g. data-privacy, financial), not enum value names. |
{"signatures":{"go":"c.Guardrails().GetGuardrailStats(ctx, \u0026guardrailsv1.GetGuardrailStatsRequest{...})","python":"client.guardrails.getguardrailstats(...)","typescript":"client.guardrails.getguardrailstats({...})","cli":"tare api guardrails stats","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/stats\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"examples":{"go":"// No Go SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","cli":"tare api guardrails stats","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/stats\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"persona":"Admin","httpVerb":"GET","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/guardrails/stats","slug":"get-guardrail-statistics"}
List guardrail rules
What it does: Returns rules for the specified guardrail.
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Owning customer scope; defaults to caller's session customer when empty. |
project_id | no | Owning project scope; defaults to caller's session project when empty. |
page | no | Cursor-pagination inputs. |
guardrail_id | yes | Required: parent guardrail id. |
search | no | Optional substring search on rule name. |
active | no | When set, filter to active or inactive rules only. |
execute_on | no | Filter to rules with these execute_on values. |
provider_ids | no | Filter to rules referencing these provider ids. |
check_types | no | Filter to rules with these check_type values. |
actions | no | Filter to rules with these action values. |
modes | no | Filter to rules with these mode values. |
Response fields:
| Field | Required | Description |
|---|---|---|
rules | no | Rules matching the request filters, one page's worth. |
page | no | Cursor-pagination outputs. |
total | no | Total count of matching rules across all pages. |
{"signatures":{"go":"c.Guardrails().ListGuardrailRules(ctx, \u0026guardrailsv1.ListGuardrailRulesRequest{...})","python":"client.guardrails.listguardrailrules(...)","typescript":"client.guardrails.listguardrailrules({...})","cli":"tare api guardrails rules list --guardrail-id $GUARDRAIL_ID","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/01H.../rules\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"examples":{"go":"// No Go SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","cli":"tare api guardrails rules list --guardrail-id $GUARDRAIL_ID","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/01H.../rules\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"persona":"Admin","httpVerb":"GET","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/guardrails/{guardrail_id}/rules","slug":"list-guardrail-rules"}
Get a guardrail rule
What it does: Returns a single rule by id. Returns NOT_FOUND when the rule does not exist under the given guardrail_id.
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Owning customer scope; defaults to caller's session customer when empty. |
project_id | no | Owning project scope; defaults to caller's session project when empty. |
guardrail_id | yes | Required: parent guardrail id. |
id | yes | Required: uuid of the rule to fetch. |
Response fields:
| Field | Required | Description |
|---|---|---|
rule | no | The requested guardrail rule. |
{"signatures":{"go":"c.Guardrails().GetGuardrailRule(ctx, \u0026guardrailsv1.GetGuardrailRuleRequest{...})","python":"client.guardrails.getguardrailrule(...)","typescript":"client.guardrails.getguardrailrule({...})","cli":"tare api guardrails rules get --guardrail-id $GUARDRAIL_ID \u003cid\u003e","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/01H.../rules/01H...\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"examples":{"go":"// No Go SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","cli":"tare api guardrails rules get --guardrail-id $GUARDRAIL_ID \u003cid\u003e","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/01H.../rules/01H...\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"persona":"Admin","httpVerb":"GET","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/guardrails/{guardrail_id}/rules/{id}","slug":"get-a-guardrail-rule"}
Create a guardrail rule
Changed in v0.5.0 (behaviour changes): Creating or updating an externalservice guardrail provider now rejects, with INVALID_ARGUMENT, a config the data plane could not use: an unknown key or non-string value, a service_url that is not an absolute http or https URL or names a link-local or metadata address, a blank endpoint or one without a leading slash, a blank timeout or one outside 0-30s, or a ca_cert_pem over 8 KiB, over four certificates or holding anything else. Its rules need a raw.threshold above 0 and at most 1.
Changed in v0.5.0 (behaviour changes): Creating or updating a guardrail rule with the externalService configuration variant now fails with INVALID_ARGUMENT for every provider kind. A stored rule that still carries the variant stays readable and editable as long as the write does not send it back.
Changed in v0.5.0 (deprecations): The externalService variant of a guardrail rule's configuration is deprecated: nothing reads it, and its headers were never sent as HTTP headers. Connection settings and the credential live on the provider; per-check parameters go in the rule's raw configuration, where threshold is the one reserved key.
Changed in v0.4.0 (behaviour changes): Editing a guardrail rule that is bound to a provider outside its own project is now refused. The rule keeps enforcing and reading it is unaffected, but any update that touches its provider, check type or configuration fails until the rule is repointed at a provider its own project owns -- which can be done in the same update call. Only rules the guardrail-provider ownership migration reports as still bound outside their project are affected; it names the count in a notice reading "N non-template rule(s) remain bound outside their own project".
Changed in v0.4.0 (security updates): A guardrail rule can now be bound only to a provider its own project owns. A caller who knew another project's provider id could previously point a rule at it and send that project's traffic through another project's provider and credential, because the binding check asked only whether the provider existed and was usable, never who owned it. The refusal reads the same whether the id names another project's provider, a catalog template or nothing at all, so it cannot be used to discover which provider ids exist. Rules that already reference a provider in their own project are unaffected. No CVE; requires a caller authorized to write guardrails in some project. Rules written before this release are NOT rewritten, and any that the upgrade left bound outside their own project keep enforcing -- and keep exporting the other project's provider configuration, its endpoint and credential reference included, into the referencing project's data-plane configuration. The upgrade reports how many such rules remain: the guardrail-provider ownership migration raises a notice reading "N non-template rule(s) remain bound outside their own project". Repoint each of them at a provider its own project owns; until you do, the next edit to the rule's provider, check type or configuration is refused.
What it does: Adds a new rule to a guardrail. Returns PERMISSION_DENIED when the target guardrail is a template (is_template=true); templates are instantiated via CreateGuardrailFromTemplate, never mutated.
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Owning customer scope; defaults to caller's session customer when empty. |
project_id | no | Owning project scope; defaults to caller's session project when empty. |
guardrail_id | yes | Required: parent guardrail id (must match rule.guardrail_id when both are set). |
rule | yes | Required: rule to create. id must be absent or empty (server-assigned). |
Response fields:
| Field | Required | Description |
|---|---|---|
rule | no | The created rule with server-assigned fields populated. |
{"signatures":{"go":"c.Guardrails().CreateGuardrailRule(ctx, \u0026guardrailsv1.CreateGuardrailRuleRequest{...})","python":"client.guardrails.createguardrailrule(...)","typescript":"client.guardrails.createguardrailrule({...})","cli":"tare api guardrails rules create --guardrail-id $GUARDRAIL_ID --rule $RULE","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/01H.../rules\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"rule\": {}\n }'"},"examples":{"go":"// No Go SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","cli":"tare api guardrails rules create --guardrail-id $GUARDRAIL_ID --rule $RULE","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/01H.../rules\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"rule\": {}\n }'"},"persona":"Admin","httpVerb":"POST","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/guardrails/{guardrail_id}/rules","slug":"create-a-guardrail-rule"}
Update a guardrail rule
Changed in v0.5.0 (behaviour changes): Creating or updating an externalservice guardrail provider now rejects, with INVALID_ARGUMENT, a config the data plane could not use: an unknown key or non-string value, a service_url that is not an absolute http or https URL or names a link-local or metadata address, a blank endpoint or one without a leading slash, a blank timeout or one outside 0-30s, or a ca_cert_pem over 8 KiB, over four certificates or holding anything else. Its rules need a raw.threshold above 0 and at most 1.
Changed in v0.5.0 (behaviour changes): Creating or updating a guardrail rule with the externalService configuration variant now fails with INVALID_ARGUMENT for every provider kind. A stored rule that still carries the variant stays readable and editable as long as the write does not send it back.
Changed in v0.5.0 (deprecations): The externalService variant of a guardrail rule's configuration is deprecated: nothing reads it, and its headers were never sent as HTTP headers. Connection settings and the credential live on the provider; per-check parameters go in the rule's raw configuration, where threshold is the one reserved key.
Changed in v0.4.0 (behaviour changes): Editing a guardrail rule that is bound to a provider outside its own project is now refused. The rule keeps enforcing and reading it is unaffected, but any update that touches its provider, check type or configuration fails until the rule is repointed at a provider its own project owns -- which can be done in the same update call. Only rules the guardrail-provider ownership migration reports as still bound outside their project are affected; it names the count in a notice reading "N non-template rule(s) remain bound outside their own project".
Changed in v0.4.0 (security updates): A guardrail rule can now be bound only to a provider its own project owns. A caller who knew another project's provider id could previously point a rule at it and send that project's traffic through another project's provider and credential, because the binding check asked only whether the provider existed and was usable, never who owned it. The refusal reads the same whether the id names another project's provider, a catalog template or nothing at all, so it cannot be used to discover which provider ids exist. Rules that already reference a provider in their own project are unaffected. No CVE; requires a caller authorized to write guardrails in some project. Rules written before this release are NOT rewritten, and any that the upgrade left bound outside their own project keep enforcing -- and keep exporting the other project's provider configuration, its endpoint and credential reference included, into the referencing project's data-plane configuration. The upgrade reports how many such rules remain: the guardrail-provider ownership migration raises a notice reading "N non-template rule(s) remain bound outside their own project". Repoint each of them at a provider its own project owns; until you do, the next edit to the rule's provider, check type or configuration is refused.
What it does: Updates mutable rule fields. Omitted/empty scalar string fields leave the existing value untouched. Enum fields set to *_UNSPECIFIED leave the existing value untouched. Absent message fields (triggered_response, configuration) leave the existing value untouched; a present configuration Struct REPLACES the stored configuration wholesale (no deep merge). The rule id must be set inside the rule field. Returns PERMISSION_DENIED when the target rule's parent guardrail is a template (is_template=true); templates are instantiated via CreateGuardrailFromTemplate, never mutated.
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Owning customer scope; defaults to caller's session customer when empty. |
project_id | no | Owning project scope; defaults to caller's session project when empty. |
guardrail_id | yes | Required: parent guardrail id (must match rule.guardrail_id when both are set). |
rule | yes | Required: rule to update. rule.id must be set. Partial update semantics: omitted/empty scalar string fields leave the existing value untouched; enum fields set to *_UNSPECIFIED leave the existing value untouched; absent message fields (triggered_response, configuration) leave the existing value untouched; a present configuration Struct REPLACES the stored configuration wholesale (no deep merge). |
Response fields:
| Field | Required | Description |
|---|---|---|
rule | no | The updated rule with server-assigned fields populated. |
{"signatures":{"go":"c.Guardrails().UpdateGuardrailRule(ctx, \u0026guardrailsv1.UpdateGuardrailRuleRequest{...})","python":"client.guardrails.updateguardrailrule(...)","typescript":"client.guardrails.updateguardrailrule({...})","cli":"tare api guardrails rules update --guardrail-id $GUARDRAIL_ID --rule $RULE","curl":"curl -X PATCH \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/01H.../rules/01H...\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"rule\": {}\n }'"},"examples":{"go":"// No Go SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","cli":"tare api guardrails rules update --guardrail-id $GUARDRAIL_ID --rule $RULE","curl":"curl -X PATCH \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/01H.../rules/01H...\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"rule\": {}\n }'"},"persona":"Admin","httpVerb":"PATCH","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/guardrails/{guardrail_id}/rules/{rule.id}","slug":"update-a-guardrail-rule"}
Delete a guardrail rule
What it does: Soft-deletes a rule (sets deleted_at; the row disappears from List/Get). Historical trigger records referencing this rule REMAIN queryable. Returns NOT_FOUND when the rule does not exist under the given guardrail_id. Returns PERMISSION_DENIED when the target rule's parent guardrail is a template (is_template=true); templates are instantiated via CreateGuardrailFromTemplate, never mutated.
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Owning customer scope; defaults to caller's session customer when empty. |
project_id | no | Owning project scope; defaults to caller's session project when empty. |
guardrail_id | yes | Required: parent guardrail id. |
id | yes | Required: uuid of the rule to delete. |
{"signatures":{"go":"c.Guardrails().DeleteGuardrailRule(ctx, \u0026guardrailsv1.DeleteGuardrailRuleRequest{...})","python":"client.guardrails.deleteguardrailrule(...)","typescript":"client.guardrails.deleteguardrailrule({...})","cli":"tare api guardrails rules delete --guardrail-id $GUARDRAIL_ID \u003cid\u003e","curl":"curl -X DELETE \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/01H.../rules/01H...\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"examples":{"go":"// No Go SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for GuardrailsService yet -- use the CLI or curl example below.","cli":"tare api guardrails rules delete --guardrail-id $GUARDRAIL_ID \u003cid\u003e","curl":"curl -X DELETE \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/01H.../rules/01H...\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"persona":"Admin","httpVerb":"DELETE","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/guardrails/{guardrail_id}/rules/{id}","slug":"delete-a-guardrail-rule"}