The DB9 REST API lets you manage databases, execute SQL, and interact with the platform programmatically. All customer endpoints live under https://api.db9.ai/customer.
For most use cases, the CLI or TypeScript SDK provide a more ergonomic interface. The REST API is ideal for custom integrations, CI/CD pipelines, or languages without an SDK.
All requests require a Bearer token in the Authorization header:
curl -H "Authorization: Bearer $DB9_API_KEY " https://api.db9.ai/customer/databases
Obtain tokens via:
db9 token create (CLI)
db9 login --api-key <KEY> (sets DB9_API_KEY)
Anonymous bootstrap (/customer/anonymous-register)
Method Path Description GET /customer/meCurrent customer identity and profile POST /customer/anonymous-registerCreate anonymous account and session POST /customer/anonymous-refreshRefresh anonymous session tokens POST /customer/claimUpgrade anonymous account with Auth0 id_token POST /customer/adopt-anonymous-databases/preflightPre-check database adoption eligibility and quotas POST /customer/adopt-anonymous-databasesTransfer databases from anonymous account
Field Type Required Description anonymous_idstring yes Anonymous customer ID
Preflight (POST /customer/adopt-anonymous-databases/preflight):
Field Type Required Description anonymous_customer_idstring yes Customer ID of the anonymous account anonymous_secretstring yes Secret for the anonymous account
Execute (POST /customer/adopt-anonymous-databases):
Field Type Required Description anonymous_customer_idstring yes Customer ID of the anonymous account anonymous_secretstring yes Secret for the anonymous account database_idsstring[] yes List of database IDs to adopt (max 100) idempotency_keystring yes Unique key for idempotent retries
Method Path Description POST /customer/databasesCreate a database GET /customer/databasesList all databases GET /customer/databases/{database_id}Get database details and connection info DELETE /customer/databases/{database_id}Delete a database POST /customer/databases/{database_id}/reset-passwordReset admin password GET /customer/databases/{database_id}/credentialsGet stored admin credentials GET /customer/databases/{database_id}/schemaGet database schema (tables, columns, types) GET /customer/databases/{database_id}/observabilityGet metrics and query samples
Field Type Required Description namestring yes Database name regionstring no Deployment region admin_passwordstring no Admin password (auto-generated if omitted)
Method Path Description POST /customer/databases/{database_id}/sqlExecute SQL query POST /customer/databases/{database_id}/dumpExport schema and data as SQL ({"ddl_only": true} for schema only)
"query" : "SELECT * FROM users"
Field Type Required Description querystring no Inline SQL query file_contentstring no SQL content (alternative to query)
Provide either query or file_content, not both.
Method Path Description POST /customer/databases/{database_id}/connect-tokenMint short-lived connect token JWT ({"role": "admin"}) POST /customer/databases/{database_id}/connect-keysCreate long-lived DB Connect Key ({"role": "admin", "scopes": [...]}) GET /customer/databases/{database_id}/connect-keysList DB Connect Keys (metadata only) DELETE /customer/databases/{database_id}/connect-keys/{key_id}Revoke a DB Connect Key
Method Path Description GET /customer/databases/{database_id}/auth-configGet browser data-plane auth config PUT /customer/databases/{database_id}/auth-configUpsert browser data-plane auth config
"jwks_url" : "https://example.com/.well-known/jwks.json" ,
"issuer" : "https://example.com"
Field Type Required Description auth_modestring no Authentication mode (e.g. byo_jwt) byo_jwtobject no Bring-your-own JWT configuration
Method Path Description POST /customer/databases/{database_id}/publishable-keysCreate publishable browser key GET /customer/databases/{database_id}/publishable-keysList publishable keys (metadata only) DELETE /customer/databases/{database_id}/publishable-keys/{key_id}Revoke a publishable key
"allowed_origins" : [ "https://example.com" ],
"exposed_schemas" : [ "public" ],
"exposed_tables" : [ "posts" , "comments" ],
"rate_limit" : { "rps" : 100 , "burst" : 200 },
Field Type Required Description namestring no Key name allowed_originsstring[] no CORS allowed origins exposed_schemasstring[] no Schemas accessible via this key exposed_tablesstring[] no Tables accessible via this key rate_limitobject no Rate limiting (rps, burst) expires_in_daysnumber no Key expiration in days
Method Path Description POST /customer/databases/{database_id}/service-keysCreate service key for server-side access GET /customer/databases/{database_id}/service-keysList service keys (metadata only) DELETE /customer/databases/{database_id}/service-keys/{key_id}Revoke a service key
Method Path Description GET /customer/databases/{database_id}/usersList database users POST /customer/databases/{database_id}/usersCreate a database user DELETE /customer/databases/{database_id}/users/{username}Delete a database user
Method Path Description GET /customer/databases/{database_id}/migrationsList applied migrations POST /customer/databases/{database_id}/migrationsApply a migration ({"name": "...", "sql": "...", "checksum": "..."})
Method Path Description POST /customer/databases/{database_id}/branchCreate a branch (schema copy)
"name" : "feature-branch" ,
"snapshot_at" : "2026-03-22T06:00:00Z"
Field Type Required Description namestring yes Branch name snapshot_atstring no RFC 3339 UTC timestamp for point-in-time branching (omit to branch from current state)
Method Path Description POST /customer/databases/{database_id}/fs-connectObtain filesystem WebSocket connection details
Method Path Description POST /customer/databases/{database_id}/functionsDeploy a function (see fields below) GET /customer/databases/{database_id}/functionsList deployed functions POST /customer/databases/{database_id}/functions/{function_id}/invokeInvoke a function ({"input": {...}}) GET /customer/databases/{database_id}/functions/{function_id}/runsList function runs GET /customer/databases/{database_id}/functions/{function_id}/runs/{run_id}Get function run details GET /customer/databases/{database_id}/functions/{function_id}/runs/{run_id}/logsGet function run logs
"entrypoint" : "index.handler" ,
"bundle_ref" : "s3://bucket/bundle.zip" ,
"bundle_digest" : "sha256:abc123" ,
"limits" : { "timeout_ms" : 30000 },
"network_allowlist" : [ "https://api.example.com" ],
"fs9_scope" : { "read" : [ "/data" ], "write" : [] },
"secret_bindings" : [ "API_KEY" ],
"cron_schedule" : "*/5 * * * *"
Field Type Required Description namestring yes Function name entrypointstring yes Function entrypoint (e.g. index.handler) bundle_refstring yes Bundle storage reference bundle_digeststring no Bundle content digest for integrity run_asstring no Database role to execute as bypass_rlsboolean no Bypass Row-Level Security limitsobject no Execution limits network_allowliststring[] no Allowed outbound network destinations fs9_scopeobject no Filesystem access scope secret_bindingsstring[] no Secrets to bind to the function cron_schedulestring no Cron expression for scheduled execution
Field Type Required Description inputobject no Function input payload idempotency_keystring no Unique key for idempotent invocations
Method Path Description POST /customer/tokensCreate API token GET /customer/tokensList API tokens DELETE /customer/tokens/{token_id}Revoke a token