OpenPanel API
OpenPanel exposes a full REST API that mirrors all web UI functionality. Every feature available in the panel can be accessed programmatically.
A machine-readable OpenAPI 3.0 spec covering every endpoint below is also available — import it into Postman/Insomnia, generate a client SDK, or load it into Swagger UI/Redoc.
Authentication​
All API requests require a Bearer token obtained via the login endpoint.
Step 1 — Get a token:
curl -s -X POST https://panel.example.com/api/login \
-H "Content-Type: application/json" \
-d '{"username": "stefan", "password": "yourpassword"}'
Response:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user_id": 1,
"expires_in": 3600
}
If the account has two-factor authentication enabled and no twofa_code was sent, the response is instead:
{"twofa_required": true, "user_id": 1}
Retry the request with twofa_code included in the body. Login attempts are rate-limited per IP; exceeding the limit returns 429 Too Many Requests.
Step 2 — Use it on every request:
curl https://panel.example.com/api/account \
-H "Authorization: Bearer eyJhbGciOi..."
Tokens expire after 1 hour (expires_in is in seconds). Both the blanket api feature flag AND the specific feature flag must be enabled in the user's plan.
MySQL​
All MySQL endpoints are flat — there is no /api/mysql/<db_name>/users nesting. Databases live under /api/mysql/databases, users under /api/mysql/users, and the two are tied together with a separate /api/mysql/grants resource.
List databases​
GET /api/mysql/databases
Authorization: Bearer <token>
{
"databases": [
{"name": "mydb", "assigned_users": "myuser"}
],
"total": 1
}
Create a database​
POST /api/mysql/databases
Content-Type: application/json
{"name": "newdb"}
Drop a database​
DELETE /api/mysql/databases/newdb
List tables in a database​
GET /api/mysql/databases/mydb/tables
{
"database": "mydb",
"tables": [
{"table": "wp_posts", "rows": 120, "data_length": 98304, "index_length": 32768, "data_free": 0}
]
}
Optimize / repair a database​
Runs OPTIMIZE TABLE or REPAIR TABLE against every table in the database.
POST /api/mysql/databases/mydb/optimize
POST /api/mysql/databases/mydb/repair
{
"database": "mydb",
"action": "optimize",
"results": [
{"table": "wp_posts", "status": "ok", "details": [{"op": "optimize", "msg_type": "status", "msg_text": "OK"}]}
]
}
Export a database​
Streams a .sql or .sql.gz file download.
GET /api/mysql/databases/mydb/export?format=sql
Import a database​
Multipart upload — field name must be file. Accepts .sql or .sql.gz.
POST /api/mysql/databases/mydb/import
Content-Type: multipart/form-data
Get per-database disk usage​
Mirrors the web UI's database-size view — distinct from /api/mysql/info, which has no size data, and /api/mysql/databases/<db>/tables, which is per-table for a single database.
GET /api/mysql/size?unit=mb&show_all=false
{"sizes": [{"database": "mydb", "size": 12.4}], "total": 1, "unit": "MB"}
Set the MySQL root password​
Write-only — the current password can't be retrieved. Updates both the % and localhost hosts and restarts the service.
PUT /api/mysql/root-password
Content-Type: application/json
{"password": "newRootPass123"}
List database users​
GET /api/mysql/users
{"users": ["myuser", "shopuser"], "total": 2}
Create a database user​
POST /api/mysql/users
Content-Type: application/json
{"username": "dbuser", "password": "securepass", "host": "%"}
host defaults to % if omitted.
Delete a database user​
DELETE /api/mysql/users/dbuser?host=%
Change a database user's password​
PATCH /api/mysql/users/dbuser/password
Content-Type: application/json
{"password": "newpass", "host": "%"}
Get a user's privileges on a database​
GET /api/mysql/users/dbuser/privileges/mydb?host=%
{"username": "dbuser", "host": "%", "database": "mydb", "privileges": ["ALL PRIVILEGES"]}
Grant privileges​
POST /api/mysql/grants
Content-Type: application/json
{"username": "dbuser", "database": "mydb", "privileges": ["ALL PRIVILEGES"], "host": "%"}
Revoke privileges​
DELETE /api/mysql/grants
Content-Type: application/json
{"username": "dbuser", "database": "mydb", "host": "%"}
Get databases/users/assignments summary​
GET /api/mysql/info
{
"databases": ["mydb", "shop"],
"users": ["dbuser", "shopuser"],
"assigned_databases": [{"database": "mydb", "users": "dbuser"}]
}
Show full processlist​
GET /api/mysql/processlist
{
"processlist": [
{"id": 42, "user": "dbuser", "host": "localhost", "db": "mydb", "command": "Query", "time": 0, "state": "", "info": "SELECT 1"}
],
"total": 1
}
Kill a running query​
Runs KILL QUERY. Only entries whose command is Query can be killed, system threads are refused (403). Returns 404 if the process is gone or no longer running a query.
POST /api/mysql/processlist/42/kill
{"id": "42", "status": "killed"}
Remote access status​
GET /api/mysql/remote-access
{
"enabled": false,
"server_ip": "203.0.113.10",
"port": "3306",
"user_access": [{"username": "dbuser", "hosts": ["%"]}]
}
Enable / disable remote access​
POST /api/mysql/remote-access
Content-Type: application/json
{"action": "enable"}
Grant a remote-access entry​
Creates a new user@host (cloning grants from an existing host for that user, if any).
POST /api/mysql/remote-access/entries
Content-Type: application/json
{"username": "dbuser", "host": "1.2.3.4", "password": "securepass"}
Change a remote-access entry's host​
PATCH /api/mysql/remote-access/entries
Content-Type: application/json
{"username": "dbuser", "old_host": "1.2.3.4", "new_host": "5.6.7.8"}
Remove a remote-access entry​
DELETE /api/mysql/remote-access/entries
Content-Type: application/json
{"username": "dbuser", "host": "1.2.3.4"}
Get server configuration​
GET /api/mysql/configuration
{
"configuration": {"max_connections": "150"},
"available_keys": ["max_connections", "max_allowed_packet", "innodb_buffer_pool_size", "..."]
}
Update server configuration​
Only keys present in available_keys are accepted. Restarts MySQL/MariaDB.
PUT /api/mysql/configuration
Content-Type: application/json
{"max_connections": "200"}
{"updated": true, "restarted": true, "configuration": {"max_connections": "200"}}
Configuration recommendations​
Checks the live server (memory limit, data per storage engine, status counters, connections and error log) and suggests values for the configurable keys, with the reason for each and the facts they are based on. Returns 503 if the database service can't be reached.
GET /api/mysql/configuration/recommendations
{
"recommendations": [
{"key": "max_connections", "label": "Max Connections", "current": "151", "recommended": "100", "reason": "..."}
],
"facts": {"memory_limit": "1 GB", "databases": "3"},
"notes": []
}
phpMyAdmin autologin​
Returns a one-click phpMyAdmin link that logs straight into the user's MySQL server — the API twin of the phpMyAdmin button in the panel. Requires the phpmyadmin feature. Pass ?db=<name> to have it included in the link.
The link stays valid until a new one is generated (by this endpoint or the panel button), so open it right away and don't share it. login_url is the regular phpMyAdmin login form for this user, for logging in with a database user's own credentials. Returns 503 if phpMyAdmin isn't running on the server.
GET /api/phpmyadmin
Authorization: Bearer <token>
{
"url": "https://panel.example.com:2053/pma.php?user=stefan&token=3f9c...",
"login_url": "https://panel.example.com:2053/index.php?manual=stefan"
}
PostgreSQL​
Same flat structure as MySQL: databases, users, and grants are separate top-level resources.
List databases​
GET /api/postgresql/databases
{
"databases": [{"name": "pgdb", "assigned_users": "pguser"}],
"total": 1
}
Create a database​
POST /api/postgresql/databases
Content-Type: application/json
{"name": "pgdb"}
Drop a database​
DELETE /api/postgresql/databases/pgdb
Export a database​
Streams a .sql dump.
GET /api/postgresql/databases/pgdb/export
Import a database​
Multipart upload — field name must be file.
POST /api/postgresql/databases/pgdb/import
Content-Type: multipart/form-data
{"database": "pgdb", "file": "dump.sql", "imported": true}
List users​
GET /api/postgresql/users
{"users": ["pguser"], "total": 1}
Create a user​
POST /api/postgresql/users
Content-Type: application/json
{"username": "pguser", "password": "securepass"}
Drop a user​
Revokes access from every database before dropping the role.
DELETE /api/postgresql/users/pguser
Change a user's password​
PATCH /api/postgresql/users/pguser/password
Content-Type: application/json
{"password": "newpass"}
Grant all privileges on a database​
POST /api/postgresql/grants
Content-Type: application/json
{"username": "pguser", "database": "pgdb"}
Revoke privileges​
DELETE /api/postgresql/grants
Content-Type: application/json
{"username": "pguser", "database": "pgdb"}
Get databases/users/assignments summary​
GET /api/postgresql/info
Show active connections​
GET /api/postgresql/processlist
{
"processlist": [
{"pid": 123, "user": "pguser", "application": "psql", "client_addr": "127.0.0.1",
"state": "active", "wait_event_type": "", "wait_event": "", "query": "SELECT 1",
"backend_type": "client backend", "duration": "0:00:00.001"}
],
"total": 1
}
Cancel a running query​
Runs pg_cancel_backend, the connection stays open. Only active client backend queries can be cancelled (403 otherwise). Returns 404 if the process is gone or no longer running a query.
POST /api/postgresql/processlist/123/kill
{"pid": "123", "status": "killed"}
Remote access status​
GET /api/postgresql/remote-access
{"enabled": false, "server_ip": "203.0.113.10", "port": "5432", "postgres_port": 5432}
Enable / disable remote access​
POST /api/postgresql/remote-access
Content-Type: application/json
{"action": "enable"}
Get / update server configuration​
Same shape as MySQL configuration — restarts PostgreSQL on save.
GET /api/postgresql/configuration
PUT /api/postgresql/configuration
Content-Type: application/json
{"max_connections": "200"}
Configuration recommendations​
Checks the live server (memory and CPU limits, data size, statistics, connections and log) and suggests values for the configurable keys, same response shape as MySQL. Returns 503 if the database service can't be reached.
GET /api/postgresql/configuration/recommendations
Domains​
List all domains​
GET /api/domains
{
"domains": [
{
"domain": "example.com", "docroot": "/var/www/html", "php_version": "8.2",
"site_count": 1, "redirect_url": null, "ssl": true, "status": "active",
"suspend_comment": null, "has_dns_zone": true
}
],
"total": 1
}
Add a domain​
docroot defaults to /var/www/html/. .onion domains also require hs_ed25519_public_key and hs_ed25519_secret_key.
POST /api/domains
Content-Type: application/json
{"domain": "newdomain.com"}
Remove a domain​
DELETE /api/domains/olddomain.com
Get domain status​
SSL / suspend / redirect status in one call.
GET /api/domains/example.com/status
{"domain": "example.com", "ssl": true, "status": "active", "suspend_comment": null, "redirect_url": null}
Suspend / unsuspend a domain​
POST /api/domains/example.com/suspend
POST /api/domains/example.com/unsuspend
Get / change the document root​
docroot must resolve inside /var/www/html/.
GET /api/domains/example.com/docroot
PUT /api/domains/example.com/docroot
Content-Type: application/json
{"docroot": "/var/www/html/example.com/public"}
Get / set / remove a redirect​
GET /api/domains/example.com/redirect
PUT /api/domains/example.com/redirect
Content-Type: application/json
{"redirect_url": "https://newsite.com"}
DELETE /api/domains/example.com/redirect
Get SSL status​
GET /api/domains/example.com/ssl
{"domain": "example.com", "ssl_mode": "auto", "keys": ""}
Issue / renew SSL​
action is required — one of autossl, generate, switch_and_generate, or custom (which also requires public_path and private_path, both inside /var/www/html/).
POST /api/domains/example.com/ssl
Content-Type: application/json
{"action": "autossl"}
Custom certificate:
POST /api/domains/example.com/ssl
Content-Type: application/json
{
"action": "custom",
"public_path": "/var/www/html/certs/example.com.crt",
"private_path": "/var/www/html/certs/example.com.key"
}
Get / save the VHost config​
GET /api/domains/example.com/vhost
PUT /api/domains/example.com/vhost
Content-Type: application/json
{"vhost": "...vhost content..."}
Get / set a display-case override​
Cosmetic only — e.g. showing "MyBrand.com" instead of "mybrand.com" in the UI.
GET /api/domains/example.com/capitalize
{"domain": "example.com", "capitalized_domain": "example.com"}
PUT /api/domains/example.com/capitalize
Content-Type: application/json
{"capitalized_domain": "Example.com"}
Get the TLSA record hash​
For DANE/TLSA DNS records, computed from the domain's active SSL certificate (Let's Encrypt or custom).
GET /api/domains/example.com/tlsa-hash
{"hash_311": "a30dc1ad...", "hash_301": "05754994...", "cert_path": "/etc/openpanel/caddy/ssl/.../example.com.crt", "type": "letsencrypt"}
DNS zone (nested under domains)​
This mirrors the standalone DNS Zone Editor below but is scoped under /api/domains/<domain>/.... Note the field name difference: record creation here uses value, while the standalone /api/dns endpoints use record.
GET /api/domains/example.com/dns
{
"domain": "example.com",
"serial": "2025011501",
"records": [
{"line_number": 12, "end_line_number": 12, "record": "www 3600 IN A 1.2.3.4"}
]
}
Save the whole zone file at once:
PUT /api/domains/example.com/dns
Content-Type: application/json
{"zone_content": "$ORIGIN example.com.\n..."}
Add a record:
POST /api/domains/example.com/dns/records
Content-Type: application/json
{"name": "www", "ttl": "3600", "type": "A", "value": "1.2.3.4"}
Update / delete a record by line number (end_row_id covers multi-line records like DKIM):
PUT /api/domains/example.com/dns/records/12
Content-Type: application/json
{"content": "www 3600 IN A 5.6.7.8", "end_row_id": 12, "serial": "2025011501"}
DELETE /api/domains/example.com/dns/records/12
Content-Type: application/json
{"end_row_id": 12}
Reset the zone to the default template, or export it as a file:
POST /api/domains/example.com/dns/restart
GET /api/domains/example.com/dns/export
Access logs​
GET /api/domains/example.com/logs?page=1&show_all=false
{
"domain": "example.com",
"logs": [{"ts": "2025-01-15T12:00:00Z", "status": 200, "path": "/"}],
"total": 1,
"page": 1,
"total_pages": 1,
"items_per_page": 1000
}
Email​
List mailboxes​
GET /api/emails
{
"emails": [
]
}
Create mailbox​
domain, username, and password are all required. Optional gb + format set a custom quota, and send_welcome: true drops a mail client setup guide into the new mailbox.
POST /api/emails
Content-Type: application/json
{"domain": "example.com", "username": "info", "password": "mailpass123"}
Get mailbox details​
GET /api/emails/[email protected]
{
"quota_limit": "1024",
"quota_used": "12",
"incoming": "ACCEPT",
"outgoing": "ACCEPT",
"server_ip": "203.0.113.10",
"mail_host": "mail.example.com"
}
Update mailbox​
At least one of gb+format, incoming (suspend/allow), outgoing (suspend/allow), or password is required.
PATCH /api/emails/[email protected]
Content-Type: application/json
{"password": "newpass456"}
Delete mailbox​
DELETE /api/emails/[email protected]
Download mail client configuration​
config_type is one of thunderbird, outlook, apple.
GET /api/emails/configuration/thunderbird/[email protected]
List aliases​
GET /api/emails/aliases
{
"aliases": [
]
}
Create alias​
POST /api/emails/aliases
Content-Type: application/json
{"username": "alias", "domain": "example.com", "target": "[email protected]"}
Get targets for one alias​
GET /api/emails/aliases/[email protected]
Add a target to an existing alias​
POST /api/emails/aliases/[email protected]
Content-Type: application/json
{"target": "[email protected]"}
Delete an alias target (or the whole alias)​
DELETE /api/emails/aliases/[email protected]
Content-Type: application/json
{"target": "[email protected]"}
Delete every target for the alias:
DELETE /api/emails/aliases/[email protected]
Content-Type: application/json
{"delete_all": true}
Get catch-all address​
GET /api/emails/default/example.com
{"domain": "example.com", "destination": null}
Set / remove catch-all address​
Omit or empty destination to remove it.
PUT /api/emails/default/example.com
Content-Type: application/json
{"destination": "[email protected]"}
Check deliverability (all domains)​
GET /api/emails/deliverability
Check deliverability for a domain​
Compares live DNS against what the mail server expects for DKIM, SPF, and DMARC.
GET /api/emails/deliverability/example.com
{
"domain": "example.com",
"server_ip": "203.0.113.10",
"ok": true,
"dkim": {"status": "ok", "current": "v=DKIM1; ...", "expected": "v=DKIM1; ..."},
"spf": {"status": "ok", "current": "v=spf1 ip4:203.0.113.10 ~all", "expected": "v=spf1 ip4:203.0.113.10 ~all"},
"dmarc": {"status": "ok", "current": "v=DMARC1; p=none", "expected": "v=DMARC1; p=none"}
}
Get Sieve mail filters​
GET /api/emails/filters/[email protected]
{
"raw": "require [\"fileinto\"];\nif header :contains \"Subject\" \"SPAM\" { fileinto \"Junk\"; }",
"parsed": [{"condition": "header :contains \"Subject\" \"SPAM\"", "action": "fileinto \"Junk\""}]
}