Customer API: automate mailboxes, databases, DNS and cron
Each hosting account can be automated with its own API: deploy scripts, a CI pipeline or your own tools can create mailboxes, databases, DNS records and cron jobs without signing in to the control panel.
Before you start
- Log in to the control panel (
https://<server>:2083). - Open API tokens (section Advanced), enter a Name, click Create token and copy the token. See create an API token.
If you do not see API tokens, your plan does not include it, or you are signed in as a team member.
Basics
- Base URL:
https://<server>:2083/api/v1 - Header:
Authorization: Bearer YOUR_TOKEN - Body: JSON (
Content-Type: application/json) or form fields. - Answers:
{"status": 1, "data": …}or{"status": 0, "error": "…"}. - Only the tools of your plan work. Otherwise:
403This tool is not included in your plan. - A suspended account gets
403This account is suspended. - Invalid input gets
422with the reason, for exampleYou have reached your email accounts limit (10).
Endpoints
| Method and path | What it does | Body |
|---|---|---|
GET /me | Username, domain, package, disk used and limit, counts | — |
GET /me/domains | Domains with type and document_root | — |
GET /me/email | Mailboxes with quota_mb and used_mb | — |
POST /me/email | Create a mailbox | address, password, quota_mb (default 1024) |
POST /me/email/{address}/password | Change a mailbox password | password |
POST /me/email/{address}/delete | Delete a mailbox | — |
GET /me/forwarders | Forwarders with id, source, destination | — |
POST /me/forwarders | Add a forwarder | source, destination |
POST /me/forwarders/{id}/delete | Delete a forwarder | — |
GET /me/databases | MySQL databases with size_mb | — |
POST /me/databases | Create a database and a user of the same name with all privileges | name, password |
POST /me/databases/{name}/delete | Delete a database and its user of the same name | — |
GET /me/dns/{domain} | DNS records with id | — |
POST /me/dns/{domain} | Add a DNS record | name, type, content, ttl, priority |
POST /me/dns/{domain}/{id}/delete | Delete a DNS record | — |
GET /me/cron | Cron jobs with id | — |
POST /me/cron | Add a cron job | schedule, command |
POST /me/cron/{id}/delete | Delete a cron job | — |
GET /me/ssl | Certificate status, issuer and expires_at per domain | — |
All paths start with /api/v1.
Examples
Account and usage:
curl -s -H "Authorization: Bearer $TOKEN" https://server1.example.com:2083/api/v1/me
Create a mailbox of 2 GB (quota_mb 0–102400):
curl -s -X POST https://server1.example.com:2083/api/v1/me/email \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"address":"[email protected]","password":"Mailb0x-Passw0rd!","quota_mb":2048}'
# {"status": 1, "data": {"address": "[email protected]"}}
Create a database and its user. The name gets your username in front:
curl -s -X POST https://server1.example.com:2083/api/v1/me/databases \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"name":"blog","password":"Db-Passw0rd!2026"}'
# {"status": 1, "data": {"database": "shop1_blog", "user": "shop1_blog", "host": "localhost"}}
Add a DNS record (types A, AAAA, CNAME, MX, TXT, NS, SRV, CAA; TTL 60–604800):
curl -s -X POST https://server1.example.com:2083/api/v1/me/dns/example.com \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"name":"api","type":"A","content":"203.0.113.10","ttl":3600}'
# {"status": 1, "data": {"id": 87}}
Add a cron job every 15 minutes:
curl -s -X POST https://server1.example.com:2083/api/v1/me/cron \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"schedule":"*/15 * * * *","command":"/usr/bin/php ~/public_html/cron.php"}'
Delete a forwarder (the id comes from GET /me/forwarders):
curl -s -X POST -H "Authorization: Bearer $TOKEN" \
https://server1.example.com:2083/api/v1/me/forwarders/42/delete
# {"status": 1, "data": {"deleted": true}}
Good to know
- Database names: lowercase letters, digits and
_, up to 32 characters before your username prefix. - Mailbox and database passwords follow the same rule as account passwords: 8+ characters with 3 of lowercase, uppercase, digits, symbols.
- The plan's limits apply as in the control panel.
Thank you — this helps us improve the article.
Still stuck?
Ask the AI about your exact situation — it answers from this knowledge base — or contact us.
Related articles
- How to create an API token for scripts and billing
Create an API token in the admin panel or the control panel for the REST API or a billing system, copy it once, see when it was last used, and revoke it.
- How to restrict an API token (IP addresses, expiry, read only)
Limit an API token to your billing server's IP addresses, let it expire after 7 to 365 days, or make it read only, and the errors you get when a limit applies.
- API returns 401 Unauthorized, 403 or IP blocked
Fix API errors: 401 Unauthorized, expired token, address not allowed, IP blocked after failed attempts, read-only token, missing privilege and 422.
- REST API overview: authentication, requests and responses
How the REST API v1 works: base URL, Bearer token authentication, JSON or form bodies, the response envelope, HTTP status codes and every endpoint.