Using the API

The Shadowspotter REST API lets you search domain intelligence and retrieve WHOIS, DNS, certificate and HTTP data from your own scripts and tools. The API base URL is https://app.shadowspotter.com/api/. Use HTTPS and keep the trailing slash on endpoint URLs.

Generate an API token

  1. Sign in to Shadowspotter and open My Profile from the user menu.
  2. Find the API Key section and click Generate API Key.
  3. Copy the value in Your API Key using the clipboard button. You can return to this page to view or copy it again.

Each account has one current token. Regenerate Key replaces it and immediately invalidates the previous token; update any scripts that use it. Delete Key revokes API access through that token. Keep the token private and store it in an environment variable or secret store instead of committing it to source code.

Creating a token does not add API quota to your plan. Check the API section of Subscription for access, monthly limits and usage for each API category.

Authenticate requests

Send this header with every authenticated request, replacing the placeholder with your API key:

Authorization: Token <your-token>

Include the literal Token prefix, a space, then your key. Set Accept: application/json to request JSON responses. For requests with a JSON body, also set Content-Type: application/json. Token-authenticated requests do not require browser session cookies or a CSRF token.

Make your first request

Set an environment variable in your shell, then call the search endpoint. The query value uses the same ShadowLang syntax as advanced search in the application. --data-urlencode encodes spaces, wildcards and other query characters for you.

export SHADOWSPOTTER_API_TOKEN='paste-your-api-key-here'

curl --get 'https://app.shadowspotter.com/api/search/' \
  --header "Authorization: Token $SHADOWSPOTTER_API_TOKEN" \
  --header 'Accept: application/json' \
  --data-urlencode 'query=entity:domain domain:*.example.com' \
  --data-urlencode 'page=1' \
  --data-urlencode 'page_size=25'

The search endpoint also accepts the same parameters in a JSON POST body:

curl 'https://app.shadowspotter.com/api/search/' \
  --header "Authorization: Token $SHADOWSPOTTER_API_TOKEN" \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{"query": "entity:domain domain:*.example.com", "page": 1, "page_size": 25}'

Search dates and pagination

ParameterUsage
queryRequired ShadowLang expression, sent as plain text in the query parameter or JSON field.
start_date, end_dateOptional dates in YYYY-MM-DD format. Search defaults to the last 30 days through now. Available history depends on your subscription.
pagePage number, starting at 1.
page_sizeResults per page: default 25, maximum 100.

Search responses contain count, page, page_size, total_pages and a results array. Increase page until you reach total_pages, keeping the query and date range the same. The total result set is subject to your subscription's result limit.

For WHOIS searches, the date range filters observation history. Use a creation_date condition in the query to filter by registration date. Each search result's matched_fields records the values that matched your query; current_enrichment contains additional snapshots from the selected time window.

Python example

With the requests package installed and the environment variable above set:

import os
import requests

response = requests.get(
    "https://app.shadowspotter.com/api/search/",
    headers={
        "Authorization": f"Token {os.environ['SHADOWSPOTTER_API_TOKEN']}",
        "Accept": "application/json",
    },
    params={"query": "entity:domain domain:*.example.com", "page_size": 25},
    timeout=60,
)
response.raise_for_status()
data = response.json()
for result in data["results"]:
    print(result)

Explore the endpoints

EndpointPurpose
GET /api/search/
POST /api/search/
Run a ShadowLang query.
GET /api/whois/{domain}/Retrieve WHOIS information, refreshing it when needed.
GET /api/domain/{domain}/dns/Retrieve stored DNS observations for a domain.
GET /api/domain/{domain}/cert/Retrieve stored certificates for a domain.
GET /api/domain/{domain}/http/Retrieve stored HTTP observations for a domain.
GET /api/passive-dns/Look up passive DNS records using the query parameter.

Replace {domain} with a domain such as example.com. See the interactive API reference (Swagger UI) for the full endpoint list, required parameters and response schemas. Click Authorize and enter Token <your-token> in the tokenAuth field, then use Try it out to send a request. These requests use your account's quotas. The OpenAPI schema is also available.

Quotas and common errors

API quotas are monthly and tracked by category, such as search, WHOIS or prevalence. Usage is shared across organization members when your account belongs to an organization. Search also checks your query quota and applies your plan's entity, field and history restrictions. Review your limits on the Subscription page.

StatusWhat to check
400 Bad RequestCheck parameter names, date formats, query syntax and page numbers. The response body describes the validation error.
401 UnauthorizedCheck that the Authorization header contains Token followed by your current key. Regenerating or deleting a key invalidates the old value.
403 ForbiddenYour account may lack permission for the operation, entity or query feature.
429 Too Many RequestsThe API category or query quota is exhausted, or the plan has no quota for it. Check Subscription before retrying; rapid retries do not reset monthly quotas.
504 Gateway TimeoutThe search timed out. Try a narrower query or shorter date range.

Check the HTTP status before reading results. Error bodies may contain detail, error, Error, or validation messages keyed by parameter name.