API Reference

Check MX records

GET /domains/mx-check — preflight a hostname's existing MX records before enabling receiving.

GET/domains/mx-check

A preflight for receiving: does a hostname already have MX records, and do they all point at our inbound host? Use it before pointing a domain's MX at us so you can warn about an existing mail provider (switching MX would redirect all of that domain's mail to us). Read-only; requires a read-scoped key.

Query parameters
namestringrequired

The hostname to check, e.g. mail.yourdomain.com.

Request

curl "https://api.mailblastr.com/domains/mx-check?name=mail.yourdomain.com" \
  -H "Authorization: Bearer $MAILBLASTR_API_KEY"
import { MailBlastr } from 'mailblastr';
const mb = new MailBlastr(process.env.MAILBLASTR_API_KEY);

const { data } = await mb.domains.mxCheck('mail.yourdomain.com');

Response

{
  "has_mx": true,
  "ours": false,
  "records": [
    { "exchange": "aspmx.l.google.com", "priority": 1 },
    { "exchange": "alt1.aspmx.l.google.com", "priority": 5 }
  ]
}
Response fields
has_mxbooleanoptional

Whether the hostname has any MX records at all.

oursbooleanoptional

Whether every MX record already points at our inbound host (i.e. receiving is ready).

recordsobject[]optional

The discovered MX records, each { exchange, priority }, sorted by priority.

A missing name returns missing_required_field (400); an invalid domain returns validation_error (422). A hostname with no MX (or an unresolvable one) returns { has_mx: false, ours: false, records: [] }. See Errors.