Database API
Database API to run single and batch SQL queries, read query logs, and get anomaly detection, optimization, scaling, and natural-language-to-SQL help.
REST API endpoints for Database. 13 operations.
Detect database anomalies
POST /api/v1/anomaliesAnalyzes recent activity and returns a report of detected database anomalies.
Auth: Bearer API key
Responses
| Status | Description |
|---|---|
200 | Anomaly report |
401 | Missing or invalid API key |
500 | Internal error |
operationId: detectAnomalies
Translate natural language to SQL
POST /api/v1/nl-to-sqlGenerates a SQL statement from a natural-language description of the desired query.
Auth: Bearer API key
Responses
| Status | Description |
|---|---|
200 | Generated SQL |
401 | Missing or invalid API key |
500 | Internal error |
operationId: naturalLanguageToSql
Get query optimization suggestions
POST /api/v1/optimizeAnalyzes the tenant's database and returns indexing and query optimization suggestions.
Auth: Bearer API key
Responses
| Status | Description |
|---|---|
200 | Optimization suggestions |
401 | Missing or invalid API key |
500 | Internal error |
operationId: optimizeQuery
List recent query logs
GET /api/v1/query-logs/{tenant_id}Returns recent query-log entries for a tenant, newest first.
Auth: Bearer API key
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
tenant_id | path | string | Yes | Tenant id (UUID) |
limit | query | integer (int64) | No | Max entries to return (default 100, max 1000) |
Responses
| Status | Description |
|---|---|
200 | Recent query log entries |
401 | Missing or invalid API key |
500 | Internal error |
operationId: listQueryLogs
Get scaling suggestions
GET /api/v1/scalingReturns capacity and scaling recommendations for the tenant's database.
Auth: Bearer API key
Responses
| Status | Description |
|---|---|
200 | Scaling suggestions |
401 | Missing or invalid API key |
500 | Internal error |
operationId: getScalingSuggestions
Execute a SQL query
POST /api/v1/sqlRuns a parameterized SQL statement against the tenant's database and returns the result set.
Auth: Bearer API key
Request body
application/json (required) — schema SqlRequest.
Responses
| Status | Description |
|---|---|
200 | Query results |
400 | Invalid SQL |
401 | Missing or invalid API key |
429 | Rate limit exceeded |
500 | Internal error |
operationId: executeSql
Execute a batch of SQL queries
POST /api/v1/sql/batchRuns multiple SQL statements in one request; each query executes independently and returns its own result set.
Auth: Bearer API key
Request body
application/json (required) — schema BatchSqlRequest.
Responses
| Status | Description |
|---|---|
200 | Array of query results |
401 | Missing or invalid API key |
500 | Internal error |
operationId: batchSql
List databases
GET /v1/databasesLists the project's databases. include_deleted=true also returns soft-deleted databases still inside the recovery grace window.
Auth: Bearer API key
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
include_deleted | query | boolean | No | Also return soft-deleted databases restorable within the grace window |
Responses
| Status | Description |
|---|---|
200 | Databases in the project |
401 | Missing or invalid API key |
operationId: listDatabases
Create a database
POST /v1/databasesCreates a ScalixNova database in the project on the requested PostgreSQL major version (16 default, 17, or 18). The version is fixed at creation; branches and point-in-time restores keep it.
Auth: Bearer API key
Request body
application/json (required) — schema CreateDatabaseRequest.
Responses
| Status | Description |
|---|---|
201 | Database created |
400 | Invalid name, isolation, or pg_version (message lists the supported versions) |
401 | Missing or invalid API key |
409 | A database with this name already exists in the org |
501 | Dedicated tier not provisionable on this deployment |
operationId: createDatabase
Delete a database
DELETE /v1/databases/{id}Soft-deletes the database: it is hidden from listings and restorable via POST /v1/databases/{id}/restore until the grace window ends, after which it is purged permanently.
Auth: Bearer API key
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | Database id |
Responses
| Status | Description |
|---|---|
200 | Database scheduled for deletion |
401 | Missing or invalid API key |
404 | Database not found |
operationId: deleteDatabase
Get a database
GET /v1/databases/{id}Fetches one database by id, including its PostgreSQL version and isolation tier.
Auth: Bearer API key
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | Database id |
Responses
| Status | Description |
|---|---|
200 | The database |
401 | Missing or invalid API key |
404 | Database not found |
operationId: getDatabase
Restore a soft-deleted database
POST /v1/databases/{id}/restoreUndoes a delete within the recovery grace window; the database returns to active with its data, version, and tier intact.
Auth: Bearer API key
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | Database id |
Responses
| Status | Description |
|---|---|
200 | Database restored to active |
401 | Missing or invalid API key |
404 | Database not found or past the grace window |
operationId: restoreDatabase
Get or create the project's default database
POST /v1/databases/provisionIdempotent: returns the project's default database connection info, creating the database (on the default PostgreSQL version) if none exists.
Auth: Bearer API key
Responses
| Status | Description |
|---|---|
200 | Connection info for the project's default database |
401 | Missing or invalid API key |
operationId: provisionDatabase