Databases API
Database engines and connections, databases and their users, exports, imports, per-database backups and one-click Adminer and phpMyAdmin sign-in through the OSS Panel API.
These endpoints are the API behind Databases in the panel's sidebar: the engines installed on the server, the databases inside them, the users that can reach each database, and the export, import and backup tools.
All paths are relative to https://<your-panel-host>/api. Read
Authentication first. The examples use:
PANEL=https://panel.example.com
TOKEN='1|xcMq8K3vZ2pL…'Permissions and availability
Every endpoint needs the database permission (Databases in
Roles). Reads need view; every
endpoint marked manage below needs manage, which implies view.
Only a server that manages its own databases serves these routes. Where the
panel does not manage databases on this server, every call answers 409 with
"This server's databases are not managed by this panel." (the text follows
Accept-Language).
Endpoint index
| Method | Path | Permission | Purpose |
|---|---|---|---|
GET | /databases/engines | view | Engines and what each can do. |
POST | /databases/engines/{engine} | manage | Install an engine. |
GET | /databases/connections | view | How the panel reaches each engine. |
PUT | /databases/connections/{engine} | manage | Change a connection. |
PUT | /databases/connections/{engine}/root-password | manage | Set or change the MySQL or MariaDB root password. |
POST | /databases/connections/{engine}/test | manage | Test the connection. |
GET | /databases | view | List databases. |
POST | /databases | manage | Create a database. |
GET | /databases/untracked | view | Databases on the engine the panel does not know. |
POST | /databases/adopt | manage | Start tracking untracked databases. |
GET | /databases/{database} | view | One database. |
DELETE | /databases/{database} | manage | Delete. |
PUT | /databases/{database}/application | manage | Attach to or detach from an application. |
GET | /databases/{database}/tables | view | Tables. |
GET, POST | /databases/{database}/users | view / manage | List or add users. |
PATCH, DELETE | /databases/{database}/users/{user} | manage | Change or delete a user. |
PUT | /databases/{database}/users/{user}/password | manage | Set a user's password. |
POST | /databases/{database}/export | manage | Start an export. |
GET | /databases/exports | view | Exports. |
GET | /databases/exports/{file} | manage | Download an export file. |
DELETE | /databases/exports/{export} | manage | Delete an export. |
GET, POST | /databases/{database}/imports | view / manage | List or begin an import. |
PUT | /databases/{database}/imports/{import}/chunk | manage | Upload a piece. |
POST | /databases/{database}/imports/{import}/start | manage | Run the import. |
DELETE | /databases/{database}/imports/{import} | manage | Cancel or remove. |
GET, PUT, DELETE | /databases/{database}/backup-target | view / manage | The database's backup plan. |
GET, POST | /databases/{database}/backups | view / manage | List backups, back up now. |
GET | /databases/{database}/backups/{backup}/download | manage | Download a backup file. |
DELETE | /databases/{database}/backups/{backup} | manage | Delete a backup. |
POST | /databases/{database}/backups/{backup}/restore | manage | Restore. |
GET | /databases/status/{engine} | view | Live engine status. |
GET | /databases/processes | view | Running queries. |
DELETE | /databases/processes/{id} | manage | Stop one. |
GET | /databases/metrics/history | view | Recent engine metrics. |
POST | /databases/{database}/adminer-sso | manage | One-click Adminer sign-in. |
POST | /databases/{database}/phpmyadmin-sso | manage | One-click phpMyAdmin sign-in. |
{engine} is mysql, mariadb, mongodb or postgresql. {database} and
{user} are numeric ids. A {database}, user, import or backup that is not
the one in the URL's parent answers 404.
A few have their own per-minute limits: 5 for the root password; 6 for
export, import start, back up now and backup download; 2 for backup restore;
12 for deleting a backup or a backup plan; 20 for beginning an import,
deleting an import and saving a backup plan; 1200 for an import chunk. The
status endpoint uses the progress budget so it can be polled.
Engines and connections
GET /databases/engines
Returns {"engines": { … }}: for each engine whether it is installed, reachable
and installable. POST /databases/engines/{engine} installs one and answers
202 with {"queued": true}. If the engine is already installed and
reachable it answers 200 with {"engines": { … }, "queued": false}. A
second install while one runs is 409 (reason: install_in_progress). An
engine the panel cannot install here (MongoDB has no installer) answers
422 with the reason.
GET /databases/connections
Returns {"connections": { … }}, one entry per engine: engine, driver,
connection_type (tcp or socket), host, port, socket, username,
has_password, has_root_password, options. Passwords are never returned.
PUT /databases/connections/{engine}
Changes how the panel reaches the engine.
| Field | Rules |
|---|---|
connection_type | Required: tcp or socket. |
host, port | Required for tcp. port is 1 to 65535. |
socket | Required for socket; up to 255 characters. |
username, password | Optional, up to 255 characters. |
options | Optional object. |
root_password | Optional, up to 128 characters, no control characters. |
test | Optional boolean: test before saving. |
Returns {"<engine>": { … }}: the connection as saved. An unknown engine is
404.
PUT /databases/connections/{engine}/root-password
MySQL and MariaDB only (404 for the others). 5 per minute.
| Field | Rules |
|---|---|
password | Required, 12 to 128 characters, no control characters. |
password_confirmation | Required: must equal password. |
current_password | Optional, up to 128 characters: the current root password, when the panel does not already hold it. |
Returns {"<engine>": { … }}.
POST /databases/connections/{engine}/test
Returns {"reachable": true|false}.
Databases
GET /databases
| Query | Rules |
|---|---|
search | Up to 255 characters. |
filter[engine] | One of the engines the server knows. |
filter[application_id] | An application id. |
filter[attached] | true for databases attached to an application, false for the others. |
sort | created_at, name, engine, users_count or size_bytes; - for descending. |
per_page | One of 10, 20, 30, 50, 100. |
curl "$PANEL/api/databases?filter[engine]=mariadb&sort=name" \
-H "Authorization: Bearer $TOKEN" -H 'Accept: application/json'{
"databases": [
{
"id": 4,
"name": "shop_db",
"engine": "mariadb",
"charset": "utf8mb4",
"collation": "utf8mb4_unicode_ci",
"application_id": 12,
"application_name": "shop",
"size_bytes": 3145728,
"size_human": "3 MB",
"users_count": 1,
"created_at": "02-11-2026 09:14:03"
}
],
"meta": { "current_page": 1, "per_page": 10, "total": 1, "last_page": 1 }
}POST /databases
Answers 201 with {"database": { … }}.
| Field | Rules |
|---|---|
name | Required, letters, digits and _, 1 to 63 characters, not a system schema, unique within the engine. |
engine | Required, an engine from the engines list. |
charset, collation | Optional, from what the engine offers. |
application_id | Optional, an existing application to attach it to. |
create_user | Optional object to create a user at the same time (below). |
create_user:
| Field | Rules |
|---|---|
username | Required with create_user: letters, digits, _, 1 to 32 characters; not a system user and not starting with pg_. |
password | Optional, 8 to 255 characters; the panel generates one when left out. |
connection_preference | localhost, remote or anywhere, if the engine supports remote users. |
host | Required for remote: the address allowed to connect. |
restart_cluster | Optional boolean, for engines that need a restart to listen on a new address. |
GET /databases/{database}
Returns {"database": { … }} with the same fields as the list, plus
users and size_reason (why a size is missing, when it is).
DELETE /databases/{database}
Answers 204.
PUT /databases/{database}/application
Body {"application_id": 12}, or null to detach. The key must be present.
Returns {"database": { … }}.
GET /databases/{database}/tables
Returns {"tables": [ … ]}. 503 with reason: engine_unreachable when the
engine does not answer.
GET /databases/untracked and POST /databases/adopt
GET /databases/untracked?engine=mariadb returns
{"untracked": [ "name", … ]}: databases that exist on the engine but not in
the panel. POST /databases/adopt with engine and names (a non-empty
array of names, each 1 to 63 letters, digits or _) starts tracking them and
answers 201 with {"databases": [ … ]}.
Database users
GET /databases/{database}/users
Returns {"users": [ … ]}. Each user has id, username,
connection_preference, host, password_known and timestamps. The
plaintext password and the ready-made connection_string are returned
only to callers with manage; everyone else gets null for those two.
POST /databases/{database}/users
Answers 201 with {"user": { … }}.
| Field | Rules |
|---|---|
username | Required: letters, digits, _, 1 to 32 characters; not a system user; not starting with pg_. |
password | Optional, 8 to 255 characters; the panel generates one when left out. |
connection_preference | Required: localhost, remote or anywhere. remote and anywhere are refused for an engine that does not support remote users. |
host | Required for remote. |
restart_cluster | Optional boolean. |
PATCH /databases/{database}/users/{user}
Any of username, connection_preference, host, restart_cluster,
password (same rules as above, password 8 to 255). Returns
{"user": { … }}.
PUT /databases/{database}/users/{user}/password
Body {"password": "…"}, 8 to 255 characters. Returns {"user": { … }}.
DELETE /databases/{database}/users/{user}
Answers 204.
Export
POST /databases/{database}/export
Starts a gzipped export in the background, 6 per minute. Answers 202 with
{"export": { … }}. A second export while one runs, or an export while an
import, restore or backup of the same database is running, answers 422 on
database.
An export has id, status (queued, running, completed or failed),
file, size_bytes, available, download_url, and reason, message
and reference when it failed.
GET /databases/exports
Returns {"exports": [ … ]}.
GET /databases/exports/{file}
Downloads the file. {file} is the export's file name. 404 for a missing
file or an invalid name. Needs manage.
DELETE /databases/exports/{export}
Answers 204; 409 (reason: export_in_progress) while it is still being
made.
Import
An import is three calls: begin it, send the file in pieces, start it.
POST /databases/{database}/importswithfile_name(required, up to 255 characters) andsize_bytes(required, at least 1, at most the server's limit: 2 GB unless the administrator changed it). Answers201with{"import": { … }, "max_chunk": <bytes>}.422ondatabasewhen the panel has no account to import with, or another import of the same database is open.PUT /databases/{database}/imports/{import}/chunkwith a piece of the file as the raw request body, no larger thanmax_chunk. Returns{"received": <total bytes so far>}.409(reason: import_not_uploading) if the import is no longer in the uploading state.POST /databases/{database}/imports/{import}/startwithconfirm_replace: true(required) and optionalsafety_copy(boolean). Answers202with{"import": { … }}.422onfileif not all bytes arrived.
An import's status is uploading, queued, running, completed or
failed; received_bytes, step, reason, message, line and
reference tell you how far it got and why it failed.
GET /databases/{database}/imports returns {"imports": [ … ]}.
DELETE …/imports/{import} removes one; a running import answers 409
(reason: import_in_progress).
Backups of one database
A database that belongs to an application is backed up with the application (see Backups and storage API). A database on its own has its own plan.
GET /databases/{database}/backup-target
Returns {"backup_target": { … } | null, "backed_up_with": { … } | null}.
backed_up_with names the application whose plan covers this database.
PUT /databases/{database}/backup-target
20 per minute.
| Field | Rules |
|---|---|
storage_destination_id | Required, an existing storage destination. |
retention_count | Required, 1 to 365. |
frequency | Required: manual, hourly, every_3_hours, every_6_hours, every_12_hours, daily, weekly or monthly. |
schedule_time | Optional, HH:mm. |
enabled | Required boolean. |
Returns {"backup_target": { … }}.
DELETE removes the plan and answers 204. While the database still has
backups it is refused with 422; send delete_backups=true to delete them as
well. While a backup is still running the plan cannot be removed (422).
GET /databases/{database}/backups
Paged like other lists. Query: filter[status], filter[type],
filter[from], filter[to] (dates; to not before from) and
per_page (1 to 100).
POST /databases/{database}/backups
Backs up now. Answers 202 with {"backup_target": { … }}. 422 on
database when there is no plan, a restore is running on the database, or a
backup is already running.
GET /databases/{database}/backups/{backup}/download
Downloads the backup file. 6 per minute.
DELETE /databases/{database}/backups/{backup}
Answers 204.
POST /databases/{database}/backups/{backup}/restore
2 per minute. Replaces the database with the backup. Answers 202 with
{"restore": { … }}.
| Field | Rules |
|---|---|
confirm | Required: the database's name, typed. |
safety_copy | Optional boolean, default true: back up the database first so the restore can be undone. |
The backup must be verified, and either this database's own or an archived
backup of a database of the same engine. The database needs a backup plan, and
no restore, import or export may be running on it. Each failure is a 422
naming backup, database or confirm.
Monitor
| Endpoint | Returns |
|---|---|
GET /databases/status/{engine} | {"status": { … }}: live engine status. |
GET /databases/processes?engine=mariadb | {"processes": [ … ]}. engine is required. |
DELETE /databases/processes/{id}?engine=mariadb | 204. The panel's own connection cannot be stopped: 422, reason: panel_process. |
GET /databases/metrics/history?engine=mariadb | {"metrics": [ … ]}: recent samples, 24 hours by default. |
One-click sign-in to Adminer and phpMyAdmin
POST /databases/{database}/adminer-sso and
POST /databases/{database}/phpmyadmin-sso take an optional
database_user_id (a user of this database) and an optional application_id,
and return {"redirect_url": "…"}. Open that URL in a
browser to be signed in.
Common errors
| Status | Message or cause |
|---|---|
403 | Your role does not include management for Databases. |
404 | Unknown engine, database, user, import, backup or export file. |
409 | The server does not manage databases here; an install, import or export is already in progress. |
422 | Validation ({"message", "errors": {"field": ["…"]}}), or a refusal that names the field it is about. |
429 | Over a limit; wait for Retry-After. |
503 | The engine is not reachable. |
Related
Application feature endpoints
Files, logs, PHP settings, environment, password protection, web firewall, AI bot blocker, Fail2ban, staging, clone, one-click updates, WP-CLI and workers through the OSS Panel API.
Backups and storage API
Backup plans for applications, backups and restores, downloads, and the storage destinations backups are written to, through the OSS Panel API.