API キーは必要?
不要です。公開 HTTPS URL に GET してください。
この接続の公開 IP、または任意の IPv4/IPv6 を安定した ipkit.v1 JSON で返します。ベース https://ipkit.dev。API キー不要。
IPKit は Cloudflare エッジで動作します。HTML と JSON は同じ照会パイプラインです。実装どおりの HTTP API を説明します。SLA はなく、合理的な利用をお願いします。
スクリプトは JSON URL を呼び、HTTP ステータスと ipkit.v1 で分岐します。ホームページの「自分の IP」記事でも、/ip-lookup のホスト名と一括の説明でも、/ipv6 の接続テストでも、/asn-lookup の AS 番号ガイドでもありません。それらの HTML からフィールドを拾わないでください。IP ごと、ASN ごとの HTML ページはありません。
ブラウザのタブでは見えにくい 3 つの呼び出しです。ホスト名から ASN と組織、失敗すべきドキュメントアドレス、HTTP ステータス付きの現在の接続。
ホスト名から ASN と組織
dns.quad9.net は公開アドレスに解決されてから ipkit.v1 になります。jq は解決後の IP、ASN、組織、usage を残します。入力したホスト名はフィールドではありません。
curl -sS 'https://ipkit.dev/api/ip/dns.quad9.net' | jq '{ip,asn:.network.asn,org:.network.organization,usage:.network.usage}'ドキュメント範囲(400 が正常)
203.0.113.10 は TEST-NET-3(RFC 5737)です。HTTP 400、code は RESERVED_IP。この 400 は拒否であり、障害ではありません。
curl -sS -D - -o /tmp/ipkit-reserved.json --url https://ipkit.dev/203.0.113.10現在の IP とステータスコード
GET /api/my-ip はこの接続に対して常に JSON です。例は body を保存し、HTTP ステータスを別に出すので、200 と 429 を同じデータとして扱いません。
code=$(curl -sS -o /tmp/ipkit.json -w '%{http_code}' https://ipkit.dev/api/my-ip)
jq '{ip,type,source}' /tmp/ipkit.json
printf 'HTTP %s\n' "$code"すべて https://ipkit.dev 上です。パスは大小文字を区別します。IPv6 はシェルによっては引用またはパーセントエンコードが必要です。
Lookup routes accept GET, HEAD, and OPTIONS. HEAD returns the same status and headers with an empty body. POST and other methods are not part of the lookup API. Clients do not send an API key; arbitrary lookups still need the operator-configured IPREGISTRY_API_KEY Worker secret.
There is no plaintext-only route and no endpoint that returns a single field. Read ip from the ipkit.v1 object (for example jq -r .ip). Lookups of private, loopback, link-local, CGNAT, multicast, unspecified, documentation, and other reserved IPv4/IPv6 ranges (including IPv4-mapped IPv6 such as ::ffff:10.0.0.1) return 400 RESERVED_IP. Current-IP detection of this connection is not subject to that check.
HTML と JSON を切り替えるのは / だけです。/{ip} と /api/* は常に JSON です。
Full nullable contract for parsers. The homepage mentions a shorter set of fields for people reading HTML; clients should use this list, including nulls and the difference between source=ipregistry and source=cloudflare. Successful lookups return Content-Type application/json; charset=utf-8, pretty-printed with two-space indent and a trailing newline. Field names stay in English. null means that value was not supplied. Locations are network estimates, not a street address or identity.
source is "ipregistry" when the configured intelligence provider succeeded. It is "cloudflare" when the record is built from Cloudflare request metadata (used for the current IP if the provider is missing or fails). Cloudflare metadata describes the connecting client only; it is never used as geolocation for a different target IP. Cloudflare-sourced records fill location.countryCode from request.cf.country or CF-IPCountry and location.country from that code when a name is known. Several network fields stay null, security flags are null, and security.risk is "unknown". If IPREGISTRY_API_KEY is unset, arbitrary lookups return 503 instead of guessing the caller’s country.
Illustrative ipkit.v1 object for 8.8.8.8. Values change with the address and data source; clients must tolerate nulls.
{
"schema": "ipkit.v1",
"ip": "8.8.8.8",
"type": "IPv4",
"source": "ipregistry",
"location": {
"continent": "North America",
"country": "United States",
"countryCode": "US",
"region": "California",
"regionCode": "CA",
"city": "Mountain View",
"postalCode": null,
"latitude": 37.386,
"longitude": -122.0838,
"timezone": "America/Los_Angeles"
},
"network": {
"asn": "AS15169",
"organization": "Google LLC",
"domain": "google.com",
"route": "8.8.8.0/24",
"usage": "hosting",
"carrier": null
},
"security": {
"proxy": false,
"vpn": false,
"tor": false,
"relay": false,
"cloud": true,
"threat": false,
"risk": "medium"
}
}Failures return JSON { "error": string, "code": string } with Cache-Control: no-store. error is a human-readable message; code is a stable machine token.
エラーを含むすべての JSON 照会応答に Access-Control-Allow-Origin: * が付きます。OPTIONS プリフライト (204) は /、/{ip}、/api/my-ip、/api/ip/{ip} で、許可メソッドは GET, HEAD, OPTIONS、Max-Age 86400。/ の HTML は CORS JSON ではありません。
接続元クライアント IP あたり 60 秒で 300 リクエスト。SLA はありません。無料の公開ツールであり、契約 API ではありません。
Current-IP JSON (negotiated / and /api/my-ip) is Cache-Control: private, no-store so one client’s address is not reused for another. Specific-IP lookups (/{ip} and /api/ip/{ip}) are Cache-Control: public, max-age=300, s-maxage=3600, stale-while-revalidate=86400. Error responses are no-store. / JSON also varies on Accept and CF-Connecting-IP.
No authentication. HTTPS only. Parse schema and handle nulls and error objects.
Current public IP (curl)
curl https://ipkit.devLook up an address
curl https://ipkit.dev/8.8.8.8IPv6 in the path (quote colons)
curl "https://ipkit.dev/2001:4860:4860::8888"Always-JSON current IP
curl https://ipkit.dev/api/my-ipJavaScript fetch
const response = await fetch('https://ipkit.dev', {
headers: { Accept: 'application/json' },
});
const data = await response.json();
console.log(data.ip, data.location.countryCode);Python
import json, urllib.request
with urllib.request.urlopen('https://ipkit.dev') as response:
data = json.load(response)
print(data['ip'], data['location']['countryCode'])Shell one-liner (scripts / DDNS)
curl -sS https://ipkit.dev | jq -r .ip照会のため、対象アドレスと通常のリクエストメタデータを Cloudflare エッジで処理します。訪問者 IP のアプリ DB はありません。位置はネットワーク推定です。プライバシーポリシーを参照してください。
プライバシーポリシー · IP 検索 · IPv6 テスト · ASN 検索
不要です。公開 HTTPS URL に GET してください。
text/plain はありません。JSON を解析: curl -sS https://ipkit.dev | jq -r .ip
Accept に text/html が含まれるため。?format=json か /api/my-ip を使ってください。
不可。/{ip} と /api/ip/{ip} は私有・予約範囲を 400 RESERVED_IP で拒否します。GET / と /api/my-ip は接続元クライアントを返します。
「IP intelligence is not configured for arbitrary lookups.」は、ipkit.dev を配信する Cloudflare アカウントに Worker シークレット IPREGISTRY_API_KEY が無いことを意味します。現在 IP の検出は引き続き動きます。