URL APIs of the JSON API for DoH (both TLS and non-TLS APIs are provided)

https://dns.alidns.com/resolve?

https://alidns_ip/resolve?

http://dns.alidns.com/resolve?

http://alidns_ip/resolve?

Notice:alidns_ip is the A record of dns.alidns.com and can be one of the following IP addresses: 223.5.5.5 and 223.6.6.6.

Request method: GET

Request parameters

Parameter Data type Description Instance Required/Optional and default value
name STRING The domain name in a request. name=www.taobao.com. Required. No default value.
type Number The request type. type=1 Optional. Default value: 1.
edns_client_subnet IP address ECS IP edns_client_subnet=1.2.3.4/24 Used by the DNS proxy. This parameter does not apply to common clients.
short BOOLEAN Specifies whether to enable the short mode. short=true or short=1 Optional. The short mode is disabled by default. Default value: false or 0.
uid STRING The ID of the user. uid=6666 Optional.

edns_client_subnet parameter:

The edns_client_subnet parameter is designed to support the EDNS Client Subnet (ECS) specified in the RFC 7871 specifications. ECS is a DNS extension that forwards the subnet information of users to the authoritative DNS server to achieve accurate DNS resolution and traffic scheduling. A long mask provides accurate address information, but a short mask better protects user privacy. The /24 mask length is recommended.

Note: This parameter is designed for the scenario in which the DNS proxy uses the JSON API for DNS over HTTPS (DoH). The process in this scenario is as follows: After the DNS proxy receives DNS queries from a user, it uses the edns_client_subnet parameter to pass the subnet information of the user to Alibaba Cloud public DNS. Then, Alibaba Cloud public DNS passes the subnet information to the authoritative DNS server.

For example, if the value of edns_client_subnet is 1.2.3.4/24, the authoritative DNS server selects a DNS link for the user based on the prefix of 1.2.3.4/24.

The following table describes values of the type parameter.

Record type ID Description Example
A 1 An IPv4 record that maps a domain name to an IPv4 address. 101.37.183.171
NS 2 A name server record. ns1.taobao.com.
CNAME 5 An alias record that associates a domain name with another domain name. www.taobao.com.danuoyi.tbcache.com.
SOA 6 A Start of Authority (SOA) record that contains administrative information about a zone. ns4.taobao.com. hostmaster.alibabadns.com. 2018011109 3600 1200 3600 360
TXT 16 A TXT record. "v=spf1 include:spf1.staff.mail.aliyun.com -all"
AAAA 28 An IPv6 record that maps a domain name to an IPv6 address. 240e:e1:f300:1:3::3fa

Sample requests:

http://dns.alidns.com/resolve?name=www.taobao.com.&type=1

Sample responses:

{
    "Status": 0,
    "TC": false,
    "RD": true,
    "RA": true,
    "AD": false,
    "CD": false,
    "Question": {       // Request segment
        "name": "www.taobao.com.",
        "type": 1
    },
    "Answer": [         // Response segment
        {
            "name": "www.taobao.com.",
            "TTL": 45,
            "type": 5,
            "data": "www.taobao.com.danuoyi.tbcache.com."
        },
        {
            "name": "www.taobao.com.danuoyi.tbcache.com.",
            "TTL": 45,
            "type": 1,
            "data": "47.246.24.234"
        },
        {
            "name": "www.taobao.com.danuoyi.tbcache.com.",
            "TTL": 45,
            "type": 1,
            "data": "47.246.24.233"
        }
    ]
    // The Authority segment. Data in this segment must be consistent with the data in the Answer segment.
    // The Additional segment. Data in this segment must be consistent with the data in the Answer segment.
    // The edns_client_subnet parameter can be set to 1.2.3.4/24.
}

Note: You can call the DoH service and JSON API for DoH on your client applications or mobile apps to resolve DNS records.