Databases
A site’s databases - its own and the others it was given - and every server’s. The browser’s reads and writes run as the site’s own database user, so they reach that site’s databases and nothing else. A PHP site may have no database: then name and user are null, and everything but its creation answers 409.
Reading needs Read only and changes need Manage, unless an endpoint says otherwise. How to read this page.
GET /api/databases
Section titled “GET /api/databases”Every database on every server, with the site it belongs to and its size as last read.
- Level: Read only
- Returns:
{databases: DatabaseListItemDto[], servers: [{id, name, scannedAt, error}]}
POST /api/databases/scan
Section titled “POST /api/databases/scan”Read every server’s databases and sizes now.
- Level: Manage
- Returns:
the list, as GET /api/databases
DELETE /api/databases/:serverId/:name
Section titled “DELETE /api/databases/:serverId/:name”Drop a database no site uses from its server.
- Level: Full. A database no site uses is the panel’s to clear, not a site’s
- Notes: Job · Destructive
- Returns:
409 when a site or a move claims it
GET /api/sites/:slug/databases
Section titled “GET /api/sites/:slug/databases”The site’s databases: names, user, host, sizes.
- Level: Read only
- Returns:
SiteDatabaseDto
POST /api/sites/:slug/database
Section titled “POST /api/sites/:slug/database”Make the site’s own database, wp_<slug>, and its user: for a PHP site made without one.
- Level: Manage
- Notes: Job
- Returns:
409 when the site has one
POST /api/sites/:slug/databases
Section titled “POST /api/sites/:slug/databases”Add another database to the site, for the site’s own database user.
- Level: Manage
- Notes: Job
- Input:
{name} - a-z, 0-9 and _, not starting with wp_ - Returns:
409 when the site has no database of its own
DELETE /api/sites/:slug/databases/:db
Section titled “DELETE /api/sites/:slug/databases/:db”Drop one of the databases added to the site; its own goes only with the site.
- Level: Manage
- Notes: Job · Destructive
POST /api/sites/:slug/database-password/reveal
Section titled “POST /api/sites/:slug/database-password/reveal”Show the password of the site’s database user.
- Level: Manage
- Notes: Destructive
- Returns:
{password}
POST /api/sites/:slug/database-password
Section titled “POST /api/sites/:slug/database-password”Give the site’s database user a new password; a WordPress site restarts with it, a PHP site’s config needs it.
- Level: Manage
- Notes: Job · Destructive
GET /api/sites/:slug/databases/:db/export
Section titled “GET /api/sites/:slug/databases/:db/export”Download a dump of one of the site’s databases.
A binary stream - fetch it with curl.
- Level: Manage. Everything the database holds, password hashes and keys included
- Notes: Not over MCP
- Returns:
the dump, gzipped (.sql.gz)
PUT /api/sites/:slug/database-uploads/:id
Section titled “PUT /api/sites/:slug/database-uploads/:id”Send one chunk of a dump to import (gzipped, at most 8 MiB a chunk).
Raw bytes, chunk by chunk.
- Level: Manage
- Notes: Not over MCP
- Input:
?offset=<bytes received>&size=<whole file>, body application/octet-stream - Returns:
{received, complete}; 409 {details: {received}} when the offset is not where the upload is
DELETE /api/sites/:slug/database-uploads/:id
Section titled “DELETE /api/sites/:slug/database-uploads/:id”Throw away an upload.
Part of the raw upload.
- Level: Manage
- Notes: Not over MCP
POST /api/sites/:slug/databases/:db/import
Section titled “POST /api/sites/:slug/databases/:db/import”Load an uploaded dump into one of the site’s databases, as the site’s own database user.
- Level: Manage
- Notes: Job · Destructive
- Input:
{uploadId, empty?: false, backupFirst?: true}
GET /api/sites/:slug/databases/:db/tables
Section titled “GET /api/sites/:slug/databases/:db/tables”The tables and views of one of the site’s databases, with rows and sizes.
- Level: Read only
- Returns:
{items: DbTableDto[]}
GET /api/sites/:slug/databases/:db/tables/:table
Section titled “GET /api/sites/:slug/databases/:db/tables/:table”A table’s columns, indexes and key.
- Level: Read only
- Returns:
DbTableStructureDto
GET /api/sites/:slug/databases/:db/tables/:table/rows
Section titled “GET /api/sites/:slug/databases/:db/tables/:table/rows”A page of a table’s rows, filtered and sorted; long values come cut.
- Level: Manage. What the database holds: emails, password hashes, keys
- Input:
?offset=0&limit=50 (≤500)&sort=<column>&dir=asc|desc&filters=[{column, op, value?}] (JSON) - Returns:
DbRowsPageDto
GET /api/sites/:slug/databases/:db/tables/:table/row
Section titled “GET /api/sites/:slug/databases/:db/tables/:table/row”One row whole, by its key.
- Level: Manage. What the database holds: emails, password hashes, keys
- Input:
?key={"<column>": "<value>"} (JSON) - Returns:
DbRowDto
POST /api/sites/:slug/databases/:db/tables/:table/rows
Section titled “POST /api/sites/:slug/databases/:db/tables/:table/rows”Insert a row.
- Level: Manage
- Notes: Destructive
- Input:
{values: {<column>: text|null}} - columns left out take their default - Returns:
{affected, insertId}
PATCH /api/sites/:slug/databases/:db/tables/:table/rows
Section titled “PATCH /api/sites/:slug/databases/:db/tables/:table/rows”Change a row, found by its key.
- Level: Manage
- Notes: Destructive
- Input:
{key: {<column>: text}, values: {<column>: text|null}} - Returns:
{affected}; 404 when no row has that key
POST /api/sites/:slug/databases/:db/tables/:table/rows/delete
Section titled “POST /api/sites/:slug/databases/:db/tables/:table/rows/delete”Delete rows, found by their keys, all or none.
- Level: Manage
- Notes: Destructive
- Input:
{keys: [{<column>: text}]} (≤500) - Returns:
{affected}
POST /api/sites/:slug/databases/:db/query
Section titled “POST /api/sites/:slug/databases/:db/query”Run SQL as the site’s database user, statement by statement, stopping at the first error.
- Level: Manage
- Notes: Destructive
- Input:
{sql} - Returns:
{results: (rows (≤1000) | ok | error)[], ms}
POST /api/sites/:slug/databases/:db/adminer
Section titled “POST /api/sites/:slug/databases/:db/adminer”A link that opens the database in Adminer once, within a minute, as the site’s user; browser session only.
- Level: Manage
- Notes: Destructive · Not over MCP
- Returns:
{url}
POST /api/sites/:slug/databases/:db/tables
Section titled “POST /api/sites/:slug/databases/:db/tables”Create a table: columns and a primary key; preview: true only answers the SQL.
- Level: Manage
- Notes: Destructive
- Input:
{name, columns: {name, type, nullable, default, onUpdateCurrentTimestamp?, autoIncrement?, comment?, collation?}[], primaryKey?, preview?} - Returns:
202 + job (database.alter), or {statements} for a preview
POST /api/sites/:slug/databases/:db/tables/:table/alter
Section titled “POST /api/sites/:slug/databases/:db/tables/:table/alter”Change a table’s columns, indexes, foreign keys or name in one ALTER TABLE; preview: true only answers the SQL.
- Level: Manage
- Notes: Destructive
- Input:
{changes: (addColumn {column, position} | modifyColumn {name, column, position} | dropColumn {name} | addIndex {index} | dropIndex {name} | addForeignKey {foreignKey} | dropForeignKey {name} | rename {name})[], preview?} - Returns:
202 + job (database.alter), or {statements} for a preview
POST /api/sites/:slug/databases/:db/tables/:table/truncate
Section titled “POST /api/sites/:slug/databases/:db/tables/:table/truncate”Empty a table: every row deleted; ?preview=true only answers the SQL.
- Level: Manage
- Notes: Destructive
- Returns:
202 + job (database.alter), or {statements}
DELETE /api/sites/:slug/databases/:db/tables/:table
Section titled “DELETE /api/sites/:slug/databases/:db/tables/:table”Drop a table or view; ?preview=true only answers the SQL.
- Level: Manage
- Notes: Destructive
- Returns:
202 + job (database.alter), or {statements}