Databases
On this page
- List database engines and versions
- Create a database
- Reveal the connection string (admin)
- Update database ports and limits
- Delete a database (optionally its volume)
- List database sessions with state, duration, current query and blocking sessions (pg_stat_activity, processlist, or CLIENT LIST)
- Cancel the running statement of a session; terminate=true closes the whole session. The session id comes from …/db/activity. Needs write access and, for agent grants, agent_access=read_write
- Run SQL that changes data or schema (INSERT, UPDATE, DELETE, CREATE INDEX [CONCURRENTLY], ALTER, VACUUM, ANALYZE, …). Several statements separated by ';' run in one transaction when the engine allows it (transactional=true: all or nothing). Needs write access and, for agent grants, agent_access=read_write. DROP, TRUNCATE, ALTER … DROP and DELETE/UPDATE without WHERE return 409 confirmation_required until confirm_destructive=true. Client commands (\d, \!, SOURCE, …), COPY, LOAD DATA and server file access are refused
- Show the query plan of one statement. Body: sql (without EXPLAIN); analyze=true runs it and reports real timings (read statements only). Use it to check that a new index is used
- Run health checks and get findings, each with a suggested SQL statement or Redis command: missing, unused, duplicate or invalid indexes, foreign keys without index, tables without primary key, dead rows, long-running or blocked sessions, cache hit ratio, connection and memory limits, failed persistence, slow queries. Review a suggestion, then run it with …/db/execute or …/db/redis/execute
- Read one Redis key: type, TTL, memory, length and value (first 64 KiB of a string, or the first `limit` elements). Query: key (required), db (0-15), limit (1-1000, default 200)
- Scan Redis keys with type, TTL and memory, without blocking the server. Query: pattern (glob, default *), cursor (start with 0, then pass the returned cursor until it is 0), count (1-1000 per step, default 200), type (string, list, set, zset, hash, stream), db (0-15)
- Database health numbers for Postgres, MySQL, MariaDB or Redis: connections, size, cache hit ratio, throughput counters, memory, uptime. Allowed whatever agent_access is. History for charts: GET /api/v1/metrics?service_id=<id>&metrics=db_connections,db_tps,db_ops_per_sec,db_cache_hit_ratio,db_size_bytes,db_memory_bytes
- Run one read-only SQL statement (SELECT, WITH, SHOW, EXPLAIN, VALUES, TABLE, DESCRIBE) in a read-only session and get columns and rows (values are text or null). Body: sql; optional max_rows and timeout_secs, capped by the settings. Statements that change anything are refused with write_statement: use …/db/execute
- Run a Redis command that changes data or settings (SET, DEL, EXPIRE, HSET, LPUSH, ZADD, CONFIG SET maxmemory, SLOWLOG RESET, EVAL, …). Needs write access and, for agent grants, agent_access=read_write. FLUSHDB, FLUSHALL, SCRIPT FLUSH and FUNCTION FLUSH/DELETE need confirm_destructive=true
- Run one read-only Redis command (GET, MGET, HGETALL, LRANGE, SMEMBERS, ZRANGE, SCAN, TTL, TYPE, INFO, SLOWLOG GET, MEMORY USAGE, CONFIG GET, …). Body: args array (preferred), or a command line; db 0-15. KEYS, MONITOR, SUBSCRIBE, blocking pops, SELECT and MULTI are refused with the alternative to use
- Browse rows of one table. Query: name (required), schema, limit (default 100, at most max_rows), offset, order_by (column name), order (asc|desc). result.truncated=true means more rows follow; raise offset
- Read the database console settings of a database service: agent_access (off, read, read_write) is what agent grants (AI agents, the iOS app) may do with its data; max_rows and timeout_secs are the per-query defaults and ceilings
- Change the database console settings (admin): agent_access off|read|read_write, max_rows 1-5000, timeout_secs 1-300. Agent grants may lower agent_access but never raise it
- Describe one table: columns (type, nullable, default) and indexes (definition, size, scans). Query: name (required), schema (default public on Postgres; the service database on MySQL/MariaDB)
- List tables and views of a SQL database with row estimates and sizes
- Restart a service
- Start a service
- Stop a service
Managed databases and their lifecycle
List database engines and versions
/api/v1/database-enginesResponses
200 List database engines and versions
DatabaseEngineView[]default_portinteger (int32)requiredenginestringrequiredversionsstring[]required
Create a database
/api/v1/environments/{id}/databasesRequest bodyapplication/json
CreateDatabase
databasestring | nullenginestringrequiredpostgres, mysql, mariadb, mongo, or redis.
memory_bytesinteger | null (int64)namestringrequirednano_cpusinteger | null (int64)public_portinteger | null (int32)Publish the database port on the host. Omit to keep it internal.
server_idstring (uuid)requiredstartboolean | nullStart the container right away. Defaults to true.
usernamestring | nullversionstringrequired
Responses
201 Create a database
ServiceViewcreated_atstring (date-time)requiredenvironment_idstring (uuid)requiredidstring (uuid)requiredkindstringrequirednamestringrequiredserver_idstring (uuid)requiredspecanyrequiredstatusstringrequired
Reveal the connection string (admin)
/api/v1/services/{id}/connectionResponses
200 Reveal the connection string (admin)
ConnectionViewdatabasestringrequiredenginestringrequiredhoststringrequiredinternal_urlstringrequiredpasswordstringrequiredportinteger (int32)requiredpublic_urlstring | nullusernamestringrequired
Update database ports and limits
/api/v1/services/{id}/databaseRequest bodyapplication/json
UpdateDatabase
clear_public_portboolean | nullmemory_bytesinteger | null (int64)nano_cpusinteger | null (int64)public_portinteger | null (int32)
Responses
200 Update database ports and limits
ServiceViewcreated_atstring (date-time)requiredenvironment_idstring (uuid)requiredidstring (uuid)requiredkindstringrequirednamestringrequiredserver_idstring (uuid)requiredspecanyrequiredstatusstringrequired
Delete a database (optionally its volume)
/api/v1/services/{id}/databaseResponses
- 204 Delete a database (optionally its volume)
List database sessions with state, duration, current query and blocking sessions (pg_stat_activity, processlist, or CLIENT LIST)
/api/v1/services/{id}/db/activityResponses
200 List database sessions with state, duration, current query and blocking sessions (pg_stat_activity, processlist, or CLIENT LIST)
DbSession[]blocked_bystring | nullclientstring | nulldatabasestring | nullduration_secsinteger | null (int64)idstringrequiredquerystring | nullstatestring | nulluser_namestring | nullwaiting_onstring | null
Cancel the running statement of a session; terminate=true closes the whole session. The session id comes from …/db/activity. Needs write access and, for agent grants, agent_access=read_write
/api/v1/services/{id}/db/activity/{session}/cancelRequest bodyapplication/json
DbCancelRequest
terminateboolean | nullClose the whole session instead of cancelling its current statement.
Responses
200 Cancel the running statement of a session; terminate=true closes the whole session. The session id comes from …/db/activity. Needs write access and, for agent grants, agent_access=read_write
DbCancelResultokbooleanrequiredThe server accepted the request.
sessionstringrequiredterminatedbooleanrequired
Run SQL that changes data or schema (INSERT, UPDATE, DELETE, CREATE INDEX [CONCURRENTLY], ALTER, VACUUM, ANALYZE, …). Several statements separated by ';' run in one transaction when the engine allows it (transactional=true: all or nothing). Needs write access and, for agent grants, agent_access=read_write. DROP, TRUNCATE, ALTER … DROP and DELETE/UPDATE without WHERE return 409 confirmation_required until confirm_destructive=true. Client commands (\d, \!, SOURCE, …), COPY, LOAD DATA and server file access are refused
/api/v1/services/{id}/db/executeRequest bodyapplication/json
DbExecuteRequest
confirm_destructiveboolean | nullRequired when a statement drops, truncates, or changes every row.
max_rowsinteger | null (int64)sqlstringrequiredOne or more statements separated by
;.timeout_secsinteger | null (int64)
Responses
200 Run SQL that changes data or schema (INSERT, UPDATE, DELETE, CREATE INDEX [CONCURRENTLY], ALTER, VACUUM, ANALYZE, …). Several statements separated by ';' run in one transaction when the engine allows it (transactional=true: all or nothing). Needs write access and, for agent grants, agent_access=read_write. DROP, TRUNCATE, ALTER … DROP and DELETE/UPDATE without WHERE return 409 confirmation_required until confirm_destructive=true. Client commands (\d, \!, SOURCE, …), COPY, LOAD DATA and server file access are refused
DbExecuteResponseelapsed_msinteger (int64)requiredstatementsDbStatementResult[]requiredDbStatementResult[]
affected_rowsinteger | null (int64)indexintegerrequiredkindstringrequiredreadorwrite.resultQueryResult | nullQueryResult | null
One of:
QueryResultcolumnsstring[]requiredrowsstring | null[][]requiredtruncatedbooleanrequiredMore rows existed than were returned.
null
statementstringrequiredtagstring | nullCommand tag such as
UPDATE 3.
transactionalbooleanrequiredAll statements ran in one transaction (all applied or none).
Show the query plan of one statement. Body: sql (without EXPLAIN); analyze=true runs it and reports real timings (read statements only). Use it to check that a new index is used
/api/v1/services/{id}/db/explainRequest bodyapplication/json
DbExplainRequest
analyzeboolean | nullRun it and report real timings. Only allowed for read statements.
sqlstringrequiredThe statement to explain.
Responses
200 Show the query plan of one statement. Body: sql (without EXPLAIN); analyze=true runs it and reports real timings (read statements only). Use it to check that a new index is used
DbQueryResponseelapsed_msinteger (int64)requiredresultQueryResultrequiredRows returned by a statement. Every value is text or
null.QueryResult
columnsstring[]requiredrowsstring | null[][]requiredtruncatedbooleanrequiredMore rows existed than were returned.
statementstringrequiredThe statement with string literals hidden.
Run health checks and get findings, each with a suggested SQL statement or Redis command: missing, unused, duplicate or invalid indexes, foreign keys without index, tables without primary key, dead rows, long-running or blocked sessions, cache hit ratio, connection and memory limits, failed persistence, slow queries. Review a suggestion, then run it with …/db/execute or …/db/redis/execute
/api/v1/services/{id}/db/insightsResponses
200 Run health checks and get findings, each with a suggested SQL statement or Redis command: missing, unused, duplicate or invalid indexes, foreign keys without index, tables without primary key, dead rows, long-running or blocked sessions, cache hit ratio, connection and memory limits, failed persistence, slow queries. Review a suggestion, then run it with …/db/execute or …/db/redis/execute
DbInsightschecked_atstring (date-time)requiredenginestringrequiredfindingsDbFinding[]requiredCritical first, then warnings, then information.
DbFinding[]
categorystringrequiredperformance,indexes,maintenance,capacity,reliability, orschema.checkstringrequiredStable machine name of the check, e.g.
unused_index.detailstringrequiredobjectstring | nullTable, index, session or setting the finding is about.
severitystringrequiredcritical,warning, orinfo.suggestionstring | nullSQL or Redis command that addresses it. Review before running it with the execute endpoint.
titlestringrequired
skippedstring[]requiredChecks that could not run, with the reason.
slow_queriesQueryResult | nullQueryResult | null
One of:
QueryResultcolumnsstring[]requiredrowsstring | null[][]requiredtruncatedbooleanrequiredMore rows existed than were returned.
null
Read one Redis key: type, TTL, memory, length and value (first 64 KiB of a string, or the first `limit` elements). Query: key (required), db (0-15), limit (1-1000, default 200)
/api/v1/services/{id}/db/keyResponses
200 Read one Redis key: type, TTL, memory, length and value (first 64 KiB of a string, or the first `limit` elements). Query: key (required), db (0-15), limit (1-1000, default 200)
DbKeyDetailkeystringrequiredlengthinteger | null (int64)Elements (or bytes for strings) in the key.
memory_bytesinteger | null (int64)truncatedbooleanrequiredttl_msinteger (int64)requiredtypestringrequiredvalueobjectrequiredString value (first 64 KiB), list/set items,
[field, value]/[member, score]pairs, or[id, [[field, value]]]stream entries.
Scan Redis keys with type, TTL and memory, without blocking the server. Query: pattern (glob, default *), cursor (start with 0, then pass the returned cursor until it is 0), count (1-1000 per step, default 200), type (string, list, set, zset, hash, stream), db (0-15)
/api/v1/services/{id}/db/keysResponses
200 Scan Redis keys with type, TTL and memory, without blocking the server. Query: pattern (glob, default *), cursor (start with 0, then pass the returned cursor until it is 0), count (1-1000 per step, default 200), type (string, list, set, zset, hash, stream), db (0-15)
DbKeyPagecursorstringrequiredPass back as
cursorfor the next page;0means the scan is complete.keysDbKey[]requiredDbKey[]
keystringrequiredmemory_bytesinteger (int64)requiredttl_msinteger (int64)requiredMilliseconds to expiry; -1 without expiry.
typestringrequired
Database health numbers for Postgres, MySQL, MariaDB or Redis: connections, size, cache hit ratio, throughput counters, memory, uptime. Allowed whatever agent_access is. History for charts: GET /api/v1/metrics?service_id=<id>&metrics=db_connections,db_tps,db_ops_per_sec,db_cache_hit_ratio,db_size_bytes,db_memory_bytes
/api/v1/services/{id}/db/overviewResponses
200 Database health numbers for Postgres, MySQL, MariaDB or Redis: connections, size, cache hit ratio, throughput counters, memory, uptime. Allowed whatever agent_access is. History for charts: GET /api/v1/metrics?service_id=<id>&metrics=db_connections,db_tps,db_ops_per_sec,db_cache_hit_ratio,db_size_bytes,db_memory_bytes
DbOverviewagent_accessstringrequiredchart_metricsstring[]requiredMetric names with history for this engine: pass them to
GET /api/v1/metrics?service_id=…&metrics=…(at most 8 per call).checked_atstring (date-time)requiredenginestringrequiredserver_versionstring | nullVersion reported by the running server.
statsDbStat[]requiredDbStat[]
keystringrequiredStable machine name, e.g.
cache_hit_ratio.labelstringrequiredunitstringrequiredcount,bytes,percent,seconds,ms, orratio.valuenumber (double)required
versionstringrequired
Run one read-only SQL statement (SELECT, WITH, SHOW, EXPLAIN, VALUES, TABLE, DESCRIBE) in a read-only session and get columns and rows (values are text or null). Body: sql; optional max_rows and timeout_secs, capped by the settings. Statements that change anything are refused with write_statement: use …/db/execute
/api/v1/services/{id}/db/queryRequest bodyapplication/json
DbQueryRequest
max_rowsinteger | null (int64)sqlstringrequiredOne read-only statement (SELECT, WITH, SHOW, EXPLAIN, VALUES, TABLE, DESCRIBE).
timeout_secsinteger | null (int64)
Responses
200 Run one read-only SQL statement (SELECT, WITH, SHOW, EXPLAIN, VALUES, TABLE, DESCRIBE) in a read-only session and get columns and rows (values are text or null). Body: sql; optional max_rows and timeout_secs, capped by the settings. Statements that change anything are refused with write_statement: use …/db/execute
DbQueryResponseelapsed_msinteger (int64)requiredresultQueryResultrequiredRows returned by a statement. Every value is text or
null.QueryResult
columnsstring[]requiredrowsstring | null[][]requiredtruncatedbooleanrequiredMore rows existed than were returned.
statementstringrequiredThe statement with string literals hidden.
Run a Redis command that changes data or settings (SET, DEL, EXPIRE, HSET, LPUSH, ZADD, CONFIG SET maxmemory, SLOWLOG RESET, EVAL, …). Needs write access and, for agent grants, agent_access=read_write. FLUSHDB, FLUSHALL, SCRIPT FLUSH and FUNCTION FLUSH/DELETE need confirm_destructive=true
/api/v1/services/{id}/db/redis/executeRequest bodyapplication/json
DbRedisRequest
argsstring[]Arguments, e.g.
["HGETALL", "user:1"]. Preferred overcommand.commandstring | nullA command line as typed in redis-cli, e.g.
SET "a key" value EX 60.confirm_destructiveboolean | nullRequired for FLUSHDB, FLUSHALL, SCRIPT FLUSH and FUNCTION FLUSH/DELETE.
dbinteger | null (int32)Logical database, 0 to 15. Defaults to 0.
Responses
200 Run a Redis command that changes data or settings (SET, DEL, EXPIRE, HSET, LPUSH, ZADD, CONFIG SET maxmemory, SLOWLOG RESET, EVAL, …). Needs write access and, for agent grants, agent_access=read_write. FLUSHDB, FLUSHALL, SCRIPT FLUSH and FUNCTION FLUSH/DELETE need confirm_destructive=true
DbRedisResponsecommandstringrequiredelapsed_msinteger (int64)requiredkindstringrequiredreadorwrite.replyobjectrequiredThe reply as JSON (strings, numbers, arrays, maps, or null).
Run one read-only Redis command (GET, MGET, HGETALL, LRANGE, SMEMBERS, ZRANGE, SCAN, TTL, TYPE, INFO, SLOWLOG GET, MEMORY USAGE, CONFIG GET, …). Body: args array (preferred), or a command line; db 0-15. KEYS, MONITOR, SUBSCRIBE, blocking pops, SELECT and MULTI are refused with the alternative to use
/api/v1/services/{id}/db/redis/queryRequest bodyapplication/json
DbRedisRequest
argsstring[]Arguments, e.g.
["HGETALL", "user:1"]. Preferred overcommand.commandstring | nullA command line as typed in redis-cli, e.g.
SET "a key" value EX 60.confirm_destructiveboolean | nullRequired for FLUSHDB, FLUSHALL, SCRIPT FLUSH and FUNCTION FLUSH/DELETE.
dbinteger | null (int32)Logical database, 0 to 15. Defaults to 0.
Responses
200 Run one read-only Redis command (GET, MGET, HGETALL, LRANGE, SMEMBERS, ZRANGE, SCAN, TTL, TYPE, INFO, SLOWLOG GET, MEMORY USAGE, CONFIG GET, …). Body: args array (preferred), or a command line; db 0-15. KEYS, MONITOR, SUBSCRIBE, blocking pops, SELECT and MULTI are refused with the alternative to use
DbRedisResponsecommandstringrequiredelapsed_msinteger (int64)requiredkindstringrequiredreadorwrite.replyobjectrequiredThe reply as JSON (strings, numbers, arrays, maps, or null).
Browse rows of one table. Query: name (required), schema, limit (default 100, at most max_rows), offset, order_by (column name), order (asc|desc). result.truncated=true means more rows follow; raise offset
/api/v1/services/{id}/db/rowsResponses
200 Browse rows of one table. Query: name (required), schema, limit (default 100, at most max_rows), offset, order_by (column name), order (asc|desc). result.truncated=true means more rows follow; raise offset
DbQueryResponseelapsed_msinteger (int64)requiredresultQueryResultrequiredRows returned by a statement. Every value is text or
null.QueryResult
columnsstring[]requiredrowsstring | null[][]requiredtruncatedbooleanrequiredMore rows existed than were returned.
statementstringrequiredThe statement with string literals hidden.
Read the database console settings of a database service: agent_access (off, read, read_write) is what agent grants (AI agents, the iOS app) may do with its data; max_rows and timeout_secs are the per-query defaults and ceilings
/api/v1/services/{id}/db/settingsResponses
200 Read the database console settings of a database service: agent_access (off, read, read_write) is what agent grants (AI agents, the iOS app) may do with its data; max_rows and timeout_secs are the per-query defaults and ceilings
DbConsoleSettingsagent_accessstringrequiredoff,read, orread_write: what AI agents and apps signed in with an agent grant may do with this database's data.max_rowsinteger (int32)requiredDefault and maximum rows one query returns (1 to 5000).
timeout_secsinteger (int32)requiredDefault and maximum seconds one statement may run (1 to 300).
updated_atstring | null (date-time)
Change the database console settings (admin): agent_access off|read|read_write, max_rows 1-5000, timeout_secs 1-300. Agent grants may lower agent_access but never raise it
/api/v1/services/{id}/db/settingsRequest bodyapplication/json
SaveDbConsoleSettings
agent_accessstring | nulloff,read, orread_write. Agents may only lower it.max_rowsinteger | null (int32)timeout_secsinteger | null (int32)
Responses
200 Change the database console settings (admin): agent_access off|read|read_write, max_rows 1-5000, timeout_secs 1-300. Agent grants may lower agent_access but never raise it
DbConsoleSettingsagent_accessstringrequiredoff,read, orread_write: what AI agents and apps signed in with an agent grant may do with this database's data.max_rowsinteger (int32)requiredDefault and maximum rows one query returns (1 to 5000).
timeout_secsinteger (int32)requiredDefault and maximum seconds one statement may run (1 to 300).
updated_atstring | null (date-time)
Describe one table: columns (type, nullable, default) and indexes (definition, size, scans). Query: name (required), schema (default public on Postgres; the service database on MySQL/MariaDB)
/api/v1/services/{id}/db/tableResponses
200 Describe one table: columns (type, nullable, default) and indexes (definition, size, scans). Query: name (required), schema (default public on Postgres; the service database on MySQL/MariaDB)
DbTableDetailcolumnsDbColumn[]requiredDbColumn[]
commentstring | nulldata_typestringrequireddefault_valuestring | nullnamestringrequirednullablebooleanrequired
indexesDbIndex[]requiredDbIndex[]
definitionstringrequiredis_primarybooleanrequiredis_uniquebooleanrequiredis_validbooleanrequirednamestringrequiredscansinteger | null (int64)Index scans since statistics were reset (Postgres).
size_bytesinteger | null (int64)
namestringrequiredschemastringrequired
List tables and views of a SQL database with row estimates and sizes
/api/v1/services/{id}/db/tablesResponses
200 List tables and views of a SQL database with row estimates and sizes
DbTable[]index_bytesinteger | null (int64)kindstringrequiredtable,view,materialized view,base table, …namestringrequiredrows_estimateinteger | null (int64)schemastringrequiredtotal_bytesinteger | null (int64)
Restart a service
/api/v1/services/{id}/restartResponses
200 Restart a service
LifecycleViewcontainer_idstring | nullstatusstringrequired
Start a service
/api/v1/services/{id}/startResponses
200 Start a service
LifecycleViewcontainer_idstring | nullstatusstringrequired
Stop a service
/api/v1/services/{id}/stopResponses
200 Stop a service
LifecycleViewcontainer_idstring | nullstatusstringrequired