Skip to content

Anti-Spam API

The anti-spam module protects sign-up, sign-in, checkout and guest tickets with blocked IP addresses, a CAPTCHA, a honeypot field, a disposable email check and Stop Forum Spam. These calls read its settings and manage the blocked IP list. See CAPTCHA and anti-spam for the settings.

Admin calls need Module access on the Antispam card of the staff group’s Permissions tab, plus each call’s own permission below (Super Administrators have all). See Authentication.

POST /api/admin/antispam/get_config

Returns the anti-spam settings, with the CAPTCHA keys.

Permission: View antispam settings (antispam.view)

No parameters.

Returns: An object: block_ips (blocking on or off), blocked_ips (the list, one address per line), captcha_enabled, captcha_provider (recaptcha_v2, recaptcha_v3, turnstile or hcaptcha), captcha_recaptcha_publickey, captcha_recaptcha_privatekey, captcha_recaptcha_v3_threshold (default 0.5), turnstile_site_key, turnstile_secret_key, hcaptcha_site_key, hcaptcha_secret_key, sfs (Stop Forum Spam check), check_temp_emails (default true), honeypot_enabled (default true) and honeypot_field (default bio).

captcha_recaptcha_privatekey, turnstile_secret_key and hcaptcha_secret_key are left out unless the caller also has the anti-spam module’s Manage settings (antispam.manage_settings).

POST /api/admin/antispam/block_ip

Adds one IP address to the blocked list and turns IP blocking on. A blocked address cannot sign up, sign in (clients and staff), check out, open a guest ticket or save a client profile.

Permission: Manage antispam settings (antispam.manage)

Parameter Type Description
ip string, required One IPv4 or IPv6 address. Ranges and wildcards are not accepted here; add them on the settings page.

Returns: An object: result (true) and ip (the address as saved).

Errors:

  • IP address is required
  • Invalid IP address
  • is already blocked.
  • You cannot block as it is the IP you are making requests from.
Example

Request parameters:

{
"ip": "203.0.113.45"
}

result:

{
"result": true,
"ip": "203.0.113.45"
}

POST /api/admin/antispam/unblock_ip

Removes one IP address from the blocked list. When the list becomes empty, IP blocking is turned off.

Permission: Manage antispam settings (antispam.manage)

Parameter Type Description
ip string, required The address exactly as it is on the list. A range or wildcard entry cannot be removed with this call, since only single addresses are accepted.

Returns: An object: result (true) and ip.

Errors:

  • IP address is required
  • Invalid IP address
  • is not currently blocked.

POST /api/admin/antispam/get_blocked_ips

Returns the blocked IP list and whether blocking is on.

Permission: View antispam settings (antispam.view)

No parameters.

Returns: An object: enabled (boolean) and ips (a list of the entries: addresses, ranges such as 203.0.113.0/24 and wildcards such as 203.0.113.*).

Example

Request parameters:

{}

result:

{
"enabled": true,
"ips": [
"203.0.113.45",
"198.51.100.0/24"
]
}

POST /api/guest/antispam/recaptcha

Returns the public CAPTCHA settings a sign-up or contact form needs to show the CAPTCHA. No secret key is returned.

No parameters.

Returns: An object: enabled ("1" or "0", as saved; false before the settings were first saved), captcha_provider (recaptcha_v2, recaptcha_v3, turnstile or hcaptcha), publickey (the reCAPTCHA site key), version (an older setting, usually null), recaptcha_v3_threshold (text, such as "0.5"), turnstile_site_key and hcaptcha_site_key. Keys that were never set are null; keys saved empty are "".

Example

Request parameters:

{}

result:

{
"publickey": "",
"enabled": "1",
"version": null,
"captcha_provider": "turnstile",
"recaptcha_v3_threshold": "0.5",
"turnstile_site_key": "0x4AAAAAAAexample",
"hcaptcha_site_key": ""
}