API Reference · v1.0.0
API Documentation
A tiny, key-free HTTP API. JSON for machines, SVG for humans. All responses are CORS-enabled and safe to embed anywhere.
Base URL:
https://ipcard.cogpu.com · No authentication · No rate limit on your own worker ·
Machine-readable docs ↗
Endpoints
| Method | Path | Description |
| GET | /api/ip | Full IP intelligence for the caller, or for ?ip=. |
| GET | /api/card.svg | Render an SVG card. Aliases: /api/card2.svg, /card.svg. |
| GET | /api/styles | Catalogue of styles, designs, widths and tag keys. |
| GET | /api/ua | Parsed User-Agent: browser, OS, device. |
| GET | /api/docs | This document as JSON. |
| GET | /api/health | Health check and edge colo. |
| GET | / | This UI. Also /en/card/?style=credit&view=all. |
Query Parameters
GET /api/ip
| Name | Type | Default | Description |
ip | string | caller | Arbitrary IPv4 / IPv6 to look up. Resolved via ipwho.is; invalid values return 400. |
demo | 1 | — | Return deterministic demo data (works outside Cloudflare). |
enrich | 1 | — | Merge proxy / VPN / Tor / hosting flags into the caller record; keeps Cloudflare's browser and edge data. |
GET /api/card.svg
| Name | Type | Default | Description |
design | string | classic | Design key. Credit: classic tier brand minimal vertical holo neon back retro globe. See /api/styles. |
w | number | 480 | Output width in px, 120–1400. Recommended 480. |
lang | en|zh | en | Language of the labels printed on the card. |
ip / demo | string | caller | Same semantics as /api/ip. |
tags | string | — | Comma separated, max 3: native,home,dual,cn2,9929,cmin2,bgp,tri,stream,ai,vip,boss,good. |
stamp | 0 | auto | Set to 0 to hide the detection-date stamp. |
UI parameters (on /)
| Name | Values | Description |
style | classic|credit|currency | Card family. Default credit. |
view | all | Tile every design of the chosen style (the reference URL behaviour). |
design, w, lang, tags, demo | — | Preselect card options. |
Response Schema · /api/ip
| Field | Type | Description |
ok | boolean | Always true on success. |
ip, version | string | Visitor address and IPv4 / IPv6. |
score | number | 0–100 estimated IP purity (heuristic, see below). |
level | string | Pristine ≥95, Clean ≥80, Normal ≥60, Suspicious ≥40, else Risky. |
native, hosting | boolean | Likely residential/native IP vs datacenter IP. |
location | object | country, countryCode, city, region, continent, latitude, longitude, postalCode, timezone, flag |
network | object | asn, org, isp, domain |
security | object | proxy, vpn, tor, anonymous, hosting |
client | object | browser, os, device, ua, language, scheme |
edge | object | colo, ray, protocol, eu |
stamp, timestamp | string | MM/YY detection date and ISO 8601 timestamp. |
source | string | cloudflare-cf | ipwho.is | demo |
How the Score Works
The purity score is a transparent heuristic, not a reputation database. It starts at 100 and subtracts for hosting / datacenter ASNs (−34), Tor (−30), proxy (−20), VPN (−18), anonymity (−10), missing geo (−8), missing ASN (−5) and browser-locale / geo mismatch (−4). Clean residential ASNs and IPv6 add a small bonus. The exact logic lives in computeScore() in the worker source.
For your own IP the score derives from Cloudflare edge metadata only. Add ?ip=8.8.8.8 to enrich an arbitrary address with security flags (proxy, VPN, Tor, hosting) from ipwho.is.
Examples
Embed Formats
Errors & Headers
| Status | Meaning |
200 | Success. JSON is application/json, cards are image/svg+xml. |
400 | Invalid ip or unknown design. |
404 | Unknown route. |
405 | Method other than GET / HEAD / OPTIONS. |
502 | Upstream IP lookup failed or timed out (4s). |
- CORS:
Access-Control-Allow-Origin: * on every API response; OPTIONS preflight returns 204.
- Caching:
/api/ip is no-store; SVG cards are cached 60s (600s with ?ip=).
- Privacy: only the requesting IP and standard request headers are read; nothing is stored or logged by this worker.
- SVG: fully self-contained — no external fonts, scripts or images — so it works inside
<img> on GitHub, forums and signatures.
Live Response