Skip to main content

Workspaces & Invites

Tags: Workspaces, Invites ยท Version: v1 ยท Stability: ๐ŸŸข Stable

A workspace is the multi-tenant boundary: every template, key, comment, and render belongs to one. Members hold a role โ€” Owner, Editor, or Viewer. Management is JWT-only; the invite preview is public so an invitee can see what they're joining before signing in.

Workspacesโ€‹

List my workspacesโ€‹

GET /api/workspaces ยท JWT โ€” every workspace the current user belongs to (with role). Used to populate the workspace switcher. To switch, see POST /api/auth/switch-workspace/{workspaceId}.

List current membersโ€‹

GET /api/workspaces/current/members ยท JWT โ€” members of the active workspace (email, role, joined-at).

Members management (Owner-only)โ€‹

Invite a memberโ€‹

POST /api/workspaces/current/invites ยท JWT (Owner)

Request โ€” InviteMemberBody
{ "email": "teammate@example.com", "role": "Editor" }

Both fields required. Creates an invite with a token. Emails aren't sent automatically yet โ€” share the resulting invite link/token with the invitee.

Change a member's roleโ€‹

PATCH /api/workspaces/current/members/{userId} ยท JWT (Owner)

Request โ€” UpdateMemberRoleBody
{ "role": "Viewer" }

{userId} is a UUID. role is required.

Remove a memberโ€‹

DELETE /api/workspaces/current/members/{userId} ยท JWT (Owner) โ€” {userId} is a UUID.


Invitesโ€‹

Preview an inviteโ€‹

GET /api/invites/{token} ยท Public

{token} is the opaque invite string. Returns the workspace name, the role offered, the inviter's email, and whether the invite is still redeemable โ€” so the invitee can decide before authenticating.

Accept an inviteโ€‹

POST /api/invites/{token}/accept ยท JWT

The invitee must be signed in. On success they join the workspace and receive a new JWT scoped to it โ€” replace the stored token and refetch.