IP Geolocation, VPN & Proxy Detection API | IP-API.io

5 min read Original article ↗

Free IP address lookup location database, IP geolocation API, and email validation service. Trusted by thousands of businesses.

IP Geolocation API Endpoints

Get Client's IP Information

GET https://ip-api.io/api/v1/ip/?api_key={YOUR_API_KEY}

Get Specific IP Information

GET https://ip-api.io/api/v1/ip/{ip}?api_key={YOUR_API_KEY}

API Response Format

Geolocation API returns a JSON object with the following structure:

{
  "ip": "78.55.53.58",
  "suspicious_factors": {
    "is_proxy": false,
    "is_tor_node": false,
    "is_spam": false,
    "is_crawler": false,
    "is_datacenter": false,
    "is_vpn": false,
    "is_threat": false
  },
  "location": {
    "country": "Germany",
    "country_code": "DE",
    "city": "Berlin",
    "latitude": 52.5694,
    "longitude": 13.3753,
    "zip": "13409",
    "timezone": "Europe/Berlin",
    "local_time": "2024-05-20T22:16:52+02:00",
    "local_time_unix": 1716236212,
    "is_daylight_savings": true
  }
}

Geo Location by IP: Code Examples

This method is ideal for front-end implementations, making API calls from the browser to retrieve the client's IP information.

const request = require('request-promise');

request('https://ip-api.io/api/v1/ip/?api_key=YOUR_API_KEY')
  .then(response => console.log(JSON.parse(response)))
  .catch(err => console.log(err));
$.getJSON('https://ip-api.io/api/v1/ip/?api_key=YOUR_API_KEY', data => console.log(data));
import axios from 'axios';

axios.get('https://ip-api.io/api/v1/ip/?api_key=YOUR_API_KEY')
  .then(response => console.log(response.data));
fetch('https://ip-api.io/api/v1/ip/?api_key=YOUR_API_KEY')
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(err => console.error(err));
import { useQuery } from 'react-query';
import axios from 'axios';

const fetchIPData = async () => {
  const { data } = await axios.get('https://ip-api.io/api/v1/ip/?api_key=YOUR_API_KEY');
  return data;
};

const IPDataComponent = () => {
  const { data, error, isLoading } = useQuery('ipData', fetchIPData);

  if (isLoading) return <span>Loading...</span>;
  if (error) return <span>Error: {error.message}</span>;

  return <div>{JSON.stringify(data)}</div>;
};

export default IPDataComponent;
import React, { useEffect, useState } from 'react';
import axios from 'axios';

const App: React.FC = () => {
  const [ipData, setIpData] = useState(null);

  useEffect(() => {
    axios.get('https://ip-api.io/api/v1/ip/?api_key=YOUR_API_KEY')
      .then(response => setIpData(response.data));
  }, []);

  return <div>{JSON.stringify(ipData)}</div>;
}

export default App;
$data = json_decode(file_get_contents('https://ip-api.io/api/v1/ip/?api_key=YOUR_API_KEY'));
var_dump($data);
import requests

response = requests.get('https://ip-api.io/api/v1/ip/?api_key=YOUR_API_KEY')
print(response.json())
require 'json'
require 'open-uri'

data = JSON.parse(open('https://ip-api.io/api/v1/ip/?api_key=YOUR_API_KEY').read)
puts data

Using Provided IP

This method is suitable for backend implementations, providing a specific IP address to retrieve its information.

const request = require('request-promise');

request('https://ip-api.io/api/v1/ip/1.2.4.5?api_key=YOUR_API_KEY')
  .then(response => console.log(JSON.parse(response)))
  .catch(err => console.log(err));
$.getJSON('https://ip-api.io/api/v1/ip/1.2.4.5?api_key=YOUR_API_KEY', data => console.log(data));
import axios from 'axios';

axios.get('https://ip-api.io/api/v1/ip/1.2.4.5?api_key=YOUR_API_KEY')
  .then(response => console.log(response.data));
fetch('https://ip-api.io/api/v1/ip/1.2.4.5?api_key=YOUR_API_KEY')
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(err => console.error(err));
import { useQuery } from 'react-query';
import axios from 'axios';

const fetchIPData = async () => {
  const { data } = await axios.get('https://ip-api.io/api/v1/ip/1.2.4.5?api_key=YOUR_API_KEY');
  return data;
};

const IPDataComponent = () => {
  const { data, error, isLoading } = useQuery('ipData', fetchIPData);

  if (isLoading) return <span>Loading...</span>;
  if (error) return <span>Error: {error.message}</span>;

  return <div>{JSON.stringify(data)}</div>;
};

export default IPDataComponent;
import React, { useEffect, useState } from 'react';
import axios from 'axios';

const App: React.FC = () => {
  const [ipData, setIpData] = useState(null);

  useEffect(() => {
    axios.get('https://ip-api.io/api/v1/ip/1.2.4.5?api_key=YOUR_API_KEY')
      .then(response => setIpData(response.data));
  }, []);

  return <div>{JSON.stringify(ipData)}</div>;
}

export default App;
$data = json_decode(file_get_contents('https://ip-api.io/api/v1/ip/1.2.4.5?api_key=YOUR_API_KEY'));
var_dump($data);
import requests

response = requests.get('https://ip-api.io/api/v1/ip/1.2.4.5?api_key=YOUR_API_KEY')
print(response.json())
require 'json'
require 'open-uri'

data = JSON.parse(open('https://ip-api.io/api/v1/ip/1.2.4.5?api_key=YOUR_API_KEY').read)
puts data

Building with Python? See the full Python tutorial →

Email Validation API Endpoints

Validate Email Address

GET https://ip-api.io/api/v1/email/{email_address}?api_key={YOUR_API_KEY}

Email Validation API Response Format

The API returns a JSON object with the following structure for email validation:

{
  "email": "johndoe@email.com",
  "is_disposable": false,
  "syntax": {
    "domain": "email.com",
    "username": "johndoe",
    "is_valid": true,
    "error_reasons": ["NONE"]
  }
}

Email Validation: Code Examples

This method demonstrates how to use the email validation endpoint to verify email addresses.

const request = require('request-promise');

request('https://ip-api.io/api/v1/email/example@example.com?api_key=YOUR_API_KEY')
  .then(response => console.log(JSON.parse(response)))
  .catch(err => console.log(err));
$.getJSON('https://ip-api.io/api/v1/email/example@example.com?api_key=YOUR_API_KEY', data => console.log(data));
import axios from 'axios';

axios.get('https://ip-api.io/api/v1/email/example@example.com?api_key=YOUR_API_KEY')
  .then(response => console.log(response.data));
fetch('https://ip-api.io/api/v1/email/example@example.com?api_key=YOUR_API_KEY')
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(err => console.error(err));
import { useQuery } from 'react-query';
import axios from 'axios';

const fetchEmailData = async () => {
  const { data } = await axios.get('https://ip-api.io/api/v1/email/example@example.com?api_key=YOUR_API_KEY');
  return data;
};

const EmailDataComponent = () => {
  const { data, error, isLoading } = useQuery('emailData', fetchEmailData);

  if (isLoading) return <span>Loading...</span>;
  if (error) return <span>Error: {error.message}</span>;

  return <div>{JSON.stringify(data)}</div>;
};

export default EmailDataComponent;
import React, { useEffect, useState } from 'react';
import axios from 'axios';

const App: React.FC = () => {
  const [emailData, setEmailData] = useState(null);

  useEffect(() => {
    axios.get('https://ip-api.io/api/v1/email/example@example.com?api_key=YOUR_API_KEY')
      .then(response => setEmailData(response.data));
  }, []);

  return <div>{JSON.stringify(emailData)}</div>;
}

export default App;
$data = json_decode(file_get_contents('https://ip-api.io/api/v1/email/example@example.com?api_key=YOUR_API_KEY'));
var_dump($data);
import requests

response = requests.get('https://ip-api.io/api/v1/email/example@example.com?api_key=YOUR_API_KEY')
print(response.json())
require 'json'
require 'open-uri'

data = JSON.parse(open('https://ip-api.io/api/v1/email/example@example.com?api_key=YOUR_API_KEY').read)
puts data
val result = URL('https://ip-api.io/api/v1/email/example@example.com?api_key=YOUR_API_KEY').readText()
println(result)
import java.net.*;
import java.io.*;

public class Main {
  public static void main(String[] args) {
    try {
      URL url = new URL('https://ip-api.io/api/v1/email/example@example.com?api_key=YOUR_API_KEY');
      BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
      String inputLine;
      while ((inputLine = in.readLine()) != null)
        System.out.println(inputLine);
      in.close();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
use std::net::TcpStream;
use std::io::{self, Read, Write};

fn main() -> io::Result<()> {
    let mut stream = TcpStream::connect('ip-api.io:80')?;
    stream.write_all(b'GET /api/v1/email/example@example.com?api_key=YOUR_API_KEY HTTP/1.0\r\n\r\n')?;
    let mut response = String::new();
    stream.read_to_string(&mut response)?;
    println!(response);
    Ok(())
}

IP-API.io has been a game changer for our global e-commerce platform. We now offer localized pricing without any hassles.

The accuracy and reliability of IP-API.io have helped us enhance our security measures and prevent unauthorized access effectively.

Kirill P.

Head of Security, HeadlessCloud

Amazing! Thanks so much for the speedy response. I have really enjoyed using IP-API.io!

Adrian R.

Project Manager

Hi guys, I really like your way to support customers. Fast and you keep your word. Keep moving guys! Cheers.

YOUR SERVICE IS AWESOME! NICE WORK! THANKS! I LOVE YOU GUYS.

Antonio G.

Independent Developer

Dear IP-API.io Team, Thanks for the awesome service!

I have tried many geolocalization API's and this is the best one both in stability and in accurate results.

Miguel C.

Software Engineer

Great project! Super API, the best I have used so far.

10,000 advanced email validation requests

25,000 advanced email validation requests

1,000,000 geo ip requests

100,000 advanced email validation requests

Note: Your API key will be sent to your email after the subscription is confirmed.

Need support?

Explore how IP-API.io can enhance your security, provide robust bot protection, and improve IP geolocation accuracy for your applications.

Contact Support

Need more queries?

Customize your experience with tailored plans that fit your IP security and geolocation needs.

Email Us