# SecurityTrails API reference

> 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,…

Source: https://osinttools.io/apis/securitytrails/ (Markdown view of an OSINTtools.io page; append `.md` to any page URL for this format).

Compiled by OSINTtools.io editors from the vendor's docs, updated Nov 29, 2026. Listing: https://osinttools.io/tools/securitytrails/

- Base URL: https://api.securitytrails.com/v1
- Authentication: API key in the `APIKEY` header. The key is in the SecurityTrails control panel. It can also be sent as the apikey query parameter.
- Free tier: yes
- Pricing: Subscription
- Rate limits: 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.
- Vendor docs: https://docs.securitytrails.com/docs/overview

## Overview

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.

## Errors

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

## Domains

### Get a domain's current DNS records with counts of domains sharing each value

`GET /domain/{hostname}`

- Takes: Domain
- Footprint: passive (the target is not contacted)

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.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `hostname` | path | string | yes | Domain or hostname Example: example.com |

Response fields:

- `hostname` (string): The hostname looked up
- `alexa_rank` (integer): Alexa rank
- `current_dns.a.values[].ip` (string): Current A record IP
- `current_dns.a.values[].ip_count` (integer): Number of domains sharing that IP
- `current_dns.a.first_seen` (string): Date the current A records were first seen
- `current_dns.mx.values[].host` (string): Mail server
- `current_dns.ns.values[].nameserver` (string): Name server
- `current_dns.txt.values[].value` (string): TXT record

```bash
curl 'https://api.securitytrails.com/v1/domain/example.com' \
  -H 'APIKEY: YOUR_API_KEY'
```

Example response (200):

```json
{
  "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"
        }
      ]
    }
  }
}
```

### List the subdomains SecurityTrails knows for a hostname

`GET /domain/{hostname}/subdomains`

- Takes: Domain
- Footprint: passive (the target is not contacted)

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

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `hostname` | path | string | yes | Domain or hostname Example: example.com |

Response fields:

- `subdomains[]` (string): Subdomain labels, e.g. www for www.example.com

```bash
curl 'https://api.securitytrails.com/v1/domain/example.com/subdomains' \
  -H 'APIKEY: YOUR_API_KEY'
```

Example response (200):

```json
{
  "subdomains": [
    "api",
    "mail",
    "www"
  ]
}
```

### Get a domain's current WHOIS with stats merged in

`GET /domain/{hostname}/whois`

- Takes: Domain
- Footprint: passive (the target is not contacted)

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

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `hostname` | path | string | yes | Domain Example: example.com |

Response fields:

- `domain` (string): The domain
- `registrarName` (string): Registrar
- `createdDate` (string): Creation date
- `updatedDate` (string): Last update
- `expiresDate` (string): Expiry date
- `status` (string): Domain status codes
- `nameServers[]` (string): Name servers
- `contacts[]` (object): Contacts by type, with country and other details
- `contactEmail` (string): Contact email

```bash
curl 'https://api.securitytrails.com/v1/domain/example.com/whois' \
  -H 'APIKEY: YOUR_API_KEY'
```

Example response (200):

```json
{
  "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`

- Takes: Domain
- Footprint: passive (the target is not contacted)

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

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `hostname` | path | string | yes | Domain Example: example.com |
| `page` | query | integer | no | The page of the returned results Example: 1 |

Response fields:

- `records[].hostname` (string): Related domain
- `records[].whois` (object): registrar, createdDate, expiresDate
- `records[].mail_provider[]` (string): Mail providers
- `records[].host_provider[]` (string): Hosting providers
- `records[].computed.company_name` (string): Company name
- `record_count` (integer): Number of records
- `meta` (object): total_pages, page, max_page, query

```bash
curl 'https://api.securitytrails.com/v1/domain/example.com/associated' \
  -H 'APIKEY: YOUR_API_KEY'
```

Example response (200):

```json
{
  "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"
}
```

### Get current and historical TLS certificates for a domain or subdomain

`GET /domain/{hostname}/ssl`

- Takes: Domain
- Footprint: passive (the target is not contacted)

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.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `hostname` | path | string | yes | Domain or subdomain Example: example.com |
| `include_subdomains` | query | boolean | no | Include certificates of subdomains Example: false |
| `status` | query | string | no | Which certificates to return Example: valid One of: valid, all, expired |

Response fields:

- `records[].dns_names[]` (string): Names on the certificate
- `records[].fingerprints.sha256` (string): SHA-256 fingerprint
- `records[].issuer.common_name` (string): Issuer common name
- `records[].issuer.organization[]` (string): Issuer organisation
- `records[].not_before` (integer): Valid from (Unix time)
- `records[].not_after` (integer): Valid until (Unix time)
- `records[].serial_number` (string): Serial number
- `record_count` (integer): Number of records

```bash
curl 'https://api.securitytrails.com/v1/domain/example.com/ssl' \
  -H 'APIKEY: YOUR_API_KEY'
```

Example response (200):

```json
{
  "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}`

- Takes: Domain
- Footprint: passive (the target is not contacted)

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.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `hostname` | path | string | yes | Domain or hostname Example: example.com |
| `type` | path | string | yes | Record type Example: a One of: a, aaaa, mx, ns, soa, txt |
| `page` | query | integer | no | The page of the returned results Example: 1 |

Response fields:

- `type` (string): Record type returned
- `pages` (integer): Number of pages
- `records[].values[]` (object): Values of the record in that period (e.g. ip and ip_count)
- `records[].first_seen` (string): First seen date
- `records[].last_seen` (string): Last seen date
- `records[].organizations[]` (string): Organisations owning the values

```bash
curl 'https://api.securitytrails.com/v1/history/example.com/dns/a' \
  -H 'APIKEY: YOUR_API_KEY'
```

Example response (200):

```json
{
  "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`

- Takes: Domain
- Footprint: passive (the target is not contacted)

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.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `hostname` | path | string | yes | Domain Example: example.com |
| `page` | query | integer | no | The page of the returned results Example: 1 |

Response fields:

- `result.items[].registrarName` (string): Registrar
- `result.items[].started` (integer): When this record was first seen (Unix ms)
- `result.items[].ended` (integer): When it was last seen (Unix ms)
- `result.items[].createdDate` (integer): Creation date (Unix ms)
- `result.items[].expiresDate` (integer): Expiry date (Unix ms)
- `result.items[].nameServers[]` (string): Name servers
- `result.items[].contact[]` (object): Contacts: type, name, organization, email, telephone, address, with *_count fields
- `result.count` (integer): Number of records

```bash
curl 'https://api.securitytrails.com/v1/history/example.com/whois' \
  -H 'APIKEY: YOUR_API_KEY'
```

Example response (200):

```json
{
  "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

### Get current WHOIS information for an IPv4 address

`GET /ips/{ipaddress}/whois`

- Takes: IP address
- Footprint: passive (the target is not contacted)

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

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `ipaddress` | path | string | yes | The IPv4 address to fetch WHOIS for Example: 203.0.113.7 |

Response fields:

- `record.ip` (string): The address
- `record.contact_email` (string): Contact email
- `record.contacts[]` (object): Contacts
- `record.source` (string): Source object of the record

```bash
curl 'https://api.securitytrails.com/v1/ips/203.0.113.7/whois' \
  -H 'APIKEY: YOUR_API_KEY'
```

Example response (200):

```json
{
  "endpoint": "/v1/ips/203.0.113.7/whois",
  "record": {
    "ip": "203.0.113.7",
    "contact_email": "abuse@example.net",
    "contacts": [],
    "source": "ORG-EXAMPLE1-RIPE"
  }
}
```

### Explore neighbouring IP addresses and how many hostnames each has

`GET /ips/nearby/{ipaddress}`

- Takes: IP address
- Footprint: passive (the target is not contacted)

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.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `ipaddress` | path | string | yes | Starting IP address, optionally with a CIDR mask Example: 203.0.113.7 |

Response fields:

- `blocks[].ip` (string): IP or block
- `blocks[].ip_count` (integer): Number of hostnames on it

```bash
curl 'https://api.securitytrails.com/v1/ips/nearby/203.0.113.7' \
  -H 'APIKEY: YOUR_API_KEY'
```

Example response (200):

```json
{
  "blocks": [
    {
      "ip": "203.0.113.6/32",
      "ip_count": 3
    },
    {
      "ip": "203.0.113.7/32",
      "ip_count": 12
    }
  ]
}
```

## Search

### Search domains by DNS, WHOIS and other fields (filter)

`POST /domains/list`

- Takes: IP address, Domain, Email
- Footprint: passive (the target is not contacted)

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.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `include_ips` | query | boolean | no | Resolve any A records and also return IP addresses Example: false |
| `page` | query | integer | no | The page of the returned results Example: 1 |

Response fields:

- `records[].domain` (string): Matching domain
- `records[].host_providers[]` (string): Hosting providers
- `records[].mail_providers[]` (string): Mail providers
- `records[].alexa_rank` (integer): Alexa rank
- `record_count` (integer): Number of matches

```bash
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"}}'
```

Example response (200):

```json
{
  "record_count": 1,
  "records": [
    {
      "domain": "example.org",
      "host_providers": [
        "Example Hosting"
      ],
      "mail_providers": [
        "Example Mail"
      ],
      "host": null,
      "alexa_rank": null
    }
  ],
  "org": [
    "Example Inc"
  ]
}
```

### Search IP addresses with SecurityTrails's DSL

`POST /ips/list`

- Footprint: passive (the target is not contacted)

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

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `page` | query | integer | no | The page of the returned results Example: 1 |

Response fields:

- `records[].ip` (string): IP address
- `records[].ptr` (string): PTR record
- `record_count` (integer): Number of matches
- `meta` (object): total_pages, query, page, max_page

```bash
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'\''"}'
```

Example response (200):

```json
{
  "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

### Get this month's API usage and allowance

`GET /account/usage`

- Footprint: passive (the target is not contacted)

Returns the queries used this month and the monthly allowance.

Response fields:

- `current_monthly_usage` (integer): Queries used this month
- `allowed_monthly_usage` (integer): Monthly allowance

```bash
curl 'https://api.securitytrails.com/v1/account/usage' \
  -H 'APIKEY: YOUR_API_KEY'
```

Example response (200):

```json
{
  "current_monthly_usage": 100,
  "allowed_monthly_usage": 10000
}
```

### Test authentication and access to the API

`GET /ping`

- Footprint: passive (the target is not contacted)

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

Response fields:

- `success` (boolean): True when the key works

```bash
curl 'https://api.securitytrails.com/v1/ping' \
  -H 'APIKEY: YOUR_API_KEY'
```

Example response (200):

```json
{
  "success": true
}
```

---

Listings on OSINTtools.io are reviewed by editors and re-verified on a schedule; check pricing and availability on the vendor's site before relying on them, and use OSINT tools only with a lawful basis.
Site index for agents: https://osinttools.io/llms.txt · Full catalog: https://osinttools.io/llms-full.txt · MCP server (Streamable HTTP, no auth): https://osinttools.io/mcp/
