{
  "ok": true,
  "name": "IP Card API",
  "version": "1.0.0",
  "base": "https://ip.cogpu.com",
  "description": "Visitor IP intelligence + embeddable SVG credit-card images. No API key required.",
  "endpoints": [
    {
      "method": "GET",
      "path": "/api/ip",
      "description": "Full IP intelligence for the caller (or for ?ip=).",
      "params": [
        {
          "name": "ip",
          "type": "string",
          "required": false,
          "description": "Lookup an arbitrary IPv4/IPv6 instead of the caller. Uses ipwho.is."
        },
        {
          "name": "demo",
          "type": "string",
          "required": false,
          "description": "Set to 1 for deterministic demo data."
        },
        {
          "name": "enrich",
          "type": "1",
          "required": false,
          "description": "Merge proxy/VPN/Tor/hosting flags from ipwho.is into the caller record. Falls back to edge-only data on failure."
        }
      ]
    },
    {
      "method": "GET",
      "path": "/api/card.svg",
      "description": "Render an SVG card. Aliases: /api/card2.svg and /card.svg.",
      "params": [
        {
          "name": "design",
          "type": "string",
          "required": false,
          "description": "One of the design keys from /api/styles. Default: classic."
        },
        {
          "name": "w",
          "type": "number",
          "required": false,
          "description": "Output width in px (120-1400). Default 480."
        },
        {
          "name": "lang",
          "type": "string",
          "required": false,
          "description": "en | zh for card labels. Default en."
        },
        {
          "name": "ip",
          "type": "string",
          "required": false,
          "description": "Render a card for another IP."
        },
        {
          "name": "demo",
          "type": "string",
          "required": false,
          "description": "Set to 1 for demo data."
        },
        {
          "name": "tags",
          "type": "string",
          "required": false,
          "description": "Comma separated, max 3: native,home,dual,cn2,9929,cmin2,bgp,tri,stream,ai,vip,boss,good."
        },
        {
          "name": "stamp",
          "type": "string",
          "required": false,
          "description": "Set to 0 to hide the date stamp."
        }
      ]
    },
    {
      "method": "GET",
      "path": "/api/styles",
      "description": "Catalogue of styles, designs, themes and tag keys."
    },
    {
      "method": "GET",
      "path": "/api/docs",
      "description": "This document, as JSON."
    },
    {
      "method": "GET",
      "path": "/api/health",
      "description": "Health check."
    },
    {
      "method": "GET",
      "path": "/",
      "description": "iOS-style UI with a live API reference tab. Also /en/card/?style=credit&view=all."
    },
    {
      "method": "GET",
      "path": "/manifest.webmanifest",
      "description": "PWA install manifest. Alias: /manifest.json."
    },
    {
      "method": "GET",
      "path": "/sw.js",
      "description": "Service Worker: network-first navigation, offline app shell and cached SVG cards."
    },
    {
      "method": "GET",
      "path": "/icon-512.png",
      "description": "512x512 PNG app icon, also used as apple-touch-icon."
    }
  ],
  "uiParameters": [
    {
      "name": "style",
      "values": "classic | credit | currency",
      "description": "Card family. Default credit."
    },
    {
      "name": "view",
      "values": "all",
      "description": "Tile every design of the selected style."
    },
    {
      "name": "design",
      "values": "design key",
      "description": "Preselect one design."
    },
    {
      "name": "w",
      "values": "240 | 360 | 480 | 560 | 720",
      "description": "Preview width."
    },
    {
      "name": "lang",
      "values": "en | zh",
      "description": "Card label language (UI stays English)."
    },
    {
      "name": "demo",
      "values": "1",
      "description": "Use demo data, works without the Cloudflare edge."
    }
  ],
  "responseFields": {
    "ip": "string — visitor IP",
    "version": "IPv4 | IPv6",
    "score": "number 0-100 — estimated IP purity",
    "level": "Pristine | Clean | Normal | Suspicious | Risky",
    "native": "boolean — likely residential/native IP",
    "hosting": "boolean — likely datacenter / hosting IP",
    "location": "country, countryCode, city, region, continent, latitude, longitude, postalCode, timezone, flag",
    "network": "asn, org, isp, domain",
    "security": "proxy, vpn, tor, anonymous, hosting",
    "client": "browser, os, device, ua, language, scheme",
    "edge": "colo, ray, protocol, eu",
    "stamp": "MM/YY detection date",
    "timestamp": "ISO 8601",
    "source": "cloudflare-cf | ipwho.is | demo"
  },
  "scoreNotes": "The purity score is a transparent heuristic, not a reputation database: starts at 100, then subtracts for hosting/DC ASNs, Tor, proxy, VPN, anonymity, missing geo/ASN and locale/geo mismatch. It is deterministic and can be re-implemented from computeScore().",
  "errorCodes": [
    {
      "status": 400,
      "meaning": "Invalid ip / design parameter"
    },
    {
      "status": 404,
      "meaning": "Unknown route"
    },
    {
      "status": 502,
      "meaning": "Upstream IP lookup failed or timed out"
    },
    {
      "status": 405,
      "meaning": "Method not allowed"
    }
  ],
  "examples": {
    "curl": "curl -s \"https://https://ip.cogpu.com/api/ip\"",
    "arbitraryIp": "curl -s \"https://https://ip.cogpu.com/api/ip?ip=8.8.8.8\"",
    "svg": "curl -s \"https://https://ip.cogpu.com/api/card.svg?design=classic&w=480\" -o card.svg",
    "markdown": "[![IP card](https://https://ip.cogpu.com/api/card.svg?design=classic&w=480)](https://https://ip.cogpu.com/)",
    "html": "<a href=\"https://https://ip.cogpu.com/\"><img src=\"https://https://ip.cogpu.com/api/card.svg?design=classic&w=480\" alt=\"IP card\" width=\"480\"></a>",
    "javascript": "fetch('https://https://ip.cogpu.com/api/ip').then(r=>r.json()).then(console.log)"
  }
}