User Guides

Farsight DNSDB API Version 1 Documentation

Introduction

DNSDB is a database that stores and indexes both the passive DNS data available via Farsight Security’s Security Information Exchange as well as the authoritative DNS data that various zone operators make available. DNSDB makes it easy to search for individual DNS RRsets and provides additional metadata for search results such as first seen and last seen timestamps as well as the DNS bailiwick associated with an RRset. DNSDB also has the ability to perform inverse or rdata searches.

This document describes how to make bulk, automated DNSDB queries via the RESTful API. There are two versions of the API; the first, implicitly API version 1, is described on this page. API version 2 is described at DNSDB APIv2.

There are a small number of differences in API version 1 as supported by the DNSDB Export product. See section DNSDB Export below.

Audience

This document is intended for programmers who want to write applications that can interact with the RESTful DNSDB API using JSON and HTTP.

Getting Started

To request a demonstration of DNSDB or to inquire about a trial API key please contact the DomainTools sales team.

Authentication

The DNSDB API is provided over an encrypted HTTPS transport over the Internet at the following URL:

Authentication is performed by providing an API key (a long string of hexadecimal digits or dashes) in a special HTTP request header, X-API-Key. For example, if your API key is d41d8cd98f00b204e9800998ecf8427e, then the following HTTP header should be added to the HTTP request:

X-API-Key: d41d8cd98f00b204e9800998ecf8427e

If the X-API-Key header is not present, or the provided API key is not valid, a 403 Forbidden response will be returned to the HTTP client.

Requests supported

There are two kinds of requests supported in DNSDB.

  1. lookup — this request is the primary query to search for individual DNS RRsets. This is the classic kind of request supported in DNSDB.
  2. summarize — this request returns a summary of RRsets that would be returned by a Lookup query. This gives you an estimate of result size. At-a-glance, it provides information on when a given domain name, IP address or other DNS asset was first-seen and last-seen by the global sensor network, as well as the total observation count.

Name encoding

All DNS names used with the DNSDB API must be encoded in Punycode. In particular, using non-basic ASCII characters may result in a 500 Internal Server error.

lookup queries

All DNSDB lookup requests are rooted in URL paths under the /lookup hierarchy. There are two separate lookup methods, “rrset” and “rdata”, which are accessed via the URL paths /lookup/rrset and /lookup/rdata respectively.

rrset lookups

The “rrset” lookup queries DNSDB’s RRset index, which supports “forward” lookups based on the owner name of an RRset.

rrset lookups follow the URL path scheme:

/lookup/rrset/TYPE/VALUE/RRTYPE/BAILIWICK

with placeholders TYPE, VALUE, RRTYPE, and BAILIWICK.

Both TYPE and VALUE are required; RRTYPE and BAILIWICK are optional. If RRTYPE is not specified, then the query will function as if “ANY” was specified.

The TYPE specifies how VALUE is interpreted. TYPE may be one of the following:

TypeDescription
nameThe VALUE is a DNS owner name in presentation format or wildcards as described below. We sometimes call this just an rrset search.
rawThe VALUE is an even number of hexadecimal digits specifying a raw octet string.

Wildcards are one of two forms: a left-hand (*.example.com) or right-hand (www.example.*) wildcard domain name. An owner name with a leading asterisk and label separator, (i.e., *.) will perform a wildcard search for any RRsets whose owner names end with the given domain name. An owner name with a trailing label separator and asterisk (i.e., .*) will perform a wildcard search for any RRsets whose owner names start with the given label(s). Note that left-hand wildcard queries are somewhat more expensive and slower than right-hand wildcard queries.

The OWNER_NAME and BAILIWICK are DNS names specified in DNS presentation format. TYPE is specified as a DNS RRtype mnemonic.

The RRtype ANY is modified somewhat from its usual meaning. A DNSDB lookup for RRtype ANY will match any RRtype except the DNSSEC-related RRtypes: DS, RRSIG, NSEC, DNSKEY, NSEC3, NSEC3PARAM, DLV, CDS, CDNSKEY, and TA. A new pseudo-mnemonic ANY-DNSSEC has been introduced that will return only those records matching the aforementioned RRtypes. RRtype ANY may be specified for RRTYPE in order to perform bailiwick filtering without also filtering on a particular RRtype.

The BAILIWICK may not be specified with raw queries.

As of July, 2022 DNSDB was changed to reduce the amount of junk wildcard domains in its database. We are gradually rolling out a change to replace multiple wildcarded DNS rrnames with a single rrname that starts with a _WILDCARD_. label.  No other rrname labels contain uppercase letters, so records with this (all upper case) _WILDCARD_. were never in DNSDB before.  Note that there are existing, real, domain names that contain a _wildcard_. label (all lower case).

The results of an rrset lookup return zero or more RRsets, along with the following metadata for each result:

ItemDescription
countThe number of times the RRset was observed via passive DNS replication.
bailiwickThe “bailiwick” of an RRset in DNSDB observed via passive DNS replication is the closest enclosing zone delegated to a nameserver which served the RRset.

The “bailiwick” of an RRset in DNSDB observed in a zone file is simply the name of the zone containing the RRset.
first seenA UTC timestamp with seconds granularity indicating the first time an RRset was seen in the given bailiwick via passive DNS replication.
last seenA UTC timestamp with seconds granularity indicating the last time an RRset was seen in the given bailiwick via passive DNS replication.
first seen in zone fileA UTC timestamp with seconds granularity indicating the first time an RRset was seen in the given bailiwick via zone file import.
last seen in zone fileA UTC timestamp with seconds granularity indicating the last time an RRset was seen in the given bailiwick via zone file import.

An rrset search result may be missing either the pair of (first seen, last seen) timestamps from passive DNS replication or from zone file import, but at least one pair of timestamps will always be present. This may change if a fundamentally new data source is introduced in the future, but there will always be at least one timestamp pair associated with an RRset.

Note: The DNSDB API returns RRSIG records with the expiration and inception times in the Unix epoch time format, seconds since 1 January 1970 00:00:00 UTC. RFC 4034 also allows presentation of these times in YYYYMMDDHHmmSS format, which many DNSSEC tools and presentation libraries use. It is always possible to distinguish between these two formats because the YYYYMMDDHHmmSS format will always be exactly 14 digits, while the decimal representation of a 32-bit unsigned integer can never be longer than 10 digits.

rdata lookups

The “rdata” lookup queries DNSDB’s Rdata index, which supports “inverse” lookups based on Rdata record values. In contrast to the rrset lookup method, rdata lookups return only individual resource records and not full resource record sets, and lack bailiwick metadata. An rrset lookup on the owner name reported via an rdata lookup must be performed to retrieve the full RRset and bailiwick.

rdata lookups follow the URL path scheme:

/lookup/rdata/TYPE/VALUE/RRTYPE

with placeholders TYPE, VALUE, and RRTYPE.

Both TYPE and VALUE are required. Placeholder TYPE specifies how VALUE is interpreted. TYPE may be one of the following:

TypeDescription
nameThe VALUE is a DNS domain name in presentation format, or a left-hand (“.example.com”) or right-hand (“www.example.”) wildcard domain name. Note that left-hand wildcard queries are somewhat more expensive than right-hand wildcard queries.
ipThe VALUE is one of an IPv4 or IPv6 single address, with a prefix length, or with an address range. If a prefix is provided, the delimiter between the network address and prefix length is a single comma (“,”) character rather than the usual slash (“/”) character to avoid clashing with the HTTP URI path name separator.
rawThe VALUE is an even number of hexadecimal digits specifying a raw octet string.

If RRTYPE is not specified, then the query will function as if “ANY” was specified.

For “name” and “raw” rdata lookups, RRTYPE optionally filters the results by RRtype in the same manner as the rrset lookup.

For “ip” rdata lookups, the supported RRTYPE values are A, AAAA, and ANY, which can be used interchangeably: you can send an IPv4 or IPv6 address to either value and the data returned will be based on the IP address sent, not on the RRTYPE value. Any other RRTYPE value will return an “HTTP 400 Bad Request” response.

Some examples of “ip” rdata URLs (noting that colon needs to be expressed as ):

https://api.dnsdb.info/lookup/rdata/ip/10.0.0.1/ANY
https://api.dnsdb.info/lookup/rdata/ip/10.0.0.1-10.1.255.255
https://api.dnsdb.info/lookup/rdata/ip/10.0.0.1,24/ANY
https://api.dnsdb.info/lookup/rdata/ip/262011cf008,126
https://api.dnsdb.info/lookup/rdata/ip/262011cf0081-262011cf008ff

Lookup result formats

The DNSDB API supports two Lookup result formats: the ad hoc “text” format which is reminiscent of the DNS master file format, and the “json” format which returns one result per line encoded in JSON format. The two formats use the exact same URL scheme. A specific result format can be selected by specifying an Accept header in the HTTP request.

The text format is the default format if no Accept header is specified, or if the Accept header specifies the text/plain type. The JSON format is selected by requesting the application/json type.

The rrset text result format is reminiscent of the DNS master file format. Each result is an RRset separated by two newline characters and is annotated with the bailiwick and timestamp information described above, prefixed with leading ;; characters. At the end of the result document is a footer prefixed with leading ;;; characters. Currently the footer only notes how many results were found and how long it took to query the database. Note that multiple RRsets with the same owner name and RRtype can appear in the result document.

The rdata text result format is similar, except that full RRsets are not returned (only resource records), no metadata is provided, and individual results are separated by a single newline rather than two.

The rrset JSON result format is a document containing one JSON-encoded result object per line. Each result object is an associative array with the following keys.

rrset results
KeyDescription
rrnameThe owner name of the RRset in DNS presentation format.
rrtypeThe resource record type of the RRset, either using the standard DNS type mnemonic, or an RFC 3597 generic type, i.e. the string TYPE immediately followed by the decimal RRtype number.
rdataEither a single Rdata value or an array of one or more Rdata values. The Rdata values are converted to the standard presentation format based on the rrtype value. If the encoder lacks a type-specific presentation format for the RRset’s rrtype, then the RFC 3597 generic Rdata encoding will be used.
bailiwickThe “bailiwick” metadata value described in the section above.
countThe number of times the RRset was observed via passive DNS replication.
time_first, time_lastUNIX epoch timestamps with second granularity indicating the first and last times the RRset was observed via passive DNS replication. Will not be present if the RRset was only observed via zone file import.
zone_time_first, zone_time_lastUNIX epoch timestamps with second granularity indicating the first and last times the RRset was observed via zone file import. Will not be present if the RRset was only observed via passive DNS replication.
rdata results
KeyDescription
rrnameThe owner name of the resource record in DNS presentation format.
rrtypeThe resource record type of the resource record, either using the standard DNS type mnemonic, or an RFC 3597 generic type, i.e. the string TYPE immediately followed by the decimal RRtype number.
rdataThe record data value. The Rdata value is converted to the standard presentation format based on the rrtype value. If the encoder lacks a type-specific presentation format for the resource record’s type, then the RFC 3597 generic Rdata encoding will be used.
countThe number of times the resource record was observed via passive DNS replication.
time_first, time_lastUNIX epoch timestamps with second granularity indicating the first and last times the resource record was observed via passive DNS replication.
zone_time_first, zone_time_lastUNIX epoch timestamps with second granularity indicating the first and last times the resource record was observed via zone file import.

summarize queries

All DNSDB summarize requests are rooted in URL paths under the /summarize hierarchy. Everything underneath /summarize is the same as for /lookup queries. For example, URL paths /summarize/rrset and /summarize/rdata respectively:

/summarize/rrset/name/OWNER_NAME/RRTYPE/BAILIWICK
/summarize/rdata/TYPE/VALUE/RRTYPE

Summarize result formats

The DNSDB API only supports one Summarize result format, the “json” format.

The JSON format is officially selected by requesting the application/json type, though it is the default format if no Accept header is specified, or if the Accept header specifies a different type.

The result format is a document containing one JSON-encoded result object, an associative array with the following keys.

rrset and rdata results
KeyDescription
countThe number of times the RRset was observed via passive DNS replication.
num_resultsThe number of results (RRsets) that would be returned from a Lookup.
time_first, time_lastUNIX epoch timestamps with second granularity indicating the first and last times the RRset was observed via passive DNS replication. Only present if the RRsets were observed via passive DNS replication.
zone_time_first, zone_time_lastUNIX epoch timestamps with second granularity indicating the first and last times the RRset was observed via zone file import. Only present if the RRsets were observed via zone file import.

If there are no RRsets found by the underlying query, the DNSDB API will return the JSON object:

{"count":0, "num_results":0}

Optional query parameters

Lookup and summarize requests accept optional query parameters mostly in common, though each has an additional optional query parameter described below.

Time-fencing query parameters

The DNSDB records when a specific DNS record was first and last observed. You may filter results by time using the “time_first_before,” “time_first_after,” “time_last_before,” and “time_last_after” query parameters. These parameters expect a integer (Unix/Epoch time) with seconds granularity or a relative time in seconds (preceded by -).

Note that the DNSDB API server may have API key-dependent time-fencing restrictions that cannot be expanded with these parameters but can reduce the results (narrow the time ranges, or completely override them).

The following time-fencing optional parameters may be present in a query URL:

ParameterDescription
time_first_beforeprovide results before the defined timestamp for when the DNS record was first observed. For example, the URL parameter “time_first_before=1420070400” will only provide matching DNS records that were first observed before (or older than) January 1, 2015.
time_first_afterprovide results after the defined timestamp for when the DNS record was first observed. For example, the URL parameter “time_first_after=-31536000” will only provide results that were first observed within the last year.
time_last_beforeprovide results before the defined timestamp for when the DNS record was last observed. For example, the URL parameter “time_last_before=1356998400” will only provide results for DNS records that were last observed before 2013.
time_last_afterprovide results after the defined timestamp for when the DNS record was last observed. For example, the URL parameter “time_last_after=-2678400” will only provide results that were last observed after 31 days ago.

Combinations of the time parameters may be used to strictly provide or exclude results for specific time-ranges. For example, to only have results when the first observed date and the last observed date are both only in 2015, you can use “time_first_after=1420070399” combined with “time_last_before=1451606400”. As another time combination example, to get DNS records that were first observed before 2012 and last observed within the last month (recently-observed records which have not changed in a very long time), use “time_first_before=1325376000” and relative “time_last_after=-2678400”.

Combinations of the time parameters may be used to strictly provide or exclude results for specific time-ranges. For example, to only have results when the first observed date and the last observed date are both only in 2015, you can use “time_first_after=1420070399” combined with “time_last_before=1451606400”. As another time combination example, to get DNS records that were first observed before 2012 and last observed within the last month (recently-observed records which have not changed in a very long time), use “time_first_before=1325376000” and relative “time_last_after=-2678400”.

Other query parameters

The following other optional parameters may be present in a query URL:

ParameterDescription
limitLimit for the number of results returned via these lookup methods. There is a built-in limit to the number of results that are returned via these lookup methods. The default limit is set at 10,000. This limit can be raised or lowered by setting the “limit” query parameter. There is also a maximum number of results allowed; requesting a limit greater than the maximum will only return the maximum. See results_max below for information on that maximum. If “?limit=0” is used then DNSDB will return the maximum number of results allowed. Obviously, if there are less results for the query than the requested limit, only the actual amount can be returned.

Example: appending “?limit=20000” to the URL path will set the response limit to 20,000 results.
swclientName of the API client software generating the DNSDB query. Limited to twenty alphanumeric characters. This may be logged by the DNSDB API server. Farsight support can help you debug a new API client using this and the following parameter.

There is no default.

Example: “?swclient=dnsdbq”.
versionVersion number of the API client software generating the DNSDB query. Limited to twenty alphanumeric characters plus dash, underscore, and period. This may be logged by the DNSDB API server.

There is no default.

Example: “?version=1.1a”.
idClient software specific identity of the user of the API client. Comprised of an alphanumeric string, a colon, and an alphanumeric string, limited to thirty characters. This may be logged by the DNSDB API server.

There is no default.

Example: “?id=dnsq:91e6245ad31387”.
aggrAggregated results group identical rrsets across all time periods and is the classic behavior from querying the DNSDB. This means you could get the total number of times an rrset has been observed, but not when it was observed. Unaggregated results ungroup identical rrsets, allowing you to see how the domain name was resolved in the DNS across the full-time range covered in DNSDB (subject to time fencing). This can give a more accurate impression of record request volume across time because it will reveal the distinct timestamps of records whose values are repeated. You can answer questions like, “Was a domain parked for a long time, mostly unused, until it was repurposed for serving malware or relaying spam, but then was abandoned again?” It allows you to see if a record was observed heavily in the last week vs. having been observed constantly for years.

This is a boolean value. Use True, the default, for the aggregated results or False for unaggregated results. The value is case insensitive and can be abbreviated.

Example: “?aggr=f”.
humantimeA boolean value that is True if time values (in time_first, time_last, zone_time_first, zone_time_last) should be returned in human readable (RFC3339 compliant) format or False if Unix-style time values in seconds since the epoch should be returned. False is the classic behavior from querying the DNSDB and is the default value for this option.

The value is case insensitive and can be abbreviated.

Example: “?humantime=t”.

Additional query parameter for lookup

The following optional parameter may be present in a lookup form of query URL:

ParameterDescription
offsetHow many rows to offset (e.g. skip) in the results. This implements an incremental result transfer feature, allowing you to view more of the available results for a single query. The rows are offset prior to the limit parameter being applied, therefore offset allows seeing additional results past a limit that matches the maximum number of results. Note that DNSDB recalculates the results for each query and the order of results might not be preserved. Therefore, this capability is not a valid way to walk all results over multiple queries — some results might be missing and some might be duplicated. The actual offset that can be used is limited or for certain API keys, offset is not allowed — see the offset_max rate_limit key below.

The offset value must be a positive integer.

The default is 0, which means do not offset the rows.

Example to return the second million results (assuming results_max is 100000): “?limit=100000&offset=1000000”.

Additional query parameter for summarize

The following optional parameter may be present in a summarize form of query URL:

ParameterDescription
max_countmax_count controls stopping when we reach that summary count. The resulting total count can exceed max_count as it will include the entire count from the last rrset examined.

The default is to not constrain the count.

Example: appending “?max_count=100” to the URL path will stop the summary when its total count reaches 100.

Service limits

The number of concurrent connections to a DNSDB API server may be limited. This limit is separate from the quota limit described below. If this limit is exceeded, the HTTP 503 “Service Unavailable” response code will be generated.

API keys have a primary quota, which limits the number of requests that can be made to the data-fetching endpoints (which are /lookup/rrset, /lookup/rdata, /summarize/rrset, and /summarize/rdata ). There are three types of quotas: time-based, block-based, and unlimited. The DNSDB API server tracks the usage of the quotas. If the quota’s limit is exceeded (if applicable), the HTTP 429 “Too Many Requests” response code will be generated with message ‘Error: Rate limit exceeded’. If a block quota is expired, then a 401 “Unauthorized” response code will be generated with message ‘Error: Quota is expired’.

There may also be a secondary, burst rate, quota associated with an API key. The burst rate limits how many requests may be made in a short time window. For example, 5 requests in 360 seconds. The parameters for burst rate are burst size and burst window.

You may query the /lookup/rate_limit endpoint to obtain a JSON map containing a top-level map that contains quota information as described below. Querying the /lookup/rate_limit endpoint does not count against the quota limit.

Time-based quotas

Time-based quotas are usually applied on a daily basis and resets daily at 00:00 (midnight) in the UTC time zone. Time-based quotas can also be applied for arbitrary time-quantum, but this is unusual.

Block-based quotas

For block quotas, there are a number of queries that are bought, with all, or a subset, of that number “split” off for a particular API key; e.g. a split is an allocation from the amount of queries purchased. Block quotas have a specific number of queries split with an expiration time (the expiration time is usually much longer than a day). For each API key, the DNSDB API server tracks the number of queries split, number used, and the expiration time. The number of queries bought is not visible to the DNSDB API server.

/lookup/rate_limit response

The /lookup/rate_limit endpoint returns a JSON map named rate containing some or all of the following:

KeyDescription
limitThe maximum number of API lookups that may be performed. This is the initial quota.
remainingFor time-based quotas: the remaining number of API lookups that may be performed until the reset time.
For block-based quotas: the remaining number of API lookups in the block quota.
resetFor time-based quotas: UNIX epoch timestamp with second granularity indicating the next point in time when the quota limit will be reset. Usually this is at 00:00 (midnight) UTC.

For block-based quotas: the value will be “n/a”.
expiresOnly present for block-based quota: UNIX epoch timestamp with second granularity indicating when the quota will expire.
results_maxReturns the maximum number of results that can be returned by these lookup methods. This overrides a “limit” query parameter if provided. For example, if “?limit=20000” is appended to the URL path but results_max=1000 then only up to 1000 results will be returned.
offset_maxThe maximum value that the offset query parameter can be. If it is higher then an HTTP 416 “Requested Range Not Satisfiable” response code will be returned with message “Error: offset value greater than maximum allowed.” If the value is “n/a” then the offset parameter is not allowed for this API key, and similar 416 error will be generated.
burst_sizeThe maximum number of API lookups that may be performed within this burst_window number of seconds.
burst_windowThe number of seconds over which a burst of queries is measured.

If burst_size and burst_window are not returned then there is no burst rate quota applicable.

For a time-based quota, the following is an example of a /lookup/rate_limit response performed on June 10, 2015 that indicates that the API key’s quota limit will be reset at midnight UTC on June 11, 2015, and that 999 lookups are remaining out of a total quota of 1000 lookups:

{
 "rate": {
 "reset": 1433980800,
 "limit": 1000,
 "remaining": 999
 }
}

For a block-based quota, the following is an example of a /lookup/rate_limit response which indicates that the API key’s quota limit will expire at Mon Apr 15 19:28:34 2019, 592 lookups were used out of a total quota of 600 lookups, the burst size is 10 queries in 5 minutes, the maximum number of results that can be requested from a single query are 256, and offset will fail if higher than 3000000.

{
 "rate": {
 "reset": "n/a",
 "burst_size": 10,
 "expires": 1555370914,
 "burst_window": 300,
 "offset_max": 3000000,
 "results_max": 256,
 "limit": 600,
 "remaining": 8
 }
}

An unlimited quota API key has the corresponding /lookup/rate_limit response:

{
 "rate": {
 "reset": "n/a",
 "limit": "unlimited",
 "remaining": "n/a"
 }
}

X-RateLimit- Headers

Responses from the data-fetching endpoints contain information in the HTTP response headers that are a subset of that obtained from the /lookup/rate_limit endpoint. These values are embedded as the X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, and for block-based quotas, X-RateLimit-Expires headers.

For a time-based quota, responses to lookups will contain response headers like:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1433980800

For a block-based quota, responses to lookups will contain response headers like:

X-RateLimit-Limit: 600
X-RateLimit-Remaining: 8
X-RateLimit-Reset: n/a
X-RateLimit-Expires: 1555370914

For an unlimited API key, responses to lookups will contain response headers like:

X-RateLimit-Limit: unlimited
X-RateLimit-Remaining: n/a
X-RateLimit-Reset: n/a

Response codes

A table of HTTP response codes that can be received:

Response codeDescription
200 OKIf a successful request is returned.
400 Bad RequestIf the URL is formatted incorrectly.
401 UnauthorizedThe API key is not authorized (usually indicates the block quota is expired).
403 ForbiddenIf the X-API-Key header is not present, the provided API key is not valid, or the Client IP address not authorized for this API key.
404 Not FoundIf there are no records found for the given lookup.
416 Requested Range Not SatisfiableIf the offset value is greater than the maximum allowed or if an offset value was provided when not permitted.
429 Too Many RequestsIf you have exceeded your quota and no new requests will be accepted at this time.

For time-based quotas: The API key’s daily quota limit is exceeded. The quota will automatically replenish, usually at the start of the next day.

For block-based quotas: The block quota is exhausted. You may need to purchase a larger quota.

For burst rate secondary quotas: There were too many queries within the burst window. The window will automatically reopen at its end.
500 Internal Server ErrorIf there is an error processing the request.
503 Service UnavailableIf the limit of number of concurrent connections is exceeded.

Example scripts

A full-featured example API client written in C is available from https://github.com/dnsdb/dnsdbq. Example API clients written in Python and shell are available from https://github.com/dnsdb/dnsdb-query.

Example results

Examples are provided in both the ad hoc text result format as well as the JSON result format. For each example, a description of the lookup is provided, then the URL used to retrieve the results and sample curl commands with the current results (at the time of the writing of this document) in both text and JSON formats. For brevity, the results are limited to a total of two records in the examples below. Note the ad hoc format directly from the DNSDB API is deprecated. As an alternative, we provide source code to convert the JSON format into the ad hoc text format is inside the dnsdbq example client referenced above in “Example Scripts”.

The examples assume the shell variable $DNSDB_API_KEY is set to your API key:

DNSDB_API_KEY=d41d8cd98f00b204e9800998ecf8427e...

1. Lookup all RRsets whose owner name is www.farsightsecurity.com, limited to 2 results

URL

/lookup/rrset/name/www.farsightsecurity.com?limit=2

Sample query with a text result

curl -i -H 'Accept: text/plain' -H "X-API-Key: $DNSDB_API_KEY" \
 "https://api.dnsdb.info/lookup/rrset/name/www.farsightsecurity.com?limit=2"
;; bailiwick: farsightsecurity.com.
;; count: 5059
;; first seen: 2013-09-25 20:02:10 -0000
;; last seen: 2015-04-01 09:51:39 -0000
www.farsightsecurity.com. IN A 66.160.140.81

;; bailiwick: farsightsecurity.com.
;; count: 17381
;; first seen: 2015-04-01 13:07:24 -0000
;; last seen: 2016-07-12 13:14:32 -0000
www.farsightsecurity.com. IN A 104.244.13.104

;;; Returned 2 RRsets in 0.03 seconds.
;;; DNSDB

Sample query with a json result

curl -H 'Accept: application/json' -H "X-API-Key: $DNSDB_API_KEY" \
 "https://api.dnsdb.info/lookup/rrset/name/www.farsightsecurity.com?limit=2"
{"count":5059,"time_first":1380139330,"time_last":1427881899,
 "rrname":"www.farsightsecurity.com.","rrtype":"A","bailiwick":"farsightsecurity.com.",
 "rdata":["66.160.140.81"]}
{"count":17381,"time_first":1427893644,"time_last":1468329272,
 "rrname":"www.farsightsecurity.com.","rrtype":"A","bailiwick":"farsightsecurity.com.",
 "rdata":["104.244.13.104"]}

1a. Summarize all RRsets whose owner name is www.farsightsecurity.com, with limit and max_count

In this call, the summarize processing will limit itself to looking at two underlying results rows and it will stop at the row when the count value reaches max_count. Effectively, since the first row in Example 1 above is over that max_count, the summarize will only account for the first row in Example 1. Notice how the count and time_first and time_last are identical to that first row.

URL

/summarize/rrset/name/www.farsightsecurity.com?limit=2&max_count=5000

Sample query with a json result

curl -H 'Accept: application/json' -H "X-API-Key: $DNSDB_API_KEY" \
 "https://api.dnsdb.info/summarize/rrset/name/www.farsightsecurity.com\
 ?limit=2&max_count=5000"
{"count":1127,"num_results":2,"time_first":1557859313,"time_last":1560537333}

1b. Summarize all RRsets whose owner name is www.farsightsecurity.com, with only limit

In this call, the summarize processing will limit itself to looking at two underlying results rows. Notice how the count is the sum of the counts from the two rows in Example 1. And notice how the time_first is from the first row and the time_last is from the second row.

URL

/summarize/rrset/name/www.farsightsecurity.com?limit=2

Sample query with a json result

curl -H 'Accept: application/json' -H "X-API-Key: $DNSDB_API_KEY" \
 "https://api.dnsdb.info/summarize/rrset/name/www.farsightsecurity.com?limit=2"
{"count":1127,"num_results":2,"time_first":1557859313,"time_last":1560537333}

2. Lookup all RRsets whose owner name ends in farsightsecurity.com, of type NS, in the farsightsecurity.com zone

URL

/lookup/rrset/name/*.farsightsecurity.com/ns/farsightsecurity.com

Sample query with a text result

curl -i -H 'Accept: text/plain' -H "X-API-Key: $DNSDB_API_KEY" \
 "https://api.dnsdb.info/lookup/rrset/name/*.farsightsecurity.com/ns/farsightsecurity.com"
;; bailiwick: farsightsecurity.com.
;; count: 51
;; first seen: 2013-07-01 14:14:43 -0000
;; last seen: 2013-07-17 01:17:44 -0000
farsightsecurity.com. IN NS ns.lah1.vix.com.
farsightsecurity.com. IN NS ns1.isc-sns.net.
farsightsecurity.com. IN NS ns2.isc-sns.com.
farsightsecurity.com. IN NS ns3.isc-sns.info.

;; bailiwick: farsightsecurity.com.
;; count: 495241
;; first seen: 2013-07-17 21:26:20 -0000
;; last seen: 2016-07-12 12:01:16 -0000
farsightsecurity.com. IN NS ns5.dnsmadeeasy.com.
farsightsecurity.com. IN NS ns6.dnsmadeeasy.com.
farsightsecurity.com. IN NS ns7.dnsmadeeasy.com.

;;; Returned 2 RRsets in 0.04 seconds.
;;; DNSDB

Sample query with a json result

curl -H 'Accept: application/json' -H "X-API-Key: $DNSDB_API_KEY" \
 "https://api.dnsdb.info/lookup/rrset/name/*.farsightsecurity.com/ns/farsightsecurity.com"
{"count":51,"time_first":1372688083,"time_last":1374023864,
 "rrname":"farsightsecurity.com.","rrtype":"NS","bailiwick":"farsightsecurity.com.",
 "rdata":["ns.lah1.vix.com.","ns1.isc-sns.net.","ns2.isc-sns.com.","ns3.isc-sns.info."]}
{"count":495241,"time_first":1374096380,"time_last":1468324876,
 "rrname":"farsightsecurity.com.","rrtype":"NS","bailiwick":"farsightsecurity.com.",
 "rdata":["ns5.dnsmadeeasy.com.","ns6.dnsmadeeasy.com.","ns7.dnsmadeeasy.com."]}

3. Lookup all resource records whose Rdata values are the IPv4 address 104.244.13.104

URL

/lookup/rdata/ip/104.244.13.104

Sample query with a text result

curl -i -H 'Accept: text/plain' -H "X-API-Key: $DNSDB_API_KEY" \
 "https://api.dnsdb.info/lookup/rdata/ip/104.244.13.104"
www.farsighsecurity.com. IN A 104.244.13.104
farsightsecurity.com. IN A 104.244.13.104
;;; Returned 2 RRs in 0.02 seconds.
;;; DNSDB

Sample query with a json result

curl -H 'Accept: application/json' -H "X-API-Key: $DNSDB_API_KEY" \
 "https://api.dnsdb.info/lookup/rdata/ip/104.244.13.104"
{"count":24,"time_first":1433550785,"time_last":1468312116,
 "rrname":"www.farsighsecurity.com.","rrtype":"A","rdata":"104.244.13.104"}
{"count":9429,"time_first":1427897872,"time_last":1468333042,
 "rrname":"farsightsecurity.com.","rrtype":"A","rdata":"104.244.13.104"}

4. Lookup all resource records whose Rdata values are addresses in the 104.244.13.104/29 network prefix

URL

/lookup/rdata/ip/104.244.13.104,29

Sample query with a text result

curl -i -H 'Accept: text/plain' -H "X-API-Key: $DNSDB_API_KEY" \
 "https://api.dnsdb.info/lookup/rdata/ip/104.244.13.104,29"
farsightsecurity.com. IN A 104.244.13.104
www.farsightsecurity.com. IN A 104.244.13.104
;;; Returned 2 RRs in 0.02 seconds.
;;; DNSDB

Sample query with a json result

curl -H 'Accept: application/json' -H "X-API-Key: $DNSDB_API_KEY" \
 "https://api.dnsdb.info/lookup/rdata/ip/104.244.13.104,29"
{"count":24,"time_first":1433550785,"time_last":1468312116,
 "rrname":"www.farsighsecurity.com.","rrtype":"A","rdata":"104.244.13.104"}
{"count":9429,"time_first":1427897872,"time_last":1468333042,
 "rrname":"farsightsecurity.com.","rrtype":"A","rdata":"104.244.13.104"}

4a. Summarize all resource records whose Rdata values are addresses in the 104.244.13.104/29 network prefix

URL

/summarize/rdata/ip/104.244.13.104,29

Sample query with a json result

curl -H 'Accept: application/json' -H "X-API-Key: $DNSDB_API_KEY" "\
 https://api.dnsdb.info/summarize/rdata/ip/104.244.13.104,29"
{"count":528,"num_results":4,"time_first":1557864746,"time_last":1560524861}

5. Lookup all resource records whose Rdata values are the IPv6 address 2620:11c:f004::104

URL

/lookup/rdata/ip/2620:11c:f004::104

Sample query with a text result

curl -i -H 'Accept: text/plain' -H "X-API-Key: $DNSDB_API_KEY" \
 "https://api.dnsdb.info/lookup/rdata/ip/2620:11c:f004::104"
farsightsecurity.com. IN AAAA 2620:11c:f004::104
www.farsightsecurity.com. IN AAAA 2620:11c:f004::104
;;; Returned 2 RRs in 0.02 seconds.
;;; DNSDB

Sample query with a json result

curl -H 'Accept: application/json' -H "X-API-Key: $DNSDB_API_KEY" \
 "https://api.dnsdb.info/lookup/rdata/ip/2620:11c:f004::104"
{"count":14,"time_first":1433845806,"time_last":1467828872,
 "rrname":"www.farsighsecurity.com.","rrtype":"AAAA","rdata":"2620:11c:f004::104"}
{"count":5307,"time_first":1427897876,"time_last":1468333042,
 "rrname":"farsightsecurity.com.","rrtype":"AAAA","rdata":"2620:11c:f004::104"}

6. Lookup all resource records whose Rdata values are addresses in the 2620:11c:f000::/36 network prefix

URL

/lookup/rdata/ip/2620:11c:f000::,36

Sample query with a text result

curl -i -H 'Accept: text/plain' -H "X-API-Key: $DNSDB_API_KEY" \
 "https://api.dnsdb.info/lookup/rdata/ip/2620:11c:f000::,36"
farsightsecurity.com. IN AAAA 2620:11c:f004::104
www.farsightsecurity.com. IN AAAA 2620:11c:f004::104
;;; Returned 2 RRs in 0.02 seconds.
;;; DNSDB

Sample query with a json result

curl -H 'Accept: application/json' -H "X-API-Key: $DNSDB_API_KEY" \
 "https://api.dnsdb.info/lookup/rdata/ip/2620:11c:f000::,36"
{"count":5307,"time_first":1427897876,"time_last":1468333042,
 "rrname":"farsightsecurity.com.","rrtype":"AAAA","rdata":"2620:11c:f004::104"}
{"count":8046,"time_first":1428586271,"time_last":1468305509,
 "rrname":"www.farsightsecurity.com.","rrtype":"AAAA","rdata":"2620:11c:f004::104"}

7. Lookup all domain names delegated to the nameserver ns5.dnsmadeeasy.com

URL

/lookup/rdata/name/ns5.dnsmadeeasy.com

Sample query with a text result

curl -i -H 'Accept: text/plain' -H "X-API-Key: $DNSDB_API_KEY" \
 "https://api.dnsdb.info/lookup/rdata/name/ns5.dnsmadeeasy.com"
farsightsecurity.com. IN NS ns5.dnsmadeeasy.com.
farsightsecurity.com. IN NS ns5.dnsmadeeasy.com.
;;; Returned 2 RRs in 0.02 seconds.
;;; DNSDB

Sample query with a json result

curl -H 'Accept: application/json' -H "X-API-Key: $DNSDB_API_KEY" \
 "https://api.dnsdb.info/lookup/rdata/name/ns5.dnsmadeeasy.com"
{"count":1078,"zone_time_first":1374250920,"zone_time_last":1468253883,
 "rrname":"farsightsecurity.com.","rrtype":"NS","rdata":"ns5.dnsmadeeasy.com."}
{"count":706617,"time_first":1374096380,"time_last":1468334926,
 "rrname":"farsightsecurity.com.","rrtype":"NS","rdata":"ns5.dnsmadeeasy.com."}

8. Lookup all domain names whose mail exchanges are the server hq.fsi.io

URL

/lookup/rdata/name/hq.fsi.io

Sample query with a text result

curl -i -H 'Accept: text/plain' -H "X-API-Key: $DNSDB_API_KEY" \
 "https://api.dnsdb.info/lookup/rdata/name/hq.fsi.io"
fsi.io. IN MX 10 hq.fsi.io.
farsightsecurity.com. IN MX 10 hq.fsi.io.
;;; Returned 2 RRs in 0.02 seconds.
;;; DNSDB

Sample query with a json result

curl -H 'Accept: application/json' -H "X-API-Key: $DNSDB_API_KEY" \
 "https://api.dnsdb.info/lookup/rdata/name/hq.fsi.io"
{"count":45644,"time_first":1372706073,"time_last":1468330740,
 "rrname":"fsi.io.","rrtype":"MX","rdata":"10 hq.fsi.io."}
{"count":19304,"time_first":1374098929,"time_last":1468333042,
 "rrname":"farsightsecurity.com.","rrtype":"MX","rdata":"10 hq.fsi.io."}

9. Lookup wildcard search for RRsets whose owner name is farsightsecurity.com, rrtype is NS, bailiwick is farsightsecurity.com, last observed after July 11, 2016 with a limit of 100 results

URL

/lookup/rrset/name/*.farsightsecurity.com/ns/farsightsecurity.com\
 ?limit=100&time\_last\_after=1468281600

Sample query with a text result

curl -i -H 'Accept: text/plain' -H "X-API-Key: $DNSDB_API_KEY" \
 "https://api.dnsdb.info/lookup/rrset/name/*.farsightsecurity.com/ns/farsightsecurity.com\
 ?limit=100&time\_last\_after=1468281600"
;; bailiwick: farsightsecurity.com.
;; count: 989291
;; first seen: 2013-07-17 21:26:20 -0000
;; last seen: 2017-07-13 16:45:30 -0000
farsightsecurity.com. IN NS ns5.dnsmadeeasy.com.
farsightsecurity.com. IN NS ns6.dnsmadeeasy.com.
farsightsecurity.com. IN NS ns7.dnsmadeeasy.com.

;;; Returned 1 RRsets in 0.37 seconds.
;;; DNSDB

Sample query with a json result

curl -H 'Accept: application/json' -H "X-API-Key: $DNSDB_API_KEY" \
 "https://api.dnsdb.info/lookup/rrset/name/*.farsightsecurity.com/ns/farsightsecurity.com\
 ?limit=100&time_last_after=1468281600"
{"count":989291,"time_first":1374096380,"time_last":1499964330,
 "rrname":"farsightsecurity.com.","rrtype":"NS","bailiwick":"farsightsecurity.com.",
 "rdata":["ns5.dnsmadeeasy.com.","ns6.dnsmadeeasy.com.","ns7.dnsmadeeasy.com."]}

10. Lookup any DNSSEC records under farsightsecurity.com

URL

lookup/rrset/name/\*.farsightsecurity.com/ANY-DNSSEC?limit=2'

Sample query with a json result

curl -k -H 'Host: api.dnsdb.info' -H 'Accept: application/json' -H "X-API-Key: $DNSDB_API_KEY" \
 'https://api.dnsdb.info/lookup/rrset/name/\*.farsightsecurity.com/ANY-DNSSEC?limit=2'
{"count":1696,"zone_time_first":1374250920,"zone_time_last":1521734545,
 "rrname":"farsightsecurity.com.","rrtype":"DS","bailiwick":"com.",
 "rdata":["60454 5 2 3672C35CFA8FF14C9C223B84277BD645C0AF54BAD5790375FE797161E4801479"]}
{"count":3,"zone_time_first":1374250920,"zone_time_last":1374423636,
 "rrname":"farsightsecurity.com.","rrtype":"RRSIG","bailiwick":"com.",
 "rdata":["DS 8 2 86400 1374774350 1374165350 8795 com. cuOdo+2G0yJpBN5ba2zxiljSzgtT\
 zminrVc3CrsNxQPqc5YVQX4eBWMB +kpgSEXPT+DF2D9HwIsPpBDNdJekBpXIRW41Yl7IdZYHySqabn7hgt\
 9M mk5KNy9gqCOK/JLRs07LPAm3wvfyYer8e0/7VCTEjF9/DMbMGsLLH3xr kBA="]}

Sample query with a json result post-formatted with jq

curl -k -H 'Host: api.dnsdb.info' -H 'Accept: application/json' -H "X-API-Key: $DNSDB_API_KEY" \
 'https://api.dnsdb.info/lookup/rrset/name/\*.farsightsecurity.com/ANY-DNSSEC?limit=2' \
 | jq .
{
 "count": 1696,
 "zone_time_first": 1374250920,
 "zone_time_last": 1521734545,
 "rrname": "farsightsecurity.com.",
 "rrtype": "DS",
 "bailiwick": "com.",
 "rdata": [
 "60454 5 2 3672C35CFA8FF14C9C223B84277BD645C0AF54BAD5790375FE797161E4801479"
 ]
}
{
 "count": 3,
 "zone_time_first": 1374250920,
 "zone_time_last": 1374423636,
 "rrname": "farsightsecurity.com.",
 "rrtype": "RRSIG",
 "bailiwick": "com.",
 "rdata": [
 "DS 8 2 86400 1374774350 1374165350 8795 com. cuOdo+2G0yJpBN5ba2zxiljSzgtTzminrVc3C\
 rsNxQPqc5YVQX4eBWMB +kpgSEXPT+DF2D9HwIsPpBDNdJekBpXIRW41Yl7IdZYHySqabn7hgt9M mk5KNy9\
 gqCOK/JLRs07LPAm3wvfyYer8e0/7VCTEjF9/DMbMGsLLH3xr kBA="
 ]
}

11. rrset/raw query for any records under fsi.io

URL

lookup/rrset/raw/0366736902696f00

Sample query with a json result

curl -k -H 'Host: api.dnsdb.info' -H 'Accept: application/json' -H "X-API-Key: $DNSDB_API_KEY" \
 'https://api.dnsdb.info/lookup/rrset/raw/0366736902696f00?limit=2'
{"count":10392,"time_first":1381265499,"time_last":1428418529,"rrname":"fsi.io.",
 "rrtype":"A","bailiwick":"fsi.io.","rdata":["66.160.140.76"]}
{"count":69435,"time_first":1428433465,"time_last":1538014110,"rrname":"fsi.io.",
 "rrtype":"A","bailiwick":"fsi.io.","rdata":["104.244.13.104"]}

12. rdata/raw query for any records under fsi.io

URL

lookup/rdata/raw/0366736902696f00

Sample query with a json result

curl -k -H 'Host: api.dnsdb.info' -H 'Accept: application/json' -H "X-API-Key: $DNSDB_API_KEY" \
 'https://api.dnsdb.info/lookup/rdata/raw/0366736902696f00?limit=2'
{"count":6,"time_first":1413228451,"time_last":1413228451,
 "rrname":"local-data.fsi.io.","rrtype":"SOA",
 "rdata":"fsi.io. hostmaster.fsi.io. 2014050101 7200 3600 604800 3600"}
{"count":25,"time_first":1412912798,"time_last":1412942807,
 "rrname":"dnstap.info.","rrtype":"SOA",
 "rdata":"fsi.io. hostmaster.fsi.io. 2014052824 7200 3600 25920000 3600"}

13. lookup rate_limit

This call shows the rate_limit response for a time-based quota.

Sample query with a json result

curl -H 'Accept: application/json' -H "X-API-Key: $DNSDB_API_KEY" \
 "https://api.dnsdb.info/lookup/rate_limit"
{
 "rate": {
 "reset": 1539129600,
 "limit": 1000,
 "remaining": 990
 }
}

DNSDB Export

API version 1 as implemented by the DNSDB Export product is simpler than that implemented by regular DNSDB. The differences to note are:

  • summarize requests are not implemented. Using it will result in an error.
  • /lookup/rate_limit is not implemented as there are no quotas. Using it will result in an error.
  • The following query parameters are not implemented and will be ignored: swclient, version, id, aggr, humantime, and offset.