iRedAdmin-Pro: RESTful API

Attention

Check out the lightweight on-premises email archiving software developed by iRedMail team: Spider Email Archiver.

Attention

Summary

iRedAdmin-Pro RESTful API will return message in JSON format.

Enable RESTful API

RESTful API is disabled by default, to enable it, please add setting below in iRedAdmin-Pro config file settings.py:

ENABLE_RESTFUL_API = True

Restarting iredadmin (if you're running Nginx) or Apache service is required after changed iRedAdmin config file.

iRedAdmin-Pro config file location

To restrict API access to few IP addresses, please login to iRedAdmin-Pro as global admin, then click menu System -> Settings, find option RESTful API is accessible only from specified IP addresses or networks, input the allowed IP addresses or networks.

Sample code to interact with iRedAdmin-Pro RESTful API

APIs

Notes:

Login

POST /api/login Login with an admin username (full email address) and password Parameters

Domain

GET /api/domains Get profiles of all managed mail domains Parameters

GET /api/domain/<domain> Get profile of an existing domain

POST /api/domain/<domain> Create a new domain Parameters

DELETE /api/domain/<domain> Delete an existing domain (all mail messages will NOT be removed)

DELETE /api/domain/<domain>/keep_mailbox_days/<number> Delete domain, and keep all mail messages for given days. Defaults to 0 day which means keeping forever.

PUT /api/domain/<domain> Update profile of an existing domain Parameters

PUT /api/domain/admins/<domain> Manage normal domain admins. Parameters

Domain Admin

Attention

GET /api/admin/<mail> Get profile of an existing domain admin

POST /api/admin/<mail> Create a new domain admin Parameters

DELETE /api/admin/<mail> Delete an existing domain admin

PUT /api/admin/<mail> Update profile of an existing domain admin Parameters

POST /api/verify_password/admin/<mail> Verify given (plain) password against the one stored in SQL/LDAP Parameters

Mail User

GET /api/user/<mail> Get profile of an existing mail user

POST /api/user/<mail> Create a new mail user Parameters

DELETE /api/user/<mail> Delete an existing mail user

DELETE /api/user/<mail>/keep_mailbox_days/<number> Delete an existing mail user, and keep the mailbox for given days. Defaults to 0 day which means keeping forever.

PUT /api/user/<mail> Update profile of an existing mail user Parameters

POST /api/user/<mail>/change_email/<new_mail> Change user's email address (from '<mail>' to '<new_mail>')

GET /api/users/<domain> Get user profiles under given domain Parameters

PUT /api/users/<domain> Update profiles of all users under given domain Parameters

POST /api/verify_password/user/<mail> Verify given (plain) password against the one stored in SQL/LDAP Parameters

Subscribable Mailing List

Attention

GET /api/mls/<domain> Get profile of all mailing lists under given domain Parameters

GET /api/ml/<mail> Get profile of an existing mailing list account Parameters

POST /api/ml/<mail> Create a new mailing list Parameters

DELETE /api/ml/<mail> Delete an existing mailing list Parameters

PUT /api/ml/<mail> Update profile of an existing mailing list Parameters

Mailing List (Unsubscribable)

Attention

GET /api/maillist/<mail> Get profile of an existing mailing list account

POST /api/maillist/<mail> Create a new mailing list Parameters

DELETE /api/maillist/<mail> Delete an existing mailing list Parameters

PUT /api/maillist/<mail> Update profile of an existing mailing list Parameters

Mail Alias

GET /api/alias/<mail> Get profile of an existing mail alias

POST /api/alias/<mail> Create a new mail alias Parameters

DELETE /api/alias/<mail> Delete an existing mail alias

PUT /api/alias/<mail> Update profile of an existing mail alias Parameters

POST /api/alias/<mail>/change_email/<new_mail> Change email address of alias account (from '<mail>' to '<new_mail>')

GET /api/aliases/<domain> Get mail aliases' profiles under given domain Parameters

Spam Policy

GET /api/spampolicy/global Get global spam policy

GET /api/spampolicy/domain/<domain> Get per-domain spam policy

GET /api/spampolicy/user/<mail> Get per-user spam policy

DELETE /api/spampolicy/global Delete global spam policy

DELETE /api/spampolicy/domain/<domain> Delete per-domain spam policy

DELETE /api/spampolicy/user/<mail> Delete per-user spam policy

PUT /api/spampolicy/global Set global spam policy Parameters

PUT /api/spampolicy/domain/<domain> Set per-domain spam policy Parameters

PUT /api/spampolicy/user/<mail> Set per-user spam policy Parameters

Throttling

GET /api/throttle/global/inbound Get global inbound throttle settings

POST /api/throttle/global/inbound Set global inbound throttle settings Parameters

GET /api/throttle/global/outbound Get global outbound throttle settings

POST /api/throttle/global/outbound Set global inbound throttle settings Parameters

GET /api/throttle/<domain>/inbound Get domain inbound throttle settings

POST /api/throttle/<domain>/inbound Set domain inbound throttle settings Parameters

GET /api/throttle/<domain>/outbound Get domain outbound throttle settings

POST /api/throttle/<domain>/outbound Set domain outbound throttle settings Parameters

GET /api/throttle/<mail>/inbound Get user inbound throttle settings

POST /api/throttle/<mail>/inbound Set user inbound throttle settings Parameters

GET /api/throttle/<mail>/outbound Get user outbound throttle settings

POST /api/throttle/<mail>/outbound Set user outbound throttle settings Parameters

Whitelisting and Blacklisting

Valid whitelisting and blacklisting addresses. Invalid addresses will be discarded silently.

Address Examples
Single IP Address 192.168.2.10
IP CIDR Network 192.168.2.0/24, 2620:0:2d0:200::7/128
Single email address user@domain.ltd
Entire email domain @domain.ltd
Entire email domain and all its sub-domains @.domain.ltd
Catch-all address @.


GET /api/wblist/inbound/whitelist/global Get global whitelists for inbound.

GET /api/wblist/inbound/blacklist/global Get global blacklists for inbound.

GET /api/wblist/outbound/whitelist/global Get global whitelists for outbound.

GET /api/wblist/outbound/blacklist/global Get global whitelists for outbound.

GET /api/wblist/inbound/whitelist/<domain> Get per-domain whitelists for inbound.

GET /api/wblist/inbound/blacklist/<domain> Get per-domain blacklists for inbound.

GET /api/wblist/outbound/whitelist/<domain> Get per-domain whitelists for outbound.

GET /api/wblist/outbound/blacklist/<domain> Get per-domain whitelists for outbound.

GET /api/wblist/inbound/whitelist/<mail> Get per-user whitelists for inbound.

GET /api/wblist/inbound/blacklist/<mail> Get per-user blacklists for inbound.

GET /api/wblist/outbound/whitelist/<mail> Get per-user whitelists for outbound.

GET /api/wblist/outbound/blacklist/<mail> Get per-user whitelists for outbound.

POST /api/wblist/inbound/whitelist/global Add new global whitelists for inbound. Parameters

POST /api/wblist/inbound/blacklist/global Add new global blacklists for inbound. Parameters

POST /api/wblist/outbound/whitelist/global Add new global whitelists for outbound. Parameters

POST /api/wblist/outbound/blacklist/global Add new global whitelists for outbound. Parameters

POST /api/wblist/inbound/whitelist/<domain> Add new per-domain whitelists for inbound. Parameters

POST /api/wblist/inbound/blacklist/<domain> Add new per-domain blacklists for inbound. Parameters

POST /api/wblist/outbound/whitelist/<domain> Add new per-domain whitelists for outbound. Parameters

POST /api/wblist/outbound/blacklist/<domain> Add new per-domain whitelists for outbound. Parameters

POST /api/wblist/inbound/whitelist/<mail> Add new per-user whitelists for inbound. Parameters

POST /api/wblist/inbound/blacklist/<mail> Add new per-user blacklists for inbound. Parameters

POST /api/wblist/outbound/whitelist/<mail> Add new per-user whitelists for outbound. Parameters

POST /api/wblist/outbound/blacklist/<mail> Add new per-user whitelists for outbound. Parameters

PUT /api/wblist/inbound/whitelist/global Delete given global whitelists for inbound. Parameters

PUT /api/wblist/inbound/blacklist/global Delete given existing global blacklists for inbound. Parameters

PUT /api/wblist/outbound/whitelist/global Delete given existing global whitelists for outbound. Parameters

PUT /api/wblist/outbound/blacklist/global Delete given existing global whitelists for outbound. Parameters

PUT /api/wblist/inbound/whitelist/<domain> Delete given per-domain whitelists for inbound. Parameters

PUT /api/wblist/inbound/blacklist/<domain> Delete given per-domain blacklists for inbound. Parameters

PUT /api/wblist/outbound/whitelist/<domain> Delete given per-domain whitelists for outbound. Parameters

PUT /api/wblist/outbound/blacklist/<domain> Delete given per-domain whitelists for outbound. Parameters

PUT /api/wblist/inbound/whitelist/<mail> Delete given per-user whitelists for inbound. Parameters

PUT /api/wblist/inbound/blacklist/<mail> Delete given per-user blacklists for inbound. Parameters

PUT /api/wblist/outbound/whitelist/<mail> Delete given per-user whitelists for outbound. Parameters

PUT /api/wblist/outbound/blacklist/<mail> Delete given per-user whitelists for outbound. Parameters

DELETE /api/wblist/inbound/whitelist/global Delete all existing global whitelists for inbound.

DELETE /api/wblist/inbound/blacklist/global Delete all existing global blacklists for inbound.

DELETE /api/wblist/outbound/whitelist/global Delete all existing global whitelists for outbound.

DELETE /api/wblist/outbound/blacklist/global Delete all existing global whitelists for outbound.

DELETE /api/wblist/inbound/whitelist/<domain> Delete all per-domain global whitelists for inbound.

DELETE /api/wblist/inbound/blacklist/<domain> Delete all per-domain global blacklists for inbound.

DELETE /api/wblist/outbound/whitelist/<domain> Delete all per-domain existing global whitelists for outbound.

DELETE /api/wblist/outbound/blacklist/<domain> Delete all per-domain existing global whitelists for outbound.

DELETE /api/wblist/inbound/whitelist/<mail> Delete all per-user existing global whitelists for inbound.

DELETE /api/wblist/inbound/blacklist/<mail> Delete all per-user existing global blacklists for inbound.

DELETE /api/wblist/outbound/whitelist/<mail> Delete all per-user existing global whitelists for outbound.

DELETE /api/wblist/outbound/blacklist/<mail> Delete all per-user existing global whitelists for outbound.

Greylisting

GET /api/greylisting/all Get all existing greylisting settings

GET /api/greylisting/global Get global greylisting setting

GET /api/greylisting/<domain> Get per-domain greylisting setting

GET /api/greylisting/<mail> Get per-user greylisting setting

POST /api/greylisting/global Set global greylisting setting Parameters

POST /api/greylisting/<domain> Set per-domain greylisting setting Parameters

POST /api/greylisting/<mail> Set per-user greylisting setting Parameters

DELETE /api/greylisting/global Delete global greylisting setting

DELETE /api/greylisting/<domain> Delete per-domain greylisting setting

DELETE /api/greylisting/<mail> Delete per-user greylisting setting

GET /api/greylisting/global/whitelists Get globally whitelisted senders for greylisting service

GET /api/greylisting/<domain>/whitelists Get whitelisted senders for greylisting service for specified domain

GET /api/greylisting/<mail>/whitelists Get whitelisted senders for greylisting service for specified user

POST /api/greylisting/global/whitelists Whitelist senders for greylisting service globally Parameters

POST /api/greylisting/<domain>/whitelists Whitelist senders for greylisting service for specified domain Parameters

POST /api/greylisting/<mail>/whitelists Whitelist senders for greylisting services for specified user Parameters

POST /api/greylisting/whitelist_spf_domains Whitelist IP addresses and networks listed in SPF/MX DNS record of given sender domains for greylisting service globally Parameters

Export Accounts

LDIF (LDAP backend only)

GET /api/ldif/domain/<domain> Export domain to LDIF

GET /api/ldif/catchall/<domain> Export per-domain catch-all account to LDIF

GET /api/ldif/admin/<mail> Export (separated) domain admin to LDIF

GET /api/ldif/user/<mail> Export mail user to LDIF

GET /api/ldif/maillist/<mail> Export mailing list account to LDIF

GET /api/ldif/alias/<mail> Export mail alias account to LDIF