Webspace API: MariaDB databases
List, create and drop the databases of a webspace, read their tables and structure, run SQL and reset passwords through the Sitequest REST API.
List, create and drop the databases of a webspace, read their tables and structure, run SQL and reset passwords through the Sitequest REST API.
Lists the MariaDB databases of a webspace. Each has a number: the :n the other database endpoints take in their path. 0 is the database an installed application uses.
Required scope: webspace:db · Role: Collaborator or higher on the webspace
| Parameter | Type | Description |
|---|---|---|
id |
string | The webspace ID |
| Header | Required | Value |
|---|---|---|
Authorization |
Yes | Bearer YOUR_API_KEY |
{
"data": {
"databases": [
{ "database": 0, "name": "ws_0862c_db0", "bytes": 48234496 },
{ "database": 1, "name": "ws_0862c_db1", "bytes": 0 }
]
}
}
| Field | Type | Description |
|---|---|---|
database |
number | The number of the database, 0 to 99 |
name |
string | Its name on the server |
bytes |
number | Its size. All databases count into the webspace's storage |
| Status | Code | Description |
|---|---|---|
| 403 | FORBIDDEN |
The API key lacks the webspace:db scope, or you are not at least Collaborator on the webspace |
| 404 | NOT_FOUND |
The webspace does not exist or is not among the resources the API key is restricted to |
| 429 | RATE_LIMITED |
More than 120 requests within a minute |
curl "https://site.quest/api/v1/webspaces/69e80ac1ab57a244bb5273fd/databases" \
-H "Authorization: Bearer YOUR_API_KEY"
This action is also available via the webspace_db_list MCP tool.
Creates a new, empty MariaDB database on a webspace, with an account of its own that reaches only this database. The password is returned once; it is not stored anywhere. There is no fixed number of databases: all of them count into the webspace's storage and go into its backups.
Required scope: webspace:db · Role: Administrator or Owner on the webspace
| Parameter | Type | Description |
|---|---|---|
id |
string | The webspace ID |
| Header | Required | Value |
|---|---|---|
Authorization |
Yes | Bearer YOUR_API_KEY |
No request body is required.
201 Created
{
"data": {
"database": 1,
"dbHost": "localhost",
"dbName": "ws_0862c_db1",
"dbUser": "ws_0862c_u1",
"dbPassword": "Z9v…"
}
}
| Field | Type | Description |
|---|---|---|
database |
number | The number of the new database, for the other endpoints |
dbHost |
string | Always localhost: the database is reachable from inside the webspace only |
dbName |
string | The database's name |
dbUser |
string | Its account |
dbPassword |
string | Returned only once. A new one: Reset Database Password |
| Status | Code | Description |
|---|---|---|
| 403 | FORBIDDEN |
The API key lacks the webspace:db scope, or you are not Administrator or Owner on the webspace |
| 404 | NOT_FOUND |
The webspace does not exist or is not among the resources the API key is restricted to |
| 409 | CONFLICT |
The webspace's storage is full, or it already has 100 databases |
| 429 | RATE_LIMITED |
More than 6 requests within a minute |
| 502 | PROVIDER |
The webspace's server cannot create databases right now |
curl -X POST "https://site.quest/api/v1/webspaces/69e80ac1ab57a244bb5273fd/databases" \
-H "Authorization: Bearer YOUR_API_KEY"
This action is also available via the webspace_db_create MCP tool. The MCP tool answers with a one-time link to the dashboard instead of the password, unless "Hide secrets from the AI model" is off for the key or app (see Authorization). This REST endpoint always returns the value.
Drops one MariaDB database of a webspace for good, with every table in it and its account. This cannot be undone; a backup of the webspace or an earlier export brings it back. A website whose application runs on the database stops working.
Required scope: webspace:db · Role: Administrator or Owner on the webspace
| Parameter | Type | Description |
|---|---|---|
id |
string | The webspace ID |
n |
number | The number of the database, from List Webspace Databases |
| Parameter | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | The database's full name, e.g. ws_0862c_db1: the confirmation that the right one is meant |
| Header | Required | Value |
|---|---|---|
Authorization |
Yes | Bearer YOUR_API_KEY |
{
"data": {
"database": 1,
"dbName": "ws_0862c_db1",
"remaining": 1
}
}
| Field | Type | Description |
|---|---|---|
remaining |
number | The databases the webspace has left |
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION |
n is not 0 to 99, or name is not the name of database n |
| 400 | MISSING_CONFIRM |
name is missing |
| 403 | FORBIDDEN |
The API key lacks the webspace:db scope, or you are not Administrator or Owner on the webspace |
| 404 | NOT_FOUND |
The webspace or database n does not exist, or the webspace is not among the resources the API key is restricted to |
| 429 | RATE_LIMITED |
More than 6 requests within a minute |
| 502 | PROVIDER |
The webspace's server could not drop the database |
curl -X DELETE "https://site.quest/api/v1/webspaces/69e80ac1ab57a244bb5273fd/databases/1?name=ws_0862c_db1" \
-H "Authorization: Bearer YOUR_API_KEY"
This action is also available via the webspace_db_drop MCP tool. It always asks for your approval first.
Without table: the tables and views of a database with engine, estimated rows and size. With table: that table's columns, indexes and foreign keys, its number of rows and the key that names one row. Reads with an account that can only read.
Required scope: webspace:db · Role: Collaborator or higher on the webspace
| Parameter | Type | Description |
|---|---|---|
id |
string | The webspace ID |
n |
number | The number of the database; 0 is the one an installed application uses |
| Parameter | Type | Required | Description |
|---|---|---|---|
table |
string | No | A table or view from the list |
| Header | Required | Value |
|---|---|---|
Authorization |
Yes | Bearer YOUR_API_KEY |
table{
"data": {
"database": 0,
"databaseName": "ws_0862c_db0",
"tables": [
{ "name": "wp_posts", "kind": "table", "engine": "InnoDB", "rowEstimate": 184, "bytes": 1622016, "collation": "utf8mb4_unicode_520_ci", "comment": "" }
]
}
}
rowEstimate is the server's estimate; exact only for some engines. kind is table or view.
table{
"data": {
"database": 0,
"table": "wp_posts",
"rows": 184,
"key": ["ID"],
"columns": [
{ "name": "ID", "type": "bigint(20) unsigned", "nullable": false, "default": null, "key": "PRI", "extra": "auto_increment", "comment": "" }
],
"indexes": [
{ "name": "post_author", "unique": false, "type": "BTREE", "columns": ["post_author"] }
],
"foreignKeys": []
}
}
| Field | Type | Description |
|---|---|---|
rows |
number | null | The exact number of rows; null when it could not be counted in time |
key |
string[] | null | The columns that name one row (primary key, else a unique key without NULL); null when there is none |
columns[].key |
string | PRI, UNI, MUL or empty |
foreignKeys[] |
object | name, columns, refTable, refColumns |
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION |
n is not 0 to 99, or table is not a valid name |
| 403 | FORBIDDEN |
The API key lacks the webspace:db scope, or you are not at least Collaborator on the webspace |
| 404 | NOT_FOUND |
The webspace, database n or the table does not exist, or the webspace is not among the resources the API key is restricted to |
| 429 | RATE_LIMITED |
More than 120 requests within a minute |
| 502 | PROVIDER |
The database answered with an error, or the webspace's server does not offer this yet |
curl "https://site.quest/api/v1/webspaces/69e80ac1ab57a244bb5273fd/databases/0/schema?table=wp_posts" \
-H "Authorization: Bearer YOUR_API_KEY"
This action is also available via the webspace_db_schema MCP tool.
Runs one or more SQL statements in a database of a webspace, with the rights of that database's own account: it reaches this one database only. With readOnly it runs with an account that can only read. Every request is a session of its own: USE, SET, temporary tables and open transactions end with it, so put START TRANSACTION … COMMIT into one request.
Required scope: webspace:db · Role: Administrator or Owner on the webspace
| Parameter | Type | Description |
|---|---|---|
id |
string | The webspace ID |
n |
number | The number of the database; 0 is the one an installed application uses |
| Header | Required | Value |
|---|---|---|
Authorization |
Yes | Bearer YOUR_API_KEY |
Content-Type |
Yes | application/json |
| Field | Type | Required | Description |
|---|---|---|---|
sql |
string | Yes | One or more statements separated by ;, up to 200,000 characters |
readOnly |
boolean | No | Run with the account that can only read |
rows |
number | No | Rows returned per statement, 1 to 10,000. Default 500 |
{ "sql": "SELECT ID, post_title FROM wp_posts WHERE post_status = 'publish' LIMIT 2", "readOnly": true }
The statements run in order; the first that fails ends the run. A statement ends after 30 seconds. A failed statement is part of the answer, not an HTTP error. The REST API asks no confirmation for DROP, TRUNCATE or a DELETE without WHERE: check your SQL before you send it.
{
"data": {
"database": 0,
"statements": [
{
"kind": "rows",
"columns": [
{ "name": "ID", "table": "wp_posts", "type": "bigint", "key": "primary", "nullable": false, "binary": false },
{ "name": "post_title", "table": "wp_posts", "type": "text", "key": null, "nullable": false, "binary": false }
],
"rows": [["1", "Hallo Welt"], ["2", "Über uns"]],
"rowCount": 2,
"cut": false
}
],
"truncated": false,
"timedOut": false,
"ms": 4
}
}
kind |
Fields | Meaning |
|---|---|---|
rows |
columns, rows, rowCount, cut, error? |
A statement that returned rows. rowCount counts all of them, rows holds those within the limit; cut says some were left out. error is set when it ended early |
change |
affected, insertId, info, warnings |
A statement that changed rows or the schema |
error |
error.code, error.sqlstate, error.message |
The database's error, e.g. 1064 for a syntax error |
Values are strings (numbers too, so nothing is rounded) or null. A long text comes as { "text": "…", "bytes": 123456 }, a binary value as { "hex": "…", "bytes": 2048 }. truncated is true when rows were left out anywhere; timedOut when a statement ran past its time.
| Status | Code | Description |
|---|---|---|
| 400 | INVALID_BODY |
The body is not valid JSON |
| 400 | VALIDATION |
n is not 0 to 99, sql is empty or too long, or rows is out of range |
| 403 | FORBIDDEN |
The API key lacks the webspace:db scope, or you are not Administrator or Owner on the webspace |
| 404 | NOT_FOUND |
The webspace or database n does not exist, or the webspace is not among the resources the API key is restricted to |
| 429 | RATE_LIMITED |
More than 60 requests within a minute |
| 502 | PROVIDER |
The webspace's server does not offer SQL yet, or could not be reached |
curl -X POST "https://site.quest/api/v1/webspaces/69e80ac1ab57a244bb5273fd/databases/0/query" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"sql": "SELECT COUNT(*) FROM wp_posts", "readOnly": true}'
This action is also available via the webspace_db_query MCP tool. It answers with the rows as a text table and asks for your approval before DROP, TRUNCATE, ALTER and an UPDATE or DELETE without WHERE.
Generate a new MariaDB password. The plaintext is returned once — store it immediately.
:n is the number of the database (from GET /api/v1/webspaces/:id/databases); 0 is the one an installed application uses.
Required scope: webspace:manage
| Header | Required | Value |
|---|---|---|
Authorization |
Yes | Bearer YOUR_API_KEY |
{
"data": {
"id": "69e80ac1...",
"database": 0,
"subdomain": "ws-0862c.sitequest.eu",
"dbName": "ws_0862c_db",
"dbUser": "ws_0862c",
"dbPassword": "Z9v…",
"dbHost": "localhost",
"warning": "Store this password now — it will not be shown again."
}
}
| Field | Type | Description |
|---|---|---|
dbPassword |
string | Returned only once. Cannot be retrieved later. |
dbHost |
string | MariaDB host. Always localhost (only reachable from inside the webspace). |
curl -X POST https://site.quest/api/v1/webspaces/69e80ac1.../databases/0/password \
-H "Authorization: Bearer sq_live_..."
This action is also available via the webspace_reset_db_password MCP tool. The MCP tool answers with a one-time link to the dashboard instead of the value, unless "Hide secrets from the AI model" is off for the key or app (see Authorization). This REST endpoint always returns the value.