Skip to main content

Overview

Guardrails endpoints

Available Operations

list

List all guardrails for the authenticated user. A workspace-scoped management key lists only its own workspace, which workspace_id defaults to; naming another workspace returns 403. Management key required.

Example Usage

Parameters

Response

operations.ListGuardrailsResponse

Errors

create

Create a new guardrail for the authenticated user. A newly created guardrail enforces nothing until it is assigned to API keys or organization members; workspace_id places the guardrail in a workspace but does not apply it to that workspace’s traffic. To restrict all traffic in a workspace, update the workspace’s default guardrail instead. Set allowed_data_regions to enforce In-Region Routing: governed requests must arrive through one of the listed OpenRouter domains and are rejected with a 403 otherwise. A workspace-scoped management key creates in its own workspace, which workspace_id defaults to; naming another workspace returns 403. Management key required.

Example Usage

Parameters

Response

components.CreateGuardrailResponse

Errors

delete

Delete an existing guardrail. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. Management key required.

Example Usage

Parameters

Response

components.DeleteGuardrailResponse

Errors

get

Get a single guardrail by ID. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. Management key required.

Example Usage

Parameters

Response

components.GetGuardrailResponse

Errors

update

Update an existing guardrail, or materialize an unconfigured workspace default guardrail. Collection fields use replace semantics: send the full desired set on every update. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. Management key required.

Example Usage

Parameters

Response

components.UpdateGuardrailResponse

Errors

list_guardrail_key_assignments

List all API key assignments for a specific guardrail. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. Management key required.

Example Usage

Parameters

Response

operations.ListGuardrailKeyAssignmentsResponse

Errors

bulk_assign_keys

Assign multiple API keys to a specific guardrail. A key may hold at most one guardrail; assigning replaces any existing assignment. A workspace-scoped management key reaches only guardrails in its own workspace (any other returns 404), and a batch naming an unknown or out-of-workspace key hash is rejected with 400 before anything changes. Management key required.

Example Usage

Parameters

Response

components.BulkAssignKeysResponse

Errors

bulk_unassign_keys

Unassign multiple API keys from a specific guardrail. A workspace-scoped management key reaches only guardrails in its own workspace (any other returns 404), and a batch naming an unknown or out-of-workspace key hash is rejected with 400 before anything changes. Management key required.

Example Usage

Parameters

Response

components.BulkUnassignKeysResponse

Errors

list_guardrail_member_assignments

List all organization member assignments for a specific guardrail. A workspace-scoped management key reaches only guardrails in its own workspace; any other guardrail returns 404. Management key required.

Example Usage

Parameters

Response

operations.ListGuardrailMemberAssignmentsResponse

Errors

bulk_assign_members

Assign multiple organization members to a specific guardrail. Requires an organization-scoped management key; workspace-scoped management keys return 403. Management key required.

Example Usage

Parameters

Response

components.BulkAssignMembersResponse

Errors

bulk_unassign_members

Unassign multiple organization members from a specific guardrail. Requires an organization-scoped management key; workspace-scoped management keys return 403. Management key required.

Example Usage

Parameters

Response

components.BulkUnassignMembersResponse

Errors

list_key_assignments

List all API key guardrail assignments for the authenticated user. A workspace-scoped management key lists only its own workspace, which workspace_id defaults to; naming another workspace returns 403. Management key required.

Example Usage

Parameters

Response

operations.ListKeyAssignmentsResponse

Errors

list_member_assignments

List all organization member guardrail assignments for the authenticated user. A workspace-scoped management key lists only its own workspace, which workspace_id defaults to; naming another workspace returns 403. Management key required.

Example Usage

Parameters

Response

operations.ListMemberAssignmentsResponse

Errors