API Docs

Everything you need to integrate IP2FY into your application.

Quick Start

Get started with IP2FY in minutes. Here's how to make your first API request:

curl
curl "https://api.ip2fy.com/8.8.8.8"

Authentication

IP2FY uses API keys for authentication. Include your API key as a query parameter:

curl
curl "https://api.ip2fy.com/8.8.8.8?key=YOUR_API_KEY"
Note: Get your API key by signing up for a free account at app.ip2fy.com/signup

Endpoints

GET
https://api.ip2fy.com/{ip}
Get geolocation data for a specific IP address
GET
https://api.ip2fy.com/
Get geolocation data for the requesting IP address

Response Format

All API responses are returned in JSON format. Here's an example response:

json
{
  "ip": "8.8.8.8",
  "hostname": "dns.google",
  "city": "Mountain View",
  "region": "California",
  "country": "US",
  "loc": "37.3860,-122.0840",
  "org": "AS15169 Google LLC",
  "postal": "94035",
  "timezone": "America/Los_Angeles"
}

Response Fields

ip
string
The IP address being queried
hostname
string
Reverse DNS hostname (may be null)
city
string
City name
region
string
Region or state name
country
string
Two-letter country code (ISO 3166-1 alpha-2)
loc
string
Latitude and longitude (comma-separated)
org
string
Organization or ISP name
postal
string
Postal code
timezone
string
Timezone in IANA format

Code Examples

javascript
fetch('https://api.ip2fy.com/8.8.8.8')
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));
python
import requests

response = requests.get('https://api.ip2fy.com/8.8.8.8')
data = response.json()
print(data)
php
$response = file_get_contents('https://api.ip2fy.com/8.8.8.8');
$data = json_decode($response, true);
print_r($data);
java
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;

URL url = new URL("https://api.ip2fy.com/8.8.8.8");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");

BufferedReader in = new BufferedReader(
    new InputStreamReader(conn.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();

while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();

System.out.println(response.toString());

Rate Limits

Rate limits vary by your plan:

Free
1,000 requests/day
Starter
50,000 requests/month
Professional
500,000 requests/month

Error Handling

The API returns appropriate HTTP status codes and error messages:

400
Bad Request - Invalid IP address format
401
Unauthorized - Invalid API key
429
Too Many Requests - Rate limit exceeded
500
Internal Server Error - Something went wrong

Need Help?

Check out our FAQ for common questions or contact support for personalized assistance.

arrow-to