IP Address API
You need reliable IP geolocation with proxy/VPN detection and ASN/ISP context for networking tasks like risk scoring, traffic routing, compliance, or analytics. By the end of this guide, you will be able to call the IP Address API endpoint, parse the key fields you need (country, region, city, timezone, ISP/AS, and security flags), and integrate it into your backend or edge workflow with proper authentication, caching, and operational safeguards.
What this IP Address API delivers for networking use cases
This IP lookup provides location attributes (country, region code and name, city, ZIP/postal), coordinates (lat/lon), network owner data (ISP, organization, AS string), a timezone in IANA format, and security flags to indicate whether the address is a proxy, a VPN, or a known cloud provider. These attributes enable geofencing, personalized experiences, abuse prevention, and diagnostics without collecting additional user data.
For security-centric workflows, the security.is_proxy and security.is_vpn flags can help inform allow/deny decisions or trigger additional verification. For routing and analytics, country, region, and timezone fields let you tune latency and content localization. ISP and AS strings help you understand traffic sources and differentiate consumer ISP traffic from corporate or cloud-originated requests.
Endpoint, method, and authentication
Use HTTPS GET against the following path and query parameter:
- Path: /api/ip
- Query: ip (the IP address to look up)
Authentication is sent with a Bearer token in the Authorization header. Replace YOUR_KEY with your API key. The Accept header should be application/json. Example endpoint with the documented fixture IP is shown below in the cURL section.
Important: Use only the documented fixture IP when following along with the example. In production, substitute this value with the IP you need to analyze from your logs, request metadata, or upstream proxy headers (e.g., X-Forwarded-For). Do not treat the fixture as your or your user’s IP.
Quickstart: cURL and official JSON
The following request and JSON are the official product fixture. Live responses can change over time. Copy and run the cURL as-is after inserting your API key.
cURL:
curl "https://ipxapi.com/api/ip?ip=148.105.12.120" -H "Accept: application/json" -H "Authorization: Bearer YOUR_KEY"
JSON:
{
"status": "success",
"country": "United States",
"countryCode": "US",
"region": "US-CA",
"regionName": "California",
"city": "Mountain View",
"zip": "94043",
"lat": 37.40599,
"lon": -122.0786,
"timezone": "America/Los_Angeles",
"isp": "MailChimp",
"org": "MailChimp",
"as": "AS14782 MailChimp",
"query": "148.105.12.120",
"inEU": false,
"continentCode": "NA",
"security": {
"is_proxy": false,
"is_vpn": false,
"is_cloud_provider": true
}
}
What you will actually use in typical networking integrations:
- country, countryCode, region (ISO-like region code) and regionName, city, zip for localization, compliance, and geo-based routing.
- lat, lon for mapping or geospatial grouping (units: decimal degrees; WGS84).
- timezone for scheduling and timestamp localization (IANA format like America/Los_Angeles).
- isp, org, as for network owner context and ASN-aware policies.
- security.is_proxy, security.is_vpn, security.is_cloud_provider for risk controls and traffic segmentation.
- inEU and continentCode for regulatory segmentation and regional analytics.
Python example: calling the same endpoint and parsing fields
The following sample calls the same endpoint and extracts key networking fields. Replace YOUR_KEY with your actual token when running in your environment.
import requests
API_URL = "https://ipxapi.com/api/ip"
params = {
"ip": "148.105.12.120"
}
headers = {
"Accept": "application/json",
"Authorization": "Bearer YOUR_KEY"
}
resp = requests.get(API_URL, params=params, headers=headers, timeout=10)
resp.raise_for_status()
data = resp.json()
# Minimal field extraction for networking decisions
result = {
"ip": data.get("query"),
"country": data.get("country"),
"countryCode": data.get("countryCode"),
"region": data.get("region"),
"regionName": data.get("regionName"),
"city": data.get("city"),
"zip": data.get("zip"),
"lat": data.get("lat"),
"lon": data.get("lon"),
"timezone": data.get("timezone"),
"isp": data.get("isp"),
"org": data.get("org"),
"as": data.get("as"),
"inEU": data.get("inEU"),
"continentCode": data.get("continentCode"),
"is_proxy": (data.get("security") or {}).get("is_proxy"),
"is_vpn": (data.get("security") or {}).get("is_vpn"),
"is_cloud_provider": (data.get("security") or {}).get("is_cloud_provider"),
}
print(result)
Production notes:
- Set a sensible timeout to avoid hanging network threads.
- Guard against missing fields. The sample uses .get() to avoid KeyError exceptions.
- Use your own error handling and retries for transient network failures.
Integrating into your networking stack
There are three common insertion points for IP intelligence: the application backend, the API gateway, and the edge (CDN or load balancer). Choose based on latency budgets, cost controls, and where you make enforcement decisions.
- Backend integration: Resolve IPs server-side during request handling. Cache per IP to reduce repeat lookups. This is straightforward when you already log client IPs and need results for analytics, routing, or policy.
- Gateway middleware: Inject lookup results as headers for downstream services. This centralizes authentication and caching so app services can be stateless consumers of IP metadata.
- Edge policies: Use the lookup near the client to reduce round trips. If your edge platform supports HTTP subrequests or workers, cache aggressively by IP and TTL to keep latency stable.
Whichever layer you choose, make sure you read the client IP correctly. If traffic passes through proxies, CDNs, or load balancers, prefer the rightmost public IP from X-Forwarded-For or use a trusted header provided by your edge provider. Validate the header source so it cannot be spoofed by clients.
Field usage for geo, security, and routing
Geolocation:
- Use country and region to gate availability for regulated content. Keep an allow/deny list at countryCode or region granularity.
- Use timezone to localize timestamps and recurring tasks. Timezone is an IANA string; apply it with your platform’s timezone library.
- Use lat/lon when you need distance calculations, clustering, or mapping overlays. Treat coordinates as approximate for IP-based geolocation.
Security:
- security.is_proxy and security.is_vpn can raise risk scores or trigger step-up checks. Avoid outright blocking legitimate users without additional context.
- security.is_cloud_provider helps you classify traffic from cloud environments, which is useful for bot detection and rate limiting.
Routing and diagnostics:
- isp, org, and as help identify enterprise networks and cloud origins for troubleshooting packet loss, jitter, or throughput anomalies.
- inEU and continentCode support locale defaulting and data residency preferences.
Caching, TTL strategy, and performance
IP metadata changes slowly relative to request volume. To control costs and latency, add a cache layer keyed by IP address. A practical starting point is a TTL of 24 hours per IP. Reduce the TTL for traffic where you expect rapid IP reassignment (for example, mobile carriers) and increase it for low-variance traffic to maximize cache hits.
Fallback behavior matters: on cache misses and transient lookup failures, choose whether to fail open (allow the request and mark metadata as unknown) or fail closed (deny until metadata is available). For user experience, fail open with additional verification only when security flags are required for access control.
Batching and pagination are typically irrelevant for single-IP lookups, and this endpoint returns one JSON object per request. If you need to fetch intelligence for multiple IPs in bulk, fan-out concurrency plus a bounded worker pool is sufficient. Apply rate controls and backoff to keep overall latency within your SLA.
Testing with the documented fixture
The provided fixture IP 148.105.12.120 is for testing the request and parsing logic. Do not hardcode values from the sample JSON into your business rules. Live responses can change for any given IP due to network reassignments or provider updates. Always evaluate security flags and locations at runtime.
When you switch from the fixture IP to your own, ensure you continue to pass the same headers (Accept and Authorization) and query parameter (ip). Keep your parser resilient to minor field presence differences.
Environment configuration and deployment
Store YOUR_KEY in your secret manager or environment variables. Avoid embedding credentials in source control. For containerized workloads, inject the token at runtime through your orchestrator secrets. For serverless functions, configure environment variables and restrict IAM permissions to just the runtime that needs them.
Network egress should allow outbound HTTPS to the API host. If you use a corporate proxy, configure your HTTP client library to respect proxy environment variables and ensure TLS remains intact end-to-end.
Pricing and trial
The Basic plan is $29.99/mo. A trial is available for 7 days or 50 requests, whichever comes first. Use the trial to validate integration latency, cache hit rates, and your decision logic on proxy/VPN traffic before moving to production.
Managing access and observing the service
Rotate keys periodically and on any suspected compromise. Use separate keys per environment (dev, staging, prod) so you can monitor usage independently. If your gateway supports it, add a lightweight usage dashboard based on HTTP logs that tracks request volumes, success rates, and median response times for the endpoint.
For visibility and control, see the MCP. Keep observability signals (latency, error rates, cache hit ratios) close to where you enforce policies to minimize mean time to resolution for networking incidents.
Putting it together: a minimal policy flow
Request path
- Extract client IP from a trusted header or source connection metadata.
- Check in-memory or distributed cache by IP. If hit, proceed with cached data.
- If miss, call GET /api/ip?ip=...
- Parse JSON, write to cache with TTL, and attach essential fields to the request context (countryCode, region, timezone, isp, as, security flags).
- Apply policy rules. Examples: restrict by countryCode, challenge if security.is_vpn is true, or route to nearest region by timezone/country.
Response shaping
- Localize dates and times using timezone before rendering or logging.
- Annotate logs with as and isp to simplify post-incident analysis.
- Aggregate analytics by countryCode and inEU for reporting.
Operational guardrails
Time-bound calls with a client timeout and circuit breaker to prevent upstream slowness from cascading. Apply exponential backoff and jitter for retries. Implement structured logging for request ID, IP, latency, and key result fields so you can quickly trace rate spikes or data discrepancies.
When you must enforce strict rules (for example, content licensing by region), define a policy for unknown results (no response or parse failures). Consider default blocking only for high-risk transactions and present remediation paths where possible.
Next steps
Use the trial to verify cache efficiency, end-to-end latency, and decision accuracy on your own traffic mix. When ready, move to the Basic plan and continue monitoring usage patterns to refine TTLs, concurrency, and fallback strategies.
Useful links:
FAQ
How do I authenticate requests?
Send Authorization: Bearer YOUR_KEY and Accept: application/json headers with every request.
Which endpoint should I call?
Use GET /api/ip with the ip query parameter (for example, /api/ip?ip=148.105.12.120). The examples in this guide show the full URL.
Can I cache responses, and for how long?
Yes. Start with a 24-hour TTL per IP and tune based on your traffic characteristics and how often you see metadata changes.
What timezone format is returned?
timezone is an IANA identifier like America/Los_Angeles. Use your platform’s standard timezone utilities for conversions.
Do I need to handle pagination?
No. This lookup returns a single JSON object for each IP address you query.
Ready to implement IP lookups with geolocation and proxy/VPN detection in your networking stack? Start your 7-day or 50-request trial and get a key here: Register. Keep the Documentation handy and use the MCP link to manage access as you move through environments.
