IP API Documentation

Introduction

Welcome to the official IP geolocation API documentation for FindIpInfo. This guide provides detailed instructions for integrating our free IP lookup and geolocation API into your applications using PHP or Java. Access comprehensive IP tracker data, including location, timezone, and currency, to enhance your projects with precise IP geolocation insights.

Step 1: Obtain an API Key

To authenticate API requests, you need a unique API key. Follow these steps:

Step 2: Make API Requests

To know your or a customer's IP address, use the following API endpoints:

Endpoint to Get Your Public IP: https://findipinfo.net/api/myip
(No API key required, returns your public IP as plain text.)

Use the following endpoint to retrieve IP geolocation data. Replace API_KEY with your key. The IP address is optional and can be provided as a query parameter (?ip=). If omitted, it defaults to the client's public IP.

Endpoint: https://findipinfo.net/api/ipinfo/{API_KEY}
Optional: Add ?ip=IP_ADDRESS to specify a target IP (e.g., ?ip=123.45.67.89).

<?php
$apiKey = 'your-api-key-here';
$ipAddress = '123.45.67.89'; // Optional: Omit or set to null to use client's IP
$url = "https://findipinfo.net/api/ipinfo/{$apiKey}" . ($ipAddress ? "?ip={$ipAddress}" : "");

try {
    $response = file_get_contents($url);
    $data = json_decode($response, true);

    if ($data['success'] === true) {
        $country = $data['data']['findipinfo']['country'];
        $city = $data['data']['findipinfo']['city'];
        $timezone = $data['data']['findipinfo']['timeZone'];

        echo "Country: {$country}\n";
        echo "City: {$city}\n";
        echo "Time Zone: {$timezone}\n";
    } else {
        echo "Error: {$data['message']}\n";
    }
} catch (Exception $e) {
    echo "Request failed: {$e->getMessage()}\n";
}
?>

Step 3: Handle API Errors

The API returns a success field to indicate request outcomes. Possible values include:

  • success: Request succeeded, data in findipinfo.
  • ip_error: Invalid IP address.
  • data_error: No geolocation data found.
  • api_error: Invalid or inactive API key.
<?php
$apiKey = 'your-api-key-here';
$ipAddress = '123.45.67.89'; // Optional: Omit or set to null to use client's IP
$url = "https://findipinfo.net/api/ipinfo/{$apiKey}" . ($ipAddress ? "?ip={$ipAddress}" : "");

try {
    $response = file_get_contents($url);
    if ($response === false) {
        echo "Connection error. Please try again.";
    } else {
        $data = json_decode($response, true);
        if ($data['success'] === true) {
            echo "Country: {$data['data']['findipinfo']['country']}\n";
        } else {
            echo "Error: {$data['message']} (Code: {$data['error_code'] ?? 'N/A'})\n";
        }
    }
} catch (Exception $e) {
    echo "Request failed: {$e->getMessage()}\n";
}
?>

API Response Examples

Success Response

{
    "success": true,
    "message": "Successfully found geolocation data",
    "data": {
        "findipinfo": {
            "continent": "Asia",
            "country": "India",
            "city": "Chandigarh",
            "capital": "New Delhi",
            "country_code": "IN",
            "country_alpha_3_code": "IND",
            "region": "Chandigarh",
            "postal": "160036",
            "latitude": 30.7339,
            "longitude": 76.7889,
            "network": "2401:4900:1c6e::/47",
            "timeZone": "Asia/Kolkata",
            "organization": "Bharti Airtel Ltd., Telemedia Services",
            "system_number": 24560,
            "telephone_code": "91",
            "currency_code": "INR",
            "currency_name": "Indian Rupee",
            "currency_symbol": "₹",
            "lang_code": "HI",
            "lang_name": "Hindi, English",
            "country_domain_name": "in",
            "flag_w40": "https://findipinfo.net/assets/flags/png/w40/in.png",
            "flag_w80": "https://findipinfo.net/assets/flags/png/w80/in.png",
            "flag_w160": "https://findipinfo.net/assets/flags/png/w160/in.png",
            "flag_w320": "https://findipinfo.net/assets/flags/png/w320/in.png",
            "flag_w640": "https://findipinfo.net/assets/flags/png/w640/in.png",
            "flag_svg": "https://findipinfo.net/assets/flags/svg/in.svg"
        }
    }
}

Error Response (Invalid IP)

{
    "success": false,
    "message": "Invalid IP address",
    "error_code": "ip_error"
}

Support

For assistance with API integration, contact our support team via WhatsApp  Live Support Chat.