This document provides a description of all available API endpoints for the MailAdmin control panel.
- Base URL:
/api - Data Format: JSON
- Authentication: Most endpoints require a JWT token passed in the
Authorizationheader. Format:Authorization: Bearer <token>
User authentication and token retrieval.
- Authentication: Not required.
- Request Body:
{ "username": "admin@example.com", "password": "your_password" } - Successful Response (200 OK):
Note: An HttpOnly Cookie
{ "access_token": "eyJhbGciOi...", "user": { "username": "admin@example.com", "superadmin": true } }refreshTokenis also set.
Refresh Access Token using Refresh Token.
- Authentication: Uses Cookie
refreshToken. - Successful Response (200 OK):
{ "access_token": "eyJhbGciOi..." }
User logout.
- Authentication: Not required. Clears the
refreshTokencookie. - Successful Response:
200 OK(no body).
Get information about the current user.
- Authentication: JWT required.
- Successful Response (200 OK): User data (Claims).
Change the password of the current user.
- Authentication: JWT required.
- Request Body:
{ "new_password": "new_secure_password" } - Successful Response (200 OK):
{ "message": "password changed successfully" }
Available only to SuperAdmin.
Retrieve a list of all administrators.
- Authentication: JWT required (SuperAdmin).
- Successful Response (200 OK): Array of administrator objects.
Retrieve details of a specific administrator and the domains they manage.
- Authentication: JWT required (SuperAdmin).
- Successful Response (200 OK):
{ "admin": { ... }, "domains": ["example.com", "test.com"] }
Create a new administrator.
- Authentication: JWT required (SuperAdmin).
- Request Body:
{ "username": "newadmin@example.com", "password": "secure_password", "superadmin": false, "active": true, "domains": ["example.com"] } - Successful Response (201 Created): Created administrator object.
Edit an administrator.
- Authentication: JWT required (SuperAdmin).
- Request Body:
{ "password": "optional_new_password", "active": true, "superadmin": false, "phone": "+123456789", "email_other": "backup@gmail.com", "domains": ["example.com", "newdomain.com"] } - Successful Response:
200 OK(no body).
Delete an administrator.
- Authentication: JWT required (SuperAdmin).
- Successful Response:
204 No Content.
Retrieve a list of domains with their statistics.
- Authentication: JWT required.
- Query Parameters:
search(string, optional) — search by name or description.active(bool, optional) — filter by status (true/false).
- Successful Response (200 OK):
[ { "domain": "example.com", "description": "Main domain", "aliases": 10, "mailboxes": 5, "maxquota": 10240, "quota": 2048, "transport": "virtual", "backupmx": false, "active": true, "mailboxes_count": 3, "aliases_count": 2, "quota_used": 1500 } ]
Create a new domain. Note: RFC aliases (postmaster, abuse, hostmaster) are created automatically.
- Authentication: JWT required (SuperAdmin).
- Request Body:
{ "domain": "newdomain.com", "description": "Description", "aliases": 0, "mailboxes": 0, "maxquota": 0, "quota": 0, "transport": "virtual", "backupmx": false, "active": true } - Successful Response (201 Created): Created domain object.
Edit a domain.
- Authentication: JWT required (SuperAdmin).
- Request Body: Same fields as creation (except
domain). - Successful Response (200 OK): Updated domain object.
Cascading deletion of a domain and all associated mailboxes, aliases, and settings.
- Authentication: JWT required (SuperAdmin).
- Successful Response:
204 No Content.
Generate recommended DNS records (MX, SPF, DKIM, DMARC) for the domain.
- Authentication: JWT required (Domain Access).
- Successful Response (200 OK):
{ "domain": "example.com", "spf": "v=spf1 ip4:1.2.3.4 mx a -all", "dkim": "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...", "dmarc": "v=DMARC1; p=quarantine; rua=mailto:postmaster@example.com" }
Retrieve a list of mailboxes.
- Authentication: JWT required.
- Query Parameters:
domain(string) — required ifsearchis not specified.search(string, optional) — search by username or name.page(int, default 1).limit(int, default 50).active(bool, optional).
- Response Headers:
X-Total-Count— total count. - Successful Response (200 OK): Array of
Mailboxobjects withquota_usedandmessagesfields.
Create a mailbox. Note: A mirror alias is created automatically.
- Authentication: JWT required (Domain Access).
- Request Body:
{ "username": "user@example.com", "password": "secure_password", "name": "John Doe", "quota": 1024, "active": true, "phone": "+123456789", "email_other": "backup@gmail.com" } - Successful Response (201 Created): Created object.
Edit a mailbox.
- Authentication: JWT required (Domain Access).
- Request Body:
{ "password": "optional_new_password", "name": "New Name", "quota": 2048, "active": true, "phone": "+123456789", "email_other": "backup@gmail.com" } - Successful Response (200 OK): Updated object.
Delete a mailbox and associated aliases/vacation auto-replies.
- Authentication: JWT required (Domain Access).
- Successful Response:
204 No Content.
Mass create mailboxes with a standard password.
- Request Body:
{ "domain": "example.com", "prefixes": ["user1", "user2"], "password": "common_password", "quota": 1024, "active": true } - Response (201 Created):
{"created": 2}
Mass delete.
- Request Body:
{"usernames": ["user1@example.com", "user2@example.com"]} - Response:
204 No Content
Mass change status (active/blocked).
- Request Body:
{"usernames": ["user1@example.com"], "active": false} - Response:
204 No Content
List forwarding aliases.
- Authentication: JWT required.
- Query Parameters:
domain,search,page,limit.
Create an alias.
- Body:
{"address": "info@example.com", "goto": "user@example.com,boss@example.com", "domain": "example.com", "active": true} - Response:
201 Created.
Edit an alias.
- Body:
{"goto": "new@example.com", "active": true}
Delete an alias.
SuperAdmin only.
GET /api/aliases/domain-aliases?domain=...POST /api/aliases/domain-aliases(Body:AliasDomainobject)DELETE /api/aliases/domain-aliases/:alias_domain
View audit logs of administrator actions.
- Parameters:
page,limit(max 500),domain.
Summary statistics for the dashboard (number of domains, mailboxes, quota used, recent logs).
Available only to SuperAdmin.
GET /api/system/health— Status of RAM, CPU, Disk, services (Postfix, Dovecot, MySQL, etc.).GET /api/system/queue— View Postfix mail queue.POST /api/system/queue/flush— Force mail queue flush.DELETE /api/system/queue/:id— Delete a message from the queue (idorall).GET /api/system/logs?lines=200&search=...— View system logs/var/log/mail.log.GET /api/system/fail2ban— List banned IPs.DELETE /api/system/fail2ban/unban?ip=...&jail=...— Unban an IP.
GET /api/tools/check-mx/:domain— Quick check of MX records.POST /api/tools/send-email— Send a test email.POST /api/tools/broadcast— Broadcast announcement to all mailboxes in a domain.
GET /api/mailboxes/:username/vacationPUT /api/mailboxes/:username/vacation- Body:
{"subject": "...", "body": "...", "active": true, "activefrom": "...", "activeuntil": "...", "interval_time": 1}
- Body:
GET /api/sieve/:username— Retrieve rules (includingGLOBALfor superadmin).POST /api/sieve/:username— Save rules (JSON).POST /api/sieve/:username/import— Import raw.sievefile from server to web interface.