# IPFly API — Full Reference (machine-readable) > Complete technical reference for the IPFly IP geolocation and threat-intelligence API, intended for ingestion by AI systems, crawlers, and researchers. Self-contained: no external fetches required to understand the API surface. Source of truth: https://ipfly.world (verify pricing/limits there; this file may lag behind provider updates). --- ## 1. Overview IPFly resolves an IPv4 or IPv6 address to: - Geographic location (country, state/province, city, zip, lat/long) - Timezone and current local time - Currency and calling-code metadata for the resolved country - ASN (Autonomous System Number) and owning organization - Company/ISP ownership data - Security/threat-intelligence flags (VPN, Tor, proxy, datacenter, known attacker/abuser, blocklists, reputation scores) Security and ASN/company fields require a Pro-tier plan or higher; lower tiers receive the standalone and location fields only. ## 2. Authentication Every request is authenticated via a `token` query parameter — no headers, no OAuth, no request signing. ``` GET https://ipfly.world/api?token=YOUR_TOKEN ``` Tokens can optionally be restricted (in the provider's dashboard) to specific origin domains and/or source IPs. With no restriction set, a token works from any origin. Once at least one domain/IP is added to the allow-list, requests from anywhere else are rejected even with a valid token. **Security guidance (from the provider's own docs):** never call this API directly from client-side JavaScript, a mobile app bundle, or any code a user can inspect — the token is visible in network requests and can be extracted. Proxy requests through a backend, or at minimum restrict the token's origin. ## 3. Endpoint & parameters ``` GET https://ipfly.world/api ``` | Parameter | Type | Required | Description | |---|---|---|---| | `token` | string | Yes | API authentication token. | | `ip` | string | No | Target IPv4 or IPv6 address. Omit to geolocate the caller's own IP. | | `include` | string | No | Requests extended field sets, e.g. `include=security`. Availability is plan-dependent. | Example: ``` GET https://ipfly.world/api?token=YOUR_TOKEN&ip=8.8.8.8&include=security ``` ### IPv6 notes IPv6 addresses are returned in the same response shape as IPv4 (e.g. `2001:4860:4860::8888`), passed as-is with no encoding needed. If traffic is IPv4-mapped through NAT64 or a CDN, the resolved location reflects the edge/gateway, not necessarily the end user. ### Sandbox / test IPs | IP | Good for testing | Typical result | |---|---|---| | `8.8.8.8` | Standard US result, hosting-type ASN | Mountain View, CA — Google LLC | | `1.1.1.1` | Anycast edge network, non-US | Sydney/Anycast — Cloudflare | | `9.9.9.9` | Privacy-focused resolver, EU-adjacent | Quad9 Foundation | | `2001:4860:4860::8888` | IPv6 code path | Same fields as IPv4, Google IPv6 DNS | | `127.0.0.1`, `10.0.0.0/8` | Negative test (private/reserved) | Error — never publicly routable | Note: these are documented as "typically stable," not contractually permanent. A common integration mistake is testing from `localhost` in development — the server's *outbound* IP is what gets geolocated, not `127.0.0.1`; behind a home router or corporate NAT expect an approximate result centered on the ISP. This is standard behavior for IP geolocation generally, not specific to this provider. ## 4. Response fields ### 4.1 Standalone (root-level) fields — always present | Field | Type | Description | |---|---|---| | `ip` | string | The queried IP address. | | `hostname` | string | Reverse DNS hostname of the IP. | | `country_code2` | string | ISO 3166-1 alpha-2 country code. | | `country_code3` | string | ISO 3166-1 alpha-3 country code. | | `country_name` | string | Common name of the country. | | `country_capital` | string | Capital city of the country. | | `country_emoji` | string | Country flag emoji. | | `calling_code` | string | International dialing code. | | `country_tld` | string | Country-code top-level domain (e.g. `.us`). | | `languages` | string | Official language(s) of the country. | | `is_eu` | boolean | Whether the country is an EU member. | ### 4.2 Location fields | Field | Type | Status | Description | |---|---|---|---| | `state_prov` | string | Optional | State / province / region name. | | `state_code` | string | Optional | State/province code. | | `district` | string | Optional | District or sub-region. | | `city` | string | Optional | City name. | | `zipcode` | string | Optional | ZIP / postal code. | | `latitude` | string | Required | Latitude coordinate. | | `longitude` | string | Required | Longitude coordinate. | ### 4.3 `asn` object (plan-dependent) | Field | Type | Description | |---|---|---| | `asn.asn` | string | AS number (e.g. `AS15169`). | | `asn.name` | string | Organization name. | | `asn.domain` | string | Organization's domain. | | `asn.route` | string | IP route/prefix (CIDR notation). | | `asn.type` | string | Network type: `isp`, `hosting`, `business`, `education`. | ### 4.4 `company` object (plan-dependent) Ownership/ISP metadata: `company.name`, `company.domain`, `company.type`. ### 4.5 `time_zone` object | Field | Type | Description | |---|---|---| | `time_zone.name` | string | IANA timezone name (e.g. `Europe/Paris`). | | `time_zone.offset` | number | UTC offset in hours (standard, no DST). | | `time_zone.offset_with_dst` | number | UTC offset including DST. | | `time_zone.current_time` | string | Current local time string. | | `time_zone.current_time_unix` | number | Current time as a Unix timestamp. | | `time_zone.current_tz_abbreviation` | string | Timezone abbreviation (e.g. `EEST`). | | `time_zone.is_dst` | boolean | Whether DST is currently active. | ### 4.6 `security` object (Pro tier and above) | Field | Type | Description | |---|---|---| | `security.is_tor` | boolean | Whether the IP is a Tor exit node. | | `security.is_vpn` | boolean | Whether the IP is used for a VPN. | | `security.is_icloud_relay` | boolean | Whether the IP is an iCloud Private Relay proxy. | | `security.is_proxy` | boolean | Whether the IP is a known proxy. | | `security.is_datacenter` | boolean | Whether the IP belongs to a datacenter allocation. | | `security.is_anonymous` | boolean | Whether the IP is used for anonymization generally. | | `security.is_known_attacker` | boolean | Whether the IP is associated with DoS/flood attacks. | | `security.is_known_abuser` | boolean | Whether the IP is associated with hijacking, malware, etc. | | `security.is_threat` | boolean | Whether the IP is classified high-risk/threat. | | `security.is_bogon` | boolean | Whether the IP falls in a bogon (unallocated/reserved) CIDR range. | | `security.blocklists` | array | Organic ban-lists the IP appears on. | | `security.scores.vpn_score` | number | VPN-likelihood reputation score. | | `security.scores.proxy_score` | number | Proxy-likelihood reputation score. | | `security.scores.threat_score` | number | Threat-likelihood reputation score. | | `security.scores.trust_score` | number | Overall trust score. | These are provider-computed heuristic classifications, not verified ground truth — treat as one signal among several for any access-control or fraud-detection decision. ### 4.7 `currency` object `currency.code` (ISO 4217, e.g. `EUR`), `currency.name` (e.g. `Euro`), `currency.symbol` (e.g. `€`). ## 5. Errors & status codes Standard HTTP status codes are used; every error additionally returns a JSON body so callers can branch on an error code without parsing status text. | Status | Meaning | Typical cause | |---|---|---| | 200 | OK | Lookup succeeded. | | 400 | Bad Request | Malformed or unparseable IP address. | | 401 | Unauthorized | Missing or invalid token. | | 403 | Forbidden | Token valid but suspended, or plan doesn't include the requested field set. | | 404 | Not Found | No record for a private, reserved, or bogon IP. | | 500 / 503 | Server Error | Transient issue on the provider's side — safe to retry with backoff. | ## 6. Example response ```json { "ip": "8.8.8.8", "hostname": "dns.google", "country_code2": "US", "country_code3": "USA", "country_name": "United States", "country_capital": "Washington", "state_prov": "California", "city": "Mountain View", "zipcode": "94043", "latitude": "37.4056", "longitude": "-122.0775", "is_eu": false, "country_emoji": "US", "calling_code": "+1", "country_tld": ".us", "languages": "en", "currency": { "code": "USD", "name": "Dollar", "symbol": "$" }, "time_zone": { "name": "America/New_York", "offset": -4, "offset_with_dst": -3, "current_time": "2026-08-21 03:12:46.964685-0400", "current_time_unix": 1787296366.9647, "current_tz_abbreviation": "EDT", "current_tz_full_name": "America/New_York", "is_dst": true }, "asn": { "asn": "AS15169", "name": "Google LLC", "domain": "google.com", "route": "8.8.8.0/24", "type": "hosting" }, "company": { "name": "AS15169 Google LLC", "domain": "google.com", "type": "isp" }, "security": { "is_tor": false, "is_vpn": false, "is_icloud_relay": false, "is_proxy": false, "is_datacenter": true, "is_anonymous": false, "is_known_attacker": false, "is_known_abuser": false, "is_threat": false, "is_bogon": false, "blocklists": [], "scores": { "vpn_score": 100, "proxy_score": 1, "threat_score": 100, "trust_score": 33 } } } ``` ## 7. Companion JavaScript SDK This repository also ships SDK, a zero-dependency UMD client wrapping the endpoint above with: - TTL + LRU response caching (memory, `localStorage`, or `sessionStorage`) - Automatic retry with exponential backoff + jitter (network errors and `5xx` only; `4xx` fails fast) - In-flight request de-duplication for identical concurrent lookups - Client-side token-bucket rate limiting - Batch lookups with bounded concurrency, returning per-item success/failure rather than rejecting as a whole - Timeout/abort support and lifecycle hooks (`onRequest`, `onResponse`, `onError`, `onCacheHit`) Full API surface, configuration options, and usage examples are documented in `README.md` in this same directory. The security guidance in Section 2 above applies equally to the SDK: browser use should go through a backend proxy or a domain-restricted token for production traffic. ## 8. Scope and limitations of this document - This file describes API behavior as documented by the provider as of the time it was written; pricing, free-tier request limits, and field availability by plan should be re-verified at https://ipfly.world before being relied upon for anything time-sensitive. - No claims are made here about IPFly's data accuracy, update frequency, or coverage for any specific IP range — that is provider-specific and not independently verified in this document. - This is not an official IPFly publication; it is a reference file prepared for AI/crawler consumption alongside a third-party SDK.