Skip to content

API Integration Guide

Learn how to integrate Have I Been Squatted’s API into your security workflows.

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.

If you previously used a legacy JWT, rotate to a platform API token. Legacy /v1/squat and /v1/nxdomain routes exist for older JWT integrations; new tokens should use the /v1/lookup/* and /v1/analyze/* routes.

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

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

When creating a token, you can 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.

We currently expose these endpoint families:

  • https://api.haveibeensquatted.com/v1/lookup/squat/{domain} - Lookup a single domain for squatting
  • https://api.haveibeensquatted.com/v1/lookup/nxdomain/{domain} - Lookup a single domain for unregistered domains (NXDOMAIN)
  • https://api.haveibeensquatted.com/v1/analyze/{domain} - Analyze a single domain for threats
  • https://api.haveibeensquatted.com/v1/ct/* - Certificate Transparency search and hydration
Terminal window
export HIBS_API_TOKEN="YOUR_API_TOKEN"
domain="example.com"
curl -N "https://api.haveibeensquatted.com/v1/lookup/squat/$domain" \
-H "Authorization: Bearer $HIBS_API_TOKEN"

Lookup and analyze endpoints use HTTP/2 streaming to provide real-time results. Here are examples of how to handle the streamed JSON responses:

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']}")

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 our JSON Schema Documentation.