← Docs

MX API

Mail exchange records for a domain.

Mail exchange records for a domain. Each row is a priority and host, sorted the way mailers try them.

Empty mx means no mail exchanger. That is an answer, not an error. Records share the DNS API's cache and expire with their DNS lifetime, capped at one hour. Failed refreshes return 503 instead of old records.

For other record types and TTLs, use DNS. To check if a domain is free to register, use Domain.

Lookup

GET
api.parseapi.com/mx/{domain}
MX hosts and priorities (empty array if none)
Explore
Parameters 1
domainstring · path · required

Domain name

Run uses the free demo on API 2.0.0. Copied code uses your API key when signed in, or YOUR_API_KEY when signed out.

import { parseAPI } from '@parseapi/sdk';

const parse = parseAPI("YOUR_API_KEY");
const result = await parse.mx("gmail.com");
console.log(result);

Run on your server with a secret key. Calling from a browser or app?

Example response (excerpt)

This example shows selected fields or shortened lists. Run the request for the full response.

{
  "domain": "gmail.com",
  "mx": [
    {
      "priority": 5,
      "host": "gmail-smtp-in.l.google.com"
    },
    {
      "priority": 10,
      "host": "alt1.gmail-smtp-in.l.google.com"
    }
  ]
}

Response fields

domainstring
Hostname checked
mxarray
Priority and host. A priority-0 host of . is null MX (accepts no mail); [] means no MX records.

Questions? Email