Inbound Domains

Run in Postman
Import the SparkPost API as a Postman collection

Inbound Domains allow you to receive emails using SparkPost. When combined with Relay Webhooks, SparkPost can parse the emails sent to the inbound domain and post their contents to your server.

Configuring MX records

In order to use an inbound domain, you will need to add MX records to your DNS settings. The DNS settings required depend on whether you have a US, EU, Enterprise account.

US Accounts

NameTypeDataPriority
<inbound domain>MXrx1.sparkpostmail.com10
<inbound domain>MXrx2.sparkpostmail.com10
<inbound domain>MXrx3.sparkpostmail.com10

EU Accounts

NameTypeDataPriority
<inbound domain>MXrx1.eu.sparkpostmail.com10
<inbound domain>MXrx2.eu.sparkpostmail.com10
<inbound domain>MXrx3.eu.sparkpostmail.com10

Enterprise Accounts

Enterprise MX records are specific to each account. They usually follow the format of <tenant>.mx.e.sparkpost.com, where <tenant> is unique to your account. Please check with your TAM if you are unsure of the setting in your own environment.

NameTypeDataPriority
<inbound domain>MX<tenant>.mx.e.sparkpost.com10

Inbound Domain Object

Example

{
  "domain": "indbound.example.com"
}

Request Body

domain string

Domain (or subdomain) name for which SparkPost will receive inbound emails. Your DNS provider's MX record for this domain must point back to SparkPost.

Request

POST /api/v1/inbound-domains
{
  "domain": "indbound.example.com"
}

Response

// Empty response body
{
  "errors": [
    {
      "message": "resource conflict",
      "description": "An inbound domain with similar attributes already exists",
      "code": "1602"
    }
  ]
}

Create an Inbound Domain

POST/api/v1/inbound-domains

Request Body

domain string required

Domain name for which SparkPost will receive inbound emails.

Request

GET /api/v1/inbound-domains/indbound.example.com

Response

{
  "results": {
    "domain": "indbound.example.com"
  }
}
{
  "errors": [
    {
      "message": "resource not found",
      "code": "1600"
    }
  ]
}

Retrieve an Inbound Domain

GET/api/v1/inbound-domains/{domain}

Parameters

domain string required

Request

DELETE /api/v1/inbound-domains/indbound.example.com

Response

// Empty response body
{
  "errors": [
    {
      "message": "resource not found",
      "code": "1600"
    }
  ]
}
{
  "errors": [
    {
      "message": "resource conflict",
      "description": "Domain currently being used in a relay-webhook. Please delete the relay-webhook first.",
      "code": "1602"
    }
  ]
}

Delete an Inbound Domain

DELETE/api/v1/inbound-domains/{domain}

Parameters

domain string required

Request

GET /api/v1/inbound-domains

Response

{
  "results": [
    {
      "domain": "indbound.example.com"
    },
    {
      "domain": "inbounddomain2.test.com"
    }
  ]
}

List all Inbound Domains

GET/api/v1/inbound-domains

Returns an array with all your inbound domains.