Skip to main content

GET /api/sessions/:id/git-status

Get git status for a session’s working directory. Authentication: Required

Path Parameters

id
string
required
Session ID

Response

success
boolean
Whether the operation succeeded
files
array
Array of changed files with status
branch
string
Current branch name
error
string
Error message if failed

Example

curl -H "Authorization: Bearer <token>" \
  http://127.0.0.1:3006/api/sessions/abc123/git-status
{
  "success": true,
  "branch": "main",
  "files": [
    {
      "path": "src/main.ts",
      "status": "modified"
    },
    {
      "path": "README.md",
      "status": "modified"
    },
    {
      "path": "test.ts",
      "status": "untracked"
    }
  ]
}

Errors

  • 403 - Access denied
  • 404 - Session not found
  • 503 - Hub not connected

GET /api/sessions/:id/git-diff-numstat

Get git diff summary with line count statistics. Authentication: Required

Path Parameters

id
string
required
Session ID

Query Parameters

staged
boolean
Show only staged changes (default: false shows unstaged)

Response

success
boolean
Whether the operation succeeded
files
array
Array of file change statistics
error
string
Error message if failed

Example

curl -H "Authorization: Bearer <token>" \
  "http://127.0.0.1:3006/api/sessions/abc123/git-diff-numstat?staged=false"
{
  "success": true,
  "files": [
    {
      "path": "src/main.ts",
      "added": 15,
      "removed": 3
    },
    {
      "path": "README.md",
      "added": 5,
      "removed": 1
    }
  ]
}

GET /api/sessions/:id/git-diff-file

Get git diff for a specific file. Authentication: Required

Path Parameters

id
string
required
Session ID

Query Parameters

path
string
required
File path to diff
staged
boolean
Show staged diff (default: false shows unstaged)

Response

success
boolean
Whether the operation succeeded
diff
string
Unified diff output
error
string
Error message if failed

Example

curl -H "Authorization: Bearer <token>" \
  "http://127.0.0.1:3006/api/sessions/abc123/git-diff-file?path=src/main.ts&staged=false"
{
  "success": true,
  "diff": "diff --git a/src/main.ts b/src/main.ts\nindex 1234567..abcdefg 100644\n--- a/src/main.ts\n+++ b/src/main.ts\n@@ -10,3 +10,5 @@\n console.log('Hello')\n+console.log('World')\n"
}

GET /api/sessions/:id/file

Read the contents of a file in the session’s working directory. Authentication: Required

Path Parameters

id
string
required
Session ID

Query Parameters

path
string
required
Relative path to the file

Response

success
boolean
Whether the operation succeeded
content
string
File contents
error
string
Error message if failed

Example

curl -H "Authorization: Bearer <token>" \
  "http://127.0.0.1:3006/api/sessions/abc123/file?path=src/main.ts"
{
  "success": true,
  "content": "console.log('Hello World');\n"
}

Errors

  • 400 - Invalid file path
  • 403 - Access denied
  • 404 - Session not found
  • 503 - Hub not connected

GET /api/sessions/:id/files

Search for files in the session’s working directory using ripgrep. Authentication: Required

Path Parameters

id
string
required
Session ID

Query Parameters

query
string
Search pattern (filename glob)
limit
number
Maximum number of results (1-500, default: 200)

Response

success
boolean
Whether the operation succeeded
files
array
Array of file objects
error
string
Error message if failed

Example: List All Files

curl -H "Authorization: Bearer <token>" \
  "http://127.0.0.1:3006/api/sessions/abc123/files?limit=50"
{
  "success": true,
  "files": [
    {
      "fileName": "main.ts",
      "filePath": "src",
      "fullPath": "src/main.ts",
      "fileType": "file"
    },
    {
      "fileName": "README.md",
      "filePath": "",
      "fullPath": "README.md",
      "fileType": "file"
    }
  ]
}

Example: Search for TypeScript Files

curl -H "Authorization: Bearer <token>" \
  "http://127.0.0.1:3006/api/sessions/abc123/files?query=.ts&limit=100"
{
  "success": true,
  "files": [
    {
      "fileName": "main.ts",
      "filePath": "src",
      "fullPath": "src/main.ts",
      "fileType": "file"
    },
    {
      "fileName": "test.ts",
      "filePath": "tests",
      "fullPath": "tests/test.ts",
      "fileType": "file"
    }
  ]
}

Errors

  • 400 - Invalid query
  • 403 - Access denied
  • 404 - Session not found
  • 503 - Hub not connected

GET /api/sessions/:id/directory

List contents of a directory in the session’s working directory. Authentication: Required

Path Parameters

id
string
required
Session ID

Query Parameters

path
string
Relative directory path (empty = root)

Response

success
boolean
Whether the operation succeeded
entries
array
Array of directory entries (files and directories)
error
string
Error message if failed

Example

curl -H "Authorization: Bearer <token>" \
  "http://127.0.0.1:3006/api/sessions/abc123/directory?path=src"
{
  "success": true,
  "entries": [
    {
      "name": "main.ts",
      "type": "file",
      "size": 1024
    },
    {
      "name": "utils",
      "type": "directory"
    }
  ]
}

Build docs developers (and LLMs) love