Skip to content
dtoolkit

REST API

All dtoolkit services expose REST APIs alongside their MCP interfaces on the same port. Every endpoint requires a Bearer token in the Authorization header unless noted otherwise.

terminal
curl -H "Authorization: Bearer <token>" http://localhost:7878/health

All services use the same auth pattern:

HeaderValue
AuthorizationBearer <api-key>
Content-Typeapplication/json

Keys are managed per-service. For shared brains (dbrain), additional keys can be issued to connected clients via the /keys endpoints.


Default port: 7878 (REST + MCP) | 7879 (dashboard)

The dbrain API provides CRUD access to entities, facts, conversations, and full-text search with optional federation across connected brains.

MethodPathDescription
GET/entitiesList all entities. Supports ?category= and ?type= query filters.
GET/entities/:nameGet a single entity by name, including its facts and metadata.
POST/entitiesCreate a new entity. Body: { name, category, type?, metadata? }.
MethodPathDescription
GET/entities/:name/factsList all facts for an entity. Supports ?tier= filter (hot, warm, cold).
POST/entities/:name/factsAdd a fact to an entity. Body: { content, tier?, source? }.
MethodPathDescription
GET/searchFull-text search across entities and facts. Query params: q (required), federated (boolean, searches connected brains when true).
MethodPathDescription
GET/conversationsList stored conversation logs.
POST/conversationsStore a conversation log entry. Body: { messages, source?, metadata? }.
MethodPathDescription
GET/workspaceGet the current workspace context (identity, project facts, injected context).
MethodPathDescription
GET/keysList all API keys. Shared brains only.
POST/keysCreate a new API key. Shared brains only. Body: { label? }.
MethodPathDescription
GET/connectionsList all federated brain connections (shared brains this instance connects to).
MethodPathDescription
POST/compactTrigger compaction: deduplicates facts, recalculates memory tiers. Admin-only.
GET/healthHealth check. Returns server status, brain type, and version. No auth required.

Default port: 7881 (REST + MCP) | 7882 (dashboard)

The dwork API manages projects, tasks (backed by BACKLOG.md files), docs, and provides full-text search across all project data.

MethodPathDescription
GET/projectsList all projects with summary stats.
GET/projects/:slugGet a single project by slug, including task counts and recent activity.
POST/projectsCreate a new project. Body: { name, slug?, description? }. Scaffolds the project directory and BACKLOG.md.
PATCH/projects/:slugUpdate project metadata. Body: { name?, description?, status? }.
MethodPathDescription
GET/projects/:slug/tasksList all tasks for a project. Supports ?status= filter (backlog, in-progress, done, blocked).
GET/projects/:slug/tasks/:idGet a single task by ID.
POST/projects/:slug/tasksCreate a task. Body: { title, description?, status?, priority? }. Writes to BACKLOG.md.
PATCH/projects/:slug/tasks/:idUpdate a task. Body: { title?, status?, priority?, description? }.
MethodPathDescription
GET/projects/:slug/docsList all docs for a project (numbered markdown files).
GET/projects/:slug/docs/:idGet a single doc by ID.
POST/projects/:slug/docsCreate a doc. Body: { title, content }.
PATCH/projects/:slug/docs/:idUpdate a doc. Body: { title?, content? }.
MethodPathDescription
GET/searchFull-text search across all projects, tasks, and docs. Query param: q (required).
GET/overviewGlobal overview: project count, task distribution by status, recent activity.
MethodPathDescription
POST/syncRe-index all markdown files into SQLite FTS5. Use after manual edits to BACKLOG.md or doc files.
GET/healthHealth check. Returns server status and version. No auth required.
GET/keysList API keys.
POST/keysCreate a new API key.

Default port: 7883 (REST + MCP) | 7884 (dashboard)

The dops API provides agent session tracking, cost analysis, and transcript ingestion from multiple AI coding CLIs.

MethodPathDescription
GET/sessionsList ingested agent sessions. Supports ?provider= and ?limit= query params.
GET/sessions/:idGet a single session with full tool-call and token breakdown.
MethodPathDescription
GET/statsAggregated stats: total sessions, tokens, tool calls, success rate, errors. Supports ?from= and ?to= date filters.
GET/costsCost breakdown by provider, model, and time period. Supports ?from=, ?to=, ?group_by= (day, week, month).
MethodPathDescription
POST/ingestIngest a transcript from a supported CLI. Body: { provider, transcript, metadata? }. Accepts Claude, Codex, Gemini, and OpenCode transcript formats.
MethodPathDescription
GET/healthHealth check. Returns server status and version. No auth required.

Default port: 7880

The dproxy API exposes the same capabilities as the CLI (dproxy ask and dproxy chat) over HTTP, with optional SSE streaming.

MethodPathDescription
POST/askExecute a single prompt. Body: { prompt, provider?, model?, context? }. Returns the full response. Set stream: true in the body for SSE streaming.
POST/chatSend a message in a conversation. Body: { message, conversation_id?, provider?, model? }. Maintains conversation history. Set stream: true for SSE.

When stream: true is included in the request body, the response uses Content-Type: text/event-stream and emits AdapterStreamEvent objects:

terminal
curl -N -H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"prompt": "explain dtoolkit", "stream": true}' \
http://localhost:7880/ask

Events follow the AdapterStreamEvent type defined in @dtoolkit/core:

Event typeDescription
startStream opened, includes model and provider metadata.
deltaIncremental text chunk.
tool_useTool call made by the model.
doneStream complete, includes token usage summary.
errorAn error occurred during execution.
MethodPathDescription
GET/historyList recent prompt/response history. Supports ?limit= query param.
GET/healthHealth check. Returns server status, available providers, and version. No auth required.

ServiceREST + MCPDashboardDefault key location
dbrain78787879~/.dbrain/config.json
dproxy7880~/.dproxy/config.json
dwork78817882~/.dwork/config.json
dops78837884~/.dops/config.json

All services return errors in a consistent JSON format:

{
"error": "not_found",
"message": "Entity 'foo' does not exist"
}
Status codeMeaning
400Bad request — invalid or missing parameters.
401Unauthorized — missing or invalid Bearer token.
403Forbidden — insufficient permissions (e.g., write to read-only brain).
404Not found — resource does not exist.
500Internal server error.
  • MCP Tools Reference — full reference for all MCP tools exposed by dbrain, dwork, and dops
  • CLI Reference — command-line interfaces for all dtoolkit services
  • Getting Started — install and configure dtoolkit
  • dbrain — persistent memory server deep dive
  • dwork — AI-native project manager deep dive
  • dops — agent observability deep dive
  • dproxy — universal CLI adapter deep dive