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

# Workspace API guidance

> Workflow guidance for generated workspace, member, and role endpoints.

The generated API Reference includes every supported Workspace endpoint. Workspaces scope sandboxes, Templates, Blueprints, imports, and selected account resources.

## Select a workspace

`GET /api/app/workspaces` lists memberships. Send `X-SandyWP-Workspace` on later requests to select one; `X-SandyWP-Organization` remains a legacy alias.

For member and role routes, the selected workspace must match the `:id` in the path. A mismatch is deliberately returned as `workspace_not_found`.

## Members

| Method and path                                  | Capability                                   |
| ------------------------------------------------ | -------------------------------------------- |
| `GET /api/app/workspaces/:id/members`            | Any member.                                  |
| `POST /api/app/workspaces/:id/members`           | `manage`; sends an email invitation.         |
| `PATCH /api/app/workspaces/:id/members/:userId`  | `manage`; assign or clear a custom role.     |
| `DELETE /api/app/workspaces/:id/members/:userId` | Self-removal or `manage` for another member. |

Members can see the workspace while still lacking permission to mutate it. A `403 capability_required` means the current role lacks the requested capability.

## Roles

Custom roles set the five capabilities `create`, `internals`, `reusables`, `integrations`, and `manage`. Reading roles is available to workspace members; creating, updating, and deleting roles is owner-only.

Deleting a role assigned to a member returns `409 role_in_use`. Reassign those members first, then retry the delete.

Use [Plans and limits](/guides/plans) for workspace plan limits and [CLI](/cli) for terminal workspace selection.
