Overview
The Workspace API provides operations for managing AFFiNE workspaces, including creation, configuration, member management, and permissions.Queries
Get All Workspaces
Retrieve all accessible workspaces for the current user.Returns array of workspaces accessible to the authenticated user
Get Workspace by ID
Retrieve a specific workspace by its ID.The workspace ID to retrieve
Mutations
Create Workspace
Create a new workspace for the authenticated user.The newly created workspace object
Update Workspace
Update workspace settings and configuration.Delete Workspace
Permanently delete a workspace. Requires workspace owner or admin permissions.The workspace ID to delete
Member Management
Invite Members
Invite users to a workspace by email addresses.The workspace ID to invite users to
Array of email addresses to invite (max 512)
Grant Member Role
Update a workspace member’s role/permission level.The role to grant. Values:
Owner, Admin, Collaborator, ExternalRevoke Member
Remove a user from a workspace.Leave Workspace
Remove yourself from a workspace.Workspace owners cannot leave their own workspace. Transfer ownership first or delete the workspace.
Type Definitions
WorkspaceType
Unique workspace identifier
Whether the workspace is publicly accessible
Workspace creation timestamp
Whether the workspace has been initialized with content
Whether this is a team workspace
Current user’s role in the workspace
Total number of workspace members
Workspace owner user object
Map of permission flags for current user
Workspace storage and member quotas
Permission Enum
Owner- Full control including workspace deletionAdmin- Administrative access, manage members and settingsCollaborator- Can create and edit documentsExternal- Limited read-only access
WorkspacePermissions
Boolean flags indicating available actions:Workspace_Read- Can read workspace contentWorkspace_Settings_Update- Can update workspace settingsWorkspace_Delete- Can delete the workspaceWorkspace_Users_Manage- Can manage workspace membersWorkspace_Users_Read- Can view member listWorkspace_Blobs_Read- Can read blob storageWorkspace_Blobs_Write- Can write to blob storageWorkspace_CreateDoc- Can create new documentsWorkspace_Sync- Can sync workspace dataWorkspace_Copilot- Can use AI features
Error Handling
- SpaceNotFound
- SpaceAccessDenied
- NoMoreSeat