Domain API

This page contains documentation for our Domain API service. This service fetches DNS records and other domain related information.

Query DNS

The /query endpoint will query DNS records for one or more types for a given host.

Request Parameters

  • Name
    host
    Type
    string
    Description

    The hostname to query

  • Name
    types
    Type
    []string
    Description

    Which DNS record types to query for. We allow for:

    AAAAACAACNAMEMXNSPTRTXTSRVSOA

    ie: types=TXT&type=CNAME&type=AAAA. If this parameter is left blank, we'll query for all of the types above.

  • Name
    server
    Type
    string
    Description

    Nameserver to use. If none provided we'll use our cloud providers defaults, which is certainly fine for most use cases.

Below is an example response from this endpoint using all parameters

// curl https://domain-api.ervsoftware.co/query?host=ervsoftware.co&server=1.1.1.1&types=A&types=AAAA -H 'Authorization: [API_TOKEN]'
{
  "records": [
    {
      "type": "A",
      "value": "216.24.57.1"
    }
  ]
}

Or with just the required host parameter.

// curl https://domain-api.ervsoftware.co/query?host=example.com -H 'Authorization: [API_TOKEN]'
{
  "records": [
    {
      "type": "NS",
      "value": "a.iana-servers.net."
    },
    {
      "type": "NS",
      "value": "b.iana-servers.net."
    },
    {
      "type": "A",
      "value": "93.184.216.34"
    },
    {
      "type": "AAAA",
      "value": "2606:2800:220:1:248:1893:25c8:1946"
    },
    {
      "type": "SOA",
      "mname": "noc.dns.icann.org.",
      "rname": "ns.icann.org.",
      "serial": 2022091396,
      "refresh": 7200,
      "retry": 3600,
      "expire": 1209600,
      "min_ttl": 3600
    },
    {
      "type": "TXT",
      "value": "v=spf1 -all"
    },
    {
      "type": "TXT",
      "value": "wgyf8z8cgvm2qmxpnbnldrcltvk4xqfn"
    },
    {
      "type": "MX",
      "value": ".",
      "priority": 0
    }
  ]
}

Domain Keys

Query TXT records for DomainKeys Identified Mail public keys using the /domain_keys endpoint.

Request Parameters

  • Name
    host
    Type
    string
    Description

    The hostname to query

  • Name
    selectors
    Type
    []string
    Description

    Which DKIM selectors to query. If left blank, we'll query for some commonly used ones. ie: selectors=google&selectors=s1&selectors=s2.

  • Name
    server
    Type
    string
    Description

    Optional Nameserver to use.

Here is an example response from this API endpoint:

// curl https://domain-api.ervsoftware.co/domain_keys?host=microsoft.com -H 'Authorization: [API_TOKEN]'
{
  "domain_keys": [
    {
      "selector": "selector2",
      "domain": "selector2-microsoft-com._domainkey.microsoft.onmicrosoft.com.",
      "version": "DKIM1",
      "key_type": "rsa",
      "public_key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCPkb8bu8RGWeJGk3hJrouZXIdZ+HTp/azRp8IUOHp5wKvPUAi/54PwuLscUjRk4Rh3hjIkMpKRfJJXPxWbrT7eMLric7f/S0h+qF4aqIiQqHFCDAYfMnN6V3Wbke2U5EGm0H/cAUYkaf2AtuHJ/rdY/EXaldAm00PgT9QQMez66QIDAQAB",
      "service_type": [
        "all"
      ]
    }
  ]
}

Sender Policy Ranges

the /sender_policy_ranges endpoint determines the effective IP ranges from the Sender Policy Framework TXT record for the given host.

This endpoint will also include the original SPF TXT record values for both the domain and all referenced policy.

Request Parameters

  • Name
    host
    Type
    string
    Description

    The hostname to query

  • Name
    server
    Type
    string
    Description

    Nameserver to use. If none provided we'll use our cloud providers defaults, which is certainly fine for most use cases.

// curl https://domain-api.ervsoftware.co/sender_policy_ranges?host=ervsoftware.co -H 'Authorization: [API_TOKEN]'
{
  "query_count": 6,
  "policy": "v=spf1 include:_spf.google.com include:spf.mtasv.net -all",
  "ips": [],
  "includes": [
    {
      "domain": "_spf.google.com",
      "policy": "v=spf1 include:_netblocks.google.com include:_netblocks2.google.com include:_netblocks3.google.com ~all",
      "ips": [],
      "includes": [
        {
          "domain": "_netblocks.google.com",
          "policy": "v=spf1 ip4:35.190.247.0/24 ip4:64.233.160.0/19 ip4:66.102.0.0/20 ip4:66.249.80.0/20 ip4:72.14.192.0/18 ip4:74.125.0.0/16 ip4:108.177.8.0/21 ip4:173.194.0.0/16 ip4:209.85.128.0/17 ip4:216.58.192.0/19 ip4:216.239.32.0/19 ~all",
          "ips": [
            {
              "version": 4, "cidr_block": "35.190.247.0/24"
            },
            {
              "version": 4, "cidr_block": "64.233.160.0/19"
            },
            {
              "version": 4, "cidr_block": "66.102.0.0/20"
            },
            {
              "version": 4, "cidr_block": "66.249.80.0/20"
            },
            {
              "version": 4, "cidr_block": "72.14.192.0/18"
            },
            {
              "version": 4, "cidr_block": "74.125.0.0/16"
            },
            {
              "version": 4, "cidr_block": "108.177.8.0/21"
            },
            {
              "version": 4, "cidr_block": "173.194.0.0/16"
            },
            {
              "version": 4, "cidr_block": "209.85.128.0/17"
            },
            {
              "version": 4, "cidr_block": "216.58.192.0/19"
            },
            {
              "version": 4, "cidr_block": "216.239.32.0/19"
            }
          ],
          "includes": []
        },
        {
          "domain": "_netblocks2.google.com",
          "policy": "v=spf1 ip6:2001:4860:4000::/36 ip6:2404:6800:4000::/36 ip6:2607:f8b0:4000::/36 ip6:2800:3f0:4000::/36 ip6:2a00:1450:4000::/36 ip6:2c0f:fb50:4000::/36 ~all",
          "ips": [
            {
              "version": 6, "cidr_block": "2001:4860:4000::/36"
            },
            {
              "version": 6, "cidr_block": "2404:6800:4000::/36"
            },
            {
              "version": 6, "cidr_block": "2607:f8b0:4000::/36"
            },
            {
              "version": 6, "cidr_block": "2800:3f0:4000::/36"
            },
            {
              "version": 6, "cidr_block": "2a00:1450:4000::/36"
            },
            {
              "version": 6, "cidr_block": "2c0f:fb50:4000::/36"
            }
          ],
          "includes": []
        },
        {
          "domain": "_netblocks3.google.com",
          "policy": "v=spf1 ip4:172.217.0.0/19 ip4:172.217.32.0/20 ip4:172.217.128.0/19 ip4:172.217.160.0/20 ip4:172.217.192.0/19 ip4:172.253.56.0/21 ip4:172.253.112.0/20 ip4:108.177.96.0/19 ip4:35.191.0.0/16 ip4:130.211.0.0/22 ~all",
          "ips": [
            {
              "version": 4, "cidr_block": "172.217.0.0/19"
            },
            {
              "version": 4, "cidr_block": "172.217.32.0/20"
            },
            {
              "version": 4, "cidr_block": "172.217.128.0/19"
            },
            {
              "version": 4, "cidr_block": "172.217.160.0/20"
            },
            {
              "version": 4, "cidr_block": "172.217.192.0/19"
            },
            {
              "version": 4, "cidr_block": "172.253.56.0/21"
            },
            {
              "version": 4, "cidr_block": "172.253.112.0/20"
            },
            {
              "version": 4, "cidr_block": "108.177.96.0/19"
            },
            {
              "version": 4, "cidr_block": "35.191.0.0/16"
            },
            {
              "version": 4, "cidr_block": "130.211.0.0/22"
            }
          ],
          "includes": []
        }
      ]
    },
    {
      "domain": "spf.mtasv.net",
      "policy": "v=spf1 ip4:50.31.156.96/27 ip4:104.245.209.192/26 ip4:50.31.205.0/24 ip4:147.160.158.0/24 -all",
      "ips": [
        {
          "version": 4, "cidr_block": "50.31.156.96/27"
        },
        {
          "version": 4, "cidr_block": "104.245.209.192/26"
        },
        {
          "version": 4, "cidr_block": "50.31.205.0/24"
        },
        {
          "version": 4, "cidr_block": "147.160.158.0/24"
        }
      ],
      "includes": []
    }
  ]
}


WHOIS

Retrieved structured WHOIS information for a given host via the /whois endpoint.

Request Parameters

  • Name
    host
    Type
    string
    Description

    The hostname to query

Example response:


// curl https://domain-api.ervsoftware.co/whois?host=example.com -H 'Authorization: [API_TOKEN]'
{
  "domain": {
    "id": "2336799_DOMAIN_COM-VRSN",
    "domain": "example.com",
    "punycode": "example.com",
    "name": "example",
    "extension": "com",
    "whois_server": "whois.iana.org",
    "status": [
      "clientdeleteprohibited",
      "clienttransferprohibited",
      "clientupdateprohibited"
    ],
    "name_servers": [
      "a.iana-servers.net",
      "b.iana-servers.net"
    ],
    "dnssec": true,
    "created_date": "1995-08-14T04:00:00Z",
    "created_date_in_time": "1995-08-14T04:00:00Z",
    "updated_date": "2023-08-14T07:01:38Z",
    "updated_date_in_time": "2023-08-14T07:01:38Z",
    "expiration_date": "2024-08-13T04:00:00Z",
    "expiration_date_in_time": "2024-08-13T04:00:00Z"
  },
  "registrar": {
    "id": "376",
    "name": "RESERVED-Internet Assigned Numbers Authority",
    "referral_url": "http://res-dom.iana.org"
  }
}