# The IP API > IP geolocation, ASN lookup, and network intelligence API The IP API (theipapi.com) provides accurate IP geolocation, ASN (Autonomous System Number) lookup, and network intelligence data through a simple REST API. It returns location details, network ownership, and threat indicators (VPN, datacenter, bogon detection) for any IPv4 or IPv6 address. ## Getting Started 1. Sign up for a free account at https://theipapi.com/signup 2. Confirm your email to receive your API key 3. Make requests to https://api.theipapi.com/v1/ip/{ip}?api_key=YOUR_API_KEY Free plan: 1,000 requests per day. Paid plans start at $19/month for 600,000 requests/month. ## Authentication All API requests require an API key passed as a query parameter: ?api_key=YOUR_API_KEY ## Endpoints ### IP Geolocation GET https://api.theipapi.com/v1/ip/{ip_address}?api_key=YOUR_API_KEY Returns geolocation, ASN, company, and threat intelligence data for an IP address. Supports both IPv4 and IPv6. Example request: curl "https://api.theipapi.com/v1/ip/8.8.8.8?api_key=YOUR_API_KEY" Example response: { "status": "OK", "body": { "ip": "8.8.8.8", "location": { "city": "Mountain View", "country": "United States of America", "country_code": "US", "latitude": 37.386, "longitude": -122.0838, "region": "California", "timezone": "America/Los_Angeles" }, "asn": { "asn": 15169, "asn_description": "Google LLC", "country": "US", "created": "2005-11-23", "network": "8.8.8.0/24", "org_name": "Google LLC", "rir": "ARIN", "updated": "2019-10-31" }, "company": { "name": "Google LLC", "address": "1600 Amphitheatre Parkway, Mountain View, CA, US", "network": "8.8.8.0 - 8.8.8.255", "route": "8.8.8.0/24" }, "is_bogon": false, "is_datacenter": true, "is_vpn": false }, "response_time_ms": 10 } Response fields: - location.city - City name - location.country - Full country name - location.country_code - ISO 3166-1 alpha-2 code - location.latitude, location.longitude - Coordinates - location.region - State or province - location.timezone - IANA timezone identifier - asn.asn - Autonomous System Number (integer) - asn.asn_description - ASN organization description - asn.country - Country code from WHOIS - asn.created, asn.updated - Registration dates - asn.network - CIDR prefix for this IP - asn.org_name - Organization name - asn.rir - Regional Internet Registry (ARIN, RIPE, APNIC, LACNIC, AFRINIC) - company.name - Network operator name - company.address - Operator address from WHOIS - company.network - IP range (dotted notation) - company.route - CIDR route - is_bogon - true if IP is reserved/private (RFC 1918, RFC 5737, etc.) - is_datacenter - true if IP belongs to a known datacenter - is_vpn - true if IP belongs to a known VPN provider - response_time_ms - Server processing time in milliseconds Bogon IPs return a minimal response with only ip and is_bogon fields. ### ASN Lookup GET https://api.theipapi.com/v1/asn/{asn_number}?api_key=YOUR_API_KEY Returns registration and organization details for an Autonomous System Number. Example request: curl "https://api.theipapi.com/v1/asn/15169?api_key=YOUR_API_KEY" Example response: { "status": "OK", "body": { "asn": { "asn": 15169, "asn_description": "Google LLC", "country": "US", "created": "2005-11-23", "org_name": "Google LLC", "rir": "ARIN", "updated": "2019-10-31" } }, "response_time_ms": 5 } ### Batch IP Geolocation POST https://api.theipapi.com/v1/ip/batch?api_key=YOUR_API_KEY Look up multiple IP addresses in a single request. Maximum 100 IPs per request. Example request: curl -X POST "https://api.theipapi.com/v1/ip/batch?api_key=YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"ips": ["8.8.8.8", "1.1.1.1"]}' Request body: {"ips": ["8.8.8.8", "1.1.1.1", "9.9.9.9"]} Example response: { "status": "OK", "results": { "8.8.8.8": { "status": "OK", "body": { ... }, "response_time_ms": 12 }, "1.1.1.1": { "status": "OK", "body": { ... }, "response_time_ms": 8 } }, "total_ips": 2, "response_time_ms": 15 } Batch notes: - Maximum 100 IPs per request - Duplicate IPs are deduplicated and counted once - Each unique IP counts as one request against your quota - All-or-nothing quota check: if insufficient quota for all IPs, the batch is rejected - Individual IP failures return per-IP errors; other IPs succeed normally - Request body limited to 100KB ## Error Responses Most errors return an HTTP error status with a JSON body: {"status": "Error", "error": "Invalid API Key"} A single-IP lookup with no matching record can return HTTP 200 with `"status": "Error"`; always check the JSON status field before using body. HTTP status codes: - 200 - Success, or a single-IP lookup with no matching record - 400 - Bad request (invalid ASN, invalid JSON, too many IPs, or invalid IP in a batch) - 401 - Unauthorized (missing or invalid API key) - 404 - ASN not found - 405 - Method not allowed - 429 - Rate limit exceeded - 500 - Internal server error ## Rate Limits | Plan | Requests | Price | Notes | |------|----------|-------|-------| | Free | 1,000/day | Free | Resets daily | | Beginner | 600,000/month | $19/month | Monthly billing period | | Standard | 3,000,000/month | $49/month | Choice of edge PoP (US / EU) | | Premium | 15,000,000/month | $99/month | Choice of edge PoP (US / EU) | When your quota is exceeded, the API returns HTTP 429. Need more than 15M req/month? Contact us via https://theipapi.com/contact. ## Free Website Tools Public, no-signup tools are available at https://theipapi.com/tools: - /tools/ip-calculator - IPv4/IPv6 subnet calculator - /tools/dns-lookup - DNS record lookup (A, AAAA, CNAME, MX, NS, TXT) - /tools/what-is-my-ip - public IP and geolocation details - /tools/asn-lookup - ASN ownership and WHOIS details - /tools/ip-to-asn - map an IP address to its ASN and route - /tools/reverse-dns-lookup - PTR / reverse DNS lookup by IP - /tools/whois - WHOIS lookup for domains and IP addresses - /tools/ip-converter - convert IPs between dotted decimal, integer, binary, and hex formats ## Links - Website: https://theipapi.com - Documentation: https://theipapi.com/documentation - Pricing: https://theipapi.com/pricing - Sign up: https://theipapi.com/signup - Free Tools: https://theipapi.com/tools - FAQ: https://theipapi.com/faq - Contact: https://theipapi.com/contact - Blog: https://theipapi.com/blog - Blog RSS feed: https://theipapi.com/feed.xml - API catalog (RFC 9727): https://theipapi.com/.well-known/api-catalog - Agent skills index (Agent Skills Discovery RFC v0.2.0): https://theipapi.com/.well-known/agent-skills/index.json ## For Agents Content pages (homepage, /pricing, /documentation, /faq, and /blog) support markdown content negotiation: send the request header `Accept: text/markdown` to receive a clean markdown rendering of the page instead of HTML. A skills discovery index is published at https://theipapi.com/.well-known/agent-skills/index.json (Agent Skills Discovery RFC v0.2.0). It lists the `ip-lookup` skill, whose SKILL.md teaches an agent how to call the IP, batch, and ASN endpoints.