DBKnox API Reference
Complete REST API documentation for the DBKnox platform. Base URL: https://api.dbknox.com/api/v1
Overview
The DBKnox API is a RESTful HTTP API that returns JSON. All requests and responses use Content-Type: application/json. Timestamps are ISO 8601 strings in UTC. IDs use a prefixed format: db_01hx…, ten_01hx…, usr_01hx….
https://api.dbknox.com/api/v1Authorization: Bearer <token>application/jsondbp_Authentication
The DBKnox API supports two authentication methods:
1. JWT Bearer Token
Obtained by calling POST /auth/login and completing the MFA challenge. Access tokens expire after 15 minutes; use the refresh token to obtain a new one.
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...
2. API Key
Long-lived keys prefixed with dbp_. Generated in Settings → API Keys. Keys are shown once at creation and stored hashed — treat them as passwords.
Authorization: Bearer dbp_live_a1b2c3d4e5f6...
Token scope
Both JWT tokens and API keys carry your tenant ID and role. The API enforces RBAC on every request — a member-role token cannot call endpoints that require admin.
Rate Limits
Rate limits are applied per tenant per IP address. Exceeding the limit returns 429 Too Many Requests with a Retry-After header.
| Endpoint group | Limit | Window |
|---|---|---|
| General API | 100 requests | per minute |
AI SQL Chat (/chat) | 30 requests | per minute |
Auth endpoints (/auth) | 10 requests | per minute |
| Report generation | 5 requests | per minute |
Auth Endpoints
/auth/registerPublicRegister a new user account. Returns a verification token./auth/loginPublicInitiate login with email and password. Returns MFA challenge token./auth/mfa/verifyPublicComplete MFA challenge with TOTP code or WebAuthn assertion. Returns JWT access + refresh tokens./auth/refreshPublicExchange a refresh token for a new access token./auth/logoutJWTInvalidate the current session and revoke the refresh token./auth/sso/saml/initPublicInitiate SAML SSO flow. Returns the IdP redirect URL./auth/sso/saml/callbackPublicSAML assertion consumer service endpoint. Issues JWT on success./auth/webauthn/registerJWTRegister a WebAuthn credential (passkey or hardware key)./auth/webauthn/authenticatePublicAuthenticate with a registered WebAuthn credential./auth/mfa/setupJWTGenerate a TOTP secret and QR code for MFA enrollment./auth/mfa/enableJWTConfirm MFA enrollment by verifying the first TOTP code.Databases Endpoints
/databasesJWTList all database connections for the current tenant. Paginated./databasesJWTCreate a new database connection. Credentials are encrypted at rest./databases/:idJWTGet a single database connection by ID. Credentials never returned./databases/:idJWTUpdate a database connection (name, host, SSL config, etc.)./databases/:idJWTSoft-delete a database connection. Starts the 30-day restore window./databases/:id/restoreJWTRestore a soft-deleted database connection within the 30-day window./databases/:id/testJWTTest a database connection. Returns latency and engine validation result./databases/bulkJWTCreate multiple database connections in a single request (max 20)./databases/:id/healthJWTGet the latest health check result and score for a specific database./databases/:id/schemaJWTIntrospect and return the database schema (tables, columns, indexes).Chat Endpoints
AI SQL Chat uses a session model. Create a session for a database, then send messages. Results are streamed via WebSocket; this endpoint returns the initial evaluation.
/chat/sessionsJWTCreate a new chat session for a database. Returns session ID and WebSocket URL./chat/sessionsJWTList all chat sessions for the current user. Paginated./chat/sessions/:idJWTGet a chat session with full message history./chat/sessions/:id/messagesJWTSend a natural language message. Returns generated SQL and safety level evaluation./chat/sessions/:id/confirmJWTConfirm execution of a high-risk query. Required before execution proceeds.Fleet Endpoints
/fleet/healthJWTGet fleet-wide health overview: score, database count, status breakdown./fleet/health/:dbIdJWTGet health history for a specific database. Includes pass/warn/fail timeline./fleet/patternsJWTGet recurring failure patterns and cross-database correlations for the fleet./fleet/checksJWTCreate a custom health check definition with SQL query and pass/fail threshold./fleet/checksJWTList all health check definitions (built-in and custom) for the tenant./fleet/checks/:idJWTDelete a custom health check definition./fleet/health/:dbId/runJWTTrigger an on-demand health check run for a specific database.Reports Endpoints
/reportsJWTGenerate a PDF health report for a database. Enqueues a background job. Returns job ID./reports/:jobId/statusJWTPoll report generation job status (queued / processing / completed / failed)./reports/:reportId/downloadJWTGet a time-limited signed URL to download the generated PDF report./reportsJWTList all generated reports for the tenant. Paginated, sortable by date./reports/scheduleJWTCreate a scheduled report for a database with a cron expression./reports/schedule/:idJWTDelete a scheduled report configuration.Scheduler Endpoints
/scheduler/jobsJWTList all scheduled jobs for the tenant (health checks, reports). Includes next run time./scheduler/jobsJWTCreate a new scheduled job. Accepts a job type, database ID, and cron expression./scheduler/jobs/:idJWTUpdate the cron expression or configuration of a scheduled job./scheduler/jobs/:idJWTDelete a scheduled job and remove it from the BullMQ queue./scheduler/jobs/:id/historyJWTGet execution history for a scheduled job (last 100 runs with start time, duration, outcome).Webhooks Endpoints
/webhooksJWTRegister a new webhook endpoint with a URL and event subscriptions./webhooksJWTList all registered webhooks for the tenant./webhooks/:idJWTGet webhook details including delivery history and failure rate./webhooks/:idJWTUpdate the URL or event subscriptions for a webhook./webhooks/:idJWTDelete a webhook registration./webhooks/:id/testJWTSend a test delivery to a webhook endpoint.Tenant Endpoints
/tenant/usageJWTGet current usage metrics: database count, member count, plan limits./tenant/settingsJWTGet tenant configuration: AI provider, retention policy, check frequency./tenant/settingsJWTUpdate tenant settings. Requires admin role./tenant/ai-providerJWTConfigure the LLM provider and API key for AI SQL Chat. Admin only. Key stored encrypted.Users Endpoints
/users/meJWTGet the current user's profile including role and MFA status./users/meJWTUpdate profile: display name, email, notification preferences./usersJWTList all team members for the tenant. Admin/owner only./users/:id/roleAdminChange a team member's role. Admin only. Logged in audit trail./users/:idAdminRemove a team member from the tenant. Admin only./users/inviteAdminInvite a new user by email. Sends an invitation link with a time-limited token./users/api-keysJWTList the current user's API keys (names and creation dates; never the key value)./users/api-keysJWTCreate a new API key. The key value (dbp_…) is returned once only./users/api-keys/:idJWTRevoke an API key immediately.Admin Endpoints
Admin endpoints require the admin role. They surface soft-deleted resources, audit log data, and agent policy management.
/admin/databases/deletedAdminList soft-deleted database connections still within the 30-day restore window./admin/audit-logAdminQuery the immutable audit log. Filterable by actor, event type, and time range./admin/agent/policyAdminUpdate the Proactive AI Agent policy (Enterprise). Controls which recommendation categories the agent generates./admin/agent/runsAdminList Proactive AI Agent run history with findings and actions (Enterprise).Health Probe Endpoints
These endpoints are used by load balancers and orchestrators. They do not require authentication.
/health/livePublicLiveness probe. Returns {"status":"ok"} if the process is running./health/readyPublicReadiness probe. Returns 200 only when the database and Redis connections are healthy.Example Request
List all databases for the current tenant:
curl -X GET https://api.dbknox.com/api/v1/databases \
-H "Authorization: Bearer dbp_live_a1b2c3d4..." \
-H "Content-Type: application/json"
Response:
{
"data": [
{
"id": "db_01hx_abc123",
"name": "prod-ecommerce",
"engine": "postgresql",
"host": "db.example.com",
"port": 5432,
"ssl_mode": "require",
"health_score": 94,
"status": "healthy",
"created_at": "2024-11-01T10:00:00Z",
"updated_at": "2024-11-23T12:00:00Z"
}
],
"pagination": {
"page": 1,
"page_size": 20,
"total": 1
}
}