API Documentation

Complete reference for all network diagnostic endpoints · OpenAPI 3.1 · interactive playground

Jump to Section
IP Info DNS Lookup HTTP Headers Port Scanner SSL Checker WHOIS / RDAP CT / Subdomains Batch Scan Share Links AI Report Health & Metrics Playground Error Codes Webhooks Rate Limits
📖 Jump to Section
Base URL https://your-worker.your-subdomain.workers.dev All endpoints return JSON: { status, message, data } · errors: { status: "error", code, message, data }
GET

IP Address Intelligence

/api/ip?data={ip-or-domain}

Multi-provider lookup (ip-api.com → ipwho.is → ipinfo.io) with failover, 24h cache, reverse DNS, threat flags, and meta (provider, cached, elapsedMs). Omitting data returns the caller's IP. SSRF-guarded.

ParameterTypeRequiredDescription
datastringoptionalIPv4, IPv6, or domain. Default: caller IP.

Cache: public, max-age=300, s-maxage=3600

GET

DNS Lookup — Multi-Resolvers

/api/dns?data={domain}&type={ALL|A|AAAA|MX|TXT|NS|CNAME|SOA|SRV}

Queries Cloudflare, Google, and Quad9 over DNS-over-HTTPS. Returns per-resolver answers, DNSSEC status (validated/secure/bogus/none), cross-resolver diff, homograph/punycode flags.

Cache: public, max-age=60, s-maxage=600

GET

HTTP Header Checker

/api/headers?data={url}

HEAD request with redirect-chain tracking (max 5 hops, each hop validated), HTTP version, full headers, and a 0-100 security score with per-header checks.

GET

Port Scanner — Streaming

/api/portscan?data={host}&ports={list}&stream=1

Concurrent engine (32 workers, randomized timeout jitter, banner capture). Range syntax 80,443,8000-8010, max 50 ports.

SSE: ?stream=1 emits start, progress, result, done events with 15s heartbeats.

Status: /api/portscan?scanId={id} returns snapshot; scans expire after 10 minutes.

GET

SSL/TLS Audit

/api/ssl?data={domain}&port={443}

Chain walk with per-level verification, OCSP revocation check (AIA responder), TLS version matrix (1.0-1.3), cipher negotiation probe, and 0-100 security score with breakdown + letter grade.

Allowed ports: 80, 443, 465, 993, 995, 8443

GET

WHOIS / RDAP Lookup

/api/whois?data={domain|ip|ASN}

RDAP-first with IANA bootstrap (cached 24h), fallback to raw port-43 WHOIS at whois.iana.org. Normalized fields: registrar, dates, nameservers, status codes, abuse contact, DNSSEC flag. Supports domains, IP ranges (inetnum), and AS{number}.

Cache: public, max-age=3600, s-maxage=86400

GET

Certificate Transparency

/api/ct?data={domain}

Subdomain discovery from crt.sh with certspotter fallback. Deduplicated names, wildcard badges, issuer lists, first/last seen, and an issuance timeline. Cached 24h (crt.sh is slow).

POST

Batch Scan Engine

POST /api/scan

Create an async job. Body: { tool: "dns"|"ip"|"ssl", items: ["a.com","8.8.8.8",...], webhookUrl?, webhookSecret? }. Max 200 unique items, concurrency 5, per-item pacing, automatic retry (2x), TTL 15 min.

GET /api/scan?jobId={id}

Job snapshot: status (created/queued/running/partial/done/failed/aborted), progress, ETA, results.

GET /api/scan?jobId={id}&stream=1

SSE events: start, progress, item, done.

GET /api/scan?abort={jobId}

Abort a running job.

POST

Share Links

POST /api/share

Body: { payload: { tool, query, result } } (max 8KB). Returns Crockford base32 code (8 chars), share URL, expiry (7 days).

GET /api/share?code={code}

Retrieve payload. Cache: public, max-age=3600, s-maxage=86400. Response includes ownerToken for deletion.

DELETE /api/share?code={code}&token={ownerToken}

Delete a share (owner token required).

GET /api/og?code={code}

SVG OpenGraph preview card for social embeds.

Client-only mode: #/share/{base64url-json} renders without server round-trip.

GET

AI Diagnostic Report

GET /api/ai?tool={ip|dns|ssl|portscan|headers|whois|ct}&data={json-encoded-result}&stream=1

Generates a human-language diagnostic summary via an OpenAI-compatible provider. Requires AI_API_KEY env. Results cached 24h (zero re-bill), daily budget guardrail (BUDGET_DAILY_USD), circuit breaker on repeated failures.

SSE: ?stream=1 streams data: {"token": "..."} chunks.

GET

Health & Metrics

GET /api/health

Memory, uptime, upstream reachability (rdap.org, Cloudflare DoH, crt.sh). Returns 503 when degraded. Exempt from rate limits.

GET /api/metrics

Rate-limit stats, cache hit ratios, error counts, active scans/jobs, KV mode. Exempt from rate limits.

Interactive Playground

Try any endpoint live. Response is validated against the OpenAPI contract in development mode.

"Press Run to fetch"

Error Codes

CodeHTTPMeaningExample body
BAD_REQUEST400Missing/invalid parameter{"status":"error","code":"BAD_REQUEST","message":"...","data":null}
INVALID_TARGET400Malformed hostname/IP/URL{"code":"INVALID_TARGET",...}
BLOCKED_TARGET403SSRF: private/loopback/link-local/metadata target{"code":"BLOCKED_TARGET","message":"resolves to blocked address 169.254.169.254 (...)"}
REBINDING_DETECTED403DNS answers changed between lookups{"code":"REBINDING_DETECTED",...}
NOT_FOUND404No data (domain/scan/share){"code":"NOT_FOUND","message":"Share link not found or expired"}
RATE_LIMITED429Too many requests; Retry-After header set{"code":"RATE_LIMITED","data":{"retryAfter":42,...}}
BUDGET_EXHAUSTED402Daily AI budget spent{"code":"BUDGET_EXHAUSTED",...}
UPSTREAM_ERROR502Upstream provider failed (after failover){"code":"UPSTREAM_ERROR",...}
SERVICE_UNAVAILABLE503Degraded (health){"code":"SERVICE_UNAVAILABLE",...}
INTERNAL_ERROR500Unexpected crash{"code":"INTERNAL_ERROR","message":"Internal server error"}

Webhooks (HMAC-Signed)

Pass webhookUrl + webhookSecret when creating a batch job. On completion the engine POSTs:

POST {webhookUrl}
Headers:
  X-Webhook-Signature: sha256={hex HMAC-SHA256 of raw body using webhookSecret}
  X-Webhook-Event: scan.completed
  X-Webhook-Idempotency-Key: {jobId}:{attempt}
Body: { "event":"scan.completed", "scanId":"...", "tool":"dns",
        "status":"done", "timestamp":"...", "attempt":1,
        "summary":{ "total":150, "ok":148, "failed":2 },
        "results":[ {item,status,result} ] }

Retries: 3 attempts with 1s/5s/30s backoff, 10s timeout. Verify the signature server-side with your secret — never trust an unauthenticated webhook.

Rate Limits

EndpointLimitBurst
/api/ip30/min/IP5
/api/dns60/min/IP10
/api/headers30/min/IP5
/api/portscan10/min/IP2
/api/ssl30/min/IP5
/api/whois20/min/IP4
/api/ct10/min/IP2
/api/scan (create)5/min/IP2
/api/ai5/min/IP1
/api/share, /api/health, /api/metricsexempt / 3010

Sliding window (60s) + token bucket. Headers: X-RateLimit-Limit, X-RateLimit-Remaining, Retry-After. Client IP taken from the first x-forwarded-for value. Optional Upstash Redis backend via UPSTASH_REDIS_REST_URL.