> ## Documentation Index > Fetch the complete documentation index at: https://openrouter.ai/docs/llms.txt > Use this file to discover all available pages before exploring further. # Guardrails > Guardrails endpoints ## Overview Guardrails endpoints ### Available Operations * [List](#list) - List guardrails * [Create](#create) - Create a guardrail * [Delete](#delete) - Delete a guardrail * [Get](#get) - Get a guardrail * [Update](#update) - Update a guardrail * [ListGuardrailKeyAssignments](#listguardrailkeyassignments) - List key assignments for a guardrail * [BulkAssignKeys](#bulkassignkeys) - Bulk assign keys to a guardrail * [BulkUnassignKeys](#bulkunassignkeys) - Bulk unassign keys from a guardrail * [ListGuardrailMemberAssignments](#listguardrailmemberassignments) - List member assignments for a guardrail * [BulkAssignMembers](#bulkassignmembers) - Bulk assign members to a guardrail * [BulkUnassignMembers](#bulkunassignmembers) - Bulk unassign members from a guardrail * [ListKeyAssignments](#listkeyassignments) - List all key assignments * [ListMemberAssignments](#listmemberassignments) - List all member assignments ## List List all guardrails for the authenticated user. [Management key](/docs/client-sdks/go/docs/guides/overview/auth/management-api-keys) required. ### Example Usage ```go theme={null} package main import( "context" "os" openrouter "github.com/OpenRouterTeam/go-sdk" "github.com/OpenRouterTeam/go-sdk/optionalnullable" "log" ) func main() { ctx := context.Background() s := openrouter.New( openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")), ) res, err := s.Guardrails.List(ctx, optionalnullable.From(openrouter.Pointer[int64](0)), openrouter.Pointer[int64](50), nil) if err != nil { log.Fatal(err) } if res != nil { for { // handle items res, err = res.Next() if err != nil { // handle error } if res == nil { break } } } } ``` ### Parameters | Parameter | Type | Required | Description | Example | | ------------- | ---------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------ | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy\_check\_mark: | The context to use for the request. | | | `offset` | optionalnullable.OptionalNullable\[`int64`] | :heavy\_minus\_sign: | Number of records to skip for pagination | 0 | | `limit` | `*int64` | :heavy\_minus\_sign: | Maximum number of records to return (max 100) | 50 | | `workspaceID` | `*string` | :heavy\_minus\_sign: | Filter guardrails by workspace ID. By default, guardrails in the default workspace are returned. | 0df9e665-d932-5740-b2c7-b52af166bc11 | | `opts` | \[][operations.Option](../../models/operations/option.mdx) | :heavy\_minus\_sign: | The options for this request. | | ### Response **[\*operations.ListGuardrailsResponse](../../models/operations/listguardrailsresponse.mdx), error** ### Errors | Error Type | Status Code | Content Type | | ------------------------------------- | ----------- | ---------------- | | sdkerrors.BadRequestResponseError | 400 | application/json | | sdkerrors.UnauthorizedResponseError | 401 | application/json | | sdkerrors.InternalServerResponseError | 500 | application/json | | sdkerrors.APIError | 4XX, 5XX | \*/\* | ## 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](/docs/client-sdks/go/docs/guides/features/in-region-routing#enforcing-in-region-routing-with-guardrails): governed requests must arrive through one of the listed OpenRouter domains and are rejected with a 403 otherwise. [Management key](/docs/client-sdks/go/docs/guides/overview/auth/management-api-keys) required. ### Example Usage ```go theme={null} package main import( "context" "os" openrouter "github.com/OpenRouterTeam/go-sdk" "github.com/OpenRouterTeam/go-sdk/models/components" "github.com/OpenRouterTeam/go-sdk/optionalnullable" "log" ) func main() { ctx := context.Background() s := openrouter.New( openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")), ) res, err := s.Guardrails.Create(ctx, components.CreateGuardrailRequest{ AllowedDataRegions: optionalnullable.From(openrouter.Pointer([]components.GuardrailDataRegion{ components.GuardrailDataRegionEurope, })), AllowedModels: optionalnullable.From[[]string](nil), AllowedProviders: optionalnullable.From(openrouter.Pointer([]string{ "openai", "anthropic", "deepseek", })), Description: optionalnullable.From(openrouter.Pointer("A guardrail for limiting API usage")), EnforceZdrAnthropic: optionalnullable.From(openrouter.Pointer(true)), EnforceZdrGoogle: optionalnullable.From(openrouter.Pointer(false)), EnforceZdrOpenai: optionalnullable.From(openrouter.Pointer(true)), EnforceZdrOther: optionalnullable.From(openrouter.Pointer(false)), EnforceZdrXai: optionalnullable.From(openrouter.Pointer(false)), IgnoredModels: optionalnullable.From[[]string](nil), IgnoredProviders: optionalnullable.From[[]string](nil), LimitUsd: optionalnullable.From(openrouter.Pointer[float64](50.0)), Name: "My New Guardrail", ResetInterval: optionalnullable.From(openrouter.Pointer(components.GuardrailIntervalMonthly)), }) if err != nil { log.Fatal(err) } if res != nil { // handle response } } ``` ### Parameters | Parameter | Type | Required | Description | | --------- | --------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------ | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy\_check\_mark: | The context to use for the request. | | `request` | [components.CreateGuardrailRequest](../../models/components/createguardrailrequest.mdx) | :heavy\_check\_mark: | The request object to use for the request. | | `opts` | \[][operations.Option](../../models/operations/option.mdx) | :heavy\_minus\_sign: | The options for this request. | ### Response **[\*components.CreateGuardrailResponse](../../models/components/createguardrailresponse.mdx), error** ### Errors | Error Type | Status Code | Content Type | | ------------------------------------- | ----------- | ---------------- | | sdkerrors.BadRequestResponseError | 400 | application/json | | sdkerrors.UnauthorizedResponseError | 401 | application/json | | sdkerrors.ForbiddenResponseError | 403 | application/json | | sdkerrors.InternalServerResponseError | 500 | application/json | | sdkerrors.APIError | 4XX, 5XX | \*/\* | ## Delete Delete an existing guardrail. [Management key](/docs/client-sdks/go/docs/guides/overview/auth/management-api-keys) required. ### Example Usage ```go theme={null} package main import( "context" "os" openrouter "github.com/OpenRouterTeam/go-sdk" "log" ) func main() { ctx := context.Background() s := openrouter.New( openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")), ) res, err := s.Guardrails.Delete(ctx, "550e8400-e29b-41d4-a716-446655440000") if err != nil { log.Fatal(err) } if res != nil { // handle response } } ``` ### Parameters | Parameter | Type | Required | Description | Example | | --------- | ---------------------------------------------------------- | -------------------- | ------------------------------------------------ | ------------------------------------ | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy\_check\_mark: | The context to use for the request. | | | `id` | `string` | :heavy\_check\_mark: | The unique identifier of the guardrail to delete | 550e8400-e29b-41d4-a716-446655440000 | | `opts` | \[][operations.Option](../../models/operations/option.mdx) | :heavy\_minus\_sign: | The options for this request. | | ### Response **[\*components.DeleteGuardrailResponse](../../models/components/deleteguardrailresponse.mdx), error** ### Errors | Error Type | Status Code | Content Type | | ------------------------------------- | ----------- | ---------------- | | sdkerrors.UnauthorizedResponseError | 401 | application/json | | sdkerrors.NotFoundResponseError | 404 | application/json | | sdkerrors.InternalServerResponseError | 500 | application/json | | sdkerrors.APIError | 4XX, 5XX | \*/\* | ## Get Get a single guardrail by ID. [Management key](/docs/client-sdks/go/docs/guides/overview/auth/management-api-keys) required. ### Example Usage ```go theme={null} package main import( "context" "os" openrouter "github.com/OpenRouterTeam/go-sdk" "log" ) func main() { ctx := context.Background() s := openrouter.New( openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")), ) res, err := s.Guardrails.Get(ctx, "550e8400-e29b-41d4-a716-446655440000") if err != nil { log.Fatal(err) } if res != nil { // handle response } } ``` ### Parameters | Parameter | Type | Required | Description | Example | | --------- | ---------------------------------------------------------- | -------------------- | -------------------------------------------------- | ------------------------------------ | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy\_check\_mark: | The context to use for the request. | | | `id` | `string` | :heavy\_check\_mark: | The unique identifier of the guardrail to retrieve | 550e8400-e29b-41d4-a716-446655440000 | | `opts` | \[][operations.Option](../../models/operations/option.mdx) | :heavy\_minus\_sign: | The options for this request. | | ### Response **[\*components.GetGuardrailResponse](../../models/components/getguardrailresponse.mdx), error** ### Errors | Error Type | Status Code | Content Type | | ------------------------------------- | ----------- | ---------------- | | sdkerrors.UnauthorizedResponseError | 401 | application/json | | sdkerrors.NotFoundResponseError | 404 | application/json | | sdkerrors.InternalServerResponseError | 500 | application/json | | sdkerrors.APIError | 4XX, 5XX | \*/\* | ## 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. [Management key](/docs/client-sdks/go/docs/guides/overview/auth/management-api-keys) required. ### Example Usage ```go theme={null} package main import( "context" "os" openrouter "github.com/OpenRouterTeam/go-sdk" "github.com/OpenRouterTeam/go-sdk/optionalnullable" "github.com/OpenRouterTeam/go-sdk/models/components" "log" ) func main() { ctx := context.Background() s := openrouter.New( openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")), ) res, err := s.Guardrails.Update(ctx, "550e8400-e29b-41d4-a716-446655440000", components.UpdateGuardrailRequest{ Description: optionalnullable.From(openrouter.Pointer("Updated description")), LimitUsd: optionalnullable.From(openrouter.Pointer[float64](75.0)), Name: openrouter.Pointer("Updated Guardrail Name"), ResetInterval: optionalnullable.From(openrouter.Pointer(components.GuardrailIntervalWeekly)), }) if err != nil { log.Fatal(err) } if res != nil { // handle response } } ``` ### Parameters | Parameter | Type | Required | Description | Example | | ------------------------ | --------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy\_check\_mark: | The context to use for the request. | | | `id` | `string` | :heavy\_check\_mark: | The unique identifier of the guardrail to update | 550e8400-e29b-41d4-a716-446655440000 | | `updateGuardrailRequest` | [components.UpdateGuardrailRequest](../../models/components/updateguardrailrequest.mdx) | :heavy\_check\_mark: | N/A | \{
"description": "Updated description",
"limit\_usd": 75,
"name": "Updated Guardrail Name",
"reset\_interval": "weekly"
} | | `opts` | \[][operations.Option](../../models/operations/option.mdx) | :heavy\_minus\_sign: | The options for this request. | | ### Response **[\*components.UpdateGuardrailResponse](../../models/components/updateguardrailresponse.mdx), error** ### Errors | Error Type | Status Code | Content Type | | ------------------------------------- | ----------- | ---------------- | | sdkerrors.BadRequestResponseError | 400 | application/json | | sdkerrors.UnauthorizedResponseError | 401 | application/json | | sdkerrors.NotFoundResponseError | 404 | application/json | | sdkerrors.ConflictResponseError | 409 | application/json | | sdkerrors.InternalServerResponseError | 500 | application/json | | sdkerrors.APIError | 4XX, 5XX | \*/\* | ## ListGuardrailKeyAssignments List all API key assignments for a specific guardrail. [Management key](/docs/client-sdks/go/docs/guides/overview/auth/management-api-keys) required. ### Example Usage ```go theme={null} package main import( "context" "os" openrouter "github.com/OpenRouterTeam/go-sdk" "github.com/OpenRouterTeam/go-sdk/optionalnullable" "log" ) func main() { ctx := context.Background() s := openrouter.New( openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")), ) res, err := s.Guardrails.ListGuardrailKeyAssignments(ctx, "550e8400-e29b-41d4-a716-446655440000", optionalnullable.From(openrouter.Pointer[int64](0)), openrouter.Pointer[int64](50)) if err != nil { log.Fatal(err) } if res != nil { for { // handle items res, err = res.Next() if err != nil { // handle error } if res == nil { break } } } } ``` ### Parameters | Parameter | Type | Required | Description | Example | | --------- | ---------------------------------------------------------- | -------------------- | --------------------------------------------- | ------------------------------------ | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy\_check\_mark: | The context to use for the request. | | | `id` | `string` | :heavy\_check\_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | | `offset` | optionalnullable.OptionalNullable\[`int64`] | :heavy\_minus\_sign: | Number of records to skip for pagination | 0 | | `limit` | `*int64` | :heavy\_minus\_sign: | Maximum number of records to return (max 100) | 50 | | `opts` | \[][operations.Option](../../models/operations/option.mdx) | :heavy\_minus\_sign: | The options for this request. | | ### Response **[\*operations.ListGuardrailKeyAssignmentsResponse](../../models/operations/listguardrailkeyassignmentsresponse.mdx), error** ### Errors | Error Type | Status Code | Content Type | | ------------------------------------- | ----------- | ---------------- | | sdkerrors.UnauthorizedResponseError | 401 | application/json | | sdkerrors.NotFoundResponseError | 404 | application/json | | sdkerrors.InternalServerResponseError | 500 | application/json | | sdkerrors.APIError | 4XX, 5XX | \*/\* | ## BulkAssignKeys Assign multiple API keys to a specific guardrail. A key may hold at most one guardrail; assigning replaces any existing assignment. [Management key](/docs/client-sdks/go/docs/guides/overview/auth/management-api-keys) required. ### Example Usage ```go theme={null} package main import( "context" "os" openrouter "github.com/OpenRouterTeam/go-sdk" "github.com/OpenRouterTeam/go-sdk/models/components" "log" ) func main() { ctx := context.Background() s := openrouter.New( openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")), ) res, err := s.Guardrails.BulkAssignKeys(ctx, "550e8400-e29b-41d4-a716-446655440000", components.BulkAssignKeysRequest{ KeyHashes: []string{ "c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93", }, }) if err != nil { log.Fatal(err) } if res != nil { // handle response } } ``` ### Parameters | Parameter | Type | Required | Description | Example | | ----------------------- | ------------------------------------------------------------------------------------- | -------------------- | -------------------------------------- | --------------------------------------------------------------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy\_check\_mark: | The context to use for the request. | | | `id` | `string` | :heavy\_check\_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | | `bulkAssignKeysRequest` | [components.BulkAssignKeysRequest](../../models/components/bulkassignkeysrequest.mdx) | :heavy\_check\_mark: | N/A | \{
"key\_hashes": \[
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
]
} | | `opts` | \[][operations.Option](../../models/operations/option.mdx) | :heavy\_minus\_sign: | The options for this request. | | ### Response **[\*components.BulkAssignKeysResponse](../../models/components/bulkassignkeysresponse.mdx), error** ### Errors | Error Type | Status Code | Content Type | | ------------------------------------- | ----------- | ---------------- | | sdkerrors.BadRequestResponseError | 400 | application/json | | sdkerrors.UnauthorizedResponseError | 401 | application/json | | sdkerrors.NotFoundResponseError | 404 | application/json | | sdkerrors.InternalServerResponseError | 500 | application/json | | sdkerrors.APIError | 4XX, 5XX | \*/\* | ## BulkUnassignKeys Unassign multiple API keys from a specific guardrail. [Management key](/docs/client-sdks/go/docs/guides/overview/auth/management-api-keys) required. ### Example Usage ```go theme={null} package main import( "context" "os" openrouter "github.com/OpenRouterTeam/go-sdk" "github.com/OpenRouterTeam/go-sdk/models/components" "log" ) func main() { ctx := context.Background() s := openrouter.New( openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")), ) res, err := s.Guardrails.BulkUnassignKeys(ctx, "550e8400-e29b-41d4-a716-446655440000", components.BulkUnassignKeysRequest{ KeyHashes: []string{ "c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93", }, }) if err != nil { log.Fatal(err) } if res != nil { // handle response } } ``` ### Parameters | Parameter | Type | Required | Description | Example | | ------------------------- | ----------------------------------------------------------------------------------------- | -------------------- | -------------------------------------- | --------------------------------------------------------------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy\_check\_mark: | The context to use for the request. | | | `id` | `string` | :heavy\_check\_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | | `bulkUnassignKeysRequest` | [components.BulkUnassignKeysRequest](../../models/components/bulkunassignkeysrequest.mdx) | :heavy\_check\_mark: | N/A | \{
"key\_hashes": \[
"c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93"
]
} | | `opts` | \[][operations.Option](../../models/operations/option.mdx) | :heavy\_minus\_sign: | The options for this request. | | ### Response **[\*components.BulkUnassignKeysResponse](../../models/components/bulkunassignkeysresponse.mdx), error** ### Errors | Error Type | Status Code | Content Type | | ------------------------------------- | ----------- | ---------------- | | sdkerrors.BadRequestResponseError | 400 | application/json | | sdkerrors.UnauthorizedResponseError | 401 | application/json | | sdkerrors.NotFoundResponseError | 404 | application/json | | sdkerrors.InternalServerResponseError | 500 | application/json | | sdkerrors.APIError | 4XX, 5XX | \*/\* | ## ListGuardrailMemberAssignments List all organization member assignments for a specific guardrail. [Management key](/docs/client-sdks/go/docs/guides/overview/auth/management-api-keys) required. ### Example Usage ```go theme={null} package main import( "context" "os" openrouter "github.com/OpenRouterTeam/go-sdk" "github.com/OpenRouterTeam/go-sdk/optionalnullable" "log" ) func main() { ctx := context.Background() s := openrouter.New( openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")), ) res, err := s.Guardrails.ListGuardrailMemberAssignments(ctx, "550e8400-e29b-41d4-a716-446655440000", optionalnullable.From(openrouter.Pointer[int64](0)), openrouter.Pointer[int64](50)) if err != nil { log.Fatal(err) } if res != nil { for { // handle items res, err = res.Next() if err != nil { // handle error } if res == nil { break } } } } ``` ### Parameters | Parameter | Type | Required | Description | Example | | --------- | ---------------------------------------------------------- | -------------------- | --------------------------------------------- | ------------------------------------ | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy\_check\_mark: | The context to use for the request. | | | `id` | `string` | :heavy\_check\_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | | `offset` | optionalnullable.OptionalNullable\[`int64`] | :heavy\_minus\_sign: | Number of records to skip for pagination | 0 | | `limit` | `*int64` | :heavy\_minus\_sign: | Maximum number of records to return (max 100) | 50 | | `opts` | \[][operations.Option](../../models/operations/option.mdx) | :heavy\_minus\_sign: | The options for this request. | | ### Response **[\*operations.ListGuardrailMemberAssignmentsResponse](../../models/operations/listguardrailmemberassignmentsresponse.mdx), error** ### Errors | Error Type | Status Code | Content Type | | ------------------------------------- | ----------- | ---------------- | | sdkerrors.UnauthorizedResponseError | 401 | application/json | | sdkerrors.NotFoundResponseError | 404 | application/json | | sdkerrors.InternalServerResponseError | 500 | application/json | | sdkerrors.APIError | 4XX, 5XX | \*/\* | ## BulkAssignMembers Assign multiple organization members to a specific guardrail. [Management key](/docs/client-sdks/go/docs/guides/overview/auth/management-api-keys) required. ### Example Usage ```go theme={null} package main import( "context" "os" openrouter "github.com/OpenRouterTeam/go-sdk" "github.com/OpenRouterTeam/go-sdk/models/components" "log" ) func main() { ctx := context.Background() s := openrouter.New( openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")), ) res, err := s.Guardrails.BulkAssignMembers(ctx, "550e8400-e29b-41d4-a716-446655440000", components.BulkAssignMembersRequest{ MemberUserIds: []string{ "user_abc123", "user_def456", }, }) if err != nil { log.Fatal(err) } if res != nil { // handle response } } ``` ### Parameters | Parameter | Type | Required | Description | Example | | -------------------------- | ------------------------------------------------------------------------------------------- | -------------------- | -------------------------------------- | -------------------------------------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy\_check\_mark: | The context to use for the request. | | | `id` | `string` | :heavy\_check\_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | | `bulkAssignMembersRequest` | [components.BulkAssignMembersRequest](../../models/components/bulkassignmembersrequest.mdx) | :heavy\_check\_mark: | N/A | \{
"member\_user\_ids": \[
"user\_abc123",
"user\_def456"
]
} | | `opts` | \[][operations.Option](../../models/operations/option.mdx) | :heavy\_minus\_sign: | The options for this request. | | ### Response **[\*components.BulkAssignMembersResponse](../../models/components/bulkassignmembersresponse.mdx), error** ### Errors | Error Type | Status Code | Content Type | | ------------------------------------- | ----------- | ---------------- | | sdkerrors.BadRequestResponseError | 400 | application/json | | sdkerrors.UnauthorizedResponseError | 401 | application/json | | sdkerrors.NotFoundResponseError | 404 | application/json | | sdkerrors.InternalServerResponseError | 500 | application/json | | sdkerrors.APIError | 4XX, 5XX | \*/\* | ## BulkUnassignMembers Unassign multiple organization members from a specific guardrail. [Management key](/docs/client-sdks/go/docs/guides/overview/auth/management-api-keys) required. ### Example Usage ```go theme={null} package main import( "context" "os" openrouter "github.com/OpenRouterTeam/go-sdk" "github.com/OpenRouterTeam/go-sdk/models/components" "log" ) func main() { ctx := context.Background() s := openrouter.New( openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")), ) res, err := s.Guardrails.BulkUnassignMembers(ctx, "550e8400-e29b-41d4-a716-446655440000", components.BulkUnassignMembersRequest{ MemberUserIds: []string{ "user_abc123", "user_def456", }, }) if err != nil { log.Fatal(err) } if res != nil { // handle response } } ``` ### Parameters | Parameter | Type | Required | Description | Example | | ---------------------------- | ----------------------------------------------------------------------------------------------- | -------------------- | -------------------------------------- | -------------------------------------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy\_check\_mark: | The context to use for the request. | | | `id` | `string` | :heavy\_check\_mark: | The unique identifier of the guardrail | 550e8400-e29b-41d4-a716-446655440000 | | `bulkUnassignMembersRequest` | [components.BulkUnassignMembersRequest](../../models/components/bulkunassignmembersrequest.mdx) | :heavy\_check\_mark: | N/A | \{
"member\_user\_ids": \[
"user\_abc123",
"user\_def456"
]
} | | `opts` | \[][operations.Option](../../models/operations/option.mdx) | :heavy\_minus\_sign: | The options for this request. | | ### Response **[\*components.BulkUnassignMembersResponse](../../models/components/bulkunassignmembersresponse.mdx), error** ### Errors | Error Type | Status Code | Content Type | | ------------------------------------- | ----------- | ---------------- | | sdkerrors.BadRequestResponseError | 400 | application/json | | sdkerrors.UnauthorizedResponseError | 401 | application/json | | sdkerrors.NotFoundResponseError | 404 | application/json | | sdkerrors.InternalServerResponseError | 500 | application/json | | sdkerrors.APIError | 4XX, 5XX | \*/\* | ## ListKeyAssignments List all API key guardrail assignments for the authenticated user. [Management key](/docs/client-sdks/go/docs/guides/overview/auth/management-api-keys) required. ### Example Usage ```go theme={null} package main import( "context" "os" openrouter "github.com/OpenRouterTeam/go-sdk" "github.com/OpenRouterTeam/go-sdk/optionalnullable" "log" ) func main() { ctx := context.Background() s := openrouter.New( openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")), ) res, err := s.Guardrails.ListKeyAssignments(ctx, optionalnullable.From(openrouter.Pointer[int64](0)), openrouter.Pointer[int64](50)) if err != nil { log.Fatal(err) } if res != nil { for { // handle items res, err = res.Next() if err != nil { // handle error } if res == nil { break } } } } ``` ### Parameters | Parameter | Type | Required | Description | Example | | --------- | ---------------------------------------------------------- | -------------------- | --------------------------------------------- | ------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy\_check\_mark: | The context to use for the request. | | | `offset` | optionalnullable.OptionalNullable\[`int64`] | :heavy\_minus\_sign: | Number of records to skip for pagination | 0 | | `limit` | `*int64` | :heavy\_minus\_sign: | Maximum number of records to return (max 100) | 50 | | `opts` | \[][operations.Option](../../models/operations/option.mdx) | :heavy\_minus\_sign: | The options for this request. | | ### Response **[\*operations.ListKeyAssignmentsResponse](../../models/operations/listkeyassignmentsresponse.mdx), error** ### Errors | Error Type | Status Code | Content Type | | ------------------------------------- | ----------- | ---------------- | | sdkerrors.UnauthorizedResponseError | 401 | application/json | | sdkerrors.InternalServerResponseError | 500 | application/json | | sdkerrors.APIError | 4XX, 5XX | \*/\* | ## ListMemberAssignments List all organization member guardrail assignments for the authenticated user. [Management key](/docs/client-sdks/go/docs/guides/overview/auth/management-api-keys) required. ### Example Usage ```go theme={null} package main import( "context" "os" openrouter "github.com/OpenRouterTeam/go-sdk" "github.com/OpenRouterTeam/go-sdk/optionalnullable" "log" ) func main() { ctx := context.Background() s := openrouter.New( openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")), ) res, err := s.Guardrails.ListMemberAssignments(ctx, optionalnullable.From(openrouter.Pointer[int64](0)), openrouter.Pointer[int64](50)) if err != nil { log.Fatal(err) } if res != nil { for { // handle items res, err = res.Next() if err != nil { // handle error } if res == nil { break } } } } ``` ### Parameters | Parameter | Type | Required | Description | Example | | --------- | ---------------------------------------------------------- | -------------------- | --------------------------------------------- | ------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy\_check\_mark: | The context to use for the request. | | | `offset` | optionalnullable.OptionalNullable\[`int64`] | :heavy\_minus\_sign: | Number of records to skip for pagination | 0 | | `limit` | `*int64` | :heavy\_minus\_sign: | Maximum number of records to return (max 100) | 50 | | `opts` | \[][operations.Option](../../models/operations/option.mdx) | :heavy\_minus\_sign: | The options for this request. | | ### Response **[\*operations.ListMemberAssignmentsResponse](../../models/operations/listmemberassignmentsresponse.mdx), error** ### Errors | Error Type | Status Code | Content Type | | ------------------------------------- | ----------- | ---------------- | | sdkerrors.UnauthorizedResponseError | 401 | application/json | | sdkerrors.InternalServerResponseError | 500 | application/json | | sdkerrors.APIError | 4XX, 5XX | \*/\* |