Update whitelist / blacklist

Update whitelist / blacklist rules at the global (whole-server) scope

  • HTTP Method: PUT
  • 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" : "whitelist",
"sender_domains" : ["good-domain.tld", "another-good-domain.tld", "my-external-domain.tld"],
"sender_emails" : ["user@good-domain.tld", "user@another-good-domain.tld", "user@my-external-domain.tld"],
"sender_ips" : ["127.55.120.245", "10.0.0.0/8"]
}
r = requests.put(url, json=data, auth=("admin","long-auth_token-here"))
try:
    pprint(r.json())
except: 
    print(r.text)

Example response (JSON)

{'action': 'whitelist',
 'sender_domains': ['good-domain.tld', 'another-good-domain.tld', 'my-external-domain.tld'],
 'sender_emails': ['user@good-domain.tld', 'user@another-good-domain.tld', 'user@my-external-domain.tld'],
 'sender_ips': ['127.55.120.245', '10.0.0.0/8'],
 'status': 'applying'}