API overview
KanbanAI exposes a JSON HTTP API and real-time interfaces (WebSocket and Server-Sent Events) under a versioned/api/v1 prefix (with a legacy /api
shim). This page gives a high-level map of the main resources and how they fit together.
Base URLs
- REST:
- Development (default):
http://localhost:3000/api/v1 - Legacy shim:
http://localhost:3000/api
- Development (default):
- Real-time:
- WebSocket:
- Board channel:
ws://localhost:3000/api/v1/ws?boardId=<boardId> - Dashboard channel:
ws://localhost:3000/api/v1/ws/dashboard - Terminal channel:
ws://localhost:3000/terminals/<cardId>/ws?projectId=<projectId>
- Board channel:
- Server-Sent Events (SSE):
- Board channel:
http://localhost:3000/api/v1/sse?boardId=<boardId>(alternative to WebSocket) - Dashboard channel:
http://localhost:3000/api/v1/sse(global dashboard events)
- Board channel:
- WebSocket:
/api/v1; paths are shown with the full prefix for clarity.
Projects & boards
- Projects:
GET /api/v1/projects– list projects.POST /api/v1/projects– create a project from an existing or new repository.GET /api/v1/projects/:projectId– fetch a single project/board.GET /api/v1/projects/:projectId/github/origin– inspect GitHub origin.GET /api/v1/projects/:projectId/settings– load per-project settings.PATCH /api/v1/projects/:projectId/settings– update per-project settings (branch, remote, defaults, inline agent/profile, optional per-inline-agent profile mapping for workflows like ticket enhancement/PR summary, automation flags, failure tolerance togglesallowScriptsToFail,allowCopyFilesToFail,allowSetupScriptToFail,allowDevScriptToFail,allowCleanupScriptToFail, GitHub Issue settings:githubIssueSyncEnabled,githubIssueSyncState(open/all/closed),githubIssueSyncIntervalMinutes(5–1440 minutes),githubIssueAutoCreateEnabled,autoCloseTicketOnPRMerge,autoCloseTicketOnIssueClose, and custom prompts:enhancePromptandprSummaryPromptfor overriding the default system prompts for ticket enhancement and PR summary generation respectively).POST /api/v1/projects/:projectId/tickets/enhance– send{title, description?, agent?, profileId?}to the configured agent and receive{ticket}with rewritten text (RFC 7807 errors on failure).GET /api/v1/projects/:projectId/enhancements– hydrate persisted enhancement entries. Returns{ enhancements: Record<string, { status: "enhancing" | "ready", suggestion?: { title: string, description?: string } }> }so the UI can show badges and up-to-date suggestions.PUT /api/v1/projects/:projectId/cards/:cardId/enhancement– record a card’s enhancement status ("enhancing"while the job runs,"ready"when the agent response is available) and an optional suggestion payload.DELETE /api/v1/projects/:projectId/cards/:cardId/enhancement– clear the persisted enhancement state after acceptance, rejection, or abandonment.
- Boards:
GET /api/v1/boards/:boardId– board state (columns + cards).POST /api/v1/boards/:boardId/cards– create a card. Accepts optionalcreateGithubIssue: boolean(only effective whengithubIssueAutoCreateEnabledis on) andimages: MessageImage[](array of base64-encoded images; supports PNG, JPEG, WebP up to 10MB each, max 5 images per card). Responds with{ state, cardId, githubIssueError? }.GET /api/v1/boards/:boardId/cards/:cardId/images– fetch images attached to a card. Returns{ images: MessageImage[] }where each image containsdata(base64),mime(image type), and optionalname.PATCH /api/v1/boards/:boardId/cards/:cardId– update card content or move cards (column + index); the payload also acceptsisEnhancedso clients can set/clear the enhancement badge without changing the card text, plusdisableAutoCloseOnPRMergeso tickets can opt out of the auto-close-on-PR-merge workflow even when the project has it enabled.DELETE /api/v1/boards/:boardId/cards/:cardId– delete a card.POST /api/v1/boards/:boardId/cards/:cardId/github/issue– create a GitHub issue for an existing card (only effective whengithubIssueAutoCreateEnabledis on). Responds with{ issueNumber: number; url: string }.POST /api/v1/boards/:boardId/import/github/issues– import GitHub issues as cards.GET /api/v1/boards/:boardId/github/issues/stats– counts linked issues by direction (imported,exported,total).
/api/v1/projects/:projectId/board/*.
Attempts & git
- Attempts:
POST /api/v1/projects/:projectId/cards/:cardId/attempts– start a new Attempt for a card.GET /api/v1/projects/:projectId/cards/:cardId/attempt– fetch the latest Attempt for a card.GET /api/v1/attempts/:id– attempt details.PATCH /api/v1/attempts/:id– stop an Attempt ({status:"stopped"}).POST /api/v1/attempts/:id/messages– send follow-up prompts. Accepts{prompt, profileId?, images?: MessageImage[]}where images is an optional array of base64-encoded images (PNG, JPEG, WebP up to 10MB each, max 5 per message).GET /api/v1/attempts/:id/logs– stream logs/messages.GET /api/v1/attempts/:id/messages– fetch paginated conversation messages. Accepts optional query parameterslimit(default 25) andoffset(default 0). Returns{items: ConversationItem[], total: number, hasMore: boolean}.DELETE /api/v1/attempts/:id/reset– reset an Attempt by clearing conversation history, logs, and todos. Accepts{deleteWorktree: boolean}to optionally delete the git worktree and branch. Returns{attempt, worktreeDeleted: boolean}. Cannot reset running or stopping Attempts.POST /api/v1/projects/:projectId/cards/:cardId/ai-review– trigger AI review for a completed Attempt. Moves the card to AI Review column and starts automated code review.
- Attempt-scoped Git:
GET /api/v1/attempts/:id/git/status– branch + file status for the Attempt worktree.GET /api/v1/attempts/:id/git/file– file content.POST /api/v1/attempts/:id/git/commit– commit changes.POST /api/v1/attempts/:id/git/push– push branch.POST /api/v1/attempts/:id/git/merge– merge into the configured base branch.
GitHub integration
- OAuth / device flow:
POST /api/v1/auth/github/device/startPOST /api/v1/auth/github/device/pollGET /api/v1/auth/github/checkPOST /api/v1/auth/github/logout
- App configuration:
GET /api/v1/auth/github/app– current OAuth app config and origin (db|env|unset).PUT /api/v1/auth/github/app– update OAuth app client ID/secret.
- Pull Requests:
GET /api/v1/projects/:projectId/pull-requests– list PRs.GET /api/v1/projects/:projectId/pull-requests/:number– PR details.POST /api/v1/projects/:projectId/pull-requests– create a PR, optionally linkingbranch,attemptId, andcardId.POST /api/v1/projects/:projectId/pull-requests/summary– ask the configured inline agent to generate a PR title/body summary for a base/head branch pair; accepts optionalattemptId/cardIdso linked GitHub issues can be auto-closed (the response may appendcloses #123/fixes #456lines) and returns{summary}or RFC 7807 errors on failure.
/projects/:projectId/github/pr routes have been removed; all PR operations go through the project-scoped
endpoints above.
Settings, onboarding, and agents
- Onboarding:
GET /api/v1/onboarding/statusPATCH /api/v1/onboarding/progressPOST /api/v1/onboarding/complete
- App settings:
GET /api/v1/settingsPATCH /api/v1/settings
- Agents & profiles:
GET /api/v1/agents– list registered agents and capabilities.GET /api/v1/projects/:projectId/agents/profiles– list profiles (project + global).POST /api/v1/projects/:projectId/agents/profiles– create a profile.PATCH /api/v1/projects/:projectId/agents/profiles/:id– update a profile.DELETE /api/v1/projects/:projectId/agents/profiles/:id– delete a profile.
Filesystem & editor
- Filesystem:
GET /api/v1/fs/git-repos– discover local Git repositories; accepts optionalpathquery.GET /api/v1/fs/browse– browse directories with optional filtering (path, showHidden, executablesOnly).
- Editor:
GET /api/v1/editors/suggestions– list detected and installed editors.POST /api/v1/editors/validate– validate an editor executable path.POST /api/v1/editors/open– open a path in a configured editor.POST /api/v1/attempts/:id/open-editor– open the preferred editor at the Attempt worktree path.
editor.open.requested/succeeded/failed events that surface as system status in the UI.
Dashboard & metrics
- Dashboard:
GET /api/v1/dashboard– returnsDashboardOverview(metrics, active attempts, recent activity, inbox, project snapshots, agent stats).- Supports time-range selection via query:
GET /api/v1/dashboard?timeRangePreset=last_24hGET /api/v1/dashboard?timeRangePreset=last_7dGET /api/v1/dashboard?from=2025-01-01T00:00:00Z&to=2025-01-02T00:00:00Z- Convenience alias:
range=<value>(supports24h,7d,30d,90d,all; each maps to the matchingtimeRangePreset).GET /api/v1/dashboard?range=24h→ shorthand fortimeRangePreset=last_24h; unknown values return HTTP400.
- Precedence: explicit
from/towins, otherwise a providedtimeRangePresetis used beforerange.
- The
DashboardOverview.metaobject includesavailableTimeRangePresets(allowed presets) andversion(forward-compatible version string). - The handler maps these parameters into the shared
DashboardTimeRangetype and echoes it on the response.
- Supports time-range selection via query:
- Real-time channels:
- WebSocket:
GET /api/v1/ws/dashboard(see realtime docs). - SSE:
GET /api/v1/sse– subscribe to dashboard overview updates via Server-Sent Events.
- WebSocket:
- Metrics:
GET /api/v1/metrics– minimal Prometheus-style metrics for liveness.GET /api/v1/healthz,GET /api/v1/readyz– health probes.
Server metadata
GET /api/v1/version– returns{currentVersion, latestVersion, updateAvailable, checkedAt}.currentVersionis derived fromKANBANAI_VERSIONor the nearestkanban-aipackage.json.latestVersionis fetched from GitHub Releases (KANBANAI_UPDATE_REPO,KANBANAI_UPDATE_TOKEN), cached for ~15 minutes, and falls back tocurrentVersionwhen the lookup fails.updateAvailablelets clients know when a newer release exists so UI can prompt for restart.
Worktrees management
- Worktrees:
GET /api/v1/projects/:projectId/worktrees– list all tracked, orphaned, and stale worktrees with summary statistics.POST /api/v1/projects/:projectId/worktrees/sync– scan the filesystem and database to discover new orphaned and stale worktrees.DELETE /api/v1/projects/:projectId/worktrees/:id– delete a tracked worktree with options (force,diskOnly,deleteBranch,deleteRemoteBranch).DELETE /api/v1/projects/:projectId/worktrees/orphaned/:encodedPath– delete an orphaned worktree found on disk.DELETE /api/v1/projects/:projectId/worktrees/stale/:id– remove a stale database entry for a worktree that no longer exists on disk.
Terminals
Terminals are available for cards in “In Progress” or “Review” columns with active worktrees.
- Terminal support:
GET /api/v1/terminals/status– check if terminals are supported on the current platform (returns{supported: boolean, reason: string | null, platform: string}).
- Project terminals:
GET /api/v1/projects/:projectId/terminals– list active terminals for a project.GET /api/v1/projects/:projectId/terminals/eligible– list cards eligible for terminal access.
- Card terminals:
GET /api/v1/terminals/:cardId– get terminal session info.POST /api/v1/terminals/:cardId/resize– resize terminal (cols, rows).DELETE /api/v1/terminals/:cardId– force close a terminal.
- WebSocket:
ws://host/terminals/:cardId/ws?projectId=:projectId– bidirectional terminal I/O.- Client → Server:
{type: 'data', data: string}or{type: 'resize', cols, rows}. - Server → Client:
{type: 'data', data: string},{type: 'exit', code}, or{type: 'error', message}.
core/realtime-and-websockets.md.