Skip to main content
ZeroBounce Docs logo
Log InSign Up Free
  • Home
  • Getting started
  • Products
  • API
  • Integrations
  • FAQ
  • About ZeroBounce
Browse documentation
ZeroBounce Docs logo
  • Getting started
  • Products
  • API
  • Integrations
  • FAQ
  • About ZeroBounce

Type at least 2 characters to search the docs.

↑↓ Navigate↵ OpenEsc Close

Docs Assistant

Answers written from the ZeroBounce documentation

Hi! I'm your ZeroBounce Docs Assistant. How can I help you with our APIs or integrations today?

Try Asking

Loading suggestions...

AI-generated from our docs. Check important details against the linked pages.

API

  • Email Validation API
    • Connecting with Postman
    • Get Credit Balance (v2)
    • Get API Usage (v2)
    • Single Email Validator-Real time (v2)
    • Greylist API Processing
    • Website Availability and WHOIS Checker
    • Batch Email Validator-Real time (v2)
    • Allowlist and Blocklist (v2)
    • Sandbox Mode (v2)
    • Status Codes (v2)
    • V2 Changes
    • File Management Overview (v2)
    • Send File (v2)
    • File Status (v2)
    • Get File (v2)
    • Delete File (v2)
  • Inbox Placement Tester API
  • Warmup API
  • Activity Data API
  • List Evaluator API
  • Email Finder API
  • Domain Search API
  • A.I. Scoring API
  • Api Dashboard
  • API Wrappers
  • API Migration
  1. Home
  2. Email Validation API Quickstart
  3. v2 Allowlist and Blocklist

Custom Filter Rules for AllowList and BlockList

The ZeroBounce email validation API offers the possibility of using custom filter rules to create personalized allow and block lists. They can be placed at the email, domain, mx record level or TLD (Top Level Domain).

Getting started

The validation process checks whether there is a matching record in your filter rule list. When one is found, the status and sub_status of the email being validated will be set as follows:

Allow

12    "status": "valid"3    "sub_status": "allowed"4  

Block

12     "status": "do_not_mail"3     "sub_status": "blocked"4  

Important Note
The more specific the rule, the higher its matching priority.
email > domain > tld > mx

For example:

api_key: your API key
rule: block
target: email
value: test@example.com

Overrides

api_key: your API key
rule: allow
target: domain
value: example.com

All fields are mandatory.

Add or Modify “allow” or “block” rule

This allows you to create custom filter rules to allow or block specific emails, email domains, mx records or tld. For the latter, you can also use an asterisk (*) at the front to denote a wildcard for mx records.

Automatically block untrusted senders and domains, and automatically allow otherwise trusted parties to begin the email validation process.

In order to modify a rule, send the same “target” and “value” fields, but change the “rule”.

Below is an example Java code of how to add a rule using the API. You must have a ZeroBounce account and access to your API key to add a custom filter rule.

Please allow up to 1 minute for changes to propagate.

There are no limits to the number of filters you can set for allow/block.

When validating an email from the allow/block list, credits will still be deducted.

API DEFAULT URL: https://api.zerobounce.net/v2/filters/add

API U.S.A. URL*: https://api-us.zerobounce.net/v2/filters/add

API EU URL: https://api-eu.zerobounce.net/v2/filters/add

Method: POST

Content-Type: application/x-www-form-urlencoded

*This endpoint uses servers located within the United States. By utilizing this endpoint, you acknowledge and consent to your data being processed on servers in the United States.

  • Parameter
    Description
  • api_key
    Your API Key, found in your account. (Required)
  • rule
    Choose which action the filter should take. Possible values: allow, block. (Required)
  • target
    Choose for which target the filter is set for. Possible values: email, domain, mx or tld. (Required)
  • value
    The email address, email domain, mx record or tld you wish to filter, based on the selected target. (Required)

Successful Response

12    {"Message": "Filter successfully added"}3    {"Message": "Filter successfully updated"}4  

Unsuccessful Response

12    {"Message": "Filter already exists"}3

Error Response

12    {"Error": "Invalid API key or your account ran out of credits"}3    {"Error": "Missing param: api_key"}4    {"Error": "Missing param: rule"}5    {"Error": "Missing param: target"}6    {"Error": "Missing param: value"}7    {"Error": "Allowed values for rule: allow, block"}8    {"Error": "Allowed values for target: email, domain, mx, tld"}9    {"Error": "Bad email syntax for param: value"}10    {"Error": "Bad domain syntax for param: value"}11    {"Error": "Invalid request format"}12

After receiving a successful response, your custom filter will automatically allow or block any email, domain, mx or tld that matches your rule.

Code samples

Delete a custom filter rule

This will enable you to delete any existing allow or block rules. If you no longer need to block a specific email, domain, mx or tld, consider deleting the rule to enable the email validation process to continue normally.

To delete any custom filter rule at the email, domain, mx or tld record level, you must enter the custom filter parameters using the endpoint to delete a filter rule.

Below is an example of how to delete a rule using the API. You must have a ZeroBounce account and access to your API key to delete a custom filter rule.

Please allow up to 1 minute for changes to propagate.

API DEFAULT URL: https://api.zerobounce.net/v2/filters/delete

API U.S.A. URL*: https://api-us.zerobounce.net/v2/filters/delete

API EU URL: https://api-eu.zerobounce.net/v2/filters/delete

Method: POST

Content-Type: application/x-www-form-urlencoded

*This endpoint uses servers located within the United States. By utilizing this endpoint, you acknowledge and consent to your data being processed on servers in the United States.

  • Parameter
    Description
  • api_key
    Your API Key, found in your account. (Required)
  • rule
    Choose which action the filter should take. Possible values: allow, block. (Required)
  • target
    Choose for which target the filter is set for. Possible values: email, domain, mx or tld. (Required)
  • value
    The email address, email domain, mx record or tld you wish to filter, based on the selected target. (Required)

Successful Response

12  {"Message": "Filter successfully deleted"}3

Unsuccessful Response

12  {"Message": "Filter does not exist"}3

Error Response

12    {"Error": "Invalid API key or your account ran out of credits"}3    {"Error": "Missing param: api_key"}4    {"Error": "Missing param: rule"}5    {"Error": "Missing param: target"}6    {"Error": "Missing param: value"}7    {"Error": "Allowed values for rule: allow, block"}8    {"Error": "Allowed values for target: email, domain, mx, tld"}9    {"Error": "Bad email syntax for param: value"}10    {"Error": "Bad domain syntax for param: value"}11    {"Error": "Invalid request format"}12

Code samples

List your filter results

After implementing your custom filter rules, the email validation API will automatically apply them to future validation attempts.

The validation process ends if it finds a matching “allow” or “block” rule for the email being validated. If you want an overview of your filters and the corresponding results, use the example below to get started.

This API shows you a complete list of your custom allow or block rules and all corresponding targets that match your rule set.

If at any point you need to add or delete new rules, you can do so at any time. Your changes will apply to future email validation attempts

If you need assistance implementing or deleting your custom allow or block rules, please contact our support team. We’re available 24/7 and ready to help you get your new allow and block lists prepared.

API DEFAULT URL: https://api.zerobounce.net/v2/filters/list

API U.S.A. URL*: https://api-us.zerobounce.net/v2/filters/list

API EU URL: https://api-eu.zerobounce.net/v2/filters/list

Method: GET or POST

Starting September 3, 2026, /v2/filters/list also accepts POST. Use the same parameters as GET, sent in the request body as application/x-www-form-urlencoded.

*This endpoint uses servers located within the United States. By utilizing this endpoint, you acknowledge and consent to your data being processed on servers in the United States.

  • Parameter
    Description
  • api_key
    Your API Key, found in your account. (Required)

ENDPOINT RESPONSE

Successful Response

12  [3    {4        "rule": "allow",5        "target": "email",6        "value": "test@example.com"7    },8    {9        "rule": "block",10        "target": "domain",11        "value": "example.com"12    },13    {14        "rule": "allow",15        "target": "mx",16        "value": "long.string.example.com"17    },18    {19        "rule": "allow",20        "target": "mx",21        "value": "*example.com"22    },23    {24        "rule": "allow",25        "target": "tld",26        "value": ".com"27    }28 ]29

Error Response

12  {"Error": "Invalid API key or your account ran out of credits"}3  {"Error": "Missing param: api_key"}4

Code samples

Was this page helpful?

PreviousSuccess / Fail ResponseNextSandbox Mode (v2)
Interested in our partner programs?
Partner program

Interested in our partner programs?