For the complete documentation index, see llms.txt. This page is also available as Markdown.

Create a forward rule

Create a forward rule on the inbox. The rule, its conditions, and its destinations are validated and saved together: if any part is invalid, nothing is created.

An inbox can have at most 5 forward rules; each rule can have at most 5 conditions and 5 destinations.

post
Authorizations
Api-TokenstringRequired

API token in Api-Token header

Path parameters
inbox_idintegerRequired

Inbound inbox ID

Example: 1
Body
namestring · max: 100Required

Rule name. Must be unique within the inbox.

Example: Copy billing mail to finance
Responses
201

Forward rule created

application/json
post/api/inbound/inboxes/{inbox_id}/forward_rules
curl -X POST https://mailtrap.io/api/inbound/inboxes/{inbox_id}/forward_rules \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Copy billing mail to finance",
    "conditions": [
      { "match_type": "sender", "operator": "ends_with", "value": "@billing.example.com" }
    ],
    "destinations": [
      { "email": "finance@example.com" }
    ]
  }'
{
  "data": {
    "id": 7,
    "name": "Copy billing mail to finance",
    "created_at": "2026-05-08T10:30:00.000Z",
    "updated_at": "2026-05-08T10:30:00.000Z",
    "conditions": [
      {
        "match_type": "sender",
        "operator": "ends_with",
        "value": "@billing.example.com",
        "header_key": null
      }
    ],
    "destinations": [
      {
        "email": "finance@example.com"
      }
    ]
  }
}

Last updated

Was this helpful?