Mailgun Email API//Routes
Routes
API Overview
Authentication
Developer Tools
Mailgun API
Messages
Domains
Domain Keys
Domain Tracking
DKIM Security
Account Webhooks
Domain Webhooks
Metrics
Logs
Bounce Classification
Tags New
Stats
Tags
Events
Send Alerts
Alerts
Limits
Unsubscribe
Complaints
Bounces
Allowlist
Forwards
Mailing Lists
Account Templates
Domain Templates
IP Pools
Dynamic IP Pools
IPs
IP Address Warmup
Subaccounts
Custom Message Limit
Account Management
Keys
Credentials
IP Allowlist
Users
Adds a new route to the account
Security
basicAuth
Smaller number indicates higher priority. Higher priority routes are handled first. Defaults to 0.
- US Mailgunhttps://api.mailgun.net/v3/routes
- EU Mailgunhttps://api.eu.mailgun.net/v3/routes
curl -i -X POST \
-u '<username>:<password>' \
https://api.mailgun.net/v3/routes \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d priority=0 \
-d 'description=it'\''s a new route' \
-d 'expression=match_recipient('\''.*@gmail.com'\'')' \
-d 'action=["forward(\"http://myhost.com/messages/\")","stop()"]'Response
{ "message": "Route has been created", "route": { "id": "4f3bad2335335426750048c6", "priority": 0, "description": "it's a new route", "expression": "match_recipient('.*@gmail.com')", "actions": [ … ], "created_at": "Wed, 15 Feb 2012 13:03:31 GMT" } }