Patterns

Package: agentrouter.guardrails.v1 Service: PatternsService

Endpoints

List guardrail patterns

Changed in v0.5.0 (behaviour changes): Listing and reading guardrail patterns now requires the guardrail_patterns.read permission or a scope that grants guardrail reads. Keys with the read, write, admin, guardrails_reader or guardrails_admin scope keep access, as do the Super Admin and Viewer roles and anyone who can open the Admin Console's Patterns page today. A key scoped to an unrelated area, or a custom role with neither, now gets a permission error.

What it does: Returns patterns visible to the requested scope, including built-in patterns which are globally visible.

Request fields:

FieldRequiredDescription
customer_idnoOwning customer scope; defaults to caller's session customer when empty. Built-in patterns are always included regardless of this value.
project_idnoOwning project scope; defaults to caller's session project when empty.
pagenoCursor-pagination inputs.
categorynoOptional filter by category (e.g., "pii", "credentials").
builtin_onlynoWhen true, return only built-in patterns (is_builtin=true).
searchnoOptional substring search on pattern name or display_name.

Response fields:

FieldRequiredDescription
patternsnoPatterns matching the request filters, one page's worth.
pagenoCursor-pagination outputs.
totalnoTotal count of matching patterns across all pages.
{"signatures":{"go":"c.Patterns().ListPatterns(ctx, \u0026guardrailsv1.ListPatternsRequest{...})","python":"client.patterns.listpatterns(...)","typescript":"client.patterns.listpatterns({...})","cli":"tare api guardrails patterns list","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/patterns\" \\\n  -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"examples":{"go":"// No Go SDK wrapper for PatternsService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for PatternsService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for PatternsService yet -- use the CLI or curl example below.","cli":"tare api guardrails patterns list","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/patterns\" \\\n  -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"persona":"Admin","httpVerb":"GET","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/guardrails/patterns","slug":"list-guardrail-patterns"}

Get a guardrail pattern

Changed in v0.5.0 (behaviour changes): Listing and reading guardrail patterns now requires the guardrail_patterns.read permission or a scope that grants guardrail reads. Keys with the read, write, admin, guardrails_reader or guardrails_admin scope keep access, as do the Super Admin and Viewer roles and anyone who can open the Admin Console's Patterns page today. A key scoped to an unrelated area, or a custom role with neither, now gets a permission error.

What it does: Returns a single pattern by id.

Request fields:

FieldRequiredDescription
customer_idnoOwning customer scope; defaults to caller's session customer when empty.
project_idnoOwning project scope; defaults to caller's session project when empty.
idyesRequired: uuid of the pattern to fetch.

Response fields:

FieldRequiredDescription
patternnoThe requested pattern.
{"signatures":{"go":"c.Patterns().GetPattern(ctx, \u0026guardrailsv1.GetPatternRequest{...})","python":"client.patterns.getpattern(...)","typescript":"client.patterns.getpattern({...})","cli":"tare api guardrails patterns get \u003cid\u003e","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/patterns/01H...\" \\\n  -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"examples":{"go":"// No Go SDK wrapper for PatternsService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for PatternsService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for PatternsService yet -- use the CLI or curl example below.","cli":"tare api guardrails patterns get \u003cid\u003e","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/patterns/01H...\" \\\n  -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"persona":"Admin","httpVerb":"GET","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/guardrails/patterns/{id}","slug":"get-a-guardrail-pattern"}

Create a guardrail pattern

What it does: Creates a new user-defined pattern. Returns PERMISSION_DENIED when attempting to create a pattern with is_builtin=true.

Request fields:

FieldRequiredDescription
customer_idnoOwning customer scope; defaults to caller's session customer when empty.
project_idnoOwning project scope; defaults to caller's session project when empty.
patternyesRequired: pattern to create. id must be absent or empty (server-assigned).

Response fields:

FieldRequiredDescription
patternnoThe created pattern with server-assigned fields populated.
{"signatures":{"go":"c.Patterns().CreatePattern(ctx, \u0026guardrailsv1.CreatePatternRequest{...})","python":"client.patterns.createpattern(...)","typescript":"client.patterns.createpattern({...})","cli":"tare api guardrails patterns create --pattern $PATTERN","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/patterns\" \\\n  -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"pattern\": {}\n  }'"},"examples":{"go":"// No Go SDK wrapper for PatternsService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for PatternsService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for PatternsService yet -- use the CLI or curl example below.","cli":"tare api guardrails patterns create --pattern $PATTERN","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/patterns\" \\\n  -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"pattern\": {}\n  }'"},"persona":"Admin","httpVerb":"POST","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/guardrails/patterns","slug":"create-a-guardrail-pattern"}

Update a guardrail pattern

What it does: Updates mutable fields of a user-defined pattern. Omitted/ empty scalar string fields leave the existing value untouched. Enum fields set to *_UNSPECIFIED leave the existing value untouched. Returns PERMISSION_DENIED when attempting to modify a built-in pattern.

Request fields:

FieldRequiredDescription
customer_idnoOwning customer scope; defaults to caller's session customer when empty.
project_idnoOwning project scope; defaults to caller's session project when empty.
patternyesRequired: pattern to update. pattern.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.

Response fields:

FieldRequiredDescription
patternnoThe updated pattern with server-assigned fields populated.
{"signatures":{"go":"c.Patterns().UpdatePattern(ctx, \u0026guardrailsv1.UpdatePatternRequest{...})","python":"client.patterns.updatepattern(...)","typescript":"client.patterns.updatepattern({...})","cli":"tare api guardrails patterns update --pattern $PATTERN","curl":"curl -X PATCH \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/patterns/01H...\" \\\n  -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"pattern\": {}\n  }'"},"examples":{"go":"// No Go SDK wrapper for PatternsService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for PatternsService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for PatternsService yet -- use the CLI or curl example below.","cli":"tare api guardrails patterns update --pattern $PATTERN","curl":"curl -X PATCH \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/patterns/01H...\" \\\n  -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"pattern\": {}\n  }'"},"persona":"Admin","httpVerb":"PATCH","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/guardrails/patterns/{pattern.id}","slug":"update-a-guardrail-pattern"}

Delete a guardrail pattern

What it does: Soft-deletes a user-defined pattern (sets deleted_at; the row disappears from List/Get). Historical trigger records referencing this pattern REMAIN queryable. Returns PERMISSION_DENIED when attempting to delete a built-in pattern.

Request fields:

FieldRequiredDescription
customer_idnoOwning customer scope; defaults to caller's session customer when empty.
project_idnoOwning project scope; defaults to caller's session project when empty.
idyesRequired: uuid of the pattern to delete.
{"signatures":{"go":"c.Patterns().DeletePattern(ctx, \u0026guardrailsv1.DeletePatternRequest{...})","python":"client.patterns.deletepattern(...)","typescript":"client.patterns.deletepattern({...})","cli":"tare api guardrails patterns delete \u003cid\u003e","curl":"curl -X DELETE \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/patterns/01H...\" \\\n  -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"examples":{"go":"// No Go SDK wrapper for PatternsService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for PatternsService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for PatternsService yet -- use the CLI or curl example below.","cli":"tare api guardrails patterns delete \u003cid\u003e","curl":"curl -X DELETE \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../guardrails/patterns/01H...\" \\\n  -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"persona":"Admin","httpVerb":"DELETE","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/guardrails/patterns/{id}","slug":"delete-a-guardrail-pattern"}