Skip to main content

Workspaces API

Manage workspaces and workspace members.

List Workspaces

GET /v1/workspaces

Returns all workspaces the authenticated user belongs to.

Example Request

curl "http://localhost:3000/api/workspaces" \
-H "Authorization: Bearer $API_KEY"

Example Response

{
"data": [
{
"id": "ws_abc123",
"name": "Acme Corp",
"hostname": "acme",
"logoUrl": "https://...",
"createdAt": "2024-06-15T10:00:00Z",
"memberCount": 25,
"role": "admin"
}
]
}

Get Workspace

GET /v1/workspaces/:workspaceId

Returns details for a specific workspace.

Example Request

curl "http://localhost:3000/api/workspaces/ws_abc123" \
-H "Authorization: Bearer $API_KEY"

Example Response

{
"data": {
"id": "ws_abc123",
"name": "Acme Corp",
"hostname": "acme",
"logoUrl": "https://...",
"description": "Acme's internal wiki",
"createdAt": "2024-06-15T10:00:00Z",
"updatedAt": "2025-01-10T09:00:00Z",
"settings": {
"defaultRole": "editor",
"allowPublicPages": true
},
"memberCount": 25
}
}

Create Workspace

POST /v1/workspaces

Creates a new workspace.

Body Parameters

ParameterTypeRequiredDescription
namestringYesWorkspace name
hostnamestringYesSubdomain
descriptionstringNoDescription

Example Request

curl -X POST "http://localhost:3000/api/workspaces" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "New Workspace",
"hostname": "newworkspace"
}'

Update Workspace

PUT /v1/workspaces/:workspaceId

Updates workspace settings.

Body Parameters

ParameterTypeRequiredDescription
namestringNoNew name
descriptionstringNoNew description
settingsobjectNoSettings object

List Members

GET /v1/workspaces/:workspaceId/members

Returns all members of a workspace.

Example Response

{
"data": [
{
"id": "user_123",
"email": "john@acme.com",
"name": "John Doe",
"avatarUrl": "https://...",
"role": "admin",
"joinedAt": "2024-06-15T10:00:00Z"
}
]
}

Add Member

POST /v1/workspaces/:workspaceId/members

Adds a member to the workspace.

Body Parameters

ParameterTypeRequiredDescription
userIdstringYesUser ID to add
rolestringYesRole: admin, editor, viewer

Change Member Role

PUT /v1/workspaces/:workspaceId/members/:userId

Changes a member's role.

Body Parameters

ParameterTypeRequiredDescription
rolestringYesNew role

Remove Member

DELETE /v1/workspaces/:workspaceId/members/:userId

Removes a member from the workspace.