Create whitelist / blacklist

Whitelist / blacklist sender domains, emails, and IPs/CIDRs at the global (whole-server) scope

  • HTTP Method: POST
  • URL: https://example.domain.tld/api/v1/antispam/wlbl/global/
  • Require authentication: Yes
  • Permission level required: MasterAdmin

Request parameters

Parameter Type Description Required
action str whitelist or blacklist Required
sender_domains list List of sender domains to whitelist or blacklist Optional
sender_emails list List of sender emails to whitelist or blacklist Optional
sender_ips list List of sender IPs/CIDRs to whitelist or blacklist Optional

Note

Any one of the above optional parameter is required

Response parameters

Parameter Type Description
action str whitelist or blacklist
sender_domains list List of sender domains whitelisted or blacklisted
sender_emails list List of sender emails whitelisted or blacklisted
sender_ips list List of sender IPs/CIDRs whitelisted or blacklisted
status str Status

Example request (Python)

import requests
import json
from pprint import pprint

url = "https://example.domain.tld/api/v1/antispam/wlbl/global/"
data = {
"action" : "blacklist",
"sender_domains" : ["bad-domain.tld", "another-bad-domain.tld"],
"sender_emails" : ["user@bad-domain.tld", "user@another-bad-domain.tld"],
"sender_ips" : ["172.16.11.255", "203.0.113.0/24"]
}
r = requests.post(url, json=data, auth=("admin","long-auth_token-here"))
try:
    pprint(r.json())
except: 
    print(r.text)

Example response (JSON)

{'action': 'blacklist',
 'sender_domains': ['bad-domain.tld', 'another-bad-domain.tld'],
 'sender_emails': ['user@bad-domain.tld', 'user@another-bad-domain.tld'],
 'sender_ips': ['172.16.11.255', '203.0.113.0/24'],
 'status': 'applying'}