Databases API
Reference for the 4 Databases operations in the Intuidy API.
Responses are JSON. A successful response is { "success": true, "data": …, "meta": … }, and each operation below documents its data. Errors use the error envelope described in Errors, pagination and limits.
| Operation | Method and path | Authorization |
|---|---|---|
| List managed databases | GET /databases | databases:read |
| List the tables in one managed database | GET /databases/{databaseId}/tables | databases:read |
| Check a managed database's health | GET /databases/{databaseId}/health | databases:read |
| Run SQL against a managed database | POST /databases/{databaseId}/query | databases:read |
List managed databases
GET /databases
The managed databases this key may read. Each row carries BOTH ids: id is the database, credential_id is its connection — notebook query cells and DB workflow nodes take the credential id, and swapping the two silently points them at a different database.
Each row also lists the extensions enabled in the database (extensions, for example postgis on a PostgreSQL database), so a caller knows whether spatial SQL will run. Extensions are listed here and managed in the web app, in the Extensions section of the database page.
Data plane only. Provisioning, database users, backups, restore, import, connection logs and enabling or disabling an extension are not published: they hand out credentials and reshape infrastructure, and are available only in the web app.
Authorization: scope databases:read.
Response 200 OK
data fields:
| Field | Type | Description |
|---|---|---|
databases | array of object | — |
databases[].id | integer | — |
databases[].name | string | — |
databases[].credential_id | integer or null | The CONNECTION id — what notebook cells and DB nodes take |
databases[].status | string | — |
databases[].engine | string | The engine's display name, e.g. MySQL or PostgreSQL. SQL against this database uses its dialect. |
databases[].engine_type | "mysql" or "postgres" | The engine's machine key |
databases[].engine_version | string or null | — |
databases[].extensions | array of string | Keys of the extensions enabled in the database, for example postgis on a PostgreSQL database. Empty when none is enabled. This is the recorded list; it is managed in the web app. |
databases[].size_mb | integer or null | — |
databases[].max_size_mb | integer or null | — |
databases[].created | string (date-time) | — |
total | integer | — |
Errors 403. See Errors, pagination and limits.
Example request
curl -X GET "https://vantage.intuidy.com/api/v1/databases" \
-H "Authorization: Bearer $INTUIDY_API_KEY"List the tables in one managed database
GET /databases/{databaseId}/tables
Table names with row counts, sizes and comments, the same listing the web app shows. Relations that an extension owns (PostGIS's spatial_ref_sys and geometry_columns, for example) are not listed and can still be queried by name. The key owner needs the query_databases permission; without it the answer is 403 PERMISSION_DENIED.
Authorization: scope databases:read.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
databaseId | integer | Yes | — |
Response 200 OK
data fields:
| Field | Type | Description |
|---|---|---|
database_id | integer | — |
tables | array of object | — |
total | integer | — |
Errors 400 (DATABASE_NOT_ACTIVE, NO_CREDENTIAL, CREDENTIAL_NOT_FOUND), 404. See Errors, pagination and limits.
Example request
curl -X GET "https://vantage.intuidy.com/api/v1/databases/<databaseId>/tables" \
-H "Authorization: Bearer $INTUIDY_API_KEY"Check a managed database's health
GET /databases/{databaseId}/health
Authorization: scope databases:read.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
databaseId | integer | Yes | — |
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
fresh | "1" | No | Probe again instead of returning the recent result. A probe opens a real connection, so a recent result is reused for a short time — a monitor polling every minute would otherwise cost one connection per poll. |
Response 200 OK
data fields:
| Field | Type | Description |
|---|---|---|
database_id | integer | — |
Errors 404 (NOT_FOUND). See Errors, pagination and limits.
Example request
curl -X GET "https://vantage.intuidy.com/api/v1/databases/<databaseId>/health" \
-H "Authorization: Bearer $INTUIDY_API_KEY"Run SQL against a managed database
POST /databases/{databaseId}/query
READ or WRITE is decided by the statement, not by the caller — the same way the query console in the web app decides. A read (SELECT, SHOW, DESCRIBE, EXPLAIN) needs databases:read; anything that mutates needs databases:write, so a reporting key cannot change data by sending an UPDATE. Anything that is neither is refused 422 and runs nowhere.
A read passes your organization's data rules on the way out, and data_rules_applied counts how many fired. The rules for the ai channel apply as on MCP query_managed_db: a rule on a table's classification can mask columns or refuse the read (403 POLICY_BLOCKED). It is capped and server-timed out.
DROP, TRUNCATE, ALTER … DROP and RENAME destroy a schema object and additionally need allow_destructive_ddl: true. No write scope is taken to authorise them on its own, and the refusal names the statement. It cannot be undone.
On a PostgreSQL database, CREATE EXTENSION, ALTER EXTENSION and DROP EXTENSION are refused with SQL_STATEMENT_BLOCKED, with or without allow_destructive_ddl. Extensions are enabled and disabled on the database's page in the web app.
Beside the scope, the key owner's role decides: a read needs the query_databases permission and a write needs edit_databases. Without it the answer is 403 PERMISSION_DENIED, naming the permission.
Authorization: scope databases:read.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
databaseId | integer | Yes | — |
Request body (application/json)
| Field | Type | Required | Description |
|---|---|---|---|
sql | string | Yes | One statement. Multi-statement input is refused. |
params | array of object | No | Prepared-statement values. WRITES only — a read that sends them is refused 400. |
variables | object | No | Values for {{dash.name}} tokens in a dashboard SQL tile's query. Bound, never spliced. |
row_limit | integer | No | Rows to return (default 1000, capped) |
allow_destructive_ddl | boolean | No | Required for DROP, TRUNCATE, ALTER … DROP and RENAME. Set it only when the object is meant to go. |
Response 200 OK
data fields:
| Field | Type | Description |
|---|---|---|
database_id | integer | — |
rows | array of object | — |
columns | array of string | — |
total_rows | integer | — |
truncated | boolean | — |
data_rules_applied | integer | Present when your organization's data rules changed the rows |
affected_rows | integer | Writes only |
insert_id | integer | Writes only |
Errors 400 (DB_SQL, DB_REJECTED, INVALID_INPUT), 403 (INSUFFICIENT_SCOPE, SQL_STATEMENT_BLOCKED, SQL_DESTRUCTIVE_DDL, POLICY_BLOCKED, POLICY_UNEVALUABLE), 422 (SQL_STATEMENT_REFUSED), 500 (DB_UNKNOWN), 502 (DB_CONNECTIVITY, DB_AUTH, DB_CONFIG), 504 (DB_TIMEOUT). See Errors, pagination and limits.
Example request
curl -X POST "https://vantage.intuidy.com/api/v1/databases/<databaseId>/query" \
-H "Authorization: Bearer $INTUIDY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"sql":"<sql>"}'