REST API reference

July 29, 2026 ยท View on GitHub

This reference is for client developers and integrators. After reading it, you can find the local API base URL, response format, auth headers, resource endpoints, session endpoints, and artifact endpoints.

Default service address:

http://127.0.0.1:8787

General conventions

Most JSON endpoints return an envelope:

{
  "success": true,
  "data": {}
}

Error responses:

{
  "success": false,
  "error": {
    "code": "RESOURCE_NOT_FOUND",
    "message": "resource not found"
  }
}

File downloads and artifact downloads return binary responses; upload endpoints use multipart/form-data.

Identity and auth

Only password session cookies and CSRF are supported. Business requests need the df_session cookie from login; unsafe methods also need X-CSRF-Token from the df_csrf cookie:

X-CSRF-Token: <token_from_df_csrf_cookie>

Web v1 does not expose workspace switching; custom integrations should use the workspace bound to the login session unless they manage workspace routing themselves. /api/v1/* and POST /api/copilotkit must share the same session, or sessions, resources, files, artifacts, and run events can appear under different users.

Identity endpoints

MethodPathPurpose
GET/api/v1/meRead the current user and workspace.

Password auth endpoints

MethodPathPurpose
GET/api/v1/auth/statusRead public auth status (registrationEnabled; no secrets).
POST/api/v1/auth/registerCreate a user account and verification token.
POST/api/v1/auth/loginSign in and set df_session and df_csrf cookies.
POST/api/v1/auth/verify-emailVerify an email token.
POST/api/v1/auth/password/forgotRequest a password reset.
POST/api/v1/auth/password/resetReset a password with a token.
GET/api/v1/auth/csrfRead the current CSRF token.
POST/api/v1/auth/logoutSign out the current session.
POST/api/v1/auth/logout-allRevoke all sessions for the current user.
GET/api/v1/auth/sessionsList active sessions for the current user.
DELETE/api/v1/auth/sessions/:idRevoke one session.
POST/api/v1/auth/password/changeChange the current user's password.

Health and capabilities

MethodPathPurpose
GET/healthzProcess liveness.
GET/readyReadiness: Mastra / builtins finished; response includes startup_ms and phases.
GET/api/v1/capabilitiesRead backend capability switches.
GET/api/v1/meRead current identity.
curl http://127.0.0.1:8787/healthz
curl http://127.0.0.1:8787/ready
curl http://127.0.0.1:8787/api/v1/capabilities

Agent Runtime

MethodPathPurpose
POST/api/copilotkitStart an agent run; returns AG-UI event stream.
POST/api/v1/runs/:id/cancelCancel a running agent run.

POST /api/copilotkit uses CopilotKit / AG-UI RunAgentInput. See Agent Runtime and AG-UI reference.

Sessions

MethodPathPurpose
GET/api/v1/sessionsList server sessions. Supports limit, cursor.
PATCH/api/v1/sessions/:sessionIdUpdate session title.
DELETE/api/v1/sessions/:sessionIdPermanently delete a session and its conversation, runs, artifacts, and child branches.
GET/api/v1/sessions/:sessionId/conversationRead authoritative server conversation history. Supports limit.
GET/api/v1/sessions/:sessionId/checkpointsList persisted context checkpoints. Supports limit.
GET/api/v1/sessions/:sessionId/trace-dagRead the semantic run/step/tool/output graph. Supports limit.
POST/api/v1/sessions/:sessionId/branchesCreate a persistent branch from an ended run or checkpoint. Body: { "runId": "..." } or { "checkpointId": "..." }.
GET/api/v1/checkpoints/:checkpointIdRead checkpoint metadata.
GET/api/v1/checkpoints/:checkpointId/context-packageRead checkpoint metadata and its context snapshot.

Session APIs restore history for Web/TUI, display titles, read tool-call pairings, and support re-asking from checkpoints. The conversation response includes messages, runEventRefs, toolCalls, and may include checkpoints, branch, and branches. Each checkpoint is derived from existing run, message, and run-event records and includes runId, status, message position bounds, event seq bounds, start/finish times, and optional error text; it marks the recoverable history boundary for one run. Branch sessions reference parent history up to the fork checkpoint instead of copying messages, so reading a branch returns the visible parent prefix plus the branch's own messages.

Workspace configuration

MethodPathPurpose
GET/api/v1/workspace-configRead workspace resource defaults.
PATCH/api/v1/workspace-configUpdate default enablement.
GET/api/v1/run-defaultsRead run default configuration.

These routes proxy a compatible Data Link or DataGraph MCP resource configured in the current workspace. They do not provide an embedded graph service.

MethodPathPurpose
GET/api/v1/datalink/serversList compatible configured servers.
GET/api/v1/datalink/:serverId/graphRead and normalize the workspace graph.
POST/api/v1/datalink/:serverId/exploreExplore the graph from a natural-language query.
POST/api/v1/datalink/:serverId/tablesAdd a table source through the configured service.
DELETE/api/v1/datalink/:serverId/tables/:tableIdRemove a table through the configured service.
POST/api/v1/datalink/:serverId/rebuildRebuild the external graph.

/api/v1/datagraph/* is accepted as an alias for /api/v1/datalink/*.

Data sources

MethodPathPurpose
GET/api/v1/datasource-typesDiscover supported data source types and field schema.
GET/api/v1/datasourcesList data sources.
POST/api/v1/datasourcesCreate a data source.
GET/api/v1/datasources/:idRead data source details.
PATCH/api/v1/datasources/:idUpdate a data source.
DELETE/api/v1/datasources/:idDelete a data source.
POST/api/v1/datasources/:id/testTest connection.
POST/api/v1/datasources/:id/introspectFetch schema; returns a job.
GET/api/v1/datasources/:id/schemaRead schema snapshot. Supports q, includeStats.
GET/api/v1/datasources/:id/tables/:table/previewPreview table data. Supports schema, limit, offset, orderBy.

The backend does not expose arbitrary SQL REST endpoints. SQL analysis runs through agent tools.

Models

MethodPathPurpose
GET/api/v1/model-profilesList model profiles.
POST/api/v1/model-profilesCreate a model profile.
GET/api/v1/model-profiles/:idRead a model profile.
PATCH/api/v1/model-profiles/:idUpdate a model profile.
DELETE/api/v1/model-profiles/:idDelete a model profile.
POST/api/v1/model-profiles/:id/testTest provider.

Knowledge bases

MethodPathPurpose
GET/api/v1/knowledge-basesList knowledge bases.
POST/api/v1/knowledge-basesCreate a knowledge base.
GET/api/v1/knowledge-bases/:idRead a knowledge base.
PATCH/api/v1/knowledge-bases/:idUpdate a knowledge base.
DELETE/api/v1/knowledge-bases/:idDelete a knowledge base.
POST/api/v1/knowledge-bases/:id/testValidate configuration.
GET/api/v1/knowledge-bases/:id/filesList documents.
POST/api/v1/knowledge-bases/:id/filesUpload documents.
DELETE/api/v1/knowledge-bases/:id/files/:documentIdHard-delete one document (cascades chunks/FTS/embeddings).
POST/api/v1/knowledge-bases/:id/files/:documentId/reindexReindex one document; success sets status to ready.
POST/api/v1/knowledge-bases/:id/files/importImport from FileAssetRef.
POST/api/v1/knowledge-bases/:id/searchRetrieval debug.
POST/api/v1/knowledge-bases/:id/reindexRebuild index; returns a job. Success marks documents ready.

MCP and Skills

MethodPathPurpose
GET / POST/api/v1/mcp-serversList or create MCP servers.
GET / PATCH / DELETE/api/v1/mcp-servers/:idRead, update, or delete MCP servers.
POST/api/v1/mcp-servers/:id/testTest MCP server.
GET/api/v1/mcp-servers/:id/toolsFetch tools manifest.
GET / POST/api/v1/skillsList or upload Skills.
POST/api/v1/skills/selectPreview Skill filtering for a run.
GET / PATCH / DELETE/api/v1/skills/:idRead, update, or delete Skills.
POST/api/v1/skills/:id/testTest Skill.
POST/api/v1/skills/:id/validateValidate Skill.
POST/api/v1/skills/:id/replaceReplace Skill package.

Files

MethodPathPurpose
GET/api/v1/filesList file assets. Supports scope, origin, source, sessionId.
POST/api/v1/filesBatch upload files. Session id required in multipart field or header.
GET/api/v1/files/:idRead file reference.
POST/api/v1/files/:id/promotePromote session-scoped file to cross-session workspace file.
DELETE/api/v1/files/:idDelete file reference.
GET/api/v1/files/:id/downloadDownload file content.
POST/api/v1/chat/uploadsUpload chat attachments for the current conversation.

Artifacts

MethodPathPurpose
GET/api/v1/artifacts?sessionId=:sessionIdList outputs for a session.
GET/api/v1/artifacts/:idRead artifact details.
GET/api/v1/artifacts/:id/previewRead preview JSON.
GET/api/v1/artifacts/:id/contentRead inline content.
GET/api/v1/artifacts/:id/downloadDownload artifact. Optional format.
POST/api/v1/artifacts/:id/promoteAdd file artifact to workspace files.
POST/api/v1/artifacts/:id/exportExport specified format; returns a job.

Query history

MethodPathPurpose
GET/api/v1/query-historyList SQL query history. Supports sessionId, datasourceId, favorite, limit.
POST/api/v1/query-history/:id/favoriteFavorite a query.
POST/api/v1/query-history/:id/unfavoriteRemove favorite.
PATCH/api/v1/query-history/:idUpdate favorite with { "favorite": true | false }.

Jobs

MethodPathPurpose
GET/api/v1/jobs/:idQuery async job status.
POST/api/v1/jobs/:id/cancelCancel async job.

Write conventions

  • Default JSON body limit is 1 MiB.
  • PATCH supports optimistic concurrency with revision or If-Match.
  • Schema fetch, index rebuild, and artifact export may use Idempotency-Key.
  • Credentials are submitted only when creating or updating resources.
  • Read APIs do not return plaintext passwords, tokens, or full connection strings.

Further reading