# Inbound routing

# Get a list of inbound routes

If you want to have information about multiple inbounds, use this GET request:

GET https://api.mailersend.com/v1/inbound

# Request parameters

URL parameter Type Required Limitations Details
domain_id string no
page int no
limit int no Min: 10, Max: 100 Default: 25

# Responses

# Valid

Response Code: 200 OK
Response Headers:
	Content-Type: application/json
{
  "data": [
    {
      "id": "v57gn2j67qlr6z4d",
      "name": "Test name",
      "address": "imxbfppzn7cbhak9lef5@inbound.mailersend.net",
      "domain": "test.remotecompany.com",
      "dns_checked_at": null,
      "enabled": true,
      "filters": [
        {
          "type": "catch_recipient",
          "key": null,
          "comparer": "equal",
          "value": "test"
        },
        {
          "type": "match_all",
          "key": null,
          "comparer": null,
          "value": null
        }
      ],
      "forwards": [
        {
          "type": "webhook",
          "value": "https:\/\/yourapp.com\/hook",
          "secret": "jYhafQeTihgw0qWclkUA7cbqTG3Zfh2j"
        }
      ],
      "mxValues": {
        "priority": 10,
        "target": "inbound.mailersend.net"
      }
    }
  ]
}

# Error

Response Code: 404 Not Found

# Get a single inbound route

If you want to get a single inbound, use this GET request:

GET https://api.mailersend.com/v1/inbound/{inbound_id}

# Request parameters

URL parameter Type Required Limitations Details
inbound_id string yes

# Responses

# Valid

Response Code: 200 OK
Response Headers:
	Content-Type: application/json
{
  "data": {
    "id": "v57gn2j67qlr6z4d",
    "name": "Test name",
    "address": "imxbbppzn7cbhak9lef5@inbound.mailersend.net",
    "domain": "test.remotecompany.com",
    "dns_checked_at": null,
    "enabled": true,
    "filters": [
      {
        "type": "catch_recipient",
        "key": null,
        "comparer": "equal",
        "value": "test"
      },
      {
        "type": "match_all",
        "key": null,
        "comparer": null,
        "value": null
      }
    ],
    "forwards": [
      {
        "id": "v57gn2j67qlr6z4d",
        "type": "webhook",
        "value": "https:\/\/yourapp.com\/hook",
        "secret": "jYhafQeTiZgw0qWxlkUA7cbqTG3Zfh2j"
      }
    ],
    "mxValues": {
      "priority": 10,
      "target": "inbound.mailersend.net"
    }
  }
}

# Error

Response Code: 404 Not Found

# Add an inbound route

If you want to add a new inbound to a domain, use this POST request:

POST https://api.mailersend.com/v1/inbound

# Request body

{
  "domain_id": "7nxe3yjmeq28vp0k",
  "name": "Test name",
  "domain_enabled": true,
  "inbound_domain": "test.remotecompany.com",
  "inbound_address": "test@inbound.mailersend.net",
  "inbound_subdomain": "inbound",
  "match_filter": {
    "type": "match_all"
  },
  "catch_filter": {
    "type": "catch_recipient",
    "filters": [
      {
        "comparer": "equal",
        "value": "test"
        }
    ]
  },
  "forwards": [
    {
      "type": "webhook",
      "value": "https://www.mailersend.com/hook"
    }
  ]
}

# Request Parameters

JSON parameters are provided in dot notation

JSON Parameter Type Required Limitations Details
domain_id string yes
name string yes Max 191 characters.
domain_enabled boolean yes
inbound_domain string yes** Max 191 characters, unique, and must end with the current domain name.
catch_filter object[] yes**
catch_filter.type string yes Must be one of the inbound's types: catch_all, catch_recipient, match_all, match_sender, match_domain, match_header.
catch_filter.filters object[] yes*** Max 5.
catch_filter.filters.*.comparer string yes Must be one of the comparers: equal, not-equal, contains, not-contains, starts-with, ends-with, not-starts-with, not-ends-with.
catch_filter.filters.*.value string yes Max 191 characters.
match_filter object[] yes
match_filter.type string yes Must be one of the inbound's types: catch_all, catch_recipient, match_all, match_sender, match_domain, match_header.
match_filter.filters object[] yes*** Max 5.
match_filter.filters.*.comparer string yes Must be one of the comparers: equal, not-equal, contains, not-contains, starts-with, ends-with, not-starts-with, not-ends-with.
match_filter.filters.*.value string yes Max 191 characters.
match_filter.filters.*.key string yes**** Max 191 characters.
forwards object[] yes Min 1 and max 5.
forwards.*.type string yes Must be either email or webhook.
forwards.*.value string yes Must be distinct, max 191 characters, if it's type is webhook it must be a valid URL, and if it's type is email it must be a valid email address.
# * Required if inbound is not enabled.
# ** Required if inbound is enabled.
# *** Required if inbound is enabled and filter type is not match_all.
# **** Required if match type is match_header.

# Responses

Response Key Type Details
data object Inbound object created.

# Valid

Response Code: 201 CREATED
Response Headers:
	Content-Type: application/json
{
  "data": {
    "id": "v57gn2j67qlr6z4d",
    "name": "Test name",
    "address": "imxbfnpzn7cbhak9lef5@inbound.mailersend.net",
    "domain": "test.remotecompany.com",
    "dns_checked_at": null,
    "enabled": true,
    "filters": [
      {
        "type": "catch_recipient",
        "key": null,
        "comparer": "equal",
        "value": "test"
      },
      {
        "type": "match_all",
        "key": null,
        "comparer": null,
        "value": null
      }
    ],
    "forwards": [
      {
        "type": "webhook",
        "value": "https:\/\/yourapp.com\/hook",
        "secret": "jYhafQeTiZgw0qWclkUA7cbqTG3Zfh2j"
      }
    ],
    "mxValues": {
      "priority": 10,
      "target": "inbound.mailersend.net"
    }
  }
}

# Invalid

Response Code: 422 Unprocessable Entity

See - Validations errors

# Update an inbound route

If you want to update the information of an existent inbound, use this PUT request:

PUT https://api.mailersend.com/v1/inbound/{inbound_id}

# Request body

{
	"domain_id": "7nxe3yjmeq28vp0k",
	"name": "Test update",
	"domain_enabled": true,
	"inbound_domain": "test.remotecompany.com",
	"inbound_address": "test@inbound.mailersend.net",
	"inbound_subdomain": "inbound",
	"match_filter": {
		"type": "match_all"
	},
	"catch_filter": {
		"type": "catch_recipient",
		"filters": [
			{
				"comparer": "equal",
				"value": "test"
			}
		]
	},
	"forwards": [
		{
			"type": "webhook",
			"value": "https://yourapp.com/hook"
		}
	]
}

# Request Parameters

URL parameter Type Required Limitations Details
inbound_id string yes

JSON parameters are provided in dot notation

JSON Parameter Type Required Limitations Details
name string yes Max 191 characters.
domain_enabled boolean yes
inbound_domain string yes** Max 191 characters, unique, and must end with the current domain name.
catch_filter object[] yes**
catch_filter.type string yes Must be one of the inbound's types: catch_all, catch_recipient, match_all, match_sender, match_domain, match_header.
catch_filter.filters object[] yes*** Max 5.
catch_filter.filters.*.comparer string yes Must be one of the comparers: equal, not-equal, contains, not-contains, starts-with, ends-with, not-starts-with, not-ends-with.
catch_filter.filters.*.value string yes Max 191 characters.
match_filter object[] yes
match_filter.type string yes Must be one of the inbound's types: catch_all, catch_recipient, match_all, match_sender, match_domain, match_header.
match_filter.filters object[] yes*** Max 5.
match_filter.filters.*.comparer string yes Must be one of the comparers: equal, not-equal, contains, not-contains, starts-with, ends-with, not-starts-with, not-ends-with.
match_filter.filters.*.value string yes Max 191 characters.
match_filter.filters.*.key string yes**** Max 191 characters.
forwards object[] yes Min 1 and max 5.
forwards.*.type string yes Must be either email or webhook.
forwards.*.value string yes Must be distinct, max 191 characters, if it's type is webhook it must be a valid URL, and if it's type is email it must be a valid email address.
# * Required if inbound is not enabled.
# ** Required if inbound is enabled.
# *** Required if inbound is enabled and filter type is not match_all.
# **** Required if match type is match_header.

# Responses

Response Key Type Details
data object Inbound object created.

# Valid

Response Code: 200 OK
Response Headers:
	Content-Type: application/json
{
  "data": {
    "id": "v57gn2j67qlr6z4d",
    "name": "Test update",
    "address": "qi5onrgpw4ujkiqg0p9b@inbound.mailersend.net",
    "domain": "test.remotecompany.com",
    "dns_checked_at": null,
    "enabled": true,
    "filters": [
      {
        "type": "catch_recipient",
        "key": null,
        "comparer": "equal",
        "value": "test"
      },
      {
        "type": "match_all",
        "key": null,
        "comparer": null,
        "value": null
      }
    ],
    "forwards": [
      {
        "type": "webhook",
        "value": "https:\/\/yourapp.com\/hook",
        "secret": "jYhafQeTiZgw0qWclkUA7cnqTG3Zfh2j"
      }
    ],
    "mxValues": {
      "priority": 10,
      "target": "inbound.mailersend.net"
    }
  }
}

# Invalid

Response Code: 422 Unprocessable Entity

See - Validations errors

# Delete an inbound route

If you want to delete an inbound route, use this DELETE request:

DELETE https://api.mailersend.com/v1/inbound/{inbound_id}

# Request parameters

URL parameter Type Required Limitations Details
inbound_id string yes

# Responses

# Valid

Response Code: 200 OK

# Error

Response Code: 404 Not Found
Last updated: 11/29/2021, 1:49:54 PM