Skip to content

API

Use Have I Been Squatted’s API in security workflows.

For Python, use the haveibeensquatted-python SDK on GitHub. A Go SDK is coming soon.

API tokens are created in the platform. Go to Settings -> API Keys, create a token, select scopes, and optionally set an expiration. The token is only shown once after creation.

API tokens are scoped. Requests made with a token must include the scope required by the endpoint.

ScopeDescriptionExample endpointsDetails
lookup:squatLook up typosquatted domainsGET /v1/lookup/squat/{domain}Squat
lookup:nxdomainLook up non-existent domainsGET /v1/lookup/nxdomain/{domain}NXDOMAIN
analyzeAnalyze domains for threatsGET /v1/analyze/{domain}Analyze
ctCertificate Transparency lookupsGET /v1/ct/search, GET /v1/ct/hydrateCertificate Transparency

When creating a token, choose a 7, 30, 60, or 90 day expiration, or select No expiration. Expired or revoked tokens stop working immediately, and the full token value is only shown once at creation.

The OpenAPI 3.1 Have I Been Squatted API specification is available as follows.

For an interactive view, open the OpenAPI specification in Swagger Editor.

EndpointDescriptionDocumentation
GET /v1/lookup/squat/{domain}Look up typosquatted permutations for a domain.Squat
GET /v1/lookup/nxdomain/{domain}Look up unregistered permutations for a domain.NXDOMAIN
GET /v1/analyze/{domain}Analyze a domain for infrastructure and threat signals.Analyze
GET /v1/ct/searchSearch certificate transparency names by pattern.Certificate Transparency search
GET /v1/ct/search/domainsSearch certificate transparency data for exact FQDNs.Certificate Transparency search domains
GET /v1/ct/hydrateHydrate certificate transparency occurrences into certificate details.Certificate Transparency occurrences hydration
GET /v1/meta/usageRetrieve usage totals and hourly breakdown.Usage

GET /v1/meta/usage returns usage information for the authenticated API key as a regular JSON body (not newline-delimited streaming). You can pass the optional query parameter t for the usage window length in minutes (default 1440). Responses use 200 for success, 400 for a bad request, 401 when the API key is missing or invalid, and 429 when rate limited. See the /meta/usage response in openapi.yaml under the OpenAPI specification on this page for the response schema.

Terminal window
export API_TOKEN="YOUR_API_TOKEN"
curl -sS "https://api.haveibeensquatted.com/v1/meta/usage" \
-H "Authorization: Bearer $API_TOKEN"

Lookup and analyze endpoints stream newline-delimited JSON as work completes (see each operation in the OpenAPI specification on this page). Here are examples of how to read those streams:

import httpx
import json
async def lookup_domain(domain: str, api_token: str):
async with httpx.AsyncClient() as client:
url = f"https://api.haveibeensquatted.com/v1/lookup/squat/{domain}"
headers = {"Authorization": f"Bearer {api_token}"}
async with client.stream("GET", url, headers=headers) as response:
async for line in response.aiter_lines():
if line.strip():
result = json.loads(line)
# Handle each result as it arrives
if result["op"] == "Meta":
print(f"Progress: {result['data']['data'][0]}/{result['data']['data'][1]}")
elif result["op"] == "GeoIp":
print(f"Found IP in {result['data']['country']['iso_code']}")

Endpoint-specific URLs and curl examples live on Lookup, Analyze, and Certificate Transparency.

Here are some examples of processing the JSON output using jq:

Terminal window
# Find domains hosted on specific ASNs
jq '.[] | select(.ips[].asn.number == 16509)' results.json
# List domains with suspicious hosting locations
jq '.[] | select(.ips[].country.iso_code != "US")' results.json
# Extract all unique ASNs
jq '.[] | .ips[].asn.organization' results.json | sort | uniq

For the complete JSON schema reference, see the JSON export reference.