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 serverBase 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
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/auth/login | Sign in and receive an access token and a refresh token |
| POST | /api/v1/auth/refresh | Exchange a refresh token for a new access token |
| POST | /api/v1/auth/logout | Revoke the session behind a refresh token |
| POST | /api/v1/auth/change-password | Change your password (12 characters minimum) |
| GET | /api/v1/auth/setup-status | Whether a fresh install still needs its first admin |
Data sources
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/datasources | List data sources you can use |
| POST | /api/v1/datasources | Create a data source |
| GET | /api/v1/datasources/:id | Get one data source (credentials are never returned) |
| POST | /api/v1/datasources/:id/test | Test a saved connection |
| GET | /api/v1/datasources/:id/schema | Databases, tables and columns |
| GET | /api/v1/datasources/:id/notes | Curated schema notes |
Queries
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/queries/execute | Run a read-only query |
| POST | /api/v1/queries/export | Run a query and download CSV, JSON or SQL inserts |
| GET | /api/v1/queries/history | Your recent queries |
| GET | /api/v1/queries/saved | List saved queries |
| POST | /api/v1/queries/saved | Save a query |
Dashboards and charts
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/dashboards | List dashboards |
| POST | /api/v1/dashboards | Create a dashboard |
| GET | /api/v1/dashboards/:id | Get a dashboard with layout and filters |
| PUT | /api/v1/dashboards/:id | Update a dashboard |
| GET | /api/v1/dashboards/:id/charts | List a dashboard's charts |
| POST | /api/v1/dashboards/:id/charts | Add a chart |
| POST | /api/v1/dashboards/:id/share | Turn the public link on or off |
| GET | /api/v1/dashboards/:id/history | Edit history |
Spaces and collections
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/spaces | List spaces (multi-dashboard share links) |
| POST | /api/v1/spaces/:id/share | Share a space |
| GET | /api/v1/collections/tree | Your collection hierarchy |
Public and health
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/public/dashboard/:token | A shared dashboard with chart results (no auth) |
| GET | /api/v1/public/space/:token | A shared space (no auth) |
| GET | /health | Health 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