Skip to content

Latest commit

 

History

History
512 lines (385 loc) · 13.8 KB

File metadata and controls

512 lines (385 loc) · 13.8 KB

DNS

Section: API Solutions

DNS lookup APIs (live, historical, reverse, bulk)

4 endpoint(s). All requests require your API key — see Authentication.

Live DNS Lookup

GET /v2.0/dns/live

Real-time DNS record lookup. 1 credit per query.

Parameters

Parameter In Required Type Description
domainName query no string
ipAddress query no string Use for PTR lookups
type query yes string all or comma-separated: A,MX,NS,TXT,SOA,SPF,AAAA,CNAME
format query no string (one of: json, xml)

Response (DnsResponse)

Field Type Description
domainName string
ipAddress string
queryTime string
status boolean
domainRegistered boolean
dnsTypes object
dnsRecords array
DnsRecord object
Field Type Description
type string
name string
ttl integer
address string
priority integer
exchange string
target string
strings array
host string
admin string
serial integer
refresh integer
retry integer
expire integer
minimum integer

Usage

Python
"""Runnable example: Live DNS Lookup (GET /v2.0/dns/live)."""
from whoisfreaks import Configuration, ApiClient
from whoisfreaks.api.dns_api import DNSApi

# Parameters for dnsLive (GET /v2.0/dns/live):
#   - domainName (string, required)
#   - ipAddress (string, required): Use for PTR lookups
#   - type (string, required): all or comma-separated: A,MX,NS,TXT,SOA,SPF,AAAA,CNAME
#   - format (string (one of: json, xml), optional)
config = Configuration()
config.api_key["ApiKeyAuth"] = "YOUR_API_KEY"   # set once
api = DNSApi(ApiClient(config))

result = api.dns_live(domain_name="example.com", ip_address="8.8.8.8", var_type="value")
print(result)
TypeScript
// Runnable example: Live DNS Lookup (GET /v2.0/dns/live)
// Parameters for dnsLive (GET /v2.0/dns/live):
//   - domainName (string, required)
//   - ipAddress (string, required): Use for PTR lookups
//   - type (string, required): all or comma-separated: A,MX,NS,TXT,SOA,SPF,AAAA,CNAME
//   - format (string (one of: json, xml), optional)
import { Configuration, DNSApi } from "whoisfreaks";

const config = new Configuration({ apiKey: "YOUR_API_KEY" });  // set once
const api = new DNSApi(config);

async function main() {
  const result = await api.dnsLive({ domainName: "example.com", ipAddress: "8.8.8.8", type: "value", format: undefined });
  console.log(result);
}
main().catch(console.error);
Go
// Runnable example: Live DNS Lookup (GET /v2.0/dns/live)
// Parameters for dnsLive (GET /v2.0/dns/live):
//   - domainName (string, required)
//   - ipAddress (string, required): Use for PTR lookups
//   - type (string, required): all or comma-separated: A,MX,NS,TXT,SOA,SPF,AAAA,CNAME
//   - format (string (one of: json, xml), optional)
package main

import (
    "context"
    "encoding/json"
    "fmt"
    wf "github.com/WhoisFreaks/whoisfreaks-go"
)

func main() {
    cfg := wf.NewConfiguration()
    client := wf.NewAPIClient(cfg)
    // apiKey is set once via the request context
    ctx := context.WithValue(context.Background(), wf.ContextAPIKeys,
        map[string]wf.APIKey{"ApiKeyAuth": {Key: "YOUR_API_KEY"}})
    result, _, err := client.DNSAPI.DnsLive(ctx).DomainName("example.com").IpAddress("8.8.8.8").Type("value").Execute()
    if err != nil { panic(err) }
    b, _ := json.MarshalIndent(result, "", "  ")
    fmt.Println(string(b))
}

Historical DNS Lookup

GET /v2.0/dns/historical

All historical DNS records. 2 credits per page (100 records/page).

Parameters

Parameter In Required Type Description
domainName query yes string
type query yes string
page query no integer
format query no string (one of: json, xml)

Response (HistoricalDnsResponse)

Field Type Description
totalPages integer
currenPage integer
totalRecords integer
historicalDns array
DnsResponse object
Field Type Description
domainName string
ipAddress string
queryTime string
status boolean
domainRegistered boolean
dnsTypes object
dnsRecords array

Usage

Python
"""Runnable example: Historical DNS Lookup (GET /v2.0/dns/historical)."""
from whoisfreaks import Configuration, ApiClient
from whoisfreaks.api.dns_api import DNSApi

# Parameters for dnsHistorical (GET /v2.0/dns/historical):
#   - domainName (string, required)
#   - type (string, required)
#   - page (integer, optional)
#   - format (string (one of: json, xml), optional)
config = Configuration()
config.api_key["ApiKeyAuth"] = "YOUR_API_KEY"   # set once
api = DNSApi(ApiClient(config))

result = api.dns_historical(domain_name="example.com", var_type="value")
print(result)
TypeScript
// Runnable example: Historical DNS Lookup (GET /v2.0/dns/historical)
// Parameters for dnsHistorical (GET /v2.0/dns/historical):
//   - domainName (string, required)
//   - type (string, required)
//   - page (integer, optional)
//   - format (string (one of: json, xml), optional)
import { Configuration, DNSApi } from "whoisfreaks";

const config = new Configuration({ apiKey: "YOUR_API_KEY" });  // set once
const api = new DNSApi(config);

async function main() {
  const result = await api.dnsHistorical({ domainName: "example.com", type: "value", page: undefined, format: undefined });
  console.log(result);
}
main().catch(console.error);
Go
// Runnable example: Historical DNS Lookup (GET /v2.0/dns/historical)
// Parameters for dnsHistorical (GET /v2.0/dns/historical):
//   - domainName (string, required)
//   - type (string, required)
//   - page (integer, optional)
//   - format (string (one of: json, xml), optional)
package main

import (
    "context"
    "encoding/json"
    "fmt"
    wf "github.com/WhoisFreaks/whoisfreaks-go"
)

func main() {
    cfg := wf.NewConfiguration()
    client := wf.NewAPIClient(cfg)
    // apiKey is set once via the request context
    ctx := context.WithValue(context.Background(), wf.ContextAPIKeys,
        map[string]wf.APIKey{"ApiKeyAuth": {Key: "YOUR_API_KEY"}})
    result, _, err := client.DNSAPI.DnsHistorical(ctx).DomainName("example.com").Type("value").Execute()
    if err != nil { panic(err) }
    b, _ := json.MarshalIndent(result, "", "  ")
    fmt.Println(string(b))
}

Reverse DNS Lookup

GET /v2.1/dns/reverse

Search domains by IP or DNS value. 5 credits per page.

Parameters

Parameter In Required Type Description
value query yes string IP, CIDR, or record value
type query yes string (one of: a, mx, cname, ns, aaaa, txt, soa)
exact query no boolean
page query no integer
format query no string (one of: json, xml)

Response (ReverseDnsResponse)

Field Type Description
totalRecords integer
totalPages integer
currentPage integer
reverseDnsRecords array
DnsResponse object
Field Type Description
domainName string
ipAddress string
queryTime string
status boolean
domainRegistered boolean
dnsTypes object
dnsRecords array

Usage

Python
"""Runnable example: Reverse DNS Lookup (GET /v2.1/dns/reverse)."""
from whoisfreaks import Configuration, ApiClient
from whoisfreaks.api.dns_api import DNSApi

# Parameters for dnsReverse (GET /v2.1/dns/reverse):
#   - value (string, required): IP, CIDR, or record value
#   - type (string (one of: a, mx, cname, ns, aaaa, txt, soa), required)
#   - exact (boolean, optional)
#   - page (integer, optional)
#   - format (string (one of: json, xml), optional)
config = Configuration()
config.api_key["ApiKeyAuth"] = "YOUR_API_KEY"   # set once
api = DNSApi(ApiClient(config))

result = api.dns_reverse(value="value", var_type="a", exact=True)
print(result)
TypeScript
// Runnable example: Reverse DNS Lookup (GET /v2.1/dns/reverse)
// Parameters for dnsReverse (GET /v2.1/dns/reverse):
//   - value (string, required): IP, CIDR, or record value
//   - type (string (one of: a, mx, cname, ns, aaaa, txt, soa), required)
//   - exact (boolean, optional)
//   - page (integer, optional)
//   - format (string (one of: json, xml), optional)
import { Configuration, DNSApi } from "whoisfreaks";

const config = new Configuration({ apiKey: "YOUR_API_KEY" });  // set once
const api = new DNSApi(config);

async function main() {
  const result = await api.dnsReverse({ value: "value", type: "a", exact: true, page: undefined, format: undefined });
  console.log(result);
}
main().catch(console.error);
Go
// Runnable example: Reverse DNS Lookup (GET /v2.1/dns/reverse)
// Parameters for dnsReverse (GET /v2.1/dns/reverse):
//   - value (string, required): IP, CIDR, or record value
//   - type (string (one of: a, mx, cname, ns, aaaa, txt, soa), required)
//   - exact (boolean, optional)
//   - page (integer, optional)
//   - format (string (one of: json, xml), optional)
package main

import (
    "context"
    "encoding/json"
    "fmt"
    wf "github.com/WhoisFreaks/whoisfreaks-go"
)

func main() {
    cfg := wf.NewConfiguration()
    client := wf.NewAPIClient(cfg)
    // apiKey is set once via the request context
    ctx := context.WithValue(context.Background(), wf.ContextAPIKeys,
        map[string]wf.APIKey{"ApiKeyAuth": {Key: "YOUR_API_KEY"}})
    result, _, err := client.DNSAPI.DnsReverse(ctx).Value("value").Type("a").Exact(true).Execute()
    if err != nil { panic(err) }
    b, _ := json.MarshalIndent(result, "", "  ")
    fmt.Println(string(b))
}

Bulk DNS Lookup

POST /v2.0/dns/bulk/live

Up to 100 domains + 100 IPs in one request.

Parameters

Parameter In Required Type Description
type query yes string
format query no string (one of: json, xml)

Response (BulkDnsResponse)

Field Type Description
bulk_dns_info array
DnsResponse object
Field Type Description
domainName string
ipAddress string
queryTime string
status boolean
domainRegistered boolean
dnsTypes object
dnsRecords array

Usage

Python
"""Runnable example: Bulk DNS Lookup (POST /v2.0/dns/bulk/live)."""
from whoisfreaks import Configuration, ApiClient
from whoisfreaks.api.dns_api import DNSApi
from whoisfreaks.models.dns_bulk_request import DnsBulkRequest

# Parameters for dnsBulk (POST /v2.0/dns/bulk/live):
#   - type (string, required)
#   - format (string (one of: json, xml), optional)
#   - body: DnsBulkRequest (required) -- request body object
config = Configuration()
config.api_key["ApiKeyAuth"] = "YOUR_API_KEY"   # set once
api = DNSApi(ApiClient(config))

dns_bulk_request = DnsBulkRequest()  # populate fields as needed
result = api.dns_bulk(var_type="value", dns_bulk_request=dns_bulk_request)
print(result)
TypeScript
// Runnable example: Bulk DNS Lookup (POST /v2.0/dns/bulk/live)
// Parameters for dnsBulk (POST /v2.0/dns/bulk/live):
//   - type (string, required)
//   - format (string (one of: json, xml), optional)
//   - body: DnsBulkRequest (required) -- request body object
import { Configuration, DNSApi } from "whoisfreaks";

const config = new Configuration({ apiKey: "YOUR_API_KEY" });  // set once
const api = new DNSApi(config);

async function main() {
  const result = await api.dnsBulk({ type: "value", dnsBulkRequest: {}, format: undefined });
  console.log(result);
}
main().catch(console.error);
Go
// Runnable example: Bulk DNS Lookup (POST /v2.0/dns/bulk/live)
// Parameters for dnsBulk (POST /v2.0/dns/bulk/live):
//   - type (string, required)
//   - format (string (one of: json, xml), optional)
//   - body: DnsBulkRequest (required) -- request body object
package main

import (
    "context"
    "encoding/json"
    "fmt"
    wf "github.com/WhoisFreaks/whoisfreaks-go"
)

func main() {
    cfg := wf.NewConfiguration()
    client := wf.NewAPIClient(cfg)
    // apiKey is set once via the request context
    ctx := context.WithValue(context.Background(), wf.ContextAPIKeys,
        map[string]wf.APIKey{"ApiKeyAuth": {Key: "YOUR_API_KEY"}})
    result, _, err := client.DNSAPI.DnsBulk(ctx).Type("value").DnsBulkRequest(*wf.NewDnsBulkRequest()).Execute()
    if err != nil { panic(err) }
    b, _ := json.MarshalIndent(result, "", "  ")
    fmt.Println(string(b))
}