Workspaces API
Manage workspaces and their members.
Endpoints
| Method | Path | Description |
|---|---|---|
POST | /workspaces | Create workspace |
GET | /workspaces | List workspaces |
GET | /workspaces/:id | Get workspace |
PUT | /workspaces/:id | Update workspace |
DELETE | /workspaces/:id | Delete workspace |
POST | /workspaces/:id/members | Add member |
GET | /workspaces/:id/members | List members |
DELETE | /workspaces/:id/members/:userId | Remove member |
POST | /workspaces/:id/invite | Invite 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
- JavaScript
- Python
curl -X POST "https://api.synjar.com/v1/workspaces" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "My Workspace"}'
const response = await fetch('https://api.synjar.com/v1/workspaces', {
method: 'POST',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ name: 'My Workspace' }),
});
const workspace = await response.json();
response = requests.post(
'https://api.synjar.com/v1/workspaces',
headers={'Authorization': f'Bearer {api_key}'},
json={'name': 'My Workspace'}
)
workspace = response.json()
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
| Role | Permissions |
|---|---|
OWNER | Full access, can delete workspace |
ADMIN | Manage members and settings |
MEMBER | View 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
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Invalid request body |
| 401 | UNAUTHORIZED | Missing or invalid token |
| 403 | FORBIDDEN | Insufficient permissions |
| 404 | WORKSPACE_NOT_FOUND | Workspace doesn't exist |
| 409 | MEMBER_EXISTS | User already a member |