> ## 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.

# Guardrail Policies

> Guardrail Policies endpoints

## Overview

Guardrail Policies endpoints

### Available Operations

* [ListAccountPolicies](#listaccountpolicies) - List workspace-wide policies
* [CreateAccountPolicy](#createaccountpolicy) - Create a workspace-wide policy
* [DeleteAccountPolicy](#deleteaccountpolicy) - Delete a workspace-wide policy
* [UpdateAccountPolicy](#updateaccountpolicy) - Update a workspace-wide policy
* [GetAPIKeyPolicyAssignment](#getapikeypolicyassignment) - Get an API key policy assignment
* [ChangeAPIKeyPolicyAssignment](#changeapikeypolicyassignment) - Change an API key policy assignment
* [GetMemberPolicyAssignment](#getmemberpolicyassignment) - Get a member policy assignment
* [ChangeMemberPolicyAssignment](#changememberpolicyassignment) - Change a member policy assignment
* [ListScimGroupPolicyAssignments](#listscimgrouppolicyassignments) - List SCIM group policy assignments
* [GetScimGroupPolicyAssignment](#getscimgrouppolicyassignment) - Get a SCIM group policy assignment
* [UpdateScimGroupPolicyAssignment](#updatescimgrouppolicyassignment) - Update a SCIM group policy assignment
* [DeleteScimGroupPolicyOptOut](#deletescimgrouppolicyoptout) - Restore a member to a SCIM group policy
* [ListScimGroupPolicyOptOuts](#listscimgrouppolicyoptouts) - List opt-outs from a SCIM group policy assignment
* [ListBudgetPolicies](#listbudgetpolicies) - List budget policies
* [CreateBudgetPolicy](#createbudgetpolicy) - Create a budget policy
* [DeleteBudgetPolicy](#deletebudgetpolicy) - Delete a budget policy
* [GetBudgetPolicy](#getbudgetpolicy) - Get a budget policy
* [UpdateBudgetPolicy](#updatebudgetpolicy) - Update a budget policy
* [ListCapacityPolicies](#listcapacitypolicies) - List capacity policies
* [CreateCapacityPolicy](#createcapacitypolicy) - Create a capacity policy
* [DeleteCapacityPolicy](#deletecapacitypolicy) - Delete a capacity policy
* [GetCapacityPolicy](#getcapacitypolicy) - Get a capacity policy
* [UpdateCapacityPolicy](#updatecapacitypolicy) - Update a capacity policy
* [ListModelAvailabilityPolicies](#listmodelavailabilitypolicies) - List model availability policies
* [CreateModelAvailabilityPolicy](#createmodelavailabilitypolicy) - Create a model availability policy
* [DeleteModelAvailabilityPolicy](#deletemodelavailabilitypolicy) - Delete a model availability policy
* [GetModelAvailabilityPolicy](#getmodelavailabilitypolicy) - Get a model availability policy
* [UpdateModelAvailabilityPolicy](#updatemodelavailabilitypolicy) - Update a model availability policy
* [ListModerationPolicies](#listmoderationpolicies) - List moderation policies
* [CreateModerationPolicy](#createmoderationpolicy) - Create a moderation policy
* [DeleteModerationPolicy](#deletemoderationpolicy) - Delete a moderation policy
* [GetModerationPolicy](#getmoderationpolicy) - Get a moderation policy
* [UpdateModerationPolicy](#updatemoderationpolicy) - Update a moderation policy

## ListAccountPolicies

List the workspace-wide policies that apply across workspaces in the account. [Management key](https://openrouter.ai/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.GuardrailPolicies.ListAccountPolicies(ctx, nil, 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) | ✔️ | The context to use for the request. | |
| `offset` | `*int64` | ➖ | Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned | 0 |
| `limit` | `*int64` | ➖ | Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned | 50 |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*operations.ListAccountPoliciesResponse](../../models/operations/listaccountpoliciesresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## CreateAccountPolicy

Create a workspace-wide budget, moderation, or model availability policy. [Management key](https://openrouter.ai/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.GuardrailPolicies.CreateAccountPolicy(ctx, components.CreateAccountGuardrailPolicyRequestBudget(
        components.BudgetAccountGuardrailPolicyRequest{
            Config: components.GuardrailBudgetPolicyAuthoringConfig{
                IncludeBYOKInBudgets: false,
                LimitUsd: openrouter.Pointer[float64](200.0),
                ResetInterval: components.GuardrailBudgetPolicyAuthoringConfigResetIntervalMonthly.ToPointer(),
            },
            Name: "Engineering monthly budget",
            PolicyType: components.BudgetAccountGuardrailPolicyRequestPolicyTypeBudget,
        },
    ))
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        switch res.Data.Type {
            case components.AccountGuardrailPolicyTypeBudget:
                // res.Data.BudgetAccountGuardrailPolicy is populated
            case components.AccountGuardrailPolicyTypeModelAvailability:
                // res.Data.ModelAvailabilityAccountGuardrailPolicy is populated
            case components.AccountGuardrailPolicyTypeModeration:
                // res.Data.ModerationAccountGuardrailPolicy is populated
            default:
                // Unknown type - use res.Data.GetUnknownRaw() for raw JSON
        }

    }
}
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | ✔️ | The context to use for the request. |
| `request` | [components.AccountGuardrailPolicyRequest](../../models/components/accountguardrailpolicyrequest.mdx) | ✔️ | The request object to use for the request. |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. |

### Response

**[\*components.AccountGuardrailPolicyResponse](../../models/components/accountguardrailpolicyresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.ConflictResponseError | 409 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## DeleteAccountPolicy

Delete a workspace-wide policy. [Management key](https://openrouter.ai/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.GuardrailPolicies.DeleteAccountPolicy(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) | ✔️ | The context to use for the request. | |
| `id` | `string` | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*components.DeleteGuardrailPolicyResponse](../../models/components/deleteguardrailpolicyresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.ConflictResponseError | 409 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## UpdateAccountPolicy

Replace a workspace-wide policy and its workspace coverage. [Management key](https://openrouter.ai/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.GuardrailPolicies.UpdateAccountPolicy(ctx, "550e8400-e29b-41d4-a716-446655440000", components.CreateAccountGuardrailPolicyRequestBudget(
        components.BudgetAccountGuardrailPolicyRequest{
            Config: components.GuardrailBudgetPolicyAuthoringConfig{
                IncludeBYOKInBudgets: false,
                LimitUsd: openrouter.Pointer[float64](200.0),
                ResetInterval: components.GuardrailBudgetPolicyAuthoringConfigResetIntervalMonthly.ToPointer(),
            },
            Name: "Engineering monthly budget",
            PolicyType: components.BudgetAccountGuardrailPolicyRequestPolicyTypeBudget,
        },
    ))
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        switch res.Data.Type {
            case components.AccountGuardrailPolicyTypeBudget:
                // res.Data.BudgetAccountGuardrailPolicy is populated
            case components.AccountGuardrailPolicyTypeModelAvailability:
                // res.Data.ModelAvailabilityAccountGuardrailPolicy is populated
            case components.AccountGuardrailPolicyTypeModeration:
                // res.Data.ModerationAccountGuardrailPolicy is populated
            default:
                // Unknown type - use res.Data.GetUnknownRaw() for raw JSON
        }

    }
}
```

### Parameters

| Parameter | Type | Required | Description | Example |
| - | - | - | - | - |
| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | ✔️ | The context to use for the request. | |
| `id` | `string` | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 |
| `accountGuardrailPolicyRequest` | [components.AccountGuardrailPolicyRequest](../../models/components/accountguardrailpolicyrequest.mdx) | ✔️ | N/A | |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*components.AccountGuardrailPolicyResponse](../../models/components/accountguardrailpolicyresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.ConflictResponseError | 409 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## GetAPIKeyPolicyAssignment

Get the policies of one type that apply to an API key in a workspace. Requires a management key with write access. [Management key](https://openrouter.ai/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/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := openrouter.New(
        openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")),
    )

    res, err := s.GuardrailPolicies.GetAPIKeyPolicyAssignment(ctx, "c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93", operations.GetAPIKeyPolicyAssignmentPolicyTypeBudget, nil)
    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) | ✔️ | The context to use for the request. | |
| `hash` | `string` | ✔️ | API key hash | c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93 |
| `policyType` | [operations.GetAPIKeyPolicyAssignmentPolicyType](../../models/operations/getapikeypolicyassignmentpolicytype.mdx) | ✔️ | Policy type the assignment is read or changed for. `rate_limit` is an Enterprise private beta feature and requires an organization-scoped management key and an explicit `workspace_id`. | budget |
| `workspaceID` | `*string` | ➖ | Workspace the policy belongs to. Required for an organization management key; a workspace-scoped key defaults to its own workspace and gets 403 for any other. | 0df9e665-d932-5740-b2c7-b52af166bc11 |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*components.GuardrailPolicyAssignmentResponse](../../models/components/guardrailpolicyassignmentresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## ChangeAPIKeyPolicyAssignment

Assign or unassign one policy for an API key. Fails with 409 when `expected_assignment` no longer matches the stored state. [Management key](https://openrouter.ai/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.GuardrailPolicies.ChangeAPIKeyPolicyAssignment(ctx, "c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93", components.ChangeGuardrailPolicyAssignmentRequest{
        Assigned: true,
        ExpectedAssignment: components.GuardrailPolicyAssignmentState{
            OptedOut: false,
            PolicyIds: []string{},
            WorkspaceDefaultPolicyIds: []string{
                "2c6f1a4e-0b7d-4e59-9a61-3f8d2e7c1b90",
            },
        },
        PolicyID: "550e8400-e29b-41d4-a716-446655440000",
        PolicyType: components.ChangeGuardrailPolicyAssignmentRequestPolicyTypeBudget,
    })
    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) | ✔️ | The context to use for the request. | |
| `hash` | `string` | ✔️ | API key hash | c56454edb818d6b14bc0d61c46025f1450b0f4012d12304ab40aacb519fcbc93 |
| `changeGuardrailPolicyAssignmentRequest` | [components.ChangeGuardrailPolicyAssignmentRequest](../../models/components/changeguardrailpolicyassignmentrequest.mdx) | ✔️ | N/A | |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*components.ChangeGuardrailPolicyAssignmentResponse](../../models/components/changeguardrailpolicyassignmentresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.ConflictResponseError | 409 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## GetMemberPolicyAssignment

Get the policies of one type that apply to a member in a workspace. Requires a management key with write access. [Management key](https://openrouter.ai/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/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := openrouter.New(
        openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")),
    )

    res, err := s.GuardrailPolicies.GetMemberPolicyAssignment(ctx, "user_2abcDEFghiJKLmnoPQRstu", operations.GetMemberPolicyAssignmentPolicyTypeBudget, nil)
    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) | ✔️ | The context to use for the request. | |
| `memberID` | `string` | ✔️ | Organization member user ID | user\_2abcDEFghiJKLmnoPQRstu |
| `policyType` | [operations.GetMemberPolicyAssignmentPolicyType](../../models/operations/getmemberpolicyassignmentpolicytype.mdx) | ✔️ | Policy type the assignment is read or changed for. `rate_limit` is an Enterprise private beta feature and requires an organization-scoped management key and an explicit `workspace_id`. | budget |
| `workspaceID` | `*string` | ➖ | Workspace the policy belongs to. Required for an organization management key; a workspace-scoped key defaults to its own workspace and gets 403 for any other. | 0df9e665-d932-5740-b2c7-b52af166bc11 |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*components.GuardrailPolicyAssignmentResponse](../../models/components/guardrailpolicyassignmentresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## ChangeMemberPolicyAssignment

Assign or unassign one policy for a member. Fails with 409 when `expected_assignment` no longer matches the stored state. [Management key](https://openrouter.ai/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.GuardrailPolicies.ChangeMemberPolicyAssignment(ctx, "user_2abcDEFghiJKLmnoPQRstu", components.ChangeGuardrailPolicyAssignmentRequest{
        Assigned: true,
        ExpectedAssignment: components.GuardrailPolicyAssignmentState{
            OptedOut: false,
            PolicyIds: []string{},
            WorkspaceDefaultPolicyIds: []string{
                "2c6f1a4e-0b7d-4e59-9a61-3f8d2e7c1b90",
            },
        },
        PolicyID: "550e8400-e29b-41d4-a716-446655440000",
        PolicyType: components.ChangeGuardrailPolicyAssignmentRequestPolicyTypeBudget,
    })
    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) | ✔️ | The context to use for the request. | |
| `memberID` | `string` | ✔️ | Organization member user ID | user\_2abcDEFghiJKLmnoPQRstu |
| `changeGuardrailPolicyAssignmentRequest` | [components.ChangeGuardrailPolicyAssignmentRequest](../../models/components/changeguardrailpolicyassignmentrequest.mdx) | ✔️ | N/A | |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*components.ChangeGuardrailPolicyAssignmentResponse](../../models/components/changeguardrailpolicyassignmentresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.ConflictResponseError | 409 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## ListScimGroupPolicyAssignments

List the guardrail policies attached to each SCIM group mapping in the organization. Requires `scim:view` and `guardrails:view`. Enterprise private beta feature. [Management key](https://openrouter.ai/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.GuardrailPolicies.ListScimGroupPolicyAssignments(ctx)
    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) | ✔️ | The context to use for the request. |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. |

### Response

**[\*components.ListScimGroupPolicyAssignmentsResponse](../../models/components/listscimgrouppolicyassignmentsresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.ConflictResponseError | 409 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## GetScimGroupPolicyAssignment

Get the guardrail policies attached to one SCIM group mapping. Requires `scim:view` and `guardrails:view`. Enterprise private beta feature. [Management key](https://openrouter.ai/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.GuardrailPolicies.GetScimGroupPolicyAssignment(ctx, "af65e842-2eb2-4feb-bc51-929aca5a7147")
    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) | ✔️ | The context to use for the request. |
| `mappingID` | `string` | ✔️ | N/A |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. |

### Response

**[\*components.ScimGroupPolicyAssignmentResponse](../../models/components/scimgrouppolicyassignmentresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.ConflictResponseError | 409 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## UpdateScimGroupPolicyAssignment

Attach or remove guardrail policies on one SCIM group mapping, then update its members' policies. Every type in the request is applied, or none is. Requires `scim:view`, `guardrails:view` and `guardrails:update`. Enterprise private beta feature. [Management key](https://openrouter.ai/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.GuardrailPolicies.UpdateScimGroupPolicyAssignment(ctx, "10d15a71-fe5b-43e7-a9cc-284d994de944", components.UpdateScimGroupPolicyAssignmentRequest{})
    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) | ✔️ | The context to use for the request. | |
| `mappingID` | `string` | ✔️ | N/A | |
| `updateScimGroupPolicyAssignmentRequest` | [components.UpdateScimGroupPolicyAssignmentRequest](../../models/components/updatescimgrouppolicyassignmentrequest.mdx) | ✔️ | N/A | \{ "budget": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f", "moderation": null } |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*components.ScimGroupPolicyAssignmentResponse](../../models/components/scimgrouppolicyassignmentresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.ConflictResponseError | 409 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## DeleteScimGroupPolicyOptOut

Remove a member's opt-out for one policy type, so the member receives their groups' policy again right away. The member must be in the mapping's group and the mapping must set a policy of that type. Requires `scim:view`, `guardrails:view` and `guardrails:update`. Enterprise private beta feature. [Management key](https://openrouter.ai/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/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := openrouter.New(
        openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")),
    )

    res, err := s.GuardrailPolicies.DeleteScimGroupPolicyOptOut(ctx, "104dbbf4-a30b-427e-8207-76203c3fadc5", "<id>", operations.DeleteScimGroupPolicyOptOutPolicyTypeRateLimit)
    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) | ✔️ | The context to use for the request. |
| `mappingID` | `string` | ✔️ | N/A |
| `userID` | `string` | ✔️ | N/A |
| `policyType` | [operations.DeleteScimGroupPolicyOptOutPolicyType](../../models/operations/deletescimgrouppolicyoptoutpolicytype.mdx) | ✔️ | N/A |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. |

### Response

**[\*components.DeleteScimGroupOptOutResponse](../../models/components/deletescimgroupoptoutresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.ConflictResponseError | 409 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## ListScimGroupPolicyOptOuts

List the group's members who opted out of a guardrail policy this mapping sets, per policy type. Opted-out members keep their own assignment (or none) instead of the group policy. Requires `scim:view` and `guardrails:view`. Enterprise private beta feature. [Management key](https://openrouter.ai/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.GuardrailPolicies.ListScimGroupPolicyOptOuts(ctx, "732784db-8051-4b40-9258-0ffc259c47ec")
    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) | ✔️ | The context to use for the request. |
| `mappingID` | `string` | ✔️ | N/A |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. |

### Response

**[\*components.ListScimGroupOptOutsResponse](../../models/components/listscimgroupoptoutsresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.ConflictResponseError | 409 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## ListBudgetPolicies

List the budget policies in a workspace. [Management key](https://openrouter.ai/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.GuardrailPolicies.ListBudgetPolicies(ctx, nil, nil, 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) | ✔️ | The context to use for the request. | |
| `offset` | `*int64` | ➖ | Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned | 0 |
| `limit` | `*int64` | ➖ | Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned | 50 |
| `workspaceID` | `*string` | ➖ | Workspace the policy belongs to. Required for an organization management key; a workspace-scoped key defaults to its own workspace and gets 403 for any other. | 0df9e665-d932-5740-b2c7-b52af166bc11 |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*operations.ListBudgetPoliciesResponse](../../models/operations/listbudgetpoliciesresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## CreateBudgetPolicy

Create a budget policy in a workspace. [Management key](https://openrouter.ai/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.GuardrailPolicies.CreateBudgetPolicy(ctx, components.CreateBudgetGuardrailPolicyRequest{
        Config: components.GuardrailBudgetPolicyAuthoringConfig{
            IncludeBYOKInBudgets: false,
            LimitUsd: openrouter.Pointer[float64](200.0),
            ResetInterval: components.GuardrailBudgetPolicyAuthoringConfigResetIntervalMonthly.ToPointer(),
        },
        Name: "Engineering monthly budget",
        PolicyType: components.CreateBudgetGuardrailPolicyRequestPolicyTypeBudget,
    })
    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) | ✔️ | The context to use for the request. |
| `request` | [components.CreateBudgetGuardrailPolicyRequest](../../models/components/createbudgetguardrailpolicyrequest.mdx) | ✔️ | The request object to use for the request. |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. |

### Response

**[\*components.BudgetGuardrailPolicyResponse](../../models/components/budgetguardrailpolicyresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.ConflictResponseError | 409 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## DeleteBudgetPolicy

Delete a budget policy. [Management key](https://openrouter.ai/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.GuardrailPolicies.DeleteBudgetPolicy(ctx, "550e8400-e29b-41d4-a716-446655440000", nil)
    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) | ✔️ | The context to use for the request. | |
| `id` | `string` | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 |
| `workspaceID` | `*string` | ➖ | Workspace the policy belongs to. Required for an organization management key; a workspace-scoped key defaults to its own workspace and gets 403 for any other. | 0df9e665-d932-5740-b2c7-b52af166bc11 |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*components.DeleteGuardrailPolicyResponse](../../models/components/deleteguardrailpolicyresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.ConflictResponseError | 409 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## GetBudgetPolicy

Get a budget policy with its member and API key assignments. [Management key](https://openrouter.ai/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.GuardrailPolicies.GetBudgetPolicy(ctx, "550e8400-e29b-41d4-a716-446655440000", nil)
    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) | ✔️ | The context to use for the request. | |
| `id` | `string` | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 |
| `workspaceID` | `*string` | ➖ | Workspace the policy belongs to. Required for an organization management key; a workspace-scoped key defaults to its own workspace and gets 403 for any other. | 0df9e665-d932-5740-b2c7-b52af166bc11 |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*components.BudgetGuardrailPolicyDetailResponse](../../models/components/budgetguardrailpolicydetailresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## UpdateBudgetPolicy

Replace a budget policy's name and config, and optionally its assignments. [Management key](https://openrouter.ai/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.GuardrailPolicies.UpdateBudgetPolicy(ctx, "550e8400-e29b-41d4-a716-446655440000", components.UpdateBudgetGuardrailPolicyRequest{
        Config: components.GuardrailBudgetPolicyAuthoringConfig{
            IncludeBYOKInBudgets: false,
            LimitUsd: openrouter.Pointer[float64](200.0),
            ResetInterval: components.GuardrailBudgetPolicyAuthoringConfigResetIntervalMonthly.ToPointer(),
        },
        Name: "Engineering monthly budget",
    })
    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) | ✔️ | The context to use for the request. | |
| `id` | `string` | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 |
| `updateBudgetGuardrailPolicyRequest` | [components.UpdateBudgetGuardrailPolicyRequest](../../models/components/updatebudgetguardrailpolicyrequest.mdx) | ✔️ | N/A | |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*components.BudgetGuardrailPolicyResponse](../../models/components/budgetguardrailpolicyresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.ConflictResponseError | 409 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## ListCapacityPolicies

List the capacity policies in a workspace. Enterprise private beta feature. [Management key](https://openrouter.ai/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.GuardrailPolicies.ListCapacityPolicies(ctx, "0df9e665-d932-5740-b2c7-b52af166bc11", nil, 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) | ✔️ | The context to use for the request. | |
| `workspaceID` | `string` | ✔️ | Workspace the capacity policy belongs to. Capacity policies require an organization-scoped management key. | 0df9e665-d932-5740-b2c7-b52af166bc11 |
| `offset` | `*int64` | ➖ | Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned | 0 |
| `limit` | `*int64` | ➖ | Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned | 50 |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*operations.ListCapacityPoliciesResponse](../../models/operations/listcapacitypoliciesresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## CreateCapacityPolicy

Create a capacity policy in a workspace. Enterprise private beta feature. [Management key](https://openrouter.ai/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.GuardrailPolicies.CreateCapacityPolicy(ctx, components.CreateCapacityGuardrailPolicyRequest{
        Config: components.GuardrailCapacityPolicyConfig{
            BucketBy: []components.BucketBy{
                components.BucketByMember,
                components.BucketByModel,
            },
            Limits: []components.GuardrailCapacityLimit{
                components.GuardrailCapacityLimit{
                    Limit: 100000,
                    Models: components.CreateModelsModelsEnum(
                        components.ModelsEnumAll,
                    ),
                    Unit: components.GuardrailCapacityLimitUnitTokens,
                },
            },
        },
        Name: "Engineering monthly budget",
        PolicyType: components.CreateCapacityGuardrailPolicyRequestPolicyTypeRateLimit,
        WorkspaceID: "0df9e665-d932-5740-b2c7-b52af166bc11",
    })
    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) | ✔️ | The context to use for the request. |
| `request` | [components.CreateCapacityGuardrailPolicyRequest](../../models/components/createcapacityguardrailpolicyrequest.mdx) | ✔️ | The request object to use for the request. |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. |

### Response

**[\*components.CapacityGuardrailPolicyResponse](../../models/components/capacityguardrailpolicyresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.ConflictResponseError | 409 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## DeleteCapacityPolicy

Delete a capacity policy. Enterprise private beta feature. [Management key](https://openrouter.ai/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.GuardrailPolicies.DeleteCapacityPolicy(ctx, "550e8400-e29b-41d4-a716-446655440000", "0df9e665-d932-5740-b2c7-b52af166bc11")
    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) | ✔️ | The context to use for the request. | |
| `id` | `string` | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 |
| `workspaceID` | `string` | ✔️ | Workspace the capacity policy belongs to. Capacity policies require an organization-scoped management key. | 0df9e665-d932-5740-b2c7-b52af166bc11 |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*components.DeleteGuardrailPolicyResponse](../../models/components/deleteguardrailpolicyresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.ConflictResponseError | 409 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## GetCapacityPolicy

Get a capacity policy with its member and API key assignments. Enterprise private beta feature. [Management key](https://openrouter.ai/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.GuardrailPolicies.GetCapacityPolicy(ctx, "550e8400-e29b-41d4-a716-446655440000", "0df9e665-d932-5740-b2c7-b52af166bc11")
    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) | ✔️ | The context to use for the request. | |
| `id` | `string` | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 |
| `workspaceID` | `string` | ✔️ | Workspace the capacity policy belongs to. Capacity policies require an organization-scoped management key. | 0df9e665-d932-5740-b2c7-b52af166bc11 |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*components.CapacityGuardrailPolicyDetailResponse](../../models/components/capacityguardrailpolicydetailresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## UpdateCapacityPolicy

Replace a capacity policy's name and config, and optionally its assignments. Enterprise private beta feature. [Management key](https://openrouter.ai/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.GuardrailPolicies.UpdateCapacityPolicy(ctx, "550e8400-e29b-41d4-a716-446655440000", components.UpdateCapacityGuardrailPolicyRequest{
        Config: components.GuardrailCapacityPolicyConfig{
            BucketBy: []components.BucketBy{
                components.BucketByMember,
                components.BucketByModel,
            },
            Limits: []components.GuardrailCapacityLimit{
                components.GuardrailCapacityLimit{
                    Limit: 100000,
                    Models: components.CreateModelsModelsEnum(
                        components.ModelsEnumAll,
                    ),
                    Unit: components.GuardrailCapacityLimitUnitTokens,
                },
            },
        },
        Name: "Engineering monthly budget",
        WorkspaceID: "0df9e665-d932-5740-b2c7-b52af166bc11",
    })
    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) | ✔️ | The context to use for the request. | |
| `id` | `string` | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 |
| `updateCapacityGuardrailPolicyRequest` | [components.UpdateCapacityGuardrailPolicyRequest](../../models/components/updatecapacityguardrailpolicyrequest.mdx) | ✔️ | N/A | |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*components.CapacityGuardrailPolicyResponse](../../models/components/capacityguardrailpolicyresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.ConflictResponseError | 409 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## ListModelAvailabilityPolicies

List the model availability policies in a workspace. [Management key](https://openrouter.ai/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.GuardrailPolicies.ListModelAvailabilityPolicies(ctx, nil, nil, 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) | ✔️ | The context to use for the request. | |
| `offset` | `*int64` | ➖ | Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned | 0 |
| `limit` | `*int64` | ➖ | Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned | 50 |
| `workspaceID` | `*string` | ➖ | Workspace the policy belongs to. Required for an organization management key; a workspace-scoped key defaults to its own workspace and gets 403 for any other. | 0df9e665-d932-5740-b2c7-b52af166bc11 |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*operations.ListModelAvailabilityPoliciesResponse](../../models/operations/listmodelavailabilitypoliciesresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## CreateModelAvailabilityPolicy

Create a model availability policy in a workspace. [Management key](https://openrouter.ai/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.GuardrailPolicies.CreateModelAvailabilityPolicy(ctx, components.CreateModelAvailabilityGuardrailPolicyRequest{
        Config: components.GuardrailModelAvailabilityPolicyAuthoringConfig{},
        Name: "Engineering monthly budget",
        PolicyType: components.CreateModelAvailabilityGuardrailPolicyRequestPolicyTypeModelAvailability,
    })
    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) | ✔️ | The context to use for the request. |
| `request` | [components.CreateModelAvailabilityGuardrailPolicyRequest](../../models/components/createmodelavailabilityguardrailpolicyrequest.mdx) | ✔️ | The request object to use for the request. |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. |

### Response

**[\*components.ModelAvailabilityGuardrailPolicyResponse](../../models/components/modelavailabilityguardrailpolicyresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.ConflictResponseError | 409 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## DeleteModelAvailabilityPolicy

Delete a model availability policy. [Management key](https://openrouter.ai/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.GuardrailPolicies.DeleteModelAvailabilityPolicy(ctx, "550e8400-e29b-41d4-a716-446655440000", nil)
    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) | ✔️ | The context to use for the request. | |
| `id` | `string` | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 |
| `workspaceID` | `*string` | ➖ | Workspace the policy belongs to. Required for an organization management key; a workspace-scoped key defaults to its own workspace and gets 403 for any other. | 0df9e665-d932-5740-b2c7-b52af166bc11 |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*components.DeleteGuardrailPolicyResponse](../../models/components/deleteguardrailpolicyresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.ConflictResponseError | 409 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## GetModelAvailabilityPolicy

Get a model availability policy with its member and API key assignments. [Management key](https://openrouter.ai/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.GuardrailPolicies.GetModelAvailabilityPolicy(ctx, "550e8400-e29b-41d4-a716-446655440000", nil)
    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) | ✔️ | The context to use for the request. | |
| `id` | `string` | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 |
| `workspaceID` | `*string` | ➖ | Workspace the policy belongs to. Required for an organization management key; a workspace-scoped key defaults to its own workspace and gets 403 for any other. | 0df9e665-d932-5740-b2c7-b52af166bc11 |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*components.ModelAvailabilityGuardrailPolicyDetailResponse](../../models/components/modelavailabilityguardrailpolicydetailresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## UpdateModelAvailabilityPolicy

Replace a model availability policy's name and config, and optionally its assignments. [Management key](https://openrouter.ai/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.GuardrailPolicies.UpdateModelAvailabilityPolicy(ctx, "550e8400-e29b-41d4-a716-446655440000", components.UpdateModelAvailabilityGuardrailPolicyRequest{
        Config: components.GuardrailModelAvailabilityPolicyAuthoringConfig{},
        Name: "Engineering monthly budget",
    })
    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) | ✔️ | The context to use for the request. | |
| `id` | `string` | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 |
| `updateModelAvailabilityGuardrailPolicyRequest` | [components.UpdateModelAvailabilityGuardrailPolicyRequest](../../models/components/updatemodelavailabilityguardrailpolicyrequest.mdx) | ✔️ | N/A | |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*components.ModelAvailabilityGuardrailPolicyResponse](../../models/components/modelavailabilityguardrailpolicyresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.ConflictResponseError | 409 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## ListModerationPolicies

List the moderation policies in a workspace. [Management key](https://openrouter.ai/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.GuardrailPolicies.ListModerationPolicies(ctx, nil, nil, 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) | ✔️ | The context to use for the request. | |
| `offset` | `*int64` | ➖ | Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned | 0 |
| `limit` | `*int64` | ➖ | Maximum number of records to return (max 100). When both offset and limit are omitted, the full list is returned | 50 |
| `workspaceID` | `*string` | ➖ | Workspace the policy belongs to. Required for an organization management key; a workspace-scoped key defaults to its own workspace and gets 403 for any other. | 0df9e665-d932-5740-b2c7-b52af166bc11 |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*operations.ListModerationPoliciesResponse](../../models/operations/listmoderationpoliciesresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## CreateModerationPolicy

Create a moderation policy in a workspace. [Management key](https://openrouter.ai/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.GuardrailPolicies.CreateModerationPolicy(ctx, components.CreateModerationGuardrailPolicyRequest{
        Config: components.GuardrailModerationPolicyConfig{},
        Name: "Engineering monthly budget",
        PolicyType: components.CreateModerationGuardrailPolicyRequestPolicyTypeModeration,
    })
    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) | ✔️ | The context to use for the request. |
| `request` | [components.CreateModerationGuardrailPolicyRequest](../../models/components/createmoderationguardrailpolicyrequest.mdx) | ✔️ | The request object to use for the request. |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. |

### Response

**[\*components.ModerationGuardrailPolicyResponse](../../models/components/moderationguardrailpolicyresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.ConflictResponseError | 409 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## DeleteModerationPolicy

Delete a moderation policy. [Management key](https://openrouter.ai/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.GuardrailPolicies.DeleteModerationPolicy(ctx, "550e8400-e29b-41d4-a716-446655440000", nil)
    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) | ✔️ | The context to use for the request. | |
| `id` | `string` | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 |
| `workspaceID` | `*string` | ➖ | Workspace the policy belongs to. Required for an organization management key; a workspace-scoped key defaults to its own workspace and gets 403 for any other. | 0df9e665-d932-5740-b2c7-b52af166bc11 |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*components.DeleteGuardrailPolicyResponse](../../models/components/deleteguardrailpolicyresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.ConflictResponseError | 409 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## GetModerationPolicy

Get a moderation policy with its member and API key assignments. [Management key](https://openrouter.ai/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.GuardrailPolicies.GetModerationPolicy(ctx, "550e8400-e29b-41d4-a716-446655440000", nil)
    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) | ✔️ | The context to use for the request. | |
| `id` | `string` | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 |
| `workspaceID` | `*string` | ➖ | Workspace the policy belongs to. Required for an organization management key; a workspace-scoped key defaults to its own workspace and gets 403 for any other. | 0df9e665-d932-5740-b2c7-b52af166bc11 |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*components.ModerationGuardrailPolicyDetailResponse](../../models/components/moderationguardrailpolicydetailresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## UpdateModerationPolicy

Replace a moderation policy's name and config, and optionally its assignments. [Management key](https://openrouter.ai/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.GuardrailPolicies.UpdateModerationPolicy(ctx, "550e8400-e29b-41d4-a716-446655440000", components.UpdateModerationGuardrailPolicyRequest{
        Config: components.GuardrailModerationPolicyConfig{},
        Name: "Engineering monthly budget",
    })
    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) | ✔️ | The context to use for the request. | |
| `id` | `string` | ✔️ | Policy ID | 550e8400-e29b-41d4-a716-446655440000 |
| `updateModerationGuardrailPolicyRequest` | [components.UpdateModerationGuardrailPolicyRequest](../../models/components/updatemoderationguardrailpolicyrequest.mdx) | ✔️ | N/A | |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*components.ModerationGuardrailPolicyResponse](../../models/components/moderationguardrailpolicyresponse.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.NotFoundResponseError | 404 | application/json |
| sdkerrors.ConflictResponseError | 409 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |
