About the DNS Tools API

API Version: 1.9

The DNS Tools API allows you to look up DNS records for a given hostname.

The DNS Lookup tool currently supports these record types:

  • A (Host records)
  • CNAME (Canonical Name records)
  • MX (Mail Exchanger records)
  • NS (Name Server records)
  • SOA (Start of Authority records)
  • TXT (Text records)

This is the API for the DNS Tools.

Endpoints

GET
https://networkcalc.com/api/dns/lookup/{hostname}

Lookup DNS

. Look up DNS records for a hostname, domain name, or IP address on the public Internet.

Parameters

{hostname}

The hostname, domain name, or IP address to look up, save, etc.

Example: https://networkcalc.com/api/dns/lookup/example.com

Response Codes

200
OK - Success.
400
NO_HOST_SPECIFIED - The {hostname} parameter was not specified.
400
INVALID_HOST - The {hostname} parmaeter is not valid.
400
NO_RECORDS - The hostname is valid, but the query returned no results.
400
INVALID_STRING - The request format is incorrect. It should be a string.
400
FAILED_TO_VALIDATE - An error occurred while validating. Verify the request and try again.
400
NO_SPF_RECORD - An SPF record was not supplied in the body or there was no published SPF record found for {hostname}.
POST
https://networkcalc.com/api/dns/lookup/save/{hostname}

Save DNS Query

. Save a DNS lookup query to your account.
This endpoint requires authorization. Read about API authorization or see NetworkCalc Pro pricing.

Parameters

{hostname}

The hostname, domain name, or IP address to look up, save, etc.

Example: https://networkcalc.com/api/dns/lookup/save/example.com

Response Codes

200
OK - Success.
400
NO_HOST_SPECIFIED - The {hostname} parameter was not specified.
400
INVALID_HOST - The {hostname} parmaeter is not valid.
400
NO_RECORDS - The hostname is valid, but the query returned no results.
400
INVALID_STRING - The request format is incorrect. It should be a string.
400
FAILED_TO_VALIDATE - An error occurred while validating. Verify the request and try again.
400
NO_SPF_RECORD - An SPF record was not supplied in the body or there was no published SPF record found for {hostname}.
GET
https://networkcalc.com/api/dns/whois/{hostname}

Lookup WHOIS

. Get the WHOIS registration information for a website's hostname, domain, or IP address.

Parameters

{hostname}

The hostname, domain name, or IP address to look up, save, etc.

Example: https://networkcalc.com/api/dns/whois/example.com

Response Codes

200
OK - Success.
400
NO_HOST_SPECIFIED - The {hostname} parameter was not specified.
400
INVALID_HOST - The {hostname} parmaeter is not valid.
400
NO_RECORDS - The hostname is valid, but the query returned no results.
400
INVALID_STRING - The request format is incorrect. It should be a string.
400
FAILED_TO_VALIDATE - An error occurred while validating. Verify the request and try again.
400
NO_SPF_RECORD - An SPF record was not supplied in the body or there was no published SPF record found for {hostname}.
POST
https://networkcalc.com/api/dns/whois/save/{hostname}

Save WHOIS Query

. Save a WHOIS lookup query to your account.
This endpoint requires authorization. Read about API authorization or see NetworkCalc Pro pricing.

Parameters

{hostname}

The hostname, domain name, or IP address to look up, save, etc.

Example: https://networkcalc.com/api/dns/whois/save/example.com

Response Codes

200
OK - Success.
400
NO_HOST_SPECIFIED - The {hostname} parameter was not specified.
400
INVALID_HOST - The {hostname} parmaeter is not valid.
400
NO_RECORDS - The hostname is valid, but the query returned no results.
400
INVALID_STRING - The request format is incorrect. It should be a string.
400
FAILED_TO_VALIDATE - An error occurred while validating. Verify the request and try again.
400
NO_SPF_RECORD - An SPF record was not supplied in the body or there was no published SPF record found for {hostname}.
POST
https://networkcalc.com/api/dns/spf/{hostname}

Lookup SPF

. Look up the published SPF record for a domain or validate the syntax of a to-be-published SPF record.

Parameters

{hostname}

The hostname, domain name, or IP address to look up, save, etc.

Example: https://networkcalc.com/api/dns/spf/example.com

Request Body

{
  "spf": "[string] An SPF record to validate. If specified, {hostname} is ignored."
}

Response Codes

200
OK - Success.
400
NO_HOST_SPECIFIED - The {hostname} parameter was not specified.
400
INVALID_HOST - The {hostname} parmaeter is not valid.
400
NO_RECORDS - The hostname is valid, but the query returned no results.
400
INVALID_STRING - The request format is incorrect. It should be a string.
400
FAILED_TO_VALIDATE - An error occurred while validating. Verify the request and try again.
400
NO_SPF_RECORD - An SPF record was not supplied in the body or there was no published SPF record found for {hostname}.
POST
https://networkcalc.com/api/dns/spf/save/{hostname}

Save SPF Query

. Save an SPF lookup query to your account.
This endpoint requires authorization. Read about API authorization or see NetworkCalc Pro pricing.

Parameters

{hostname}

The hostname, domain name, or IP address to look up, save, etc.

Example: https://networkcalc.com/api/dns/spf/save/example.com

Request Body

{
  "text": "[string] An SPF record in its textual representation. If included, `{hostname}` is ignored."
}

Response Codes

200
OK - Success.
400
NO_HOST_SPECIFIED - The {hostname} parameter was not specified.
400
INVALID_HOST - The {hostname} parmaeter is not valid.
400
NO_RECORDS - The hostname is valid, but the query returned no results.
400
INVALID_STRING - The request format is incorrect. It should be a string.
400
FAILED_TO_VALIDATE - An error occurred while validating. Verify the request and try again.
400
NO_SPF_RECORD - An SPF record was not supplied in the body or there was no published SPF record found for {hostname}.
GET
https://networkcalc.com/api/dns/saved/{id}

Get Saved Queries

. Get queries that were saved to your account.
This endpoint requires authorization. Read about API authorization or see NetworkCalc Pro pricing.

Parameters

{id}

(Optional) The unique identifier for the saved query.

Example: https://networkcalc.com/api/dns/saved/123

Response Codes

200
OK - Success.
400
NO_HOST_SPECIFIED - The {hostname} parameter was not specified.
400
INVALID_HOST - The {hostname} parmaeter is not valid.
400
NO_RECORDS - The hostname is valid, but the query returned no results.
400
INVALID_STRING - The request format is incorrect. It should be a string.
400
FAILED_TO_VALIDATE - An error occurred while validating. Verify the request and try again.
400
NO_SPF_RECORD - An SPF record was not supplied in the body or there was no published SPF record found for {hostname}.
PATCH
https://networkcalc.com/api/dns/dns/saved/{id}

Edit Saved Query

. Edit a query that was saved to your account.
This endpoint requires authorization. Read about API authorization or see NetworkCalc Pro pricing.

Parameters

{id}

(Optional) The unique identifier for the saved query.

Example: https://networkcalc.com/api/dns/dns/saved/123

Request Body

{
  "hostname": "[undefined] The hostname used in the query.",
  "type ": "[string] The type of query, e.g., 'dns', 'whois', 'spf'.",
  "text": "[string] An SPF record in its textual representation. If included, `{hostname}` is ignored."
}

Response Codes

200
OK - Success.
400
NO_HOST_SPECIFIED - The {hostname} parameter was not specified.
400
INVALID_HOST - The {hostname} parmaeter is not valid.
400
NO_RECORDS - The hostname is valid, but the query returned no results.
400
INVALID_STRING - The request format is incorrect. It should be a string.
400
FAILED_TO_VALIDATE - An error occurred while validating. Verify the request and try again.
400
NO_SPF_RECORD - An SPF record was not supplied in the body or there was no published SPF record found for {hostname}.
DELETE
https://networkcalc.com/api/dns/dns/saved/{id}

Deleted Saved Query

. Delete a query that was saved to your account.
This endpoint requires authorization. Read about API authorization or see NetworkCalc Pro pricing.

Parameters

{id}

(Optional) The unique identifier for the saved query.

Example: https://networkcalc.com/api/dns/dns/saved/123

Response Codes

200
OK - Success.
400
NO_HOST_SPECIFIED - The {hostname} parameter was not specified.
400
INVALID_HOST - The {hostname} parmaeter is not valid.
400
NO_RECORDS - The hostname is valid, but the query returned no results.
400
INVALID_STRING - The request format is incorrect. It should be a string.
400
FAILED_TO_VALIDATE - An error occurred while validating. Verify the request and try again.
400
NO_SPF_RECORD - An SPF record was not supplied in the body or there was no published SPF record found for {hostname}.

Response Formats

DNSResponse

{
  "status": "[string] The status of the request.",
  "hostname": "[string] The requested hostname.",
  "records": {
    "A": "[array] A (Host) records. Returned as an array of objects: { address, ttl }.",
    "CNAME": "[array] CNAME (Canonical Name) records. Returned as an array of objects: { address }.",
    "MX": "[array] MX (Mail Exchanger) records. Returned as an array of objects: { exchange, priority }.",
    "NS": "[array] NS (Name Server) records. Returned as an array of objects: { nameserver }.",
    "SOA": "[array] SOA (Start of Authority) records. Returned as an array of objects: { nameserver, hostmaster }.",
    "TXT": "[array] TXT (Text) records. Returned as an array of strings."
  }
}

DNSQueryResponse

{
  "status": "[string|array] The status of the request. May contain an array of errors as status.errors.",
  "hostname": "[string] The requested hostname.",
  "query": {
    "type ": "[string] The type of DNS query, e.g., 'dns', 'whois', 'spf'.",
    "hostname": "[string] The saved hostname.",
    "created_at": "[datetime] The date and time the query was saved.",
    "updated_at": "[datetime] The date and time the query was last updated."
  }
}

SPFResponse

{
  "status": "[string] The status of the request.",
  "hostname": "[string] The hostname of the SPF record to look up. Ignored if an SPF string was included in the body.",
  "spf": "[string] The SPF record string.",
  "validation": {
    "is_valid": "[boolean] true if the SPF record is valid, false otherwise.",
    "total_lookups": "[number] The total number of DNS lookups for the record.",
    "terms": "[array] An array containing each term and its validation. Includes attributes term, type, is_valid, dns_lookups."
  }
}

DNSSavedQueryResponse

{
  "status": "[string] The status of the request.",
  "queries|query": "[array|object] An array of saved queries, or a single query if {id} was specified. See DNSQueryResponse"
}

DNSSavedQueryDeleteResponse

{
  "status": "[string] The status of the request."
}

WHOISResponse

{
  "status": "[string] The status of the request.",
  "hostname": "[string] The requested hostname.",
  "whois": {
    "domain_status": "[string] The current status of the domain, expressed as a short phrase.",
    "domain_status_description": "[string] A description of the domain's current status.",
    "registrar": "[string] The registrar for the domain.",
    "registrar_iana_id": "[number] The domain's unique identifier in the IANA database.",
    "registrar_domain_id": "[string] The domain's unique identifier in the registry.",
    "registry_created_date": "[datetime] The date the current registration was created.",
    "registry_expiration_date": "[datetime] The date the registration expired or will expire.",
    "abuse_email": "[string] The email address to contact for reporting abuse.",
    "abuse_phone": "[string] The phone number to contact for reporting abuse."
  }
}