Create a verification rule
Add an allow or block rule to the account’s verification engine.
Creates a rule that matches on an exact address, a domain, a top-level domain or an MX provider, and either force-allows or force-blocks matching addresses before any probe runs.
POST /v3/validate/rules
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
rule_type | string | Required | Match granularity: email, domain, tld or mx_provider. |
value | string | Required | The address, domain, TLD or MX provider to match (1–320 chars). Lowercased and trimmed before storing. |
action | string | Required | block short-circuits matching addresses to do_not_mail; allow forces them valid without a probe. |
reason | string | Optional | Why the rule exists (max 500 chars). |
Responses
| Status | Description |
|---|---|
201 | Created. The rule object: { id, rule_type, value, action, priority, reason, created_at }. |
400 | Validation error — unknown rule_type or action, or an over-length value. |
401 | Missing or invalid API key. |
Code examples
cURL
curl -X POST https://api.wemail.io/v3/validate/rules \
-H "Authorization: Bearer afn_live_…" \
-H "Content-Type: application/json" \
-d '{ "rule_type": "domain", "value": "example.com", "action": "block", "reason": "Internal deny list" }'Node.js
const res = await fetch("https://api.wemail.io/v3/validate/rules", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.WEMAIL_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ "rule_type": "domain", "value": "example.com", "action": "block", "reason": "Internal deny list" }),
});
const data = await res.json();Python
import os, requests
r = requests.post(
"https://api.wemail.io/v3/validate/rules",
headers={"Authorization": f"Bearer {os.environ['WEMAIL_API_KEY']}"},
json={ "rule_type": "domain", "value": "example.com", "action": "block", "reason": "Internal deny list" },
)
data = r.json()