Preciso de chave API?
Não. GET nas URL HTTPS públicas.
Consulte o IP público desta ligação, ou qualquer IPv4/IPv6, como JSON ipkit.v1 estável. Base https://ipkit.dev. Sem chave.
O IPKit corre no edge da Cloudflare. HTML e JSON partilham o mesmo pipeline. Esta página documenta a API HTTP como está no código. Sem SLA; use com moderação.
Os scripts chamam os URL JSON e ramificam pelo estado HTTP e pelo objeto ipkit.v1. Não é o artigo “qual é o meu IP”, nem o percurso de hostname/lote em /ip-lookup, nem o teste IPv6 em /ipv6, nem o guia de números AS em /asn-lookup. Não extraia campos dessas páginas HTML. Não há uma página HTML por IP ou por ASN.
Três chamadas que um separador do browser esconde: um hostname reduzido a ASN e organização, um endereço de documentação que tem de falhar, e a ligação atual com o estado HTTP.
Hostname, depois ASN e organização
dns.quad9.net é resolvido para um endereço público e devolvido como ipkit.v1. O jq fica com o IP, o ASN, a organização e usage. O hostname escrito não é um campo.
curl -sS 'https://ipkit.dev/api/ip/dns.quad9.net' | jq '{ip,asn:.network.asn,org:.network.organization,usage:.network.usage}'Intervalo de documentação (espera-se 400)
203.0.113.10 é TEST-NET-3 (RFC 5737). A resposta é HTTP 400 com RESERVED_IP. Esse 400 é uma recusa, não uma falha do serviço.
curl -sS -D - -o /tmp/ipkit-reserved.json --url https://ipkit.dev/203.0.113.10IP atual e código HTTP
GET /api/my-ip é sempre JSON para esta ligação. O excerto guarda o corpo e imprime o estado HTTP à parte para não tratar 200 e 429 como a mesma carga.
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"Tudo em https://ipkit.dev. Os caminhos distinguem maiúsculas. Codifique IPv6 se a shell partir nos dois pontos.
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.
Só / escolhe HTML ou JSON. /{ip} e /api/* devolvem sempre 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.
Todas as respostas JSON (incluindo erros) incluem Access-Control-Allow-Origin: *. O preflight OPTIONS (204) existe em /, /{ip}, /api/my-ip e /api/ip/{ip} (GET, HEAD, OPTIONS; Max-Age 86400). O HTML de / não é JSON CORS.
300 pedidos por 60 segundos por IP do cliente. Sem SLA. Uso razoável: ferramenta pública gratuita, não uma API contratada.
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 .ipO IPKit processa o endereço pedido e metadados HTTP no edge da Cloudflare. Não há base de IPs de visitantes. A localização é estimativa de rede. Ver a política de privacidade.
Política de privacidade · IP lookup · Teste IPv6 · ASN lookup
Não. GET nas URL HTTPS públicas.
Não há text/plain. Faça parse do JSON: curl -sS https://ipkit.dev | jq -r .ip
Accept inclui text/html. Use ?format=json ou /api/my-ip.
Não. /{ip} e /api/ip/{ip} recusam intervalos privados/reservados com 400 RESERVED_IP. GET / e /api/my-ip continuam a devolver o cliente ligado.
A mensagem "IP intelligence is not configured for arbitrary lookups." significa que falta o segredo Worker IPREGISTRY_API_KEY na conta Cloudflare de ipkit.dev. A IP atual continua a funcionar.