Skip to content

Update a route

Request

Updates a given route. All parameters are optional. This only updates the specified fields, leaving others unchanged.

Security
basicAuth
Path
idstringrequired

ID of the route

Bodyapplication/x-www-form-urlencoded
idstring

Unique identifier of the route

priorityinteger

Smaller number indicates higher priority. Higher priority routes are handled first.

descriptionstring

An arbitrary string.

expressionstring

The filtering rule.

actionArray of strings

This action is executed when the expression evaluates to True. You can pass multiple parameters.

curl -i -X PUT \
  -u '<username>:<password>' \
  'https://api.mailgun.net/v3/routes/{id}' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d priority=0 \
  -d 'description=Sample route' \
  -d 'expression=match_recipient(".*@samples.mailgun.org")' \
  -d 'action=["forward(\"http://myhost.com/messages/\")","stop()"]'

Responses

OK

Bodyapplication/json
messagestring

A string describing the result of the operation

routeobject(RouteResponse)
Response
{ "message": "Route has been updated", "route": { "id": "4f3bad2335335426750048c6", "priority": 0, "description": "Sample route", "expression": "match_recipient(\".*@samples.mailgun.org\")", "actions": [], "created_at": "Wed, 15 Feb 2012 13:03:31 GMT" } }