Skip to content
OSINTtools.io

Shodan API

Search engine for internet-connected hosts, indexing open ports, service banners and TLS certificates by IP.

Base URL
https://api.shodan.io
Sign-in
API key
Free tier
Free tier
Pricing
Subscription
Format
REST
Endpoints
14

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

Introduction

The Shodan REST API searches Shodan's database of banners: what its crawlers saw on Internet-facing hosts (open ports, services, software, certificates, organisation, location). It also returns DNS records Shodan has collected for a domain, resolves hostnames and IPs, and can ask Shodan to crawl given IPs on demand.

An investigator uses it to see every service Shodan has recorded on an IP (with history), to count or search hosts matching filters such as org:, hostname: or port:, and to list a domain's subdomains and DNS records. Host lookups, searches and DNS lookups read Shodan's existing data; only the on-demand scan makes Shodan contact the target.

Calls go to https://api.shodan.io with your key in the key query parameter; responses are JSON, and a non-200 status means an error with a message such as {"error": "Invalid IP"}. Searches with a filter, pages past the first and domain DNS lookups use query credits; scans use scan credits (1 per IP). Every account comes with a free API plan; paid API plans add monthly query and scan credits.

Quick start

  1. Get a key

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

  2. Make your first request

    All services Shodan has found on an IP address. Replace YOUR_API_KEY and run it in a terminal, or use Try it on the endpoint.

    curl 'https://api.shodan.io/shodan/host/203.0.113.7?key=YOUR_API_KEY'
  3. Read the response

    A 200 response looks like this, shortened.

    {
      "ip_str": "203.0.113.7",
      "hostnames": [
        "host7.example.net"
      ],
      "domains": [
        "example.net"
      ],
      "org": "Example Hosting",
      "isp": "Example Networks",
      "asn": "AS64500",
      "country_code": "NL",
      "city": "Amsterdam",
      "latitude": 52.37,
      "longitude": 4.89,
      "os": null,
      "tags": [],
      "ports": [
        22,
        443
      ],
      "last_update": "2026-11-20T04:12:33.000000",
      "data": [
        {
    …

Authentication

Send your API key in the key query parameter of every request.

All Shodan accounts come with a free API plan; the key is on your account page.

Get a key from Shodan

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

Rate limits and pricing

All API plans are subject to a rate limit of 1 request per second.

Free tier. Pricing: subscription.

  • Membership$49 one-time · 100 query credits and 100 scan credits/month, monitor 16 IPs
  • Freelancer$69/month · API: 10,000 query credits, 5,120 scan credits/month, monitor 5,120 IPs
  • Small Business$359/month · API: 200,000 query credits, 65,536 scan credits/month, monitor 65,536 IPs
  • Corporate$1,099/month · API: unlimited query credits, 327,680 scan credits/month, monitor 327,680 IPs
  • EnterpriseContact sales · Unlimited query and scan credits and monitored IPs

Plans from account.shodan.io, checked Nov 25, 2026.

Errors

StatusMeaning
404Host lookup: invalid IP ({"error": "Invalid IP"}). The docs say any non-200 status is an error, with the reason in an error field

Hosts

Returns host details (organisation, ISP, ASN, location, hostnames, domains, open ports, tags, OS) and the banner for each service. history=true adds every historical banner; minify=true returns only the ports and general host information.

Path parameters

ipstringrequiredtakes your ip address

Host IP address

Example: 203.0.113.7

Query parameters

historyboolean

True to return all historical banners

Example: falseDefault: false
minifyboolean

True to return only the list of ports and general host information, no banners

Example: falseDefault: false
Response fields · 11Show

ip_strstring

The IP address

hostnames[]string

Hostnames seen for the IP

domains[]string

Domains seen for the IP

orgstring

Organisation the IP is assigned to

ispstring

ISP

asnstring

Autonomous system number

country_codestring

Country code

citystring

City

ports[]integer

Open ports seen

last_updatestring

When the host was last updated

data[]object

One banner per service: port, transport, product, timestamp, raw data and protocol-specific fields

curl 'https://api.shodan.io/shodan/host/203.0.113.7?key=YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "ip_str": "203.0.113.7",
  "hostnames": [
    "host7.example.net"
  ],
  "domains": [
    "example.net"
  ],
  "org": "Example Hosting",
  "isp": "Example Networks",
  "asn": "AS64500",
  "country_code": "NL",
  "city": "Amsterdam",
  "latitude": 52.37,
  "longitude": 4.89,
  "os": null,
  "tags": [],
  "ports": [
    22,
    443
  ],
  "last_update": "2026-11-20T04:12:33.000000",
  "data": [
    {
      "port": 443,
      "transport": "tcp",
      "product": "nginx",
      "timestamp": "2026-11-20T04:12:33.000000",
      "data": "HTTP/1.1 200 OK\r\nServer: nginx\r\n"
    }
  ]
}
  • Passive: the target is not contacted
  • Cost: No query credits

Same query syntax as host search, but returns only the total and facet summaries. Does not use query credits.

Query parameters

querystringrequired

Shodan search query, in filter:value syntax

Example: org:"Example Hosting" port:22
facetsstring

Comma-separated properties to summarise; prop:count sets how many values

Example: org,os
Response fields · 3Show

totalinteger

Number of matching results

matches[]object

Always empty

facetsobject

For each facet, a list of {count, value}

curl 'https://api.shodan.io/shodan/host/count?query=org%3A%22Example%20Hosting%22%20port%3A22&key=YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "matches": [],
  "facets": {
    "os": [
      {
        "count": 41,
        "value": "Linux"
      }
    ]
  },
  "total": 57
}

Search helpers

  • Passive: the target is not contacted

Shows which filters a query uses, their values, the remaining free text and any errors.

Query parameters

querystringrequired

The query to tokenise

Example: Raspbian port:22
Response fields · 4Show

attributesobject

Filter values found, e.g. ports

errors[]string

Problems in the query

stringstring

The non-filter text

filters[]string

Filter names used

curl 'https://api.shodan.io/shodan/host/search/tokens?query=Raspbian%20port%3A22&key=YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "attributes": {
    "ports": [
      22
    ]
  },
  "errors": [],
  "string": "Raspbian",
  "filters": [
    "port"
  ]
}

List the filter names a search query can use

GET/shodan/host/search/filters

  • Passive: the target is not contacted

Returns the names of all search filters.

Response fields · 1Show

[]string

Filter name

curl 'https://api.shodan.io/shodan/host/search/filters?key=YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
[
  "all",
  "asn",
  "city",
  "hostname",
  "org",
  "port"
]
  • Passive: the target is not contacted

Returns the names of all facets.

Response fields · 1Show

[]string

Facet name

curl 'https://api.shodan.io/shodan/host/search/facets?key=YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
[
  "asn",
  "country",
  "org",
  "os",
  "port"
]

DNS

  • Takes: Domain
  • Passive: the target is not contacted
  • Cost: 1 query credit per lookup

Returns the domain's subdomains and its records (subdomain, type, value, last seen), 100 per page. history=true includes historical records; type limits to one record type.

Path parameters

domainstringrequiredtakes your domain

Domain name to look up

Example: example.com

Query parameters

historyboolean

True to include historical DNS data

Example: falseDefault: false
typestring

DNS record type

Example: MXOne of: A, AAAA, CNAME, NS, SOA, MX, TXT
pageinteger

Page of results, 100 per page

Example: 1Default: 1
Response fields · 8Show

domainstring

The domain looked up

tags[]string

Tags such as ipv6

subdomainstring

Subdomain (empty for the domain itself)

typestring

Record type

valuestring

Record value

last_seenstring

When Shodan last saw the record

subdomains[]string

Subdomains found

moreboolean

Whether more pages exist

curl 'https://api.shodan.io/dns/domain/example.com?key=YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "domain": "example.com",
  "tags": [
    "ipv6"
  ],
  "data": [
    {
      "subdomain": "",
      "type": "MX",
      "value": "mail.example.com",
      "last_seen": "2026-11-15T10:20:30.000000"
    },
    {
      "subdomain": "www",
      "type": "A",
      "value": "192.0.2.10",
      "last_seen": "2026-11-15T10:20:30.000000"
    }
  ],
  "subdomains": [
    "mail",
    "www"
  ],
  "more": false
}

Returns an object mapping each hostname to an IP address.

Query parameters

hostnamesstringrequiredtakes your domain

Comma-separated list of hostnames

Example: example.com
Response fields · 1Show

{hostname}string

IP address the hostname resolves to

curl 'https://api.shodan.io/dns/resolve?hostnames=example.com&key=YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "example.com": "192.0.2.10"
}

Returns an object mapping each IP to a list of hostnames.

Query parameters

ipsstringrequiredtakes your ip address

Comma-separated list of IP addresses

Example: 192.0.2.10
Response fields · 1Show

{ip}[]string

Hostnames for the IP

curl 'https://api.shodan.io/dns/reverse?ips=192.0.2.10&key=YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "192.0.2.10": [
    "host10.example.net"
  ]
}

On-demand scanning

  • Takes: IP address
  • Active: contacts the target
  • Cost: 1 scan credit per IP
  • Plan: Paid API plan

Shodan's crawlers connect to the given IPs, so this contacts the target. Returns a scan ID to poll with GET /shodan/scan/{id}. Needs a paid API plan. ips can also be a JSON object mapping each IP to a list of [port, protocol] pairs.

Request body (form) · 1Show

ipsstringalways present

Comma-separated IPs or netblocks in CIDR notation to crawl

Response fields · 3Show

countinteger

Number of IPs that will be crawled

idstring

Scan ID

credits_leftinteger

Scan credits remaining

curl -X POST 'https://api.shodan.io/shodan/scan?key=YOUR_API_KEY' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'ips=198.51.100.0/30,203.0.113.7'
Replace YOUR_API_KEY with your key
Response
{
  "count": 5,
  "id": "Ab12Cd34Ef56Gh78",
  "credits_left": 4995
}
  • Passive: the target is not contacted

Returns the scan's status: SUBMITTING, QUEUE, PROCESSING or DONE.

Path parameters

idstringrequired

Scan ID returned by POST /shodan/scan

Example: Ab12Cd34Ef56Gh78
Response fields · 4Show

countinteger

IPs in the scan

statusstring

SUBMITTING, QUEUE, PROCESSING or DONE

idstring

Scan ID

createdstring

When the scan was created

curl 'https://api.shodan.io/shodan/scan/Ab12Cd34Ef56Gh78?key=YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "count": 5,
  "status": "DONE",
  "id": "Ab12Cd34Ef56Gh78",
  "created": "2026-11-28T14:02:11.000000"
}
  • Passive: the target is not contacted

Returns your scans with their status, creation time and size.

Response fields · 2Show

matches[]object

Scans: id, status, created, size, credits_left

totalinteger

Number of scans

curl 'https://api.shodan.io/shodan/scans?key=YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "matches": [
    {
      "id": "Ab12Cd34Ef56Gh78",
      "status": "DONE",
      "created": "2026-11-28T14:02:11.000000",
      "size": 5,
      "credits_left": 4995
    }
  ],
  "total": 1
}

Account

  • Passive: the target is not contacted

Returns the plan behind your key, credits left and usage limits.

Response fields · 9Show

planstring

API plan

query_creditsinteger

Query credits left

scan_creditsinteger

Scan credits left

monitored_ipsinteger

IPs being monitored

usage_limitsobject

Plan limits for scan_credits, query_credits and monitored_ips

unlockedboolean

Whether the account is unlocked

unlocked_leftinteger

Unlocks left

httpsboolean

HTTPS filter access

telnetboolean

Telnet filter access

curl 'https://api.shodan.io/api-info?key=YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "scan_credits": 100,
  "usage_limits": {
    "scan_credits": 100,
    "query_credits": 100,
    "monitored_ips": 16
  },
  "plan": "dev",
  "https": false,
  "unlocked": true,
  "query_credits": 87,
  "monitored_ips": 0,
  "unlocked_left": 87,
  "telnet": false
}
  • Passive: the target is not contacted

Returns information about the account behind the key.

Response fields · 4Show

memberboolean

Whether the account has a membership

creditsinteger

Credits

display_namestring

Display name, or null

createdstring

When the account was created

curl 'https://api.shodan.io/account/profile?key=YOUR_API_KEY'
Replace YOUR_API_KEY with your key
Response
{
  "member": true,
  "credits": 0,
  "display_name": null,
  "created": "2020-06-15T10:44:43.148000"
}