> ## 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. # ExternalUsers ## Overview ### Available Operations * [List](#list) - List registered external users * [Create](#create) - Register an external user * [Delete](#delete) - Deactivate a registered external user * [Get](#get) - Get a registered external user * [Update](#update) - Update a registered external user ## List List registrations belonging to the authenticated organization. Inactive registrations are excluded by default. [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.ExternalUsers.List(ctx, optionalnullable.From(openrouter.Pointer[int64](0)), openrouter.Pointer[int64](50), nil, openrouter.Pointer(false)) 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 | | `user` | `*string` | ➖ | Immutable case-sensitive tracking string supplied as user on inference requests or as external.user on API keys: 1 to 512 characters, well-formed Unicode, no NUL, no surrounding whitespace. URL-encode it in resource paths; an ID of `.` or `..` cannot be addressed by path, so look it up with the list filter. | employee\_123 | | `includeInactive` | `*bool` | ➖ | Include deactivated registrations. | false | | `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | | ### Response **[\*operations.ListExternalUsersResponse](../../models/operations/listexternalusersresponse.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 | \*/\* | ## Create Register a caller-supplied tracking ID under the authenticated organization. No login account, policy, or credentials are created. [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.ExternalUsers.Create(ctx, components.CreateExternalUserRequest{ User: "employee_123", }) 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.CreateExternalUserRequest](../../models/components/createexternaluserrequest.mdx) | ✔️ | The request object to use for the request. | | `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | ### Response **[\*components.ExternalUserResponse](../../models/components/externaluserresponse.mdx), error** ### Errors | Error Type | Status Code | Content Type | | - | - | - | | sdkerrors.BadRequestResponseError | 400 | application/json | | sdkerrors.UnauthorizedResponseError | 401 | application/json | | sdkerrors.NotFoundResponseError | 404 | application/json | | sdkerrors.ConflictResponseError | 409 | application/json | | sdkerrors.InternalServerResponseError | 500 | application/json | | sdkerrors.APIError | 4XX, 5XX | \*/\* | ## Delete Soft-deactivate a registration while retaining its tracking ID. Repeat deactivation succeeds. This does not block inference; reactivate through PATCH. [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")), ) err := s.ExternalUsers.Delete(ctx, "employee_123") if err != nil { log.Fatal(err) } } ``` ### Parameters | Parameter | Type | Required | Description | Example | | - | - | - | - | - | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | ✔️ | The context to use for the request. | | | `user` | `string` | ✔️ | Immutable case-sensitive tracking string supplied as user on inference requests or as external.user on API keys: 1 to 512 characters, well-formed Unicode, no NUL, no surrounding whitespace. URL-encode it in resource paths; an ID of `.` or `..` cannot be addressed by path, so look it up with the list filter. | employee\_123 | | `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | | ### Response **error** ### Errors | Error Type | Status Code | Content Type | | - | - | - | | sdkerrors.BadRequestResponseError | 400 | application/json | | sdkerrors.UnauthorizedResponseError | 401 | application/json | | sdkerrors.NotFoundResponseError | 404 | application/json | | sdkerrors.InternalServerResponseError | 500 | application/json | | sdkerrors.APIError | 4XX, 5XX | \*/\* | ## Get Retrieve an active or inactive registration by its URL-encoded, caller-supplied tracking ID. [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.ExternalUsers.Get(ctx, "employee_123") 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. | | | `user` | `string` | ✔️ | Immutable case-sensitive tracking string supplied as user on inference requests or as external.user on API keys: 1 to 512 characters, well-formed Unicode, no NUL, no surrounding whitespace. URL-encode it in resource paths; an ID of `.` or `..` cannot be addressed by path, so look it up with the list filter. | employee\_123 | | `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | | ### Response **[\*components.ExternalUserResponse](../../models/components/externaluserresponse.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 | \*/\* | ## Update Update registration state without changing identity. State changes do not enforce inference 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/components" "log" ) func main() { ctx := context.Background() s := openrouter.New( openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")), ) res, err := s.ExternalUsers.Update(ctx, "employee_123", components.UpdateExternalUserRequest{ IsActive: true, }) 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. | | | `user` | `string` | ✔️ | Immutable case-sensitive tracking string supplied as user on inference requests or as external.user on API keys: 1 to 512 characters, well-formed Unicode, no NUL, no surrounding whitespace. URL-encode it in resource paths; an ID of `.` or `..` cannot be addressed by path, so look it up with the list filter. | employee\_123 | | `updateExternalUserRequest` | [components.UpdateExternalUserRequest](../../models/components/updateexternaluserrequest.mdx) | ✔️ | N/A | \{ "is\_active": true } | | `opts` | \[][operations.Option](../../models/operations/option.mdx) | ➖ | The options for this request. | | ### Response **[\*components.ExternalUserResponse](../../models/components/externaluserresponse.mdx), error** ### Errors | Error Type | Status Code | Content Type | | - | - | - | | sdkerrors.BadRequestResponseError | 400 | application/json | | sdkerrors.UnauthorizedResponseError | 401 | application/json | | sdkerrors.NotFoundResponseError | 404 | application/json | | sdkerrors.InternalServerResponseError | 500 | application/json | | sdkerrors.APIError | 4XX, 5XX | \*/\* |