API Reference

API documentation for List Coder's extensibility and integration points.

API Reference

List Coder exposes APIs for extending functionality, building integrations, and automating workflows.


Local Server API

When List Coder is running, it exposes a local HTTP API on port 27432.

Base URL

http://localhost:27432/api

Authentication

Include the API token from Settings → Advanced → API Token:

Authorization: Bearer YOUR_API_TOKEN

Endpoints

Health Check

GET /health

Returns server status.

Response:

{
  "status": "ok",
  "version": "3.3.0",
  "uptime": 3600
}

Get Current File

GET /editor/file

Returns the currently active file information.

Response:

{
  "path": "/workspace/src/index.ts",
  "language": "typescript",
  "lineCount": 150,
  "cursorLine": 42
}

Insert Text

POST /editor/insert

Insert text at the current cursor position.

Request:

{
  "text": "const newVariable = 'hello';",
  "line": 42,
  "column": 0
}

Replace Selection

POST /editor/replace

Replace the current selection.

Request:

{
  "text": "new content here",
  "startLine": 10,
  "startColumn": 0,
  "endLine": 15,
  "endColumn": 5
}

Execute AI Command

POST /ai/complete

Send a prompt to the AI and get a completion.

Request:

{
  "prompt": "Write a function to sort an array",
  "language": "typescript",
  "context": "// Current file content..."
}

Response:

{
  "completion": "function sortArray(arr: number[]): number[] {\n  return arr.sort((a, b) => a - b);\n}",
  "tokens": 25
}

Run Agent Task

POST /agent/run

Start an autonomous agent task.

Request:

{
  "task": "Add error handling to all API endpoints",
  "files": ["src/api/*.ts"],
  "model": "gpt-4o"
}

Response:

{
  "taskId": "abc-123",
  "status": "running",
  "estimatedTime": 30
}

Get Agent Status

GET /agent/status/:taskId

Check the status of a running agent task.

Response:

{
  "taskId": "abc-123",
  "status": "completed",
  "changes": [
    { "file": "src/api/users.ts", "action": "modified" },
    { "file": "src/api/orders.ts", "action": "modified" }
  ]
}

Git Operations

GET /git/status
GET /git/branches
POST /git/commit
POST /git/push
POST /git/pull

WebSocket API

For real-time events, connect to the WebSocket:

ws://localhost:27432/events

Events

EventDescription
file:openA file was opened
file:saveA file was saved
ai:completeAI completion was triggered
agent:startAgent task started
agent:completeAgent task completed
git:commitA commit was made

Extension API

Build extensions for List Coder using the Extension API:

import { Extension, registerCommand } from 'list-coder-api';

export class MyExtension extends Extension {
  activate() {
    registerCommand('myExtension.hello', () => {
      this.showNotification('Hello from my extension!');
    });
  }

  deactivate() {
    // Cleanup
  }
}

Webhooks

Configure webhooks in Settings → Advanced → Webhooks to receive notifications:

{
  "webhooks": [
    {
      "url": "https://your-server.com/webhook",
      "events": ["agent:complete", "git:commit"],
      "secret": "your-webhook-secret"
    }
  ]
}

Rate Limits

EndpointLimit
/ai/complete60 requests/minute
/agent/run5 concurrent tasks
All others120 requests/minute

Error Responses

All errors follow this format:

{
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Too many requests. Please wait.",
    "retryAfter": 30
  }
}