OpenAdmin API Documentation
OpenAdmin API can be used to manage options available from the OpenAdmin interface: hosting plans, accounts, domains, services, etc. All API endpoints require Bearer JWT authentication.
OpenAdmin API is available only on OpenPanel Enterprise edition.
To use the API, enable it first from the OpenAdmin > Settings > API Access page or from terminal with opencli api on command.
To generate a token for use with the endpoints, send a POST request to /api/ using your OpenAdmin username and password:
curl -X POST "https://OPENADMIN_DOMAIN_OR_IP:2087/api/" && \
-H "Content-Type: application/json" -d '{"username":"OPENADMIN_USERNAME","password":"OPENADMIN_PASSWORD"}'
We recommend creating a separate admin user dedicated solely to API usage. This way, you can quickly suspend or delete that account if its credentials are ever compromised.
Example response with the token is:
{"access_token":"eyJhbGciOiJIUzI1NiIsInRs4CI6IkpXVCJ9.eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTc4MDc0OTkwOCwianRpIjoiZDcwZmY2NmEtNDNiOC00OGZkLThiMWEtZDIwYWUwMDNhNjEyIiwidHlwZSI6ImFjY2VzcyIsInN1YiI6Im9wc3VwcG9ydCIsIm5iZiI6MTc4MDc0OTkwOCwiY3NyZiI6IjZlOGRmNGVmLTA0MjktNGNkYy1hNTg5LTJkYzUwMDk2ZDI2NSIsI3V4cCI6MTc4M33c1MDgwOH0.WLQ8rsVOF6pQg07i1fI1lXfd8_cCmryiOjGqg8zgOmw"}
This token must be sent in header for all other API endpoints:
-H "Authorization: Bearer YOUR_JWT_TOKEN" -H "Content-Type: application/json"
๐ก Hint: Use opencli api list command to view usage examples for all the endpoints available on your OpenPanel version.
Usersโ
List All Accountsโ
GET /api/users
Example response
[
{
"username": "stefan",
"email": "stefan@pejcic.rs",
"plan_name": "default_plan_nginx"
}
]
Create Accountโ
POST /api/users
Request Body:
{
"email": "stefan@pejcic.rs",
"username": "stefan",
"password": "s32dsasaq",
"plan_name": "default_plan_nginx"
}
Response:
{
"response": {
"message": "Successfully added user stefan password: s32dsasaq"
},
"success": true
}
Get Single Accountโ
GET /api/users/{username}
Suspend / Unsuspend / Change Passwordโ
PATCH /api/users/{username}
Request Body Example:
{
"action": "suspend",
"password": "NEW_PASSWORD_HERE"
}
Change Planโ
PUT /api/users/{username}
Request Body:
{
"plan_name": "default_plan_nginx"
}
Delete Accountโ
DELETE /api/users/{username}
Autologin to User Accountโ
CONNECT /api/users/{username}
List Users with Dedicated IPsโ
GET /api/ips
Plansโ
List All Plansโ
GET /api/plans
Response:
{
"plans": [
{
"id": 1,
"name": "ubuntu_nginx_mysql",
"description": "Unlimited disk space and Nginx",
"bandwidth": 100,
"cpu": "1",
"ram": "1g",
"disk_limit": "10 GB",
"storage_file": "0 GB",
"inodes_limit": 1000000,
"db_limit": 0,
"domains_limit": 0,
"websites_limit": 10,
"docker_image": "openpanel/nginx"
}
]
}
Get Single Planโ
GET /api/plans/{plan_id}
Domainsโ
List All Domainsโ
GET /api/domains
Add Domainโ
POST /api/domains/new
Request Body:
{
"username": "current_user",
"domain": "example.com",
"docroot": "/var/www/html/example.com"
}
Suspend Domainโ
POST /api/domains/suspend/{domain}
Unsuspend Domainโ
POST /api/domains/unsuspend/{domain}
Delete Domainโ
POST /api/domains/delete/{domain}
Usageโ
API Usage Infoโ
GET /api/usage
Current Usage Statsโ
GET /api/usage/stats
Response:
{
"usage_stats": "{\"timestamp\": \"2024-09-03\", \"users\": 1, \"domains\": 2, \"websites\": 0}"
}
CPU Usageโ
GET /api/usage/cpu
Response Example:
{
"core_0": 0,
"core_1": 0
}
Memory Usageโ
GET /api/usage/memory
Disk Usage Per Userโ
GET /api/usage/disk
Server Disk Usageโ
GET /api/usage/server
Response Example:
[
{
"device": "/dev/vda1",
"mountpoint": "/",
"fstype": "ext4",
"total": 123690532864,
"used": 63366230016,
"free": 60307525632,
"percent": 51.2
}
]
Systemโ
Get System Informationโ
GET /api/system
Response Example:
{
"hostname": "stefi",
"os": "Ubuntu 24.04 LTS",
"time": "2024-09-04 15:09:16",
"kernel": "6.8.0-36-generic",
"cpu": "DO-Premium-Intel(x86_64)",
"openpanel_version": "0.2.7",
"running_processes": 178,
"package_updates": 98,
"uptime": "18905"
}
Servicesโ
List Monitored Servicesโ
GET /api/services
Edit Services Listโ
PUT /api/services
Request Body Example:
{
"service1": { "name": "Service One", "status": "active" },
"service2": { "name": "Service Two", "status": "inactive" }
}
Check Status of Servicesโ
GET /api/services/status
Start Serviceโ
POST /api/service/start/{service_name}
Restart Serviceโ
POST /api/service/restart/{service_name}
Stop Serviceโ
POST /api/service/stop/{service_name}
Notificationsโ
List Notificationsโ
GET /api/notifications
Response Example:
[
{ "title": "Update available", "message": "New package updates available." }
]
- Users
- List All Accounts
- Create Account
- Get Single Account
- Suspend / Unsuspend / Change Password
- Change Plan
- Delete Account
- Autologin to User Account
- List Users with Dedicated IPs
- Plans
- List All Plans
- Get Single Plan
- Domains
- List All Domains
- Add Domain
- Suspend Domain
- Unsuspend Domain
- Delete Domain
- Usage
- API Usage Info
- Current Usage Stats
- CPU Usage
- Memory Usage
- Disk Usage Per User
- Server Disk Usage
- System
- Get System Information
- Services
- List Monitored Services
- Edit Services List
- Check Status of Services
- Start Service
- Restart Service
- Stop Service
- Notifications
- List Notifications