> ## Documentation Index
> Fetch the complete documentation index at: https://docs.squarecloud.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Invite a workspace member

> Add a member to a workspace with POST /v2/workspaces/members using their invite code, and assign a role: view, manager, maintain or admin. Owner only.

<ParamField header="Authorization" type="string" placeholder="API Key" required>
  The API key for your account. You can find this in your [account settings](https://squarecloud.app/en/account/security).
</ParamField>

Requires an API key with the `workspaces:manage` [scope](/en/api-reference/authentication#scopes).

Adds a member to a workspace using a short-lived code from [Get Invite Code](/en/api-reference/endpoint/workspace/members/code): the invited user is identified by the code, and the caller assigns their role with `group`. Only the workspace owner can call this endpoint, and the workspace's member count is capped by the owner's plan tier.

The role in `group` decides what the member can do on the workspace's shared applications: see [Roles](#roles). Change a role later with [Change Permissions](/en/api-reference/endpoint/workspace/members/perms). An owner cannot invite themselves. Rate limited to 1 addition every 5 seconds per user.

## Roles

The dashboard shows each role by name, and the API takes the value in the `group` column.

| Dashboard | `group` | What the member can do on the workspace's shared applications |
| - | - | - |
| View | `view` | Read only: information, status, logs, metrics, network analytics and deploy history. |
| Manager | `manager` | Everything `view` can, plus start, stop and restart, and the current deploy settings. |
| Maintain | `maintain` | Everything `view` can, plus start, stop and restart, commits, files, DNS records and cache purge. |
| Admin | `admin` | Everything, including environment variables, snapshots, custom domains, the GitHub webhook and restricted files such as `.env`. |

The workspace owner shows up in member lists with `group: "owner"` and always has full access. `owner` can't be assigned.

## Parameters

<ParamField body="workspaceId" type="string" placeholder="Workspace Id" required>
  The ID of the workspace.
</ParamField>

<ParamField body="code" type="string" placeholder="Invite code" required>
  A string with the member invite code.
</ParamField>

<ParamField body="group" type="string" placeholder="Permission name" required>
  The member's role: `view`, `manager`, `maintain` or `admin`. See [Roles](#roles).
</ParamField>

## Response

<ResponseField name="status" type="string">
  Indicates whether the call was successful: `success` if it was, `error` if not.
</ResponseField>

<ResponseExample>
  ```json theme={"system"}
  {
    "status": "success"
  }
  ```
</ResponseExample>

## Common errors

| Code | HTTP | Meaning |
| - | - | - |
| `INVALID_ID` | 400 | `workspaceId` is missing. |
| `INVALID_CODE` | 400 | The invite code is missing, malformed, or has expired. |
| `CANNOT_INVITE_OWNER` | 400 | The invite code belongs to the caller, who already owns the workspace. |
| `INVALID_GROUP` | 400 | `group` is not one of `view`, `manager`, `maintain`, `admin`. |
| `MEMBERS_LIMIT_REACHED` | 400 | The workspace already has the plan's maximum number of members. |
| `MEMBER_ALREADY_ADDED` | 400 | The invited user is already a member of this workspace. |
| `WORKSPACE_NOT_FOUND` | 404 | The workspace does not exist. |

## Related

* CLI: [`squarecloud workspace member add`](/en/cli-reference/workspace-members#squarecloud-workspace-member-add)
* SDKs: [`api.workspaces.members.add()`](/en/sdks/js/workspaces) (JavaScript), [`client.workspaces.members.add()`](/en/sdks/py/workspaces) (Python), [`c.Workspaces.Members.Add()`](/en/sdks/go/workspaces) (Go)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.