Documentation/API Reference

REST API

The same API the DBCraft web app uses. Everything you can do in the UI, you can script.

Connecting an AI agent?

Use the MCP server instead. It has OAuth with per-scope consent, tokens that cannot reach this API, and 22 tools designed for agents.

MCP server

Base URL

https://your-dbcraft-instance.com/api/v1

Authentication

Sign in with POST /api/v1/auth/login, then send the access token on every request:

Authorization: Bearer <access-token>

Access tokens are short-lived (5 minutes by default). Call /api/v1/auth/refresh with the refresh token to get a new one. Sessions idle for more than 15 minutes cannot be refreshed and need a fresh sign-in.

Endpoints

Authentication

MethodEndpointDescription
POST/api/v1/auth/loginSign in and receive an access token and a refresh token
POST/api/v1/auth/refreshExchange a refresh token for a new access token
POST/api/v1/auth/logoutRevoke the session behind a refresh token
POST/api/v1/auth/change-passwordChange your password (12 characters minimum)
GET/api/v1/auth/setup-statusWhether a fresh install still needs its first admin

Data sources

MethodEndpointDescription
GET/api/v1/datasourcesList data sources you can use
POST/api/v1/datasourcesCreate a data source
GET/api/v1/datasources/:idGet one data source (credentials are never returned)
POST/api/v1/datasources/:id/testTest a saved connection
GET/api/v1/datasources/:id/schemaDatabases, tables and columns
GET/api/v1/datasources/:id/notesCurated schema notes

Queries

MethodEndpointDescription
POST/api/v1/queries/executeRun a read-only query
POST/api/v1/queries/exportRun a query and download CSV, JSON or SQL inserts
GET/api/v1/queries/historyYour recent queries
GET/api/v1/queries/savedList saved queries
POST/api/v1/queries/savedSave a query

Dashboards and charts

MethodEndpointDescription
GET/api/v1/dashboardsList dashboards
POST/api/v1/dashboardsCreate a dashboard
GET/api/v1/dashboards/:idGet a dashboard with layout and filters
PUT/api/v1/dashboards/:idUpdate a dashboard
GET/api/v1/dashboards/:id/chartsList a dashboard's charts
POST/api/v1/dashboards/:id/chartsAdd a chart
POST/api/v1/dashboards/:id/shareTurn the public link on or off
GET/api/v1/dashboards/:id/historyEdit history

Spaces and collections

MethodEndpointDescription
GET/api/v1/spacesList spaces (multi-dashboard share links)
POST/api/v1/spaces/:id/shareShare a space
GET/api/v1/collections/treeYour collection hierarchy

Public and health

MethodEndpointDescription
GET/api/v1/public/dashboard/:tokenA shared dashboard with chart results (no auth)
GET/api/v1/public/space/:tokenA shared space (no auth)
GET/healthHealth check

Users, organisations, invitations and admin settings live under /api/v1/users, /api/v1/organizations and /api/v1/admin.

Need help?

Building an integration and stuck on something? Drop us a line and we'll walk you through it.

Email us