IPinfo API
ipinfo.io · Developer Tools
Detailed IP geolocation — city, region, country, ASN, ISP, timezone, and privacy detection (VPN/proxy/Tor). Free tier: 50,000 requests/month.
Authentication
Sample Requests
Get detailed info for Google's public DNS IP.
Hover any highlighted part to learn what it does
curl -X GET "https://ipinfo.io/8.8.8.8/json?token=YOUR_TOKEN" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
import requests
params = {
"token": "YOUR_TOKEN"
}
headers = {
"Authorization": "Bearer YOUR_ACCESS_TOKEN"
}
response = requests.get(
"https://ipinfo.io/8.8.8.8/json",
params=params,
headers=headers,
)
print(response.json())const url = new URL('https://ipinfo.io/8.8.8.8/json');
url.searchParams.set('token', 'YOUR_TOKEN');
const response = await fetch(url, {
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
},
});
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://ipinfo.io/8.8.8.8/json")
q := baseURL.Query()
q.Set("token", "YOUR_TOKEN")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
req.Header.Set("Authorization", "Bearer YOUR_ACCESS_TOKEN")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://ipinfo.io/8.8.8.8/json")
uri.query = URI.encode_www_form({
"token" => "YOUR_TOKEN"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer YOUR_ACCESS_TOKEN"
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://ipinfo.io/8.8.8.8/json?" . http_build_query([
"token" => "YOUR_TOKEN"
]);
$opts = ["http" => [
"method" => "GET",
"header" => implode("\r\n", [
"Authorization: Bearer YOUR_ACCESS_TOKEN"
]),
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Get info for your own IP address.
Hover any highlighted part to learn what it does
curl -X GET "https://ipinfo.io/json?token=YOUR_TOKEN" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
import requests
params = {
"token": "YOUR_TOKEN"
}
headers = {
"Authorization": "Bearer YOUR_ACCESS_TOKEN"
}
response = requests.get(
"https://ipinfo.io/json",
params=params,
headers=headers,
)
print(response.json())const url = new URL('https://ipinfo.io/json');
url.searchParams.set('token', 'YOUR_TOKEN');
const response = await fetch(url, {
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
},
});
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://ipinfo.io/json")
q := baseURL.Query()
q.Set("token", "YOUR_TOKEN")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
req.Header.Set("Authorization", "Bearer YOUR_ACCESS_TOKEN")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://ipinfo.io/json")
uri.query = URI.encode_www_form({
"token" => "YOUR_TOKEN"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer YOUR_ACCESS_TOKEN"
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://ipinfo.io/json?" . http_build_query([
"token" => "YOUR_TOKEN"
]);
$opts = ["http" => [
"method" => "GET",
"header" => implode("\r\n", [
"Authorization: Bearer YOUR_ACCESS_TOKEN"
]),
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- Get a free token at ipinfo.io/signup (50K req/month)
- Pass token=YOUR_TOKEN or Authorization: Bearer YOUR_TOKEN
- Any IP: GET https://ipinfo.io/{ip}/json?token=TOKEN
- Your IP: GET https://ipinfo.io/json?token=TOKEN
- Specific field: GET https://ipinfo.io/{ip}/city?token=TOKEN
What can you build with IPinfo API?
IPinfo API is a Developer Tools API. Developers commonly use developer tools APIs for:
- automating code review and quality checks
- integrating CI/CD pipelines and build systems
- managing feature flags and A/B tests
- monitoring errors and application performance
- generating and validating test data
Bearer token. Your app exchanges credentials for a short-lived token, then sends it as an Authorization header. Tokens expire, so your code needs to handle renewal. IPinfo API is free to use up to a usage limit, making it a low-risk choice to experiment with.
New to APIs? Read our beginner's guide