Free IP API

Free, Fast and Reliable IP Geolocation API.
Easy to use and available in JSON

FREE for commercial and non-commercial use.

{
    "ipVersion": 4,
    "ipAddress": "18.191.200.223",
    "latitude": 39.96138,
    "longitude": -82.997749,
    "countryName": "United States of America",
    "countryCode": "US",
    "timeZone": "-04:00",
    "zipCode": "43085",
    "cityName": "Columbus",
    "regionName": "Ohio",
    "continent": "Americas",
    "continentCode": "AM",
    "isProxy": false,
    "currency": {
        "code": "USD",
        "name": "US Dollar"
    },
    "language": "English",
    "timeZones": ["America/Adak","America/Anchorage","America/Boise","America/Chicago","America/Denver","America/Detroit","America/Indiana/Indianapolis","America/Indiana/Knox","America/Indiana/Marengo","America/Indiana/Petersburg","America/Indiana/Tell_City","America/Indiana/Vevay","America/Indiana/Vincennes","America/Indiana/Winamac","America/Juneau","America/Kentucky/Louisville","America/Kentucky/Monticello","America/Los_Angeles","America/Menominee","America/Metlakatla","America/New_York","America/Nome","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Phoenix","America/Sitka","America/Yakutat","Pacific/Honolulu"],
    "tlds": [".us"]
}
            

How it works?

FreeIPAPI is a free service for commercial and non-commercial uses. We're using free and opensource databases such as ip2location to provide this API. Since we're running servers to provide this service, To prevent heavy loads on our servers we applied a limit of 60 requests per minute to the users, However, if you need more, You can subscribe to one of our paid plans.

How to use

The API accepts GET and POST methods and you can pass ip field as body or query param. However, If you don't pass the ip field we'll use the sender's ip address to extract the information. Here you can find some sample codes to use it however, you can read our documentation

<?php

$ipAddress = "{IP-ADDRESS}";
$url = "https://freeipapi.com/api/json/$ipAddress";

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

print_r($data);

    
# Get the ip info
curl https://freeipapi.com/api/json/1.1.1.1

# Get only public ip address
curl https://freeipapi.com

    
import requests

ip_address = "{IP-ADDRESS}"
url = f"https://freeipapi.com/api/json/{ip_address}"

response = requests.get(url)
data = response.json()

print(data)

    
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class Main {
    public static void main(String[] args) throws IOException {
        String ipAddress = "{IP-ADDRESS}";
        String urlString = "https://freeipapi.com/api/json/" + ipAddress;

        URL url = new URL(urlString);
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        connection.setRequestMethod("GET");

        BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        StringBuilder response = new StringBuilder();
        String line;
        while ((line = reader.readLine()) != null) {
            response.append(line);
        }
        reader.close();

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

    
const axios = require('axios');

const ipAddress = "{IP-ADDRESS}";
const url = `https://freeipapi.com/api/json/${ipAddress}`; // to get specific ip's info
// const url = `https://freeipapi.com/api/json`; // to get current request's ip info

axios.get(url)
    .then(response => {
        const data = response.data;
        console.log(data);
    })
    .catch(error => {
        console.error(error);
    });

    
const url = `https://freeipapi.com/api/json`; // get current request's ip info

$.get(url, function (data) {
    console.log(data);
});

    
package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
)

func main() {
	ipAddress := "{IP-ADDRESS}"
	url := fmt.Sprintf("https://freeipapi.com/api/json/%s", ipAddress)

	response, err := http.Get(url)
	if err != nil {
		fmt.Println(err)
		return
	}
	defer response.Body.Close()

	body, err := ioutil.ReadAll(response.Body)
	if err != nil {
		fmt.Println(err)
		return
	}

	fmt.Println(string(body))
}

    
require 'net/http'
require 'json'

ip_address = "{IP-ADDRESS}"
url = URI.parse("https://freeipapi.com/api/json/#{ip_address}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url.request_uri)
response = http.request(request)
data = JSON.parse(response.body)

puts data

    
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        string ipAddress = "{IP-ADDRESS}";
        string url = $"https://freeipapi.com/api/json/{ipAddress}";

        using (HttpClient client = new HttpClient())
        {
            HttpResponseMessage response = await client.GetAsync(url);
            string responseBody = await response.Content.ReadAsStringAsync();

            Console.WriteLine(responseBody);
        }
    }
}

    
use reqwest;

#[tokio::main]
async fn main() -> Result<(), Box> {
    let ip_address = "{IP-ADDRESS}";
    let url = format!("https://freeipapi.com/api/json/{}", ip_address);

    let response = reqwest::get(&url).await?.text().await?;
    println!("{}", response);

    Ok(())
}

    

Pricing

FreeIPAPI is still FREE with no account required! We're introducing subscriptions for users who want to increase the request limit to more than 60 requests per minute

Free

€0 / Month
  • 60 Requests per minute
  • IPv4 and IPv6 queries
  • Regularly updated database
  • Commercial use allowed
  • IP & Domain White Listing
  • API Keys
  • Email Support

Unlimited

€9.90 / Month
  • Unlimited Requests
  • IPv4 and IPv6 queries
  • Regularly updated database
  • Commercial use allowed
  • IP & Domain White Listing
  • API Keys
  • Email Support

Browser Extensions