Databases
Databases API
Manage MySQL/MariaDB databases and users.
Roles: All authenticated users manage their own databases. Admin sees all.
List Databases
GET /api/v1/databases
Response:
[
{
"id": "john_mydb",
"name": "john_mydb",
"user": "john_mydb",
"owner": "john",
"domain": "example.com",
"remote_access": false,
"remote_host": "",
"size_kb": 1024,
"created_at": "2026-01-15T10:00:00Z"
}
]
Create Database
POST /api/v1/databases
{
"name": "mydb",
"user": "mydb_user",
"password": "secure_password123",
"domain": "example.com"
}
name and user are automatically prefixed with the owner username (e.g., john_mydb).
Response:
{
"id": "john_mydb",
"name": "john_mydb",
"user": "john_mydb_user",
"owner": "john",
"created_at": "2026-04-20T10:00:00Z"
}
Get Database
GET /api/v1/databases/{id}
{id} is the full database name (e.g., john_mydb).
Update Database
PUT /api/v1/databases/{id}
{
"remote_access": true,
"remote_host": "10.0.0.5"
}
Set remote_host to "%" to allow any remote host.
Delete Database
DELETE /api/v1/databases/{id}
Drops the database and MySQL user.
Reset Database Password
POST /api/v1/databases/{id}/reset-password
{ "password": "new_secure_password" }
phpMyAdmin Auto-Login
POST /api/v1/databases/{id}/phpmyadmin
Response:
{
"url": "http://localhost:8080/pma/?token=...",
"token": "abc123"
}
Returns a single-use phpMyAdmin login URL.
Error Codes
| Code | Meaning |
|---|---|
| 400 | Invalid database name (only [a-zA-Z0-9_] allowed) |
| 404 | Database not found |
| 409 | Database already exists |
| 403 | Access denied (not your database) |