# IPinfo

> Free, keyless IP address and network lookup API: public IP, approximate geolocation (country, region, city, coordinates, time zone), and ASN/network organization, from self-hosted GeoLite2 databases. No account, API key, or cookies.

Without `?ip=`, every lookup describes the IP address that connected to this service (the caller's public IP). Add `?ip=<IPv4 or IPv6>` to look up any address. Geolocation is approximate and may reflect a VPN or provider. Private/reserved addresses return only the address.

## Quick start

- `curl https://ip.bea.sh/json` — all available fields as JSON
- `curl https://ip.bea.sh/ip` — plain-text IP address
- `curl 'https://ip.bea.sh/json?ip=8.8.8.8'` — look up a specific address
- `curl https://ip.bea.sh/country-iso` — a single field as plain text

## API

- [OpenAPI 3.1 description](https://ip.bea.sh/openapi.json): machine-readable schema for every endpoint
- [Usage guide](https://ip.bea.sh/usage): terminal-friendly plain-text reference with examples
- [MCP server](https://ip.bea.sh/mcp): Streamable HTTP Model Context Protocol endpoint (stateless, no auth) with tools `lookup_ip`, `get_database_info`, `check_port`

## Behavior

- JSON omits unavailable fields; single-field endpoints return HTTP 404 when a value is unavailable.
- Errors are JSON objects with an `error` message. Invalid addresses return 400.
- HTTP 429 means the per-source-IP rate limit was reached; wait `Retry-After` seconds.
- Responses are never cached (`Cache-Control: no-store`); CORS is open to all origins.
- GET and HEAD are supported on lookup routes.

## Optional

- [Database info](https://ip.bea.sh/database-info): GeoLite2 build dates and update status
- [Health](https://ip.bea.sh/healthz): service status and build revision
- [Statistics](https://ip.bea.sh/stats.json): aggregate request counters for this deployment
