Skip to content

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

FieldTypeRequiredDescription
namestringYesWorkspace name
descriptionstringNoWorkspace 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

FieldTypeRequiredDescription
orderstring[]YesArray of workspace IDs in desired order

Get Workspace

GET /api/workspaces/:id

Get a single workspace.

Path Parameters

ParameterTypeDescription
idstringWorkspace ID

Update Workspace

PUT /api/workspaces/:id

Update a workspace.

Path Parameters

ParameterTypeDescription
idstringWorkspace ID

Request Body

FieldTypeRequiredDescription
namestringNoUpdated name
descriptionstringNoUpdated description

Set Default Workspace

PUT /api/workspaces/:id/default

Set a workspace as the default (used when the user opens the dashboard).

Path Parameters

ParameterTypeDescription
idstringWorkspace ID

Delete Workspace

DELETE /api/workspaces/:id

Delete a workspace. Repository configs in this workspace are moved to the default workspace.

Path Parameters

ParameterTypeDescription
idstringWorkspace ID