Skip to main content

Workspaces API

Manage workspaces and their members.

Endpoints

MethodPathDescription
POST/workspacesCreate workspace
GET/workspacesList workspaces
GET/workspaces/:idGet workspace
PUT/workspaces/:idUpdate workspace
DELETE/workspaces/:idDelete workspace
POST/workspaces/:id/membersAdd member
GET/workspaces/:id/membersList members
DELETE/workspaces/:id/members/:userIdRemove member
POST/workspaces/:id/inviteInvite by email

Create workspace

POST /workspaces

Create a new workspace.

Request

{
"name": "My Workspace"
}

Response

{
"id": "ws_abc123",
"name": "My Workspace",
"createdAt": "2025-01-01T12:00:00Z"
}

Example

curl -X POST "https://api.synjar.com/v1/workspaces" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "My Workspace"}'

List workspaces

GET /workspaces

List all workspaces accessible to the authenticated user.

Response

[
{
"id": "ws_abc123",
"name": "My Workspace",
"role": "OWNER",
"createdAt": "2025-01-01T12:00:00Z",
"documentCount": 42,
"memberCount": 5
}
]

Get workspace

GET /workspaces/:id

Get details for a specific workspace.

Response

{
"id": "ws_abc123",
"name": "My Workspace",
"role": "OWNER",
"createdAt": "2025-01-01T12:00:00Z",
"documentCount": 42,
"memberCount": 5,
"settings": {
"allowPublicSearchLinks": true,
"defaultDocumentPurpose": "KNOWLEDGE"
}
}

Update workspace

PUT /workspaces/:id

Update workspace settings.

Request

{
"name": "Updated Name",
"settings": {
"allowPublicSearchLinks": false
}
}

Delete workspace

DELETE /workspaces/:id

Permanently delete a workspace and all its documents.

danger

This action cannot be undone. All documents, search links, and instruction sets will be permanently deleted.

Add member

POST /workspaces/:id/members

Add an existing user as a workspace member.

Request

{
"userId": "user_xyz789",
"role": "MEMBER"
}

Roles

RolePermissions
OWNERFull access, can delete workspace
ADMINManage members and settings
MEMBERView and search documents, upload

List members

GET /workspaces/:id/members

Response

[
{
"userId": "user_abc",
"email": "owner@example.com",
"name": "John Owner",
"role": "OWNER",
"joinedAt": "2025-01-01T12:00:00Z"
},
{
"userId": "user_xyz",
"email": "member@example.com",
"name": "Jane Member",
"role": "MEMBER",
"joinedAt": "2025-01-15T12:00:00Z"
}
]

Remove member

DELETE /workspaces/:id/members/:userId

Remove a member from the workspace.

note

Owners cannot remove themselves. Transfer ownership first.

Invite by email

POST /workspaces/:id/invite

Send email invitation to join workspace.

Request

{
"email": "newuser@example.com",
"role": "MEMBER"
}

Response

{
"invitationId": "inv_abc123",
"email": "newuser@example.com",
"role": "MEMBER",
"expiresAt": "2025-02-01T12:00:00Z"
}

Error responses

StatusCodeDescription
400VALIDATION_ERRORInvalid request body
401UNAUTHORIZEDMissing or invalid token
403FORBIDDENInsufficient permissions
404WORKSPACE_NOT_FOUNDWorkspace doesn't exist
409MEMBER_EXISTSUser already a member

See also