GeoLite2 API
HTTPS API for IPv4 city, country, and ASN lookups.
When ip is omitted, the service uses the caller's observed public IPv4.
This service supports IPv4 only.
Base URLs
Use any of the following base URLs:
https://geolite2.ipcrystal.comhttps://geolite2.kubectl.nethttps://geolite2.websocket.cn
Common endpoint prefix:
Request conventions
| Item | Value |
|---|---|
| Method | GET |
| Authentication | None (public API) |
| Transport | HTTPS |
| IP family | IPv4 only |
| Automatic detection | If ip is omitted, the caller's observed public IPv4 is used |
Query parameters
ip (optional)
IPv4 address in dotted-decimal format.
Example:
Example validation regex:
Lookup behavior:
?ip=<IPv4>: Lookup for the specified address.- Omit
ip: Lookup for the caller's observed public IPv4.
Endpoints
| Endpoint | Description | Optional query parameter |
|---|---|---|
/api/geolite2/lookup/city |
City-level geolocation | ip |
/api/geolite2/lookup/country |
Country-level geolocation | ip |
/api/geolite2/lookup/asn |
Autonomous System (ASN) data | ip |
All endpoints return lookup data for either the provided IPv4 address or the caller's observed public IPv4.
Examples
Set base URL
Lookup caller IPv4
Lookup a specific IPv4
Country lookup
ASN lookup
Quick test via alternate domain
Notes
- IPv6 addresses are not supported.
- Private, loopback, link-local, multicast, and invalid IPv4 addresses should not be used for public geolocation lookups.
- Always use HTTPS to avoid exposing request metadata.
- For reproducible results, explicitly provide the
ipparameter. - For application integrations, validate input before sending requests and add retries with backoff.