Skip to content
Dymini Panel
v0.19.1
Menu

Databases

On this page

Managed databases and their lifecycle

List database engines and versions

GET/api/v1/database-engines

Responses

  • 200 List database engines and versionsDatabaseEngineView[]
    • default_portinteger (int32)required
    • enginestringrequired
    • versionsstring[]required

Create a database

POST/api/v1/environments/{id}/databases

Request bodyapplication/json

CreateDatabase

  • databasestring | null
  • enginestringrequired

    postgres, mysql, mariadb, mongo, or redis.

  • memory_bytesinteger | null (int64)
  • namestringrequired
  • nano_cpusinteger | null (int64)
  • public_portinteger | null (int32)

    Publish the database port on the host. Omit to keep it internal.

  • server_idstring (uuid)required
  • startboolean | null

    Start the container right away. Defaults to true.

  • usernamestring | null
  • versionstringrequired

Responses

  • 201 Create a databaseServiceView
    • created_atstring (date-time)required
    • environment_idstring (uuid)required
    • idstring (uuid)required
    • kindstringrequired
    • namestringrequired
    • server_idstring (uuid)required
    • specanyrequired
    • statusstringrequired

Reveal the connection string (admin)

GET/api/v1/services/{id}/connection

Responses

  • 200 Reveal the connection string (admin)ConnectionView
    • databasestringrequired
    • enginestringrequired
    • hoststringrequired
    • internal_urlstringrequired
    • passwordstringrequired
    • portinteger (int32)required
    • public_urlstring | null
    • usernamestringrequired

Update database ports and limits

PATCH/api/v1/services/{id}/database

Request bodyapplication/json

UpdateDatabase

  • clear_public_portboolean | null
  • memory_bytesinteger | null (int64)
  • nano_cpusinteger | null (int64)
  • public_portinteger | null (int32)

Responses

  • 200 Update database ports and limitsServiceView
    • created_atstring (date-time)required
    • environment_idstring (uuid)required
    • idstring (uuid)required
    • kindstringrequired
    • namestringrequired
    • server_idstring (uuid)required
    • specanyrequired
    • statusstringrequired

Delete a database (optionally its volume)

DELETE/api/v1/services/{id}/database

Responses

  • 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)

GET/api/v1/services/{id}/db/activity

Responses

  • 200 List database sessions with state, duration, current query and blocking sessions (pg_stat_activity, processlist, or CLIENT LIST)DbSession[]
    • blocked_bystring | null
    • clientstring | null
    • databasestring | null
    • duration_secsinteger | null (int64)
    • idstringrequired
    • querystring | null
    • statestring | null
    • user_namestring | null
    • waiting_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

POST/api/v1/services/{id}/db/activity/{session}/cancel

Request bodyapplication/json

DbCancelRequest

  • terminateboolean | null

    Close 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_writeDbCancelResult
    • okbooleanrequired

      The server accepted the request.

    • sessionstringrequired
    • terminatedbooleanrequired

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

POST/api/v1/services/{id}/db/execute

Request bodyapplication/json

DbExecuteRequest

  • confirm_destructiveboolean | null

    Required when a statement drops, truncates, or changes every row.

  • max_rowsinteger | null (int64)
  • sqlstringrequired

    One 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 refusedDbExecuteResponse
    • elapsed_msinteger (int64)required
    • statementsDbStatementResult[]required
      DbStatementResult[]
      • affected_rowsinteger | null (int64)
      • indexintegerrequired
      • kindstringrequired

        read or write.

      • resultQueryResult | null
        QueryResult | null

        One of:

        • QueryResult
          • columnsstring[]required
          • rowsstring | null[][]required
          • truncatedbooleanrequired

            More rows existed than were returned.

        • null
      • statementstringrequired
      • tagstring | null

        Command tag such as UPDATE 3.

    • transactionalbooleanrequired

      All 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

POST/api/v1/services/{id}/db/explain

Request bodyapplication/json

DbExplainRequest

  • analyzeboolean | null

    Run it and report real timings. Only allowed for read statements.

  • sqlstringrequired

    The 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 usedDbQueryResponse
    • elapsed_msinteger (int64)required
    • resultQueryResultrequired

      Rows returned by a statement. Every value is text or null.

      QueryResult
      • columnsstring[]required
      • rowsstring | null[][]required
      • truncatedbooleanrequired

        More rows existed than were returned.

    • statementstringrequired

      The 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

GET/api/v1/services/{id}/db/insights

Responses

  • 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/executeDbInsights
    • checked_atstring (date-time)required
    • enginestringrequired
    • findingsDbFinding[]required

      Critical first, then warnings, then information.

      DbFinding[]
      • categorystringrequired

        performance, indexes, maintenance, capacity, reliability, or schema.

      • checkstringrequired

        Stable machine name of the check, e.g. unused_index.

      • detailstringrequired
      • objectstring | null

        Table, index, session or setting the finding is about.

      • severitystringrequired

        critical, warning, or info.

      • suggestionstring | null

        SQL or Redis command that addresses it. Review before running it with the execute endpoint.

      • titlestringrequired
    • skippedstring[]required

      Checks that could not run, with the reason.

    • slow_queriesQueryResult | null
      QueryResult | null

      One of:

      • QueryResult
        • columnsstring[]required
        • rowsstring | null[][]required
        • truncatedbooleanrequired

          More 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)

GET/api/v1/services/{id}/db/key

Responses

  • 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)DbKeyDetail
    • keystringrequired
    • lengthinteger | null (int64)

      Elements (or bytes for strings) in the key.

    • memory_bytesinteger | null (int64)
    • truncatedbooleanrequired
    • ttl_msinteger (int64)required
    • typestringrequired
    • valueobjectrequired

      String 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)

GET/api/v1/services/{id}/db/keys

Responses

  • 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)DbKeyPage
    • cursorstringrequired

      Pass back as cursor for the next page; 0 means the scan is complete.

    • keysDbKey[]required
      DbKey[]
      • keystringrequired
      • memory_bytesinteger (int64)required
      • ttl_msinteger (int64)required

        Milliseconds 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

GET/api/v1/services/{id}/db/overview

Responses

  • 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_bytesDbOverview
    • agent_accessstringrequired
    • chart_metricsstring[]required

      Metric 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)required
    • enginestringrequired
    • server_versionstring | null

      Version reported by the running server.

    • statsDbStat[]required
      DbStat[]
      • keystringrequired

        Stable machine name, e.g. cache_hit_ratio.

      • labelstringrequired
      • unitstringrequired

        count, bytes, percent, seconds, ms, or ratio.

      • 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

POST/api/v1/services/{id}/db/query

Request bodyapplication/json

DbQueryRequest

  • max_rowsinteger | null (int64)
  • sqlstringrequired

    One 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/executeDbQueryResponse
    • elapsed_msinteger (int64)required
    • resultQueryResultrequired

      Rows returned by a statement. Every value is text or null.

      QueryResult
      • columnsstring[]required
      • rowsstring | null[][]required
      • truncatedbooleanrequired

        More rows existed than were returned.

    • statementstringrequired

      The 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

POST/api/v1/services/{id}/db/redis/execute

Request bodyapplication/json

DbRedisRequest

  • argsstring[]

    Arguments, e.g. ["HGETALL", "user:1"]. Preferred over command.

  • commandstring | null

    A command line as typed in redis-cli, e.g. SET "a key" value EX 60.

  • confirm_destructiveboolean | null

    Required 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=trueDbRedisResponse
    • commandstringrequired
    • elapsed_msinteger (int64)required
    • kindstringrequired

      read or write.

    • replyobjectrequired

      The 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

POST/api/v1/services/{id}/db/redis/query

Request bodyapplication/json

DbRedisRequest

  • argsstring[]

    Arguments, e.g. ["HGETALL", "user:1"]. Preferred over command.

  • commandstring | null

    A command line as typed in redis-cli, e.g. SET "a key" value EX 60.

  • confirm_destructiveboolean | null

    Required 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 useDbRedisResponse
    • commandstringrequired
    • elapsed_msinteger (int64)required
    • kindstringrequired

      read or write.

    • replyobjectrequired

      The 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

GET/api/v1/services/{id}/db/rows

Responses

  • 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 offsetDbQueryResponse
    • elapsed_msinteger (int64)required
    • resultQueryResultrequired

      Rows returned by a statement. Every value is text or null.

      QueryResult
      • columnsstring[]required
      • rowsstring | null[][]required
      • truncatedbooleanrequired

        More rows existed than were returned.

    • statementstringrequired

      The 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

GET/api/v1/services/{id}/db/settings

Responses

  • 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 ceilingsDbConsoleSettings
    • agent_accessstringrequired

      off, read, or read_write: what AI agents and apps signed in with an agent grant may do with this database's data.

    • max_rowsinteger (int32)required

      Default and maximum rows one query returns (1 to 5000).

    • timeout_secsinteger (int32)required

      Default 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

PUT/api/v1/services/{id}/db/settings

Request bodyapplication/json

SaveDbConsoleSettings

  • agent_accessstring | null

    off, read, or read_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 itDbConsoleSettings
    • agent_accessstringrequired

      off, read, or read_write: what AI agents and apps signed in with an agent grant may do with this database's data.

    • max_rowsinteger (int32)required

      Default and maximum rows one query returns (1 to 5000).

    • timeout_secsinteger (int32)required

      Default 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)

GET/api/v1/services/{id}/db/table

Responses

  • 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)DbTableDetail
    • columnsDbColumn[]required
      DbColumn[]
      • commentstring | null
      • data_typestringrequired
      • default_valuestring | null
      • namestringrequired
      • nullablebooleanrequired
    • indexesDbIndex[]required
      DbIndex[]
      • definitionstringrequired
      • is_primarybooleanrequired
      • is_uniquebooleanrequired
      • is_validbooleanrequired
      • namestringrequired
      • scansinteger | null (int64)

        Index scans since statistics were reset (Postgres).

      • size_bytesinteger | null (int64)
    • namestringrequired
    • schemastringrequired

List tables and views of a SQL database with row estimates and sizes

GET/api/v1/services/{id}/db/tables

Responses

  • 200 List tables and views of a SQL database with row estimates and sizesDbTable[]
    • index_bytesinteger | null (int64)
    • kindstringrequired

      table, view, materialized view, base table, …

    • namestringrequired
    • rows_estimateinteger | null (int64)
    • schemastringrequired
    • total_bytesinteger | null (int64)

Restart a service

POST/api/v1/services/{id}/restart

Responses

  • 200 Restart a serviceLifecycleView
    • container_idstring | null
    • statusstringrequired

Start a service

POST/api/v1/services/{id}/start

Responses

  • 200 Start a serviceLifecycleView
    • container_idstring | null
    • statusstringrequired

Stop a service

POST/api/v1/services/{id}/stop

Responses

  • 200 Stop a serviceLifecycleView
    • container_idstring | null
    • statusstringrequired