Skip to content
OSINTtools.io

SecurityTrails API

Historical DNS, WHOIS and subdomain data for domains and IPs, now part of Recorded Future.

Base URL
https://api.securitytrails.com/v1
Sign-in
API key
Free tier
Free tier
Pricing
Subscription
Format
REST
Endpoints
13

Compiled by OSINTtools.io editors from docs.securitytrails.com · updated Nov 29, 2026Work on this API? Claim it to keep these docs currentReport a mistake

Introduction

The SecurityTrails API returns SecurityTrails's stored DNS and WHOIS data: a domain's current DNS records (with how many other domains share each value), its subdomains, current and historical WHOIS, DNS history by record type, associated domains, TLS certificates, and data on IP addresses (WHOIS, neighbouring ranges). Search endpoints filter the whole domain and IP datasets by fields such as IP range, name server, mail server or WHOIS email.

An investigator uses it to see what a domain pointed to in the past, enumerate subdomains, follow registrant details across WHOIS history, and pivot from an IP address, name server or WHOIS email to other domains. All lookups read SecurityTrails's database; the target is not contacted.

Calls go to https://api.securitytrails.com/v1 with your key in the APIKEY header (the apikey query parameter also works, but the docs discourage it because query strings are often logged). Responses are JSON; list endpoints take a page parameter.

Every subscription has a monthly quota; past it the API answers 429. Each account is also limited to a number of requests per second, reset after one second; the docs do not give the numbers. GET /account/usage shows the month's usage.

Quick start

  1. Get a key

    Create an account with SecurityTrails and copy your api key (free tier). Where to get it

  2. Make your first request

    Get a domain's current DNS records with counts of domains sharing each value. Replace YOUR_API_KEY and run it in a terminal, or use Try it on the endpoint.

    curl 'https://api.securitytrails.com/v1/domain/example.com' \
      -H 'APIKEY: YOUR_API_KEY'
  3. Read the response

    A 200 response looks like this, shortened.

    {
      "hostname": "example.com",
      "alexa_rank": 83756,
      "current_dns": {
        "a": {
          "first_seen": "2020-05-26",
          "values": [
            {
              "ip": "192.0.2.10",
              "ip_count": 12
            }
          ]
        },
        "mx": {
          "first_seen": "2020-05-26",
          "values": [
            {
              "priority": 10,
              "host": "mail.example.com",
              "host_count": 3
            }
          ]
        },
        "ns": {
    …

Authentication

Send your API key in the APIKEY header of every request.

The key is in the SecurityTrails control panel. It can also be sent as the apikey query parameter.

Try it on this page keeps your key in your browser; it is never sent to OSINTtools.io.

Rate limits and pricing

A monthly quota per subscription (429 once reached) and a per-account requests-per-second limit that resets after one second; the docs do not state the numbers.

Free tier. Pricing: subscription.

Errors

StatusMeaning
400Invalid request, e.g. the domain has invalid characters or the query has a syntax error
401Authentication failed
429Monthly quota reached or request rate exceeded

Domains

Returns current A, AAAA, MX, NS, SOA and TXT records, each with its first-seen date and statistics such as how many other domains share the same IP, mail server or name server.

Path parameters

hostnamestringrequiredtakes your domain

Domain or hostname

Example: example.com
Response fields · 8Show

hostnamestring

The hostname looked up

alexa_rankinteger

Alexa rank

ipstring

Current A record IP

ip_countinteger

Number of domains sharing that IP

first_seenstring

Date the current A records were first seen

hoststring

Mail server

nameserverstring

Name server

valuestring

TXT record

curl 'https://api.securitytrails.com/v1/domain/example.com' \
  -H 'APIKEY: YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "hostname": "example.com",
  "alexa_rank": 83756,
  "current_dns": {
    "a": {
      "first_seen": "2020-05-26",
      "values": [
        {
          "ip": "192.0.2.10",
          "ip_count": 12
        }
      ]
    },
    "mx": {
      "first_seen": "2020-05-26",
      "values": [
        {
          "priority": 10,
          "host": "mail.example.com",
          "host_count": 3
        }
      ]
    },
    "ns": {
      "first_seen": "2020-05-26",
      "values": [
        {
          "nameserver": "ns1.example.net",
          "nameserver_count": 5213
        }
      ]
    },
    "txt": {
      "first_seen": "2020-05-26",
      "values": [
        {
          "value": "v=spf1 mx -all"
        }
      ]
    }
  }
}

Returns subdomain labels (without the parent domain) for the hostname.

Path parameters

hostnamestringrequiredtakes your domain

Domain or hostname

Example: example.com
Response fields · 1Show

subdomains[]string

Subdomain labels, e.g. www for www.example.com

curl 'https://api.securitytrails.com/v1/domain/example.com/subdomains' \
  -H 'APIKEY: YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "subdomains": [
    "api",
    "mail",
    "www"
  ]
}

Returns the current WHOIS record: registrar, dates, status, name servers and contacts, with counts of how many other records share each contact value.

Path parameters

hostnamestringrequiredtakes your domain

Domain

Example: example.com
Response fields · 9Show

domainstring

The domain

registrarNamestring

Registrar

createdDatestring

Creation date

updatedDatestring

Last update

expiresDatestring

Expiry date

statusstring

Domain status codes

nameServers[]string

Name servers

contacts[]object

Contacts by type, with country and other details

contactEmailstring

Contact email

curl 'https://api.securitytrails.com/v1/domain/example.com/whois' \
  -H 'APIKEY: YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "domain": "example.com",
  "registrarName": "EXAMPLE REGISTRAR LLC",
  "createdDate": "2017-06-21T07:45:18Z",
  "updatedDate": "2023-06-22T10:55:40Z",
  "expiresDate": "2025-06-21T07:45:18Z",
  "status": "clientTransferProhibited clientUpdateProhibited",
  "nameServers": [
    "NS1.EXAMPLE.NET",
    "NS2.EXAMPLE.NET"
  ],
  "contacts": [
    {
      "type": "technicalContact",
      "countryCode": "US",
      "country": "UNITED STATES"
    }
  ],
  "contactEmail": "abuse@example.net",
  "endpoint": "/v1/domain/example.com/whois"
}

Find domains related to a domain

GET/domain/{hostname}/associated

Returns domains SecurityTrails considers related to the input domain, each with WHOIS registrar and dates, mail and hosting providers, and the computed company name.

Path parameters

hostnamestringrequiredtakes your domain

Domain

Example: example.com

Query parameters

pageinteger

The page of the returned results

Example: 1
Response fields · 7Show

hostnamestring

Related domain

whoisobject

registrar, createdDate, expiresDate

mail_provider[]string

Mail providers

host_provider[]string

Hosting providers

company_namestring

Company name

record_countinteger

Number of records

metaobject

total_pages, page, max_page, query

curl 'https://api.securitytrails.com/v1/domain/example.com/associated' \
  -H 'APIKEY: YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "records": [
    {
      "hostname": "example.org",
      "whois": {
        "registrar": "Example Registrar Inc.",
        "createdDate": 1106675546000,
        "expiresDate": 1737000000000
      },
      "mail_provider": [
        "Example Mail"
      ],
      "host_provider": [
        "Example Hosting"
      ],
      "computed": {
        "company_name": "Example Inc"
      },
      "alexa_rank": 5000
    }
  ],
  "record_count": 1,
  "meta": {
    "total_pages": 1,
    "query": "example.com",
    "page": 1,
    "max_page": 100
  },
  "endpoint": "/v1/domain/example.com/associated"
}

Returns certificates seen for the hostname: DNS names, SHA-1 and SHA-256 fingerprints, issuer, subject, validity dates and serial number. Choose valid, expired or all certificates, and optionally include subdomains.

Path parameters

hostnamestringrequiredtakes your domain

Domain or subdomain

Example: example.com

Query parameters

include_subdomainsboolean

Include certificates of subdomains

Example: falseDefault: false
statusstring

Which certificates to return

Example: validDefault: validOne of: valid, all, expired
Response fields · 8Show

dns_names[]string

Names on the certificate

sha256string

SHA-256 fingerprint

common_namestring

Issuer common name

organization[]string

Issuer organisation

not_beforeinteger

Valid from (Unix time)

not_afterinteger

Valid until (Unix time)

serial_numberstring

Serial number

record_countinteger

Number of records

curl 'https://api.securitytrails.com/v1/domain/example.com/ssl' \
  -H 'APIKEY: YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "endpoint": "/v1/domain/example.com/ssl",
  "meta": {
    "max_page": 1,
    "page": 1,
    "total_pages": 1
  },
  "record_count": 1,
  "records": [
    {
      "dns_names": [
        "example.com",
        "www.example.com"
      ],
      "fingerprints": {
        "sha1": "1A2B3C4D5E6F708192A3B4C5D6E7F8091A2B3C4D",
        "sha256": "9A8B7C6D5E4F30211A2B3C4D5E6F708192A3B4C5D6E7F8091A2B3C4D5E6F7081"
      },
      "issuer": {
        "common_name": "Example CA R1",
        "country": [
          "US"
        ],
        "organization": [
          "Example CA"
        ]
      },
      "not_before": 1700000000,
      "not_after": 1707776000,
      "serial_number": "123456789012345678901234567890",
      "subject": {}
    }
  ]
}

History

Get a hostname's DNS history for one record type

GET/history/{hostname}/dns/{type}

Lists past values of the record type with first and last seen dates and the organisations behind them. Types: a, aaaa, mx, ns, soa, txt.

Path parameters

hostnamestringrequiredtakes your domain

Domain or hostname

Example: example.com
typestringrequired

Record type

Example: aDefault: aOne of: a, aaaa, mx, ns, soa, txt

Query parameters

pageinteger

The page of the returned results

Example: 1
Response fields · 6Show

typestring

Record type returned

pagesinteger

Number of pages

values[]object

Values of the record in that period (e.g. ip and ip_count)

first_seenstring

First seen date

last_seenstring

Last seen date

organizations[]string

Organisations owning the values

curl 'https://api.securitytrails.com/v1/history/example.com/dns/a' \
  -H 'APIKEY: YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "pages": 1,
  "type": "a/ipv4",
  "records": [
    {
      "first_seen": "2019-05-26",
      "last_seen": "2021-05-31",
      "values": [
        {
          "ip": "198.51.100.20",
          "ip_count": 40
        }
      ],
      "organizations": [
        "Example Hosting"
      ]
    }
  ]
}

Get a domain's WHOIS history

GET/history/{hostname}/whois

Returns past WHOIS records, each with the period it was seen (started, ended), registrar, dates, name servers, status and contacts, with counts of how many records share each contact value.

Path parameters

hostnamestringrequiredtakes your domain

Domain

Example: example.com

Query parameters

pageinteger

The page of the returned results

Example: 1
Response fields · 8Show

registrarNamestring

Registrar

startedinteger

When this record was first seen (Unix ms)

endedinteger

When it was last seen (Unix ms)

createdDateinteger

Creation date (Unix ms)

expiresDateinteger

Expiry date (Unix ms)

nameServers[]string

Name servers

contact[]object

Contacts: type, name, organization, email, telephone, address, with *_count fields

countinteger

Number of records

curl 'https://api.securitytrails.com/v1/history/example.com/whois' \
  -H 'APIKEY: YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "result": {
    "items": [
      {
        "domain": "example.com",
        "registrarName": "Example Registrar Inc.",
        "started": 1512131429000,
        "ended": 1543667429000,
        "createdDate": 1498031118000,
        "expiresDate": 1529567118000,
        "nameServers": [
          "NS1.EXAMPLE.NET",
          "NS2.EXAMPLE.NET"
        ],
        "contact": [
          {
            "type": "registrant",
            "name": "Example Privacy Service",
            "organization": "Example Privacy Service",
            "email": "privacy@example.net",
            "country": "UNITED STATES",
            "name_count": 10,
            "email_count": 2
          }
        ]
      }
    ],
    "count": 1
  },
  "endpoint": "/v1/history/example.com/whois"
}

IPs

Returns the current IP WHOIS record: contact email, contacts and source object.

Path parameters

ipaddressstringrequiredtakes your ip address

The IPv4 address to fetch WHOIS for

Example: 203.0.113.7
Response fields · 4Show

ipstring

The address

contact_emailstring

Contact email

contacts[]object

Contacts

sourcestring

Source object of the record

curl 'https://api.securitytrails.com/v1/ips/203.0.113.7/whois' \
  -H 'APIKEY: YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "endpoint": "/v1/ips/203.0.113.7/whois",
  "record": {
    "ip": "203.0.113.7",
    "contact_email": "abuse@example.net",
    "contacts": [],
    "source": "ORG-EXAMPLE1-RIPE"
  }
}

Returns the neighbours of an IP address in its range, each with the number of hostnames pointing to it. The address can carry a CIDR mask.

Path parameters

ipaddressstringrequiredtakes your ip address

Starting IP address, optionally with a CIDR mask

Example: 203.0.113.7
Response fields · 2Show

ipstring

IP or block

ip_countinteger

Number of hostnames on it

curl 'https://api.securitytrails.com/v1/ips/nearby/203.0.113.7' \
  -H 'APIKEY: YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "blocks": [
    {
      "ip": "203.0.113.6/32",
      "ip_count": 3
    },
    {
      "ip": "203.0.113.7/32",
      "ip_count": 12
    }
  ]
}

Finds domains matching a filter: IPv4 (with CIDR), IPv6, apex domain, keyword, MX, NS, CNAME, subdomain, SOA email, TLD, or WHOIS fields (email, name, organization, street, postal code, telephone, fax, city). include_ips also resolves A records.

Query parameters

include_ipsboolean

Resolve any A records and also return IP addresses

Example: falseDefault: false
pageinteger

The page of the returned results

Example: 1
Request body (JSON) · 7Show

ipv4string

IPv4 address; can include a CIDR mask

apex_domainstring

Apex domain

keywordstring

Keyword

mxstring

Mail server

nsstring

Name server

whois_emailstring

WHOIS email

whois_organizationstring

WHOIS organization

Response fields · 5Show

domainstring

Matching domain

host_providers[]string

Hosting providers

mail_providers[]string

Mail providers

alexa_rankinteger

Alexa rank

record_countinteger

Number of matches

curl -X POST 'https://api.securitytrails.com/v1/domains/list' \
  -H 'APIKEY: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"filter":{"whois_email":"admin@example.com"}}'
Replace YOUR_API_KEY with your key
Response
{
  "record_count": 1,
  "records": [
    {
      "domain": "example.org",
      "host_providers": [
        "Example Hosting"
      ],
      "mail_providers": [
        "Example Mail"
      ],
      "host": null,
      "alexa_rank": null
    }
  ],
  "org": [
    "Example Inc"
  ]
}
  • Passive: the target is not contacted

Runs a DSL query against the IP dataset, for example on PTR records.

Query parameters

pageinteger

The page of the returned results

Example: 1
Request body (JSON) · 1Show

querystringalways present

The DSL query to run against the IPs database

Response fields · 4Show

ipstring

IP address

ptrstring

PTR record

record_countinteger

Number of matches

metaobject

total_pages, query, page, max_page

curl -X POST 'https://api.securitytrails.com/v1/ips/list' \
  -H 'APIKEY: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"query":"ptr_part = '\''ns1'\''"}'
Replace YOUR_API_KEY with your key
Response
{
  "records": [
    {
      "ptr": "ns1",
      "ip": "198.51.100.53"
    }
  ],
  "record_count": 1,
  "meta": {
    "total_pages": 1,
    "query": "ptr_part = 'ns1'",
    "page": 1,
    "max_page": 100
  },
  "endpoint": "/v1/ips/list"
}

Account

  • Passive: the target is not contacted

Returns the queries used this month and the monthly allowance.

Response fields · 2Show

current_monthly_usageinteger

Queries used this month

allowed_monthly_usageinteger

Monthly allowance

curl 'https://api.securitytrails.com/v1/account/usage' \
  -H 'APIKEY: YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "current_monthly_usage": 100,
  "allowed_monthly_usage": 10000
}
  • Passive: the target is not contacted

Returns success when the key is valid; 401 or 429 otherwise.

Response fields · 1Show

successboolean

True when the key works

curl 'https://api.securitytrails.com/v1/ping' \
  -H 'APIKEY: YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "success": true
}