DNS Records
Get DNS records
Section titled “Get DNS records”Namecheap: domains.dns.getHosts
GET /domains/:domain/dnsResponse 200
{ "data": { "domain": "example.com", "isUsingOurDns": true, "emailType": "MX", "records": [ { "hostId": "12345", "name": "@", "type": "A", "address": "93.184.216.34", "mxPref": 10, "ttl": 1800, "isActive": true }, { "hostId": "12346", "name": "www", "type": "CNAME", "address": "example.com", "mxPref": 10, "ttl": 1800, "isActive": true }, { "hostId": "12347", "name": "@", "type": "MX", "address": "mail.example.com", "mxPref": 10, "ttl": 1800, "isActive": true } ] }}Errors: 404 domain not found, 409 domain not using Namecheap DNS.
Set DNS records
Section titled “Set DNS records”Namecheap: domains.dns.setHosts
POST /domains/:domain/dns{ "records": [ { "name": "@", "type": "A", "address": "93.184.216.34", "ttl": 1800, "mxPref": 10 }, { "name": "www", "type": "CNAME", "address": "example.com", "ttl": 1800, "mxPref": 10 }, { "name": "@", "type": "TXT", "address": "v=spf1 include:_spf.google.com ~all", "ttl": 1800, "mxPref": 10 }, { "name": "@", "type": "MX", "address": "aspmx.l.google.com", "ttl": 1800, "mxPref": 1 } ]}| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | Hostname: @, www, mail, *, etc. |
type | string | yes | A, AAAA, CNAME, MX, MXE, TXT, URL, URL301, FRAME, CAA |
address | string | yes | IP address, hostname, or text value |
ttl | number | no | TTL in seconds (60–60000, default 1800) |
mxPref | number | no | MX preference (1–99, default 10) |
Response 200
{ "data": { "domain": "example.com", "isSuccess": true }}Reset DNS to Namecheap default
Section titled “Reset DNS to Namecheap default”Resets the domain to use Namecheap’s default nameservers and removes all custom DNS records.
Namecheap: domains.dns.setDefault
POST /domains/:domain/dns/defaultResponse 200
{ "data": { "domain": "example.com", "updated": true }}