Skip to main content

List User Workspaces

curl -X GET "https://api.example.com/workspaces/?limit=10" \
  -H "Authorization: Bearer YOUR_TOKEN"
{
  "message": "Workspaces retrieved successfully",
  "data": {
    "workspaces": [
      {
        "id": "workspace123",
        "name": "My Water Quality Project",
        "owner": "user123",
        "type": "private",
        "rol": "owner"
      }
    ],
    "next_index": "eyJpZCI6Im5leHQifQ=="
  }
}
Retrieve all workspaces owned by the authenticated user. Endpoint: GET /workspaces/ Authentication: Required (Bearer token)

Query Parameters

limit
number
default:"10"
Number of items to retrieve (1-100)
index
string
Pagination index for next page

Response

message
string
Success message
data
object
Workspace data with pagination

Get All Workspaces (Admin)

curl -X GET https://api.example.com/workspaces/all/ \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN"
{
  "message": "All workspaces retrieved successfully",
  "workspaces": [
    {
      "id": "workspace123",
      "name": "Production Workspace",
      "owner": "user123",
      "type": "private",
      "created_at": "2024-01-15T10:30:00Z"
    }
  ]
}
Retrieve all workspaces in the system. This endpoint is restricted to admin users only. Endpoint: GET /workspaces/all/ Authentication: Required (Admin role only)

Response

message
string
Success message
workspaces
array
Array of all workspace objects in the system
This endpoint requires admin privileges. Regular users will receive a 403 Forbidden error.

Get Workspace by ID

curl -X GET https://api.example.com/workspaces/workspace123 \
  -H "Authorization: Bearer YOUR_TOKEN"
{
  "message": "Workspace retrieved successfully",
  "data": {
    "id": "workspace123",
    "name": "My Water Quality Project",
    "owner": "user123",
    "type": "private",
    "rol": "owner",
    "user": {
      "uid": "user123",
      "email": "[email protected]",
      "username": "johndoe"
    }
  }
}
Retrieve a specific workspace by ID. Endpoint: GET /workspaces/{id} Authentication: Required (Bearer token)

Path Parameters

id
string
required
Workspace ID

Response

message
string
Success message
data
object
Workspace details including owner information

Create Workspace

curl -X POST https://api.example.com/workspaces/ \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "New Water Quality Project",
    "type": "private"
  }'
{
  "message": "Workspace created successfully",
  "data": {
    "id": "workspace456",
    "name": "New Water Quality Project",
    "owner": "user123",
    "type": "private",
    "rol": "owner"
  }
}
Create a new workspace. Endpoint: POST /workspaces/ Authentication: Required (Bearer token)

Request Body

name
string
required
Workspace name (3-50 characters)
type
string
default:"private"
Workspace type: private or public

Response

message
string
Success message
data
object
Created workspace object

Update Workspace

curl -X PUT https://api.example.com/workspaces/workspace123 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Updated Project Name",
    "type": "public"
  }'
{
  "message": "Workspace updated successfully",
  "data": {
    "id": "workspace123",
    "name": "Updated Project Name",
    "owner": "user123",
    "type": "public",
    "rol": "owner"
  }
}
Update workspace details. Endpoint: PUT /workspaces/{id} Authentication: Required (Bearer token, must be owner)

Path Parameters

id
string
required
Workspace ID

Request Body

name
string
required
Updated workspace name
type
string
Workspace type: private or public

Response

message
string
Success message
data
object
Updated workspace object

Delete Workspace

curl -X DELETE https://api.example.com/workspaces/workspace123 \
  -H "Authorization: Bearer YOUR_TOKEN"
{
  "message": "Workspace deleted successfully"
}
Delete a workspace. Endpoint: DELETE /workspaces/{id} Authentication: Required (Bearer token, must be owner)

Path Parameters

id
string
required
Workspace ID to delete

Response

message
string
Success message

List Shared Workspaces

curl -X GET "https://api.example.com/workspaces/share/?limit=10" \
  -H "Authorization: Bearer YOUR_TOKEN"
{
  "message": "Shares retrieved successfully",
  "workspaces": {
    "workspaces": [
      {
        "id": "workspace789",
        "name": "Shared Project",
        "owner": "otheruser123",
        "type": "private",
        "rol": "viewer",
        "guest": "user123"
      }
    ],
    "next_index": null
  }
}
Get workspaces that have been shared with the authenticated user. Endpoint: GET /workspaces/share/ Authentication: Required (Bearer token)

Query Parameters

limit
number
default:"10"
Number of items to retrieve (1-100)
index
string
Pagination index

List Public Workspaces

curl -X GET "https://api.example.com/workspaces/public/?limit=10"
{
  "message": "Public workspaces retrieved successfully",
  "workspaces": {
    "workspaces": [
      {
        "id": "workspace999",
        "name": "Public Water Quality Data",
        "rol": "viewer"
      }
    ],
    "next_index": null
  }
}
Get all public workspaces. Endpoint: GET /workspaces/public/ Authentication: None required

Query Parameters

limit
number
default:"10"
Number of items to retrieve (1-100)
index
string
Pagination index

Get Workspace Guests

curl -X GET https://api.example.com/workspaces/workspace123/guest/ \
  -H "Authorization: Bearer YOUR_TOKEN"
{
  "message": "Guests retrieved successfully",
  "guests": [
    {
      "uid": "guest123",
      "email": "[email protected]",
      "username": "guestuser",
      "rol": "viewer"
    }
  ]
}
Get all guests (collaborators) for a workspace. Endpoint: GET /workspaces/{id}/guest/ Authentication: Required (Bearer token, must be owner)

Path Parameters

id
string
required
Workspace ID

Add Guest to Workspace

curl -X POST https://api.example.com/workspaces/workspace123/guest/ \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "guest": "[email protected]",
    "rol": "viewer"
  }'
{
  "message": "Guest created successfully",
  "guest": {
    "uid": "guest123",
    "email": "[email protected]",
    "username": "guestuser",
    "rol": "viewer"
  }
}
Add a guest (collaborator) to a workspace. An invitation email will be sent. Endpoint: POST /workspaces/{id}/guest/ Authentication: Required (Bearer token, must be owner)

Path Parameters

id
string
required
Workspace ID

Request Body

guest
string
required
Email address of the user to invite
rol
string
required
Role for the guest: viewer, editor, or admin

Update Guest Role

curl -X PUT https://api.example.com/workspaces/workspace123/guest/guest123 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "rol": "editor"
  }'
{
  "message": "Guest updated successfully",
  "guest": {
    "uid": "guest123",
    "email": "[email protected]",
    "username": "guestuser",
    "rol": "editor"
  }
}
Update a guest’s role in the workspace. Endpoint: PUT /workspaces/{id}/guest/{guest} Authentication: Required (Bearer token, must be owner)

Path Parameters

id
string
required
Workspace ID
guest
string
required
Guest user ID

Request Body

rol
string
required
New role: viewer, editor, or admin

Remove Guest from Workspace

curl -X DELETE https://api.example.com/workspaces/workspace123/guest/guest123 \
  -H "Authorization: Bearer YOUR_TOKEN"
{
  "message": "Guest deleted successfully",
  "guest": {
    "uid": "guest123",
    "email": "[email protected]",
    "username": "guestuser",
    "rol": "viewer"
  }
}
Remove a guest from the workspace. Endpoint: DELETE /workspaces/{id}/guest/{guest} Authentication: Required (Bearer token, must be owner)

Path Parameters

id
string
required
Workspace ID
guest
string
required
Guest user ID to remove

Build docs developers (and LLMs) love