R4

Get DNS Records

Retrieves all DNS records configured for a domain managed by your organization.

GET /api/v1/machine/domain-manager/dns-records

Query Parameters

ParameterTypeRequiredDescription
domainstringYesThe domain name to retrieve DNS records for (e.g., "example.com")

Headers

HeaderTypeRequiredDescription
X-API-KeystringYesYour API key

Response

Success (200 OK)

{
  "domain": "example.com",
  "records": [
    {
      "type": "A",
      "name": "@",
      "value": "192.168.1.1",
      "ttl": 300
    },
    {
      "type": "CNAME",
      "name": "www",
      "value": "example.com.",
      "ttl": 300
    },
    {
      "type": "MX",
      "name": "@",
      "value": "mail.example.com.",
      "ttl": 300,
      "mxPref": 10
    },
    {
      "type": "TXT",
      "name": "@",
      "value": "v=spf1 include:_spf.google.com ~all",
      "ttl": 300
    }
  ]
}

Response Fields

FieldTypeDescription
domainstringThe domain name
recordsarrayArray of DNS records
records[].typestringRecord type (A, AAAA, CNAME, MX, TXT, NS, SRV, CAA)
records[].namestringHost name ("@" for root, or subdomain like "www")
records[].valuestringRecord value (IP, hostname, or text)
records[].ttlnumberTime to live in seconds
records[].mxPrefnumberMX priority (only for MX records)

Error Responses

401 Unauthorized - Invalid or missing API key

{
  "error": {
    "code": "unauthorized",
    "message": "Invalid or missing API key. Please provide your API key in the X-API-Key header."
  }
}

403 Forbidden - Domain not managed through R4

{
  "error": {
    "code": "domain_not_managed",
    "message": "The domain \"example.com\" is not managed through R4. DNS records can only be retrieved for domains purchased through the R4 platform."
  }
}

404 Not Found - Domain not found in your organization

{
  "error": {
    "code": "domain_not_found",
    "message": "The domain \"example.com\" was not found in your organization or you do not have access to it."
  }
}

Example Request

curl -X GET "https://r4.dev/api/v1/machine/domain-manager/dns-records?domain=example.com" \
  -H "X-API-Key: rk_abc123def456.ghijklmnopqrstuvwxyz1234567890abcdef"

Use Cases

  • Infrastructure auditing: Verify DNS configuration across your domains
  • Monitoring: Build dashboards showing current DNS settings
  • Pre-deployment checks: Validate DNS before deploying applications
  • Documentation: Automatically document your DNS configuration

DNS Record Types

A Record

Maps a domain to an IPv4 address.

{ "type": "A", "name": "@", "value": "192.168.1.1", "ttl": 300 }

AAAA Record

Maps a domain to an IPv6 address.

{ "type": "AAAA", "name": "@", "value": "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "ttl": 300 }

CNAME Record

Creates an alias from one domain to another.

{ "type": "CNAME", "name": "www", "value": "example.com.", "ttl": 300 }

MX Record

Specifies mail servers for the domain. Lower mxPref values indicate higher priority.

{ "type": "MX", "name": "@", "value": "mail.example.com.", "ttl": 300, "mxPref": 10 }

TXT Record

Contains arbitrary text data, commonly used for SPF, DKIM, and domain verification.

{ "type": "TXT", "name": "@", "value": "v=spf1 include:_spf.google.com ~all", "ttl": 300 }

NS Record

Specifies authoritative nameservers for the domain.

{ "type": "NS", "name": "@", "value": "ns1.example.com.", "ttl": 86400 }

Notes

  • Only domains purchased through R4 (internalPurchase: true) can have their DNS records retrieved
  • External domains (registered elsewhere) are not accessible through this endpoint
  • The domain must be associated with a tenant in your organization