NewConnect Claude, Cursor, ChatGPT, and other AI agents to API Ninjas via our MCP server

MX Lookup API

The MX Lookup API retrieves mail exchange (MX) records for any given domain.

(4.7)

From 5,110 users

4,200+

Applications using this API

API Status

Online - All Systems Operational

API Response Times

Average
P50
P75
P90
P95
348ms372ms435ms805ms1167ms

Didn't find what you were looking for? Suggest an improvement


/v1/mxlookup GET

https://api.api-ninjas.com/v1/mxlookup

Returns a list of MX records associated with a particular domain. Free users receive only data from the first MX record, while premium users get access to all MX records.

Parameters

  • domain  required

    Valid domain to check (e.g. x.com). All top-level domains are supported.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

A JSON array of objects, each containing the following fields, or an error if the request is unsuccessful.

  • priority

    Priority value of the MX record (lower numbers indicate higher priority).

  • value

    The mail server hostname.

Sample Request Live Demo!

domain

Try this API endpoint with all available parameters in our API playground

https://api.api-ninjas.com/v1/mxlookup?domain=x.com

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON

Code Examples

1 2 curl -X GET "https://api.api-ninjas.com/v1/mxlookup?domain=example.com" \ -H "X-Api-Key: YOUR_API_KEY"

If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.