IPFly API Documentation

Complete reference for integrating IP geolocation and threat intelligence into your applications.

Quick Start

Get up and running with IPFly API in minutes. Make your first request with the example below.

GET https://ipfly.world/api?token=YOUR_TOKEN&ip=8.8.8.8
// Example Response { "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": "πŸ‡ΊπŸ‡Έ", "calling_code": "+1", "country_tld": ".us", "languages": "en", "asn": { "asn": "AS15169", "name": "Google LLC", "domain": "google.com", "route": "8.8.8.0/24", "type": "hosting" }, "currency": { "code": "USD", "name": "Dollar", "symbol": "$" }, "company": { "name": "Google LLC", "domain": "google.com", "type": "hosting" }, "security": { "is_tor": false, "is_proxy": false, "is_vpn": false, "is_relay": false, "is_cloud_provider": true, "proxy_type": "" }, "time_zone": { "name": "America/New_York", "offset": -4, "offset_with_dst": -3, "current_time": "2025-10-21 05:34:00.397532-0400", "current_time_unix": 1761039240.39756, "current_tz_abbreviation": "EDT", "current_tz_full_name": "America/New_York", "is_dst": true } }

Authentication

All API requests require authentication using your API token. Include it as a query parameter in your requests. You can query your IP address without entering it. This will return information about your current IP and connection.

Request to obtain currently connected IPv4/IPv6 of your client:

GET https://ipfly.world/api?token=YOUR_TOKEN

Request to obtain information from specified IPv4/IPv6:

GET https://ipfly.world/api?token=YOUR_TOKEN&ip=IP_ADDRESS

You can get your API token by signing up for a free account. The token should be kept secure and not shared publicly.

Making Requests

Make HTTP GET requests to our API endpoint with the required parameters.

Parameters

Parameter Type Required Description
token string Yes Your API authentication token
ip string No IP address to lookup (IPv4 or IPv6)

Standalone Fields Reference

These fields are returned at the root level of the API response and contain core information about the IP address being queried.

Field Type Description Required
ip string IP address that is used to lookup geolocation information. Required
hostname string Hostname of the IP address used to query ipfly API. Required
country_code2 string Country code (ISO 3166-1 alpha-2) of the country. Required
country_code3 string Country code (ISO 3166-1 alpha-3) of the country. Required
country_name string Common name of the country. Required
country_capital string Capital city of the country. Required
country_emoji string Flag emoji representing the country of the IP address. Required
calling_code string International calling code for the country. Required
country_tld string Country code top-level domain (e.g., .us for United States). Required
languages string Official languages spoken in the country. Required

Location Object Reference

Detailed geographic information about the IP address location including continent, country, and city-level data.

Field Type Description Required
state_prov string Name of the state/province/region. Optional
city string Name of the city. Optional
zipcode string ZIP/Postal code of the location. Optional
latitude string Latitude coordinate of the location. Required
longitude string Longitude coordinate of the location. Required
is_eu boolean Indicates if the country belongs to the European Union. Required

ASN Object Reference

Autonomous System Number information including network details and organization.

Field Type Description Required
asn.asn string Autonomous System Number associated with the IP. Required
asn.name string Name of the organization that owns the ASN. Required
asn.domain string Domain associated with the organization. Required
asn.route string IP address range associated with the ASN. Required
asn.type string Type of network (e.g., hosting, isp, business). Required

Currency Object Reference

Information about the official currency used in the country of the IP address.

Field Type Description Required
currency.code string 3-letter currency code (ISO 4217). Required
currency.name string Full name of the currency. Required
currency.symbol string Currency symbol used in the country. Required

Company Object Reference

Information about the company or organization associated with the IP address.

Field Type Description Required
company.name string Name of the company or organization. Required
company.domain string Domain associated with the company. Required
company.type string Type of business or service. Required

Time Zone Object Reference

Comprehensive time zone information including current time, offsets, and daylight saving details.

Field Type Description Required
time_zone.name string IANA time zone name (e.g., "America/New_York"). Required
time_zone.offset integer UTC offset in hours. Required
time_zone.offset_with_dst integer UTC offset including daylight saving time. Required
time_zone.current_time string Current local time in ISO format. Required
time_zone.current_time_unix float Current local time as Unix timestamp. Required
time_zone.current_tz_abbreviation string Current time zone abbreviation. Required
time_zone.current_tz_full_name string Current time zone full name. Required
time_zone.is_dst boolean Indicates if daylight saving time is currently active. Required

Security Object Reference

Security assessment and threat intelligence data for the IP address.

Field Type Description Required
security.is_tor boolean Indicates if the IP is a Tor exit node. Required
security.is_proxy boolean Indicates if the IP is a proxy server. Required
security.is_vpn boolean Indicates if the IP is a VPN server. Required
security.is_relay boolean Indicates if the IP is a network relay. Required
security.is_cloud_provider boolean Indicates if the IP belongs to a cloud provider. Required
security.proxy_type string Type of proxy if applicable. Optional

Code Examples

Integrate IPFly API into your application with these code examples.

JavaScript
PHP
Python
Java
Ruby
cURL
// Using Fetch API async function lookupIP(ip) { const token = 'YOUR_API_TOKEN'; const response = await fetch(`https://ipfly.world/api?token=${token}&ip=${ip}`); const data = await response.json(); return data; } // Example usage lookupIP('8.8.8.8') .then(data => console.log(data)) .catch(error => console.error('Error:', error)); // Using jQuery $.ajax({ url: 'https://ipfly.world/api', method: 'GET', data: { token: 'YOUR_API_TOKEN', ip: '8.8.8.8' }, success: function(data) { console.log(data); }, error: function(xhr, status, error) { console.error('Error:', error); } });
<?php // Using cURL function lookupIP($ip) { $token = 'YOUR_API_TOKEN'; $url = "https://ipfly.world/api?token=$token&ip=$ip"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $response = curl_exec($ch); curl_close($ch); return json_decode($response, true); } // Example usage $data = lookupIP('8.8.8.8'); print_r($data); // Using file_get_contents (if allow_url_fopen is enabled) function lookupIPSimple($ip) { $token = 'YOUR_API_TOKEN'; $url = "https://ipfly.world/api?token=$token&ip=$ip"; $response = file_get_contents($url); return json_decode($response, true); } ?>
import requests def lookup_ip(ip_address): token = 'YOUR_API_TOKEN' url = f'https://ipfly.world/api?token={token}&ip={ip_address}' try: response = requests.get(url) response.raise_for_status() # Raises an HTTPError for bad responses return response.json() except requests.exceptions.RequestException as e: print(f"Error: {e}") return None # Example usage data = lookup_ip('8.8.8.8') print(data) # Alternative using urllib import urllib.request import json def lookup_ip_urllib(ip_address): token = 'YOUR_API_TOKEN' url = f'https://ipfly.world/api?token={token}&ip={ip_address}' with urllib.request.urlopen(url) as response: data = json.loads(response.read().decode()) return data
import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import com.google.gson.JsonObject; import com.google.gson.JsonParser; public class IPLookup { public static JsonObject lookupIP(String ipAddress) { try { String token = "YOUR_API_TOKEN"; String urlString = "https://ipfly.world/api?token=" + token + "&ip=" + ipAddress; URL url = new URL(urlString); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); BufferedReader in = new BufferedReader( new InputStreamReader(conn.getInputStream())); String inputLine; StringBuilder content = new StringBuilder(); while ((inputLine = in.readLine()) != null) { content.append(inputLine); } in.close(); conn.disconnect(); return JsonParser.parseString(content.toString()).getAsJsonObject(); } catch (Exception e) { e.printStackTrace(); return null; } } // Example usage public static void main(String[] args) { JsonObject data = lookupIP("8.8.8.8"); System.out.println(data); } }
require 'net/http' require 'json' def lookup_ip(ip_address) token = 'YOUR_API_TOKEN' url = "https://ipfly.world/api?token=#{token}&ip=#{ip_address}" uri = URI(url) response = Net::HTTP.get(uri) JSON.parse(response) end # Example usage data = lookup_ip('8.8.8.8') puts data # Alternative using the 'net/http' with error handling def lookup_ip_with_error_handling(ip_address) token = 'YOUR_API_TOKEN' url = "https://ipfly.world/api?token=#{token}&ip=#{ip_address}" begin uri = URI(url) response = Net::HTTP.get(uri) JSON.parse(response) rescue => e puts "Error: #{e.message}" nil end end
# Basic cURL request curl -X GET "https://ipfly.world/api?token=YOUR_API_TOKEN&ip=8.8.8.8" # Save response to file curl -X GET "https://ipfly.world/api?token=YOUR_API_TOKEN&ip=8.8.8.8" -o response.json # Pretty print JSON response (requires jq) curl -s -X GET "https://ipfly.world/api?token=YOUR_API_TOKEN&ip=8.8.8.8" | jq '.' # With custom headers curl -X GET \ -H "Accept: application/json" \ "https://ipfly.world/api?token=YOUR_API_TOKEN&ip=8.8.8.8" # Using environment variable for token export IPFLY_TOKEN="YOUR_API_TOKEN" curl -X GET "https://ipfly.world/api?token=$IPFLY_TOKEN&ip=8.8.8.8"