Custom Rules
Custom rules let you override classification results for specific domains or MX patterns. When a rule matches, it takes priority over the default classification logic.
This is useful when:
- Your organization uses a provider that EmailKind doesn't recognize
- You want to reclassify specific domains differently (e.g., mark a domain as "business" instead of "personal")
- You have internal mail servers with custom MX records
Rule types
| Type | Description | Example |
|---|---|---|
| domain | Exact domain match | internal.company.com |
| mx_pattern | Wildcard MX pattern match | *.mail.myhost.com |
Domain rules match the exact domain being classified. They have the highest priority.
MX pattern rules match against the MX records of the classified domain. Wildcards (*) are supported:
*.example.commatches any subdomain of example.commx*.example.commatches mx1.example.com, mx2.example.com, etc.
API endpoints
List rules
GET /v1/rules
curl -H "Authorization: Bearer sk_live_YOUR_KEY" \
"https://emailkind.com/v1/rules"
Response:
{
"success": true,
"request_id": "req_abc123",
"rules": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"match_type": "domain",
"match_value": "internal.company.com",
"provider_name": "Internal Mail",
"provider_type": "business",
"created_at": "2025-01-15T10:30:00Z"
}
],
"count": 1
}
Create a rule
POST /v1/rules
curl -X POST -H "Authorization: Bearer sk_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"match_type": "domain",
"match_value": "internal.company.com",
"provider_name": "Internal Mail",
"provider_type": "business"
}' \
"https://emailkind.com/v1/rules"
Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
| match_type | string | Yes | domain or mx_pattern |
| match_value | string | Yes | The domain or MX pattern to match |
| provider_name | string | Yes | Display name for the provider |
| provider_type | string | Yes | One of: business, personal, disposable, education, hosting, self_hosted |
Response:
{
"success": true,
"request_id": "req_def456",
"rule": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"match_type": "domain",
"match_value": "internal.company.com",
"provider_name": "Internal Mail",
"provider_type": "business",
"created_at": "2025-01-15T10:30:00Z"
}
}
Delete a rule
DELETE /v1/rules/{id}
curl -X DELETE -H "Authorization: Bearer sk_live_YOUR_KEY" \
"https://emailkind.com/v1/rules/550e8400-e29b-41d4-a716-446655440000"
Limits
- Maximum 50 rules per account
- Available on Starter plan and above
- Rules are applied in real-time — no delay after creation
- If a domain matches both a domain rule and an MX pattern rule, the domain rule takes priority
How rules affect classification
When a custom rule matches, the API response will include:
provider.id:custom_followed by the provider name (lowercase, underscored)provider.name: Your custom provider nameprovider.type: Your specified provider typeconfidence:1.0(since the match is user-defined)- Classification flags (
is_business,is_free, etc.) are set based on the provider type