Workspaces
Organize repository configurations into workspaces for better management.
Base path: /api/workspaces
Authentication: Bearer token required on all routes
List Workspaces
GET /api/workspaces/
List all workspaces for the authenticated user.
Response
json
{
"success": true,
"data": [
{
"_id": "ws1",
"name": "Production",
"description": "Production infrastructure",
"isDefault": true,
"order": 0,
"repoConfigCount": 5
}
]
}Example
bash
curl -H "Authorization: Bearer TOKEN" \
https://api.controlinfra.com/api/workspaces/Create Workspace
POST /api/workspaces/
Create a new workspace.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Workspace name |
description | string | No | Workspace description |
Response
json
{
"success": true,
"data": {
"_id": "ws2",
"name": "Staging",
"description": "Staging environment",
"isDefault": false,
"order": 1
}
}Example
bash
curl -X POST https://api.controlinfra.com/api/workspaces/ \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "Staging", "description": "Staging environment"}'Reorder Workspaces
PUT /api/workspaces/reorder
Update the display order of workspaces.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
order | string[] | Yes | Array of workspace IDs in desired order |
Get Workspace
GET /api/workspaces/:id
Get a single workspace.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Workspace ID |
Update Workspace
PUT /api/workspaces/:id
Update a workspace.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Workspace ID |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | No | Updated name |
description | string | No | Updated description |
Set Default Workspace
PUT /api/workspaces/:id/default
Set a workspace as the default (used when the user opens the dashboard).
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Workspace ID |
Delete Workspace
DELETE /api/workspaces/:id
Delete a workspace. Repository configs in this workspace are moved to the default workspace.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Workspace ID |