For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://modelgates.ai/docs/_mcp/server.
Workspaces - Go SDK
The Go SDK and docs are currently in beta. Report issues on GitHub.
Overview
Workspaces endpoints
Available Operations
- List - List workspaces
- Create - Create a workspace
- Delete - Delete a workspace
- Get - Get a workspace
- Update - Update a workspace
- BulkAddMembers - Bulk add members to a workspace
- BulkRemoveMembers - Bulk remove members from a workspace
List
List all workspaces for the authenticated user. Management key required.
Example Usage
package main import( "context" "os" modelgates "github.com/ModelGatesTeam/go-sdk" "github.com/ModelGatesTeam/go-sdk/optionalnullable" "log") func main() { ctx := context.Background() s := modelgates.New( modelgates.WithSecurity(os.Getenv("MODELGATES_API_KEY")), ) res, err := s.Workspaces.List(ctx, optionalnullable.From[int64](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 | :heavy_check_mark: | The context to use for the request. | |
offset | optionalnullable.OptionalNullable[int64] | :heavy_minus_sign: | Number of records to skip for pagination | 0 |
limit | *int64 | :heavy_minus_sign: | Maximum number of records to return (max 100) | 50 |
opts | []operations.Option | :heavy_minus_sign: | The options for this request. |
Response
*operations.ListWorkspacesResponse, error
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.UnauthorizedResponseError | 401 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | */* |
Create
Create a new workspace for the authenticated user. Management key required.
Example Usage
package main import( "context" "os" modelgates "github.com/ModelGatesTeam/go-sdk" "github.com/ModelGatesTeam/go-sdk/optionalnullable" "github.com/ModelGatesTeam/go-sdk/models/components" "log") func main() { ctx := context.Background() s := modelgates.New( modelgates.WithSecurity(os.Getenv("MODELGATES_API_KEY")), ) res, err := s.Workspaces.Create(ctx, components.CreateWorkspaceRequest{ DefaultImageModel: optionalnullable.From(modelgates.Pointer("openai/dall-e-3")), DefaultProviderSort: optionalnullable.From(modelgates.Pointer("price")), DefaultTextModel: optionalnullable.From(modelgates.Pointer("openai/gpt-4o")), Description: optionalnullable.From(modelgates.Pointer("Production environment workspace")), Name: "Production", Slug: "production", }) if err != nil { log.Fatal(err) } if res != nil { // handle response }}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx | context.Context | :heavy_check_mark: | The context to use for the request. |
request | components.CreateWorkspaceRequest | :heavy_check_mark: | The request object to use for the request. |
opts | []operations.Option | :heavy_minus_sign: | The options for this request. |
Response
*components.CreateWorkspaceResponse, error
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.BadRequestResponseError | 400 | application/json |
| sdkerrors.UnauthorizedResponseError | 401 | application/json |
| sdkerrors.ForbiddenResponseError | 403 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | */* |
Delete
Delete an existing workspace. The default workspace cannot be deleted. Workspaces with active API keys cannot be deleted. Management key required.
Example Usage
package main import( "context" "os" modelgates "github.com/ModelGatesTeam/go-sdk" "log") func main() { ctx := context.Background() s := modelgates.New( modelgates.WithSecurity(os.Getenv("MODELGATES_API_KEY")), ) res, err := s.Workspaces.Delete(ctx, "production") if err != nil { log.Fatal(err) } if res != nil { // handle response }}Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
ctx | context.Context | :heavy_check_mark: | The context to use for the request. | |
id | string | :heavy_check_mark: | The workspace ID (UUID) or slug | production |
opts | []operations.Option | :heavy_minus_sign: | The options for this request. |
Response
*components.DeleteWorkspaceResponse, 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 | */* |
Get
Get a single workspace by ID or slug. Management key required.
Example Usage
package main import( "context" "os" modelgates "github.com/ModelGatesTeam/go-sdk" "log") func main() { ctx := context.Background() s := modelgates.New( modelgates.WithSecurity(os.Getenv("MODELGATES_API_KEY")), ) res, err := s.Workspaces.Get(ctx, "production") if err != nil { log.Fatal(err) } if res != nil { // handle response }}Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
ctx | context.Context | :heavy_check_mark: | The context to use for the request. | |
id | string | :heavy_check_mark: | The workspace ID (UUID) or slug | production |
opts | []operations.Option | :heavy_minus_sign: | The options for this request. |
Response
*components.GetWorkspaceResponse, error
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.UnauthorizedResponseError | 401 | application/json |
| sdkerrors.NotFoundResponseError | 404 | application/json |
| sdkerrors.InternalServerResponseError | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | */* |
Update
Update an existing workspace by ID or slug. Management key required.
Example Usage
package main import( "context" "os" modelgates "github.com/ModelGatesTeam/go-sdk" "github.com/ModelGatesTeam/go-sdk/models/components" "log") func main() { ctx := context.Background() s := modelgates.New( modelgates.WithSecurity(os.Getenv("MODELGATES_API_KEY")), ) res, err := s.Workspaces.Update(ctx, "production", components.UpdateWorkspaceRequest{ Name: modelgates.Pointer("Updated Workspace"), Slug: modelgates.Pointer("updated-workspace"), }) if err != nil { log.Fatal(err) } if res != nil { // handle response }}Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
ctx | context.Context | :heavy_check_mark: | The context to use for the request. | |
id | string | :heavy_check_mark: | The workspace ID (UUID) or slug | production |
updateWorkspaceRequest | components.UpdateWorkspaceRequest | :heavy_check_mark: | N/A | {"name": "Updated Workspace","slug": "updated-workspace"} |
opts | []operations.Option | :heavy_minus_sign: | The options for this request. |
Response
*components.UpdateWorkspaceResponse, 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 | */* |
BulkAddMembers
Add multiple organization members to a workspace. Members are assigned the same role they hold in the organization. Management key required.
Example Usage
package main import( "context" "os" modelgates "github.com/ModelGatesTeam/go-sdk" "github.com/ModelGatesTeam/go-sdk/models/components" "log") func main() { ctx := context.Background() s := modelgates.New( modelgates.WithSecurity(os.Getenv("MODELGATES_API_KEY")), ) res, err := s.Workspaces.BulkAddMembers(ctx, "production", components.BulkAddWorkspaceMembersRequest{ UserIds: []string{ "user_abc123", "user_def456", }, }) if err != nil { log.Fatal(err) } if res != nil { // handle response }}Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
ctx | context.Context | :heavy_check_mark: | The context to use for the request. | |
id | string | :heavy_check_mark: | The workspace ID (UUID) or slug | production |
bulkAddWorkspaceMembersRequest | components.BulkAddWorkspaceMembersRequest | :heavy_check_mark: | N/A | {"user_ids": ["user_abc123","user_def456"]} |
opts | []operations.Option | :heavy_minus_sign: | The options for this request. |
Response
*components.BulkAddWorkspaceMembersResponse, 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 | */* |
BulkRemoveMembers
Remove multiple members from a workspace. Members with active API keys in the workspace cannot be removed. Management key required.
Example Usage
package main import( "context" "os" modelgates "github.com/ModelGatesTeam/go-sdk" "github.com/ModelGatesTeam/go-sdk/models/components" "log") func main() { ctx := context.Background() s := modelgates.New( modelgates.WithSecurity(os.Getenv("MODELGATES_API_KEY")), ) res, err := s.Workspaces.BulkRemoveMembers(ctx, "production", components.BulkRemoveWorkspaceMembersRequest{ UserIds: []string{ "user_abc123", "user_def456", }, }) if err != nil { log.Fatal(err) } if res != nil { // handle response }}Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
ctx | context.Context | :heavy_check_mark: | The context to use for the request. | |
id | string | :heavy_check_mark: | The workspace ID (UUID) or slug | production |
bulkRemoveWorkspaceMembersRequest | components.BulkRemoveWorkspaceMembersRequest | :heavy_check_mark: | N/A | {"user_ids": ["user_abc123","user_def456"]} |
opts | []operations.Option | :heavy_minus_sign: | The options for this request. |
Response
*components.BulkRemoveWorkspaceMembersResponse, 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 | */* |