Skip to main content
A workspace shares apps with other Square Cloud users, each with a role. c.Workspaces manages workspaces, c.Workspaces.Members their members and c.Workspaces.Apps the shared apps. Creating workspaces needs a Standard, Pro or Enterprise plan. Each snippet below runs on its own inside this program: paste one at a time into main and run goimports (see Running the examples).

Workspaces

Workspaces.List(ctx) returns every workspace you own or belong to, with the same fields:
To leave a workspace as a member, or delete it as the owner:
The owner cannot leave (400 CANNOT_LEAVE_OWNER): delete the workspace instead.

Members

Adding a member takes an invite code that the member generates with Members.InviteCode(ctx). The code is valid for 5 minutes.
To change a member’s role or remove them, pass their ID from Workspaces.Get:
Roles (WorkspaceGroup): GroupView (view), GroupManager (manager), GroupMaintain (maintain) and GroupAdmin (admin). A member’s Group is a plain string, since it can also be "owner". Calling a method that your role does not allow is 403 PERMISSION_DENIED.

Shared applications

A workspace can hold up to 100 apps (400 APPLICATIONS_LIMIT_REACHED).

Acting on a shared app

To act on an app shared with you, pass the composite id <appId>-<workspaceId> to any c.Apps method. Workspaces.Get and Workspaces.List return raw ids, so build it yourself:

Errors

Workspace routes other than Get send the ids in the request body, so an empty id there is 400 INVALID_ID from the server (not a local error). Get sends the id in the path, so an empty id fails locally with INVALID_ID (status 0).

Next steps

AI

Chat completions through the AI Gateway.

Workspace API reference

The REST endpoints behind these methods.

Workspaces from the CLI

The same actions from the terminal.