UAPI accesses the cPanel interface's features. Use this API to access and modify cPanel account data and settings.
https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/
https://{host}:{port}/execute/
Request
This function creates a Mail Exchanger (MX) record. For more information about MX record settings, read our Email Routing Configuration documentation.
Important:
When you disable the Receive Mail role, the system disables this function
The new mail exchanger's priority value.
Note:
It is common practice to set a priority value that is divisible by five.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/Email/add_mx
- A server running cPanel.
https://cpanel-server.tld:2083/execute/Email/add_mx
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/Email/add_mx?domain=example.com&exchanger=mail.example.com&priority=5&alwaysaccept=1'{ "apiversion": 3, "func": "add_mx", "module": "Email", "result": { "data": { … }, "errors": null, "messages": null, "metadata": {}, "status": 1, "warnings": null } }
Request
This function creates a Mail Exchanger (MX) record. For more information about MX record settings, read our Email Routing Configuration documentation.
Important:
When you disable the Receive Mail role, the system disables this function.
The mail exchanger's current name.
The mail exchanger's new priority value.
Note:
Common practice sets a priority value divisible by five.
Whether the mail exchanger accepts all mail for the domain.
1— The mail exchanger always accepts mail.0— The mail exchanger does not always accept mail.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/Email/change_mx
- A server running cPanel.
https://cpanel-server.tld:2083/execute/Email/change_mx
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/Email/change_mx?domain=example.com&exchanger=mail.example.com&oldexchanger=mail.example.com&priority=15&alwaysaccept=1&oldpriority=5'{ "apiversion": 3, "func": "change_mx", "module": "Email", "result": { "data": { … }, "errors": null, "messages": null, "metadata": {}, "status": 1, "warnings": null } }
Request
This function deletes a Mail Exchanger (MX) record. For more information about MX record settings, read our Email Routing Configuration documentation.
Important:
When you disable the DNS role, the system disables this function.
The mail exchanger's priority value. If multiple MX entries match the exchanger value, the system uses this parameter to find the correct entry.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/Email/delete_mx
- A server running cPanel.
https://cpanel-server.tld:2083/execute/Email/delete_mx
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/Email/delete_mx?domain=example.com&exchanger=mail.example.com&priority=15'{ "apiversion": 3, "func": "delete_mx", "module": "Email", "result": { "data": { … }, "errors": null, "messages": null, "metadata": {}, "status": 1, "warnings": null } }