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

# Scim

> Management endpoints for SCIM group-to-workspace mappings, authenticated with a management key. These are not the SCIM 2.0 connector endpoints for your identity provider. In your identity provider, enter the SCIM endpoint URL shown when you enable provisioning under Settings > Members > SCIM Mappings. See https://openrouter.ai/docs/guides/features/scim-mappings#set-up-provisioning.

## Overview

Management endpoints for SCIM group-to-workspace mappings, authenticated with a management key. These are not the SCIM 2.0 connector endpoints for your identity provider. In your identity provider, enter the SCIM endpoint URL shown when you enable provisioning under Settings > Members > SCIM Mappings. See [https://openrouter.ai/docs/guides/features/scim-mappings#set-up-provisioning](https://openrouter.ai/docs/guides/features/scim-mappings.md#set-up-provisioning).

### Available Operations

* [ListMappings](#listmappings) - List SCIM group mappings
* [Create](#create) - Create a SCIM group mapping
* [Delete](#delete) - Delete a SCIM group mapping
* [Read](#read) - Get a SCIM group mapping
* [Update](#update) - Update a SCIM group mapping
* [ListGroups](#listgroups) - List SCIM groups
* [CreateSyncJob](#createsyncjob) - Start a SCIM directory sync
* [GetSyncJob](#getsyncjob) - Get SCIM directory sync status

## ListMappings

List SCIM group-to-workspace mappings for the organization. [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/optionalnullable"
	"log"
)

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

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

    res, err := s.Scim.ListMappings(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) | ✔️ | The context to use for the request. | |
| `offset` | optionalnullable.OptionalNullable\[`int64`] | ➖ | Number of records to skip for pagination | 0 |
| `limit` | `*int64` | ➖ | Maximum number of records to return (max 100) | 50 |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*operations.ListScimGroupMappingsResponse](../../models/operations/listscimgroupmappingsresponse.mdx), error**

### Errors

| Error Type | Status Code | Content Type |
| - | - | - |
| sdkerrors.UnauthorizedResponseError | 401 | application/json |
| sdkerrors.ForbiddenResponseError | 403 | application/json |
| sdkerrors.NotFoundResponseError | 404 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## Create

Create a SCIM group-to-workspace role mapping. Creating a mapping that already exists with the same role succeeds and re-applies the mapping to the group members. Requesting a different role for an existing mapping returns 409. Assigning the `admin` role is dashboard-only and returns 403 for management keys. [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.Scim.Create(ctx, components.CreateScimGroupMappingRequest{
        Role: components.CreateScimGroupMappingRequestRoleAdmin,
        ScimGroupID: "ecdda85d-40dc-4ed7-9955-2bf12128e7da",
        WorkspaceID: "d5a84a53-ce30-4057-ab5e-bd7b45553567",
    })
    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.CreateScimGroupMappingRequest](../../models/components/createscimgroupmappingrequest.mdx) | ✔️ | The request object to use for the request. |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. |

### Response

**[\*components.CreateScimGroupMappingResponse](../../models/components/createscimgroupmappingresponse.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 | \*/\* |

## Delete

Delete a SCIM group-to-workspace mapping. For an `admin` mapping, `keep_members=true` returns `403` and leaves the mapping in place — preserving members as workspace admins is dashboard-only. [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.Scim.Delete(ctx, "ef7219ae-c495-43b3-b46b-52bf82772570", operations.CreateKeepMembersBoolean(
        false,
    ))
    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` | ✔️ | N/A | |
| `keepMembers` | [operations.KeepMembers](../../models/operations/keepmembers.mdx) | ✔️ | Required. Whether to keep workspace members after deleting the mapping. `false` **removes** the members this mapping granted access to; `true` deletes the mapping while leaving membership intact as manually-managed. Exception: for an `admin` mapping, `keep_members=true` returns `403` and leaves the mapping in place — management keys cannot preserve members as workspace admins, so do not plan an admin mapping rotation around preserving members through this endpoint (use the dashboard instead). There is deliberately no default — omitting it returns `400` so the destructive path cannot be reached by accident. Mirrors the dashboard, whose `DeleteMappingSchema.keepMembers` is likewise required. | false |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*components.DeleteScimGroupMappingResponse](../../models/components/deletescimgroupmappingresponse.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 | \*/\* |

## Read

Get a SCIM group-to-workspace mapping. [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.Scim.Read(ctx, "aca4d64d-fff7-419d-a8ae-3ec5ab8a0c1e")
    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. |
| `id` | `string` | ✔️ | N/A |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. |

### Response

**[\*components.GetScimGroupMappingResponse](../../models/components/getscimgroupmappingresponse.mdx), error**

### Errors

| Error Type | Status Code | Content Type |
| - | - | - |
| sdkerrors.UnauthorizedResponseError | 401 | application/json |
| sdkerrors.ForbiddenResponseError | 403 | application/json |
| sdkerrors.NotFoundResponseError | 404 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## Update

Update a SCIM group mapping role. Assigning the `admin` role is dashboard-only and returns 403 for management keys. [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.Scim.Update(ctx, "361a9698-8c34-4cbb-b0be-f6fd47094a30", components.UpdateScimGroupMappingRequest{
        Role: components.UpdateScimGroupMappingRequestRoleMember,
    })
    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. |
| `id` | `string` | ✔️ | N/A |
| `updateScimGroupMappingRequest` | [components.UpdateScimGroupMappingRequest](../../models/components/updatescimgroupmappingrequest.mdx) | ✔️ | N/A |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. |

### Response

**[\*components.UpdateScimGroupMappingResponse](../../models/components/updatescimgroupmappingresponse.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 | \*/\* |

## ListGroups

List SCIM groups for the organization. [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/optionalnullable"
	"log"
)

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

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

    res, err := s.Scim.ListGroups(ctx, optionalnullable.From(openrouter.Pointer[int64](0)), openrouter.Pointer[int64](50), 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` | optionalnullable.OptionalNullable\[`int64`] | ➖ | Number of records to skip for pagination | 0 |
| `limit` | `*int64` | ➖ | Maximum number of records to return (max 100) | 50 |
| `displayName` | `*string` | ➖ | Exact match filter on display\_name. Omitted or empty returns groups unfiltered by name (subject to offset/limit). When external\_id is also present, both must match. | Engineering |
| `externalID` | `*string` | ➖ | Exact match filter on external\_id, e.g. the identity provider (such as Entra ID) group object ID. Omitted or empty returns groups unfiltered by external\_id (subject to offset/limit). When display\_name is also present, both must match. | a1b2c3d4-e5f6-7890-abcd-ef1234567890 |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | |

### Response

**[\*operations.ListScimGroupsResponse](../../models/operations/listscimgroupsresponse.mdx), error**

### Errors

| Error Type | Status Code | Content Type |
| - | - | - |
| sdkerrors.UnauthorizedResponseError | 401 | application/json |
| sdkerrors.ForbiddenResponseError | 403 | application/json |
| sdkerrors.NotFoundResponseError | 404 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## CreateSyncJob

Start a SCIM directory sync. [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.Scim.CreateSyncJob(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

**[\*operations.CreateScimSyncJobResponse](../../models/operations/createscimsyncjobresponse.mdx), error**

### Errors

| Error Type | Status Code | Content Type |
| - | - | - |
| sdkerrors.UnauthorizedResponseError | 401 | application/json |
| sdkerrors.ForbiddenResponseError | 403 | application/json |
| sdkerrors.NotFoundResponseError | 404 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |

## GetSyncJob

Get SCIM directory sync status. [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.Scim.GetSyncJob(ctx, "11506961-3c26-4184-a388-53273cc64c83")
    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. |
| `id` | `string` | ✔️ | N/A |
| `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. |

### Response

**[\*components.GetScimSyncJobResponse](../../models/components/getscimsyncjobresponse.mdx), error**

### Errors

| Error Type | Status Code | Content Type |
| - | - | - |
| sdkerrors.UnauthorizedResponseError | 401 | application/json |
| sdkerrors.ForbiddenResponseError | 403 | application/json |
| sdkerrors.NotFoundResponseError | 404 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | \*/\* |
