API Reference

Containers

Execute Command in Container

  • API Name: Execute Command
  • API Route: POST /api/v1/containers/exec
  • Request:
    • Body:
json
    {
      "projectId": "string (required)",
      "workspaceId": "string (required)",
      "command": "string (required)"
    }
  • What it does: Executes a shell command inside the container associated with the given project and workspace.
  • Returns:
json
  {
    "success": true,
    "output": "string (stdout)",
    "error": "string (stderr)",
    "exitCode": number
  }

Get Container Status

  • API Name: Get Container Status
  • API Route: POST /api/v1/containers/status
  • Request:
    • Body:
json
    {
      "projectId": "string (required)",
      "workspaceId": "string (required)"
    }
  • What it does: Retrieves the live status of a container from Docker and merges it with stored details from the database (including the container password if set).
  • Returns:
json
  {
    "success": true,
    "message": "Container status retrieved successfully",
    "data": { "...containerInfo", "password": "string | undefined" }
  }

Start Container

  • API Name: Start Container
  • API Route: POST /api/v1/containers/start
  • Request:
    • Body:
json
    {
      "projectId": "string (required)",
      "workspaceId": "string (required)",
      "files": "object (optional)"
    }
  • What it does: Starts (or creates and starts) the Docker container for the given project and workspace. Optionally accepts initial files to populate the container with.
  • Returns:
json
  {
    "success": true,
    "message": "Container started successfully",
    "data": { "...containerInfo" }
  }

Stop Container

  • API Name: Stop Container
  • API Route: POST /api/v1/containers/stop
  • Request:
    • Body:
json
    {
      "projectId": "string (required)",
      "workspaceId": "string (required)"
    }
  • What it does: Stops the running container for the given project and workspace. Returns a success message even if the container was already stopped.
  • Returns:
json
  {
    "success": true | false,
    "message": "Container stopped successfully | Container was already stopped"
  }

Sync Files to Container

  • API Name: Sync Files to Container
  • API Route: POST /api/v1/containers/sync
  • Request:
    • Body:
json
    {
      "projectId": "string (required)",
      "workspaceId": "string (required)",
      "files": "object (required, can be empty object)",
      "clean": "boolean (optional, default: false)"
    }
  • What it does: Syncs a set of files into the container filesystem. If clean is true, clears the workspace before syncing (useful for a fresh state).
  • Returns:
json
  {
    "success": true,
    "message": "Files synced successfully | Workspace cleaned successfully"
  }

Set VS Code Theme

  • API Name: Set VS Code Theme in Container
  • API Route: POST /api/v1/containers/vscode-theme
  • Request:
    • Body:
json
    {
      "projectId": "string (required)",
      "workspaceId": "string (required)",
      "theme": "string (required)"
    }
  • What it does: Sets the VS Code theme inside the container by writing to the VS Code settings file.
  • Returns: { "success": true }