# 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](https://www.sendping.co/docs/receiving/introduction): 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**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | The hostname to check, e.g. `mail.yourdomain.com`. |

### Request

```bash
curl "https://www.sendping.co/api/domains/mx-check?name=mail.yourdomain.com" \
  -H "Authorization: Bearer $SENDPING_API_KEY"
```

```js
import { SendPing } from 'sendping';
const mb = new SendPing(process.env.SENDPING_API_KEY);

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

### Response

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

**Response fields**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `has_mx` | boolean | No | Whether the hostname has any MX records at all. |
| `ours` | boolean | No | Whether every MX record already points at our inbound host (i.e. receiving is ready). |
| `records` | object[] | No | The discovered MX records, each `{ exchange, priority }`, sorted by priority. |

A missing `name` returns `missing_required_field` (422). An invalid, unresolvable, or MX-less hostname returns `200` with `{ has_mx: false, ours: false, records: [] }` — this endpoint fails open and never returns `validation_error`. See [Errors](https://www.sendping.co/docs/api/errors).
