For AI agents: fetch the complete documentation index at /llms.txt, the full documentation corpus at /llms-full.txt, the agent skill at /skill.md, or this page as Markdown at /docs/mobile/workspaces.md (or send Accept: text/markdown).
Workspaces and members
Switch workspaces, manage the organization, and handle invitations.
Resolve the active workspace
GET /api/workspaces returns the member's workspace memberships and the active workspace id; POST with a workspace id switches. The server resolves context from the selection cookie to the stored preference to the personal workspace and verifies live membership, so a forged or stale selection cannot read another workspace.
Manage the organization
GET /api/mobile/organization returns members, pending invitations, seat usage, and the caller's capabilities — canManage and canLeave; a personal workspace answers notOrganization instead. POST creates an organization, PATCH renames it (owner only), and DELETE removes it (owner only, confirmed by typing the name).
Organization screens live under Settings → Members and Settings → General; the member's own display name edits go through the Better Auth profile route and accept one to one hundred characters.
Invite and accept
POST /api/mobile/invitations emails an invitation with role admin, member, or guest — owner and admin only. Typed failures cover alreadyMember, alreadyInvited, seatLimitExceeded, dailySendLimit, and invalidInput, so the interface can explain each refusal. Resend and revoke live on the invitation id routes, and resend is rate-limited.
Acceptance arrives through the <scheme>://invite/<token> deep link: the app posts the token to the invitations accept route, which returns the workspace id, activates that workspace, and records the preference server-side. Errors cover expired, emailMismatch, not-pending, and seat-limit-exceeded.
Change roles and remove members
PATCH /api/mobile/members/:userId assigns owner, admin, member, or guest; DELETE removes a member; POST /api/mobile/members/leave leaves voluntarily. The sole owner cannot leave or be demoted, members cannot remove themselves through the admin route, and a role change that alters nothing is rejected rather than recorded.
Verification and troubleshooting
Test seat limits, a revoked invitation link, a guest role's reduced actions, and switching back to the personal workspace. A removed member's cached selection must fail closed on the next request, not keep reading the old workspace.