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

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<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

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<models.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

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<models.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

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<models.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

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<models.UpdateGuardrailResponse>

Errors

listGuardrailKeyAssignments

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

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<operations.ListGuardrailKeyAssignmentsResponse>

Errors

bulkAssignKeys

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

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<models.BulkAssignKeysResponse>

Errors

bulkUnassignKeys

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

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<models.BulkUnassignKeysResponse>

Errors

listGuardrailMemberAssignments

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

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<operations.ListGuardrailMemberAssignmentsResponse>

Errors

bulkAssignMembers

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

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<models.BulkAssignMembersResponse>

Errors

bulkUnassignMembers

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

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<models.BulkUnassignMembersResponse>

Errors

listKeyAssignments

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

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<operations.ListKeyAssignmentsResponse>

Errors

listMemberAssignments

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

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<operations.ListMemberAssignmentsResponse>

Errors