Iniciar sesión

API

REST API for integrating with the MXGuard mail filtering system.

API Basics

Endpoint

https://my.mxguard.net/panelv32/api/?token=YOUR_API_TOKEN

Request Format

Requests are sent via POST with a JSON body. GET with URL parameters is also supported.

POST body (JSON)
{ "request": "module_name", "action": "action_name", "parameters": "values" }

Authorization

The token is passed in the URL parameter token. You can generate a token in the control panel under "Access Tokens".

Supported Modules

requestDescription
trackerEmail processing history
messageDetails of a specific email
queueDelivery queue
domainsList of domains
domainManage a single domain
boxesList of mailboxes
boxManage a single mailbox
whitelistsWhitelist
blacklistsBlacklist
statsStatistics

Tracker

History of email message processing.

List of Emails

Request
{ "request": "tracker", "action": "list", "status": "quarant", "date": "day", "mail_to": "example.com" }
ParameterDescriptionExample
statusEmail statusquarant, deliv, reject, error
datePeriodday, lastday, week, month
subjectEmail subject"Promotion"
mail_fromSender"sender@domain.com"
mail_toRecipient"user@example.com"
smidEmail ID"2508200002183574501"
ip_fromSender IP"192.168.1.1"
perpageRecords per page50
pagePage number1
Response
{ "perpage": "50", "page": 1, "records": 453, "pages": 10, "rows": { "1": { "byid": {"key": "byid", "val": "2508200002183574501"}, "status": {"key": "status", "val": "zonde", "view": "Spam traps"}, "date": {"key": "date", "val": "today at 00:02, Wed"}, "subject": {"key": "subject", "val": "Contract Tender Notice"}, "mail_from": {"key": "mail_from","val": "srm@lukoil.com"}, "mail_to": {"key": "mail_to", "val": "yuri@mydomain.com"}, "status_info": {"key": "status_info","val": "237"} } } }

Detailed Email Information

Request
{ "request": "message", "action": "view", "byid": "2508200324264421504" }
FieldDescription
byidUnique email ID
smidMXGuard Message ID
dateDate and time of processing
heloSender's EHLO greeting
ip_fromSender's IP address
mail_fromSender's email
mail_toRecipient's email
subjectEmail subject
msizeEmail size
quarantineQuarantine flag (0/1)
statusProcessing status code
status_textText description of status
headEmail headers (raw)
logEmail processing log
Response (success)
{ "records": 1, "code": "success", "rows": { "1": { "byid": {"key":"byid","val":"2508200324264421504"}, "smid": {"key":"smid","val":"2508200324264421504"}, "date": {"key":"date","val":"August 20 at 03:24:26"}, "ip_from": {"key":"ip_from","val":"10.255.7.3"}, "mail_from": {"key":"mail_from","val":"sender@example.com"}, "mail_to": {"key":"mail_to","val":"sn@mydomain.com"}, "subject": {"key":"subject","val":"Sample email subject"}, "msize": {"key":"msize","val":"2.5 Kb"}, "quarantine": {"key":"quarantine","val":"0"}, "status_text": {"key":"status_text", "val":"Email delivered to destination"}, "head": {"key":"head","val":"Email headers..."}, "log": {"key":"log","val":"Processing log..."} } } }
Response (error)
{ "records": 0, "code": "failed", "error": "notfound", "text": "Record not found", "module": "tracker", "request": "view" }

Email Queue

Queue list
{ "request": "queue", "action": "list", "mail_from": "sn@example.com", "date": "day", "perpage": 50, "page": 1 }
Force-send all
{ "request": "queue", "action": "sendall" }
Frequent use of sendall may cause receiving servers to block you due to the burst of outgoing traffic.
Response (list)
{ "records": 1, "code": "success", "rows": { "1": { "byid": {"key":"byid","val":"2508221749084133220"}, "status": {"key":"status","val":"queue", "view":"Queued"}, "date": {"key":"date","val":"today at 17:49, Fri"}, "mail_from": {"key":"mail_from","val":"sn@example.com"}, "mail_to": {"key":"mail_to", "val":"recipient@example.com"}, "status_info":{"key":"status_info","val":"340"} } }, "actions": ["list", "sendall"], "module": "tracker", "request": "list" }
Response (sendall)
{ "code": "success", "message": "All queued emails have been sent", "sent_count": 15, "module": "tracker", "request": "sendall" }

Domain Management

List of Domains

Request
{ "request": "domains", "action": "list", "active": "1", "domain": "example" }
Response
{ "records": 1, "code": "success", "rows": { "1": { "byid": {"key":"byid","val":"mydomain.com"}, "status": {"key":"status","val":"normal", "view":"Active"}, "domain": {"key":"domain","val":"mydomain.com"}, "emailcnt": {"key":"emailcnt","val":"31"}, "mx_fail": {"key":"mx_fail","val":"0"}, "mxs_mx": {"key":"mxs_mx", "val":"001:mx.mxguard.net;020:mx1.mxguard.net"}, "spamlevel": {"key":"spamlevel","val":"6982 (90 %)"} } } }

View Domain Settings

Request
{"request":"domain","action":"view","byid":"mydomain.com"}
FieldDescription
smtpserverPrimary SMTP delivery server
smtpserver2Backup SMTP server
portSMTP server port
databytesEmail size limit
num1Spam filtering level (1–10)
boxtypeMailbox management type (add_safe / manual)
masquaradeSender masquerading (yes/no)
weblearnWeb-based spam-filter training (enable/disable)
dkim_selectorDKIM selector
dkim_pubDKIM public key

Adding a Domain

Request
{ "request": "domain", "action": "add", "domain": "newdomain.com", "smtpserver": "mx.yandex.ru", "boxtype": "add_safe", "masquarade": "yes" }
ParameterRequired
domainYes
smtpserverYes
smtpserver2No
portNo
boxtypeNo
masquaradeNo
commentNo
Response (success)
{ "code": "success", "rows": {"byid": 1855}, "actions": ["view","save","add","delete","check"], "module": "domain", "request": "add" }
Validation Error
{ "code": "failed", "error": "fields", "rows": { "smtpserver": { "errors": [{"error":"badhost", "error_text":"Host is invalid"}] } }, "text": "Error filling in fields" }

Editing a Domain

Request
{ "request": "domain", "action": "save", "byid": "mydomain.com", "smtpserver": "mx1.yandex.ru", "num1": "7.00" }

The response contains the changed fields along with their old and new values:

{"code":"success","rows":[{ "field":"smtpserver","old":"mx.yandex.ru","val":"mx1.yandex.ru" }]}

Deleting a Domain

Request
{ "request": "domain", "action": "delete", "byid": "example.com" }
All mailboxes on the domain must be deleted before the domain itself can be deleted. This operation cannot be undone.
Error CodeDescription
notfoundDomain not found
access_deniedNo permission to delete
has_mailboxesDomain has mailboxes
has_aliasesDomain has aliases
system_domainSystem domain

Mailbox Management

List of Mailboxes
{ "request": "boxes", "action": "list", "domain": "mydomain.com", "status": "active", "email": "admin@", "perpage": 100, "page": 1 }
View Mailbox
{ "request": "box", "action": "view", "byid": "user@mydomain.com" }
Adding a Mailbox
{ "request": "box", "action": "add", "email": "newuser@mydomain.com", "password": "securepassword123" }
Editing a Mailbox
{ "request": "box", "action": "save", "byid": "user@mydomain.com", "comment": "Administrator", "password": "newpassword456" }
Deleting a Mailbox
{ "request": "box", "action": "delete", "byid": "user@mydomain.com" }
Response FieldDescription
byidMailbox email (ID)
statusactive / disabled / zonde
emailFull email address
emailcntNumber of emails
boxunusedUnused flag
boxnospamDisable filtering
commentComment
spamlevelSpam level
Error CodeDescription
notfoundMailbox not found
already_existsMailbox already exists
invalid_emailInvalid email format
domain_not_existsDomain does not exist
password_too_weakPassword is too weak
quota_exceededMailbox quota exceeded

Whitelist

List Entries
{ "request": "whitelists", "action": "list", "status": "personal", "address": "gmail.com", "to_address": "user@mydomain.com" }
Adding an Entry
{ "request": "whitelists", "action": "add", "address": "partner@company.com", "to_address": "user@mydomain.com", "status": "personal", "comment": "Trusted partner" }
Editing / Deleting
{ "request": "whitelists", "action": "save", "byid": "61539", "comment": "Updated comment" } {"request":"whitelists","action":"delete","byid":"61539"}
Sample List Response
{ "records": 483, "code": "success", "rows": { "1": { "byid": {"key":"byid","val":"61539"}, "status": {"key":"status","val":"personal", "view":"Personal"}, "address": {"key":"address", "val":"partner@gmail.com"}, "to_address": {"key":"to_address", "val":"eg@mydomain.com"}, "comment": {"key":"comment", "val":"Partner LLC"} } } }
Entries with to_address: "(for all)" apply to every recipient on the domain. Whitelisting an entire domain (gmail.com) can significantly reduce the filtering level.

Blacklist

List Entries
{ "request": "blacklists", "action": "list", "status": "domain", "address": "*.com" }
Adding an Entry
{ "request": "blacklists", "action": "add", "address": "*.spammer.com", "to_address": "(for all)", "status": "domain", "comment": "Known spammer" }
Editing / Deleting
{"request":"blacklists","action":"save", "byid":"192605","comment":"Updated"} {"request":"blacklists","action":"delete","byid":"192605"}
TypeExample address
Emailspammer@example.com
Domain*.example.com
IP192.168.1.1
IP range192.168.1.*
statusDescription
personalPersonal entry
domainEntire domain
ipBy IP address

Statistics

Retrieving Statistics
{ "request": "stats", "action": "list", "period": "month", "domain": "example.com" }
Detailed Statistics
{ "request": "stats", "action": "view", "byid": "2024-08", "domain": "example.com" }
ParameterDescription
periodday, week, month, year
domainFilter by domain
date_fromPeriod start (YYYY-MM-DD)
date_toPeriod end (YYYY-MM-DD)

Error Codes

HTTPStatusDescription
200SuccessRequest completed successfully
400Bad RequestInvalid request syntax
401UnauthorizedInvalid or missing token
403ForbiddenAccess denied
404Not FoundObject not found
500Internal ErrorInternal server error
errorDescription
notfoundRecord not found
access_deniedNo access
deniedNo permission for this operation
fieldsField validation errors
requiredRequired field not filled in
badhostInvalid host format
invalid_emailInvalid email format
invalid_domainInvalid domain format
invalid_addressInvalid address format
invalid_ipInvalid IP format
already_existsRecord already exists
domain_existsDomain already exists
has_mailboxesDomain contains mailboxes
quota_exceededQuota exceeded
password_too_weakPassword is too weak
queue_emptyQueue is empty
database_errorDatabase error

Example Requests

GET Request with URL Parameters

cURL
curl -X GET \ 'https://my.mxguard.net/panelv32/api/?token=YOUR_TOKEN&request=tracker&action=list&mail_from=newsletter@company.com&date=week&status=quarant' \ -H 'Content-Type: application/json'

POST Request with JSON Body

cURL
curl -X POST \ 'https://my.mxguard.net/panelv32/api/?token=YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "request": "tracker", "action": "list", "mail_from": "billing@service.com", "date": "month", "status": "deliv", "subject": "Invoice", "perpage": 100, "page": 1 }'

Python

import requests, json TOKEN = "YOUR_API_TOKEN" URL = f"https://my.mxguard.net/panelv32/api/?token={TOKEN}" def api(payload): r = requests.post(URL, json=payload, headers={"Content-Type": "application/json"}) return r.json() # List of quarantined emails print(api({"request":"tracker","action":"list","status":"quarant","date":"day"})) # Add a domain print(api({"request":"domain","action":"add", "domain":"example.com","smtpserver":"mail.example.com"})) # Working with the queue queue = api({"request":"queue","action":"list","perpage":100}) if queue.get("records", 0) > 0: api({"request":"queue","action":"sendall"})