Build priority-ordered conditional routing rules, evaluate message metadata and spam metrics, and trigger automated forwarding, dropping, or webhook dispatching.
Quick Reference
| Endpoint | Method | Scope | Purpose |
|---|---|---|---|
/v1/rules | GET | rules:read | List all configured routing rules ordered by priority |
/v1/rules | POST | rules:write | Create a new conditional routing rule |
/v1/rules/:id | GET | rules:read | Retrieve configuration and conditions for a specific rule |
/v1/rules/:id | PATCH | rules:write | Update rule criteria, priority, active state, or actions |
/v1/rules/:id | DELETE | rules:write | Permanently delete a routing rule |
/v1/rules/reorder | POST | rules:write | Atomically reorder rule evaluation priority sequence |
Rule Evaluation Model
The Rules Engine intercepts inbound transactions immediately after address resolution and evaluates messages against your workspace's rule chain:
- Priority Pipeline: Rules run in sequence starting from
priority: 1. - Compound Logic: Each rule specifies
match_type: "ALL"(logical AND) ormatch_type: "ANY"(logical OR) across up to 20 conditions. - Execution Halting (
stop_processing): When set totrue, a matched rule terminates the pipeline immediately. Lower-priority rules will not run for that message. - Action Composition: A single rule can execute up to 10 combined actions simultaneously (e.g. inject custom headers, strip tracking beacons, and dispatch a webhook).
Supported Condition Fields & Operators
Evaluated Fields
| Field | Description | Example Target |
|---|---|---|
from_address | Full envelope sender email | billing@vendor.com |
from_domain | Sender domain part | vendor.com |
from_name | Friendly display name | Acme Billing Team |
reply_to | Reply-To header address | support@reply.vendor.com |
alias_address | Receiving alias address | orders@acme-corp.com |
alias_domain | Receiving alias domain | acme-corp.com |
subject | Message subject line | Invoice #1042 |
header | Arbitrary email header (requires header_name) | X-Custom-Campaign |
email_size_kb | Message payload size in kilobytes | 1024 |
has_attachments | Presence of file attachments | true or false |
attachment_name | Filename of an attached document | report.xlsx |
attachment_mime | MIME type of an attachment | application/pdf |
spf_status | SPF verification verdict | pass, fail, softfail |
dkim_status | DKIM cryptographic verdict | pass, fail, none |
dmarc_status | DMARC policy verdict | pass, fail |
spam_score | Heuristic spam rating | 5.0 |
Comparison Operators
is · is_not · contains · does_not_contain · starts_with · ends_with · matches_regex · exists · not_exists · greater_than · less_than
Supported Action Types
| Action Type | Parameters | Behavior |
|---|---|---|
drop_silently | — | Discards message silently without forwarding or bouncing. |
quarantine | — | Isolates message for administrative review. |
reroute_to | destination_id | Overrides default alias routing and forwards to specified destination. |
add_subject_prefix | prefix | Prepends string to email subject (e.g. [INTERNAL]). |
add_subject_suffix | suffix | Appends string to email subject (e.g. (Reviewed)). |
strip_tracking_pixels | — | Neutralizes spy beacons and tracking pixels from HTML bodies. |
strip_attachments | extensions (optional) | Strips all or specific file attachments from forwarded message. |
add_custom_header | header_name, header_value | Injects an RFC header into the forwarded message. |
deactivate_alias | — | Automatically pauses the receiving alias upon match. |
send_to_webhook | webhook_endpoint_id | Dispatches real-time JSON payload to registered webhook URL. |
GET /v1/rules — List Routing Rules
Scope: rules:read · Rate Limit: 60/min · Idempotent: Yes
Returns all routing rules configured for your workspace ordered by evaluation priority.
Example Request
curl -X GET "https://api.aliasfleet.com/v1/rules" \
-H "Authorization: Bearer afp_4a8f9c1b2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e" \
-H "Accept: application/json"
Response (200 OK)
{
"rules": [
{
"id": "7b8c9d0e-1f2a-3b4c-5d6e-7f8a9b0c1d2e",
"name": "Quarantine High Spam Inbound",
"description": "Quarantine messages failing SPF or carrying high spam scores",
"is_active": true,
"priority": 1,
"match_type": "ANY",
"stop_processing": true,
"conditions": [
{
"field": "spf_status",
"operator": "is",
"value": "fail"
},
{
"field": "spam_score",
"operator": "greater_than",
"value": "6.5"
}
],
"actions": [
{
"action_type": "quarantine"
}
],
"created_at": "2026-08-28T14:00:00.000Z",
"updated_at": "2026-08-28T14:00:00.000Z"
}
]
}
POST /v1/rules — Create Routing Rule
Scope: rules:write · Rate Limit: 30/min · Idempotent: No
Creates a new conditional routing rule and positions it within the evaluation pipeline.
Request Body Parameters
| Parameter | Type | Required | Constraints | Description |
|---|---|---|---|---|
name | string | Yes | 1–120 chars | Human-readable rule title. |
description | string | Optional | Max 500 chars | Operational notes or rationale. |
is_active | boolean | Optional | Boolean | Rule active state. Defaults to true. |
priority | integer | Optional | Min 1 | Evaluation position. Defaults to next available priority. |
match_type | string | Optional | ALL or ANY | Condition logic: ALL (AND) or ANY (OR). Defaults to ALL. |
stop_processing | boolean | Optional | Boolean | Halt rule chain evaluation if matched. Defaults to false. |
conditions | array | Yes | 1–20 conditions | Array of condition descriptor objects. |
actions | array | Yes | 1–10 actions | Array of action descriptor objects. |
Example Request
curl -X POST "https://api.aliasfleet.com/v1/rules" \
-H "Authorization: Bearer afp_4a8f9c1b2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e" \
-H "Content-Type: application/json" \
-d '{
"name": "VIP Billing Forwarder",
"description": "Reroute financial correspondence to finance inbox with subject tag",
"priority": 2,
"match_type": "ALL",
"stop_processing": false,
"conditions": [
{
"field": "subject",
"operator": "contains",
"value": "Invoice"
},
{
"field": "from_domain",
"operator": "is",
"value": "accounting-partner.com"
}
],
"actions": [
{
"action_type": "reroute_to",
"destination_id": "dest_adn6UTmkzn6OWpGq"
},
{
"action_type": "add_subject_prefix",
"prefix": "[FINANCE]"
}
]
}'
Response (201 Created)
{
"message": "Rule created successfully",
"rule": {
"id": "3e4f5a6b-7c8d-9e0f-1a2b-3c4d5e6f7a8b",
"name": "VIP Billing Forwarder",
"description": "Reroute financial correspondence to finance inbox with subject tag",
"is_active": true,
"priority": 2,
"match_type": "ALL",
"stop_processing": false,
"conditions": [
{
"field": "subject",
"operator": "contains",
"value": "Invoice"
},
{
"field": "from_domain",
"operator": "is",
"value": "accounting-partner.com"
}
],
"actions": [
{
"action_type": "reroute_to",
"destination_id": "dest_adn6UTmkzn6OWpGq"
},
{
"action_type": "add_subject_prefix",
"prefix": "[FINANCE]"
}
],
"created_at": "2026-09-04T12:00:00.000Z",
"updated_at": "2026-09-04T12:00:00.000Z"
}
}
Errors
| Status | Code | Cause & Resolution |
|---|---|---|
400 Bad Request | DESTINATION_NOT_FOUND | destination_id specified in reroute_to does not exist on your account. |
400 Bad Request | DESTINATION_NOT_VERIFIED | Target destination has not passed 6-digit OTP verification. Verify it first under /v1/destinations. |
400 Bad Request | WEBHOOK_ENDPOINT_NOT_FOUND | webhook_endpoint_id specified in send_to_webhook does not exist on your account. |
403 Forbidden | LIMIT_REACHED | Maximum rule count reached for your subscription tier. Upgrade plan to expand limit. |
GET /v1/rules/:id — Inspect Routing Rule
Scope: rules:read · Rate Limit: 60/min · Idempotent: Yes
Retrieves the complete configuration, conditions, and actions for a single routing rule.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Rule UUID identifier. |
Example Request
curl -X GET "https://api.aliasfleet.com/v1/rules/3e4f5a6b-7c8d-9e0f-1a2b-3c4d5e6f7a8b" \
-H "Authorization: Bearer afp_4a8f9c1b2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e" \
-H "Accept: application/json"
Response (200 OK)
{
"rule": {
"id": "3e4f5a6b-7c8d-9e0f-1a2b-3c4d5e6f7a8b",
"name": "VIP Billing Forwarder",
"is_active": true,
"priority": 2,
"match_type": "ALL",
"stop_processing": false,
"conditions": [
{
"field": "subject",
"operator": "contains",
"value": "Invoice"
}
],
"actions": [
{
"action_type": "reroute_to",
"destination_id": "dest_adn6UTmkzn6OWpGq"
}
]
}
}
Errors
| Status | Code | Cause & Resolution |
|---|---|---|
404 Not Found | NOT_FOUND | Rule ID does not exist or access denied. |
PATCH /v1/rules/:id — Update Routing Rule
Scope: rules:write · Rate Limit: 60/min · Idempotent: Yes
Modifies an existing routing rule. Unspecified fields remain unchanged.
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Optional | Updated rule title (1–120 chars). |
description | string | Optional | Updated description notes. |
is_active | boolean | Optional | Toggle rule enforcement without deletion. |
priority | integer | Optional | Update rule pipeline position. |
match_type | string | Optional | ALL or ANY. |
stop_processing | boolean | Optional | Update execution halting behavior. |
conditions | array | Optional | Replacement conditions array. |
actions | array | Optional | Replacement actions array. |
Example Request
curl -X PATCH "https://api.aliasfleet.com/v1/rules/3e4f5a6b-7c8d-9e0f-1a2b-3c4d5e6f7a8b" \
-H "Authorization: Bearer afp_4a8f9c1b2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e" \
-H "Content-Type: application/json" \
-d '{
"is_active": false
}'
Response (200 OK)
{
"message": "Rule updated successfully",
"rule": {
"id": "3e4f5a6b-7c8d-9e0f-1a2b-3c4d5e6f7a8b",
"name": "VIP Billing Forwarder",
"is_active": false,
"priority": 2
}
}
DELETE /v1/rules/:id — Delete Routing Rule
Scope: rules:write · Rate Limit: 60/min · Idempotent: Yes
Permanently deletes a routing rule and releases its quota allocation.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Rule UUID identifier. |
Example Request
curl -X DELETE "https://api.aliasfleet.com/v1/rules/3e4f5a6b-7c8d-9e0f-1a2b-3c4d5e6f7a8b" \
-H "Authorization: Bearer afp_4a8f9c1b2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e"
Response (200 OK)
{
"message": "Rule deleted successfully"
}
POST /v1/rules/reorder — Reorder Rule Priority Chain
Scope: rules:write · Rate Limit: 30/min · Idempotent: Yes
Atomically reorganizes the priority sequence of all routing rules in your workspace. The index of each ID in the provided array defines its new priority value (index 0 becomes priority 1).
Request Body Parameters
| Parameter | Type | Required | Constraints | Description |
|---|---|---|---|---|
rule_ids | string[] | Yes | Valid rule UUIDs | Ordered array of rule IDs reflecting the desired evaluation hierarchy. |
Example Request
curl -X POST "https://api.aliasfleet.com/v1/rules/reorder" \
-H "Authorization: Bearer afp_4a8f9c1b2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e" \
-H "Content-Type: application/json" \
-d '{
"rule_ids": [
"7b8c9d0e-1f2a-3b4c-5d6e-7f8a9b0c1d2e",
"3e4f5a6b-7c8d-9e0f-1a2b-3c4d5e6f7a8b"
]
}'
Response (200 OK)
{
"message": "Rules reordered successfully",
"count": 2
}
Errors
| Status | Code | Cause & Resolution |
|---|---|---|
400 Bad Request | VALIDATION_ERROR | rule_ids array contains invalid IDs or does not match workspace rules. |