Skip to content

No public description#1519

Open
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_920024553
Open

No public description#1519
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_920024553

Conversation

@copybara-service
Copy link
Copy Markdown
Contributor

No public description

PiperOrigin-RevId: 920024553
@OjanaProkiti
Copy link
Copy Markdown


title: "IPinfo Lite API"
navTitle: "IPinfo Lite API"
slug: "/developers/lite-api"
parent: "ipinfo-api"
description: "Free API tier with unlimited country-level geolocation and basic ASN information."

IPinfo Lite API

Available for: Every IPinfo user

The IPinfo Lite API is our free-tier API access plan, which includes unlimited country-level geolocation information and unlimited basic ASN information. Geolocation information provided by the IPinfo Lite API service includes country and continent information, while ASN information includes ASN, organization name, and domain name.

The API has no daily or monthly limit and provides unlimited access. The API is based on our IPinfo Lite IP database.

You can access IPinfo Lite data as a downloadable dataset as well: IPinfo Lite IP Data Downloads

Quick Reference

Your browser does not support the video tag.

IPinfo Lite API URL breakdown

API Schema

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "IPinfo Lite API Response",
  "description": "Schema for IPinfo Lite API response",
  "type": "object",
  "properties": {
    "ip": {
      "type": "string",
      "description": "The IP address being queried.",
      "example": "8.8.8.8"
    },
    "asn": {
      "type": "string",
      "description": "The Autonomous System Number (ASN) identifying the organization that owns or operates the IP address.",
      "example": "AS15169"
    },
    "as_name": {
      "type": "string",
      "description": "The official name of the Autonomous System (AS) organization.",
      "example": "Google LLC"
    },
    "as_domain": {
      "type": "string",
      "description": "The official domain name of the Autonomous System (AS) organization.",
      "example": "google.com"
    },
    "country_code": {
      "type": "string",
      "description": "The ISO 3166 country code (ISO 3166-1 alpha-2).",
      "example": "US"
    },
    "country": {
      "type": "string",
      "description": "The country where the IP address is located.",
      "example": "United States"
    },
    "continent_code": {
      "type": "string",
      "description": "The two-letter continent code.",
      "example": "NA"
    },
    "continent": {
      "type": "string",
      "description": "The continent where the IP address is located.",
      "example": "North America"
    }
  },
  "required": ["ip"]
}
Field Description Example
ip The client IP address or IP address being queried 8.8.8.8
asn Autonomous System Number AS15169
as_name Organization name Google LLC
as_domain Organization's domain name google.com
country_code Two-letter country code (ISO 3166-1 alpha-2) US
country Full country name United States
continent_code Two-letter continent code NA
continent Full continent name North America

Lookup IP addresses

bash

curl https://api.ipinfo.io/lite/8.8.8.8?token=$TOKEN
{
  "ip": "8.8.8.8",
  "asn": "AS15169",
  "as_name": "Google LLC",
  "as_domain": "google.com",
  "country_code": "US",
  "country": "United States",
  "continent_code": "NA",
  "continent": "North America"
}

Python

import ipinfo

# Initialize Lite handler
handler = ipinfo.getHandlerLite(access_token='$TOKEN')

# Look up a specific IP address
details = handler.getDetails("8.8.8.8")

print(details.ip)              # '8.8.8.8'
print(details.country_code)    # 'US'
print(details.country)         # 'United States'
print(details.asn)             # 'AS15169'
print(details.as_name)         # 'Google LLC'

print(details.all)
{
  "ip": "8.8.8.8",
  "asn": "AS15169",
  "as_name": "Google LLC",
  "as_domain": "google.com",
  "country_code": "US",
  "country": "United States",
  "continent_code": "NA",
  "continent": "North America"
}

PHP

getDetails('8.8.8.8');

echo $details->ip . PHP_EOL;            // '8.8.8.8'
echo $details->country_code . PHP_EOL;  // 'US'
echo $details->country . PHP_EOL;       // 'United States'
echo $details->asn . PHP_EOL;           // 'AS15169'
echo $details->as_name . PHP_EOL;       // 'Google LLC'

print_r($details->all); // all fields as an associative array
{
  "ip": "8.8.8.8",
  "asn": "AS15169",
  "as_name": "Google LLC",
  "as_domain": "google.com",
  "country_code": "US",
  "country": "United States",
  "continent_code": "NA",
  "continent": "North America"
}

Laravel (PHP)

getDetails('8.8.8.8');

echo $details->ip . PHP_EOL;            // '8.8.8.8'
echo $details->country_code . PHP_EOL;  // 'US'
echo $details->country . PHP_EOL;       // 'United States'
echo $details->asn . PHP_EOL;           // 'AS15169'
echo $details->as_name . PHP_EOL;       // 'Google LLC'

// Get ALL details as an array/dictionary
print_r($details->all);
{
  "ip": "8.8.8.8",
  "asn": "AS15169",
  "as_name": "Google LLC",
  "as_domain": "google.com",
  "country_code": "US",
  "country": "United States",
  "continent_code": "NA",
  "continent": "North America"
}

Node.js

const { IPinfoLiteWrapper } = require("node-ipinfo");

(async () => {
  // Initialize Lite handler
  const ipinfo = new IPinfoLiteWrapper(process.env.TOKEN || "$TOKEN");

  // Look up a specific IP address
  const details = await ipinfo.lookupIp("8.8.8.8");

  console.log(details.ip);            // "8.8.8.8"
  console.log(details.countryCode);   // e.g. "US" (property names depend on the response)
  console.log(details.country);       // e.g. "United States"
  console.log(details.asn);           // e.g. { asn: "AS15169", name: "Google LLC", domain: "google.com", ... }

  // Print ALL details as JSON
  console.log(JSON.stringify(details, null, 2));
})().catch(console.error);
{
  "ip": "8.8.8.8",
  "asn": "AS15169",
  "as_name": "Google LLC",
  "as_domain": "google.com",
  "country_code": "US",
  "country": "United States",
  "continent_code": "NA",
  "continent": "North America"
}

Go

package main

import (
	"encoding/json"
	"fmt"
	"log"
	"net"
	"os"

	"github.com/ipinfo/go/v2/ipinfo"
)

func main() {
	// Initialize Lite client
	token := os.Getenv("IPINFO_TOKEN") // same as $TOKEN
	if token == "" {
		log.Fatal("missing IPINFO_TOKEN")
	}
	client := ipinfo.NewLiteClient(nil, nil, token)

	// Look up a specific IP address
	details, err := client.GetIPInfo(net.ParseIP("8.8.8.8"))
	if err != nil {
		log.Fatal(err)
	}

	// Access individual fields
	fmt.Println(details.IP.String()) // "8.8.8.8"
	fmt.Println(details.CountryCode) // "US"
	fmt.Println(details.Country)     // "United States"
	fmt.Println(details.ASN)         // "AS15169"
	fmt.Println(details.ASName)      // "Google LLC"

	// Get ALL details as JSON
	b, _ := json.MarshalIndent(details, "", "  ")
	fmt.Println(string(b))
}
{
  "ip": "8.8.8.8",
  "asn": "AS15169",
  "as_name": "Google LLC",
  "as_domain": "google.com",
  "country_code": "US",
  "country": "United States",
  "continent_code": "NA",
  "continent": "North America"
}

Java

import io.ipinfo.api.IPinfoLite;
import io.ipinfo.api.errors.RateLimitedException;
import io.ipinfo.api.model.IPResponseLite;

public class Main {
    public static void main(String[] args) {
        // Initialize Lite client
        IPinfoLite client = new IPinfoLite.Builder()
                .setToken(System.getenv("TOKEN")) // same as $TOKEN
                .build();

        try {
            // Look up a specific IP address (Lite endpoint: https://api.ipinfo.io/lite/{ip})
            IPResponseLite details = client.lookupIP("8.8.8.8");

            System.out.println(details.getIp());          // "8.8.8.8"
            System.out.println(details.getCountryCode()); // "US"
            System.out.println(details.getCountry());     // "United States"
            System.out.println(details.getAsn());         // "AS15169"
            System.out.println(details.getAsName());      // "Google LLC"

            // If you just need the raw JSON, you can serialize the object:
            // System.out.println(new com.google.gson.Gson().toJson(details));
        } catch (RateLimitedException ex) {
            System.err.println("Rate limited by IPinfo API");
        }
    }
}
{
  "ip": "8.8.8.8",
  "asn": "AS15169",
  "as_name": "Google LLC",
  "as_domain": "google.com",
  "country_code": "US",
  "country": "United States",
  "continent_code": "NA",
  "continent": "North America"
}

Rust

use ipinfo::{IpInfoLite, IpInfoLiteConfig};

#[tokio::main]
async fn main() -> Result> {
    // Initialize Lite handler
    let config = IpInfoLiteConfig {
        token: Some("$TOKEN".to_string()),
        ..Default::default()
    };
    let mut ipinfo = IpInfoLite::new(config)?;

    // Look up a specific IP address
    let details = ipinfo.lookup("8.8.8.8").await?;

    println!("{}", details.ip);                 // "8.8.8.8"
    println!("{:?}", details.country_code);     // Some("US")
    println!("{:?}", details.country);          // Some("United States")
    println!("{:?}", details.asn);              // Some("AS15169")
    println!("{:?}", details.as_name);          // Some("Google LLC")

    // Print ALL details as JSON
    println!("{}", serde_json::to_string_pretty(&details)?);

    Ok(())
}
{
  "ip": "8.8.8.8",
  "asn": "AS15169",
  "as_name": "Google LLC",
  "as_domain": "google.com",
  "country_code": "US",
  "country": "United States",
  "continent_code": "NA",
  "continent": "North America"
}

Get information on your or visitors' IP address:

bash

curl https://api.ipinfo.io/lite/me?token=$TOKEN
{
  "ip": "8.8.8.8",
  "asn": "AS15169",
  "as_name": "Google LLC",
  "as_domain": "google.com",
  "country_code": "US",
  "country": "United States",
  "continent_code": "NA",
  "continent": "North America"
}

Python

import ipinfo

# Initialize Lite handler
handler = ipinfo.getHandlerLite(access_token='$TOKEN')

# Call getDetails() without an IP address
details = handler.getDetails()

# Access your information
my_details = handler.getDetails()
print(my_details.ip)           # Your IP address
print(my_details.country)      # Your country

# Get ALL details as a dictionary
print(my_details.all)
{
  "ip": "8.8.8.8",
  "asn": "AS15169",
  "as_name": "Google LLC",
  "as_domain": "google.com",
  "country_code": "US",
  "country": "United States",
  "continent_code": "NA",
  "continent": "North America"
}

PHP

getDetails();

// Access your information
echo $my_details->ip . PHP_EOL;           // Your IP address
echo $my_details->country . PHP_EOL;      // Your country

// Get ALL details as an associative array (Lite response payload)
print_r($my_details->all);

// Lookup a specific IP
$details = $client->getDetails('8.8.8.8');
echo json_encode($details->all, JSON_PRETTY_PRINT), PHP_EOL;
{
  "ip": "8.8.8.8",
  "asn": "AS15169",
  "as_name": "Google LLC",
  "as_domain": "google.com",
  "country_code": "US",
  "country": "United States",
  "continent_code": "NA",
  "continent": "North America"
}

Laravel (PHP)

getDetails();

echo $myDetails->ip . PHP_EOL;       // Your IP address
echo $myDetails->country . PHP_EOL;  // Your country

// Look up a specific IP (equivalent to: /lite/8.8.8.8?token=$TOKEN)
$details = $client->getDetails('8.8.8.8');

// Get ALL details as an array/dictionary
print_r($details->all);
{
  "ip": "8.8.8.8",
  "asn": "AS15169",
  "as_name": "Google LLC",
  "as_domain": "google.com",
  "country_code": "US",
  "country": "United States",
  "continent_code": "NA",
  "continent": "North America"
}

Node.js

import { IPinfoLiteWrapper } from "node-ipinfo";

// Initialize Lite client
const client = new IPinfoLiteWrapper(process.env.TOKEN || "$TOKEN");

// Call lookupIp() with an IP address (Lite endpoint)
const details = await client.lookupIp("8.8.8.8");

// Access fields (note: this SDK uses camelCase)
console.log(details.ip);          // "8.8.8.8"
console.log(details.asn);         // "AS15169"
console.log(details.asName);      // "Google LLC"
console.log(details.asDomain);    // "google.com"
console.log(details.countryCode); // "US"
console.log(details.country);     // "United States"
console.log(details.continentCode); // "NA"
console.log(details.continent);     // "North America"

// Get ALL details as an object
console.log(details);
{
  "ip": "8.8.8.8",
  "asn": "AS15169",
  "as_name": "Google LLC",
  "as_domain": "google.com",
  "country_code": "US",
  "country": "United States",
  "continent_code": "NA",
  "continent": "North America"
}

Go

package main

import (
	"encoding/json"
	"fmt"
	"log"
	"net"
	"os"

	"github.com/ipinfo/go/v2/ipinfo"
)

func main() {
	// Read token (same as $TOKEN in your curl example)
	token := os.Getenv("IPINFO_TOKEN")
	if token == "" {
		log.Fatal("missing IPINFO_TOKEN")
	}

	// Initialize Lite client (https://api.ipinfo.io/lite/)
	client := ipinfo.NewLiteClient(nil, nil, token)

	// Call GetIPInfo() with no IP to get "me"
	myInfo, err := client.GetIPInfo(nil)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println("My IP:", myInfo.IP)
	fmt.Println("My country:", myInfo.Country)

	// Call GetIPInfo() for a specific IP (like: /lite/8.8.8.8?token=...)
	info, err := client.GetIPInfo(net.ParseIP("8.8.8.8"))
	if err != nil {
		log.Fatal(err)
	}

	// Get ALL details as JSON
	b, _ := json.MarshalIndent(info, "", "  ")
	fmt.Println(string(b))
}
{
  "ip": "8.8.8.8",
  "asn": "AS15169",
  "as_name": "Google LLC",
  "as_domain": "google.com",
  "country_code": "US",
  "country": "United States",
  "continent_code": "NA",
  "continent": "North America"
}

Java

import io.ipinfo.api.IPinfoLite;
import io.ipinfo.api.errors.RateLimitedException;
import io.ipinfo.api.model.IPResponseLite;

public class Main {
    public static void main(String[] args) {
        // Read token from env var (equivalent to $TOKEN in curl)
        String token = System.getenv("TOKEN");

        // Initialize Lite client
        IPinfoLite client = new IPinfoLite.Builder()
                .setToken(token)
                .build();

        try {
            // Lookup an IP (Lite endpoint: https://api.ipinfo.io/lite/{ip})
            IPResponseLite details = client.lookupIP("8.8.8.8");

            // Access fields (names match the Lite response)
            System.out.println(details.getIp());            // 8.8.8.8
            System.out.println(details.getAsn());           // AS15169
            System.out.println(details.getAsName());        // Google LLC
            System.out.println(details.getAsDomain());      // google.com
            System.out.println(details.getCountryCode());   // US
            System.out.println(details.getCountry());       // United States
            System.out.println(details.getContinentCode()); // NA
            System.out.println(details.getContinent());     // North America
        } catch (RateLimitedException ex) {
            // Handle rate limits here (HTTP 429)
            System.err.println("Rate limited by IPinfo API");
        }
    }
}
{
  "ip": "8.8.8.8",
  "asn": "AS15169",
  "as_name": "Google LLC",
  "as_domain": "google.com",
  "country_code": "US",
  "country": "United States",
  "continent_code": "NA",
  "continent": "North America"
}

Rust

use ipinfo::{IpInfoLite, IpInfoLiteConfig};

#[tokio::main]
async fn main() -> Result> {
    // Initialize Lite handler
    let config = IpInfoLiteConfig {
        token: Some("$TOKEN".to_string()),
        ..Default::default()
    };
    let mut ipinfo = IpInfoLite::new(config)?;

    // Call lookup_self_v4() to get details for your own public IPv4 ("me")
    let my_details = ipinfo.lookup_self_v4().await?;
    println!("{}", my_details.ip);            // Your IP address
    println!("{:?}", my_details.country);     // Your country (name)

    // Look up a specific IP (like: curl https://api.ipinfo.io/lite/8.8.8.8?token=$TOKEN)
    let details = ipinfo.lookup("8.8.8.8").await?;

    // Get ALL details as JSON
    println!("{}", serde_json::to_string_pretty(&details)?);

    Ok(())
}
{
  "ip": "8.8.8.8",
  "asn": "AS15169",
  "as_name": "Google LLC",
  "as_domain": "google.com",
  "country_code": "US",
  "country": "United States",
  "continent_code": "NA",
  "continent": "North America"
}

IP Address Types

US Based IP

https://api.ipinfo.io/lite/64.189.247.110?token=$TOKEN
{
  "ip": "64.189.247.110",
  "asn": "AS54607",
  "as_name": "Apogee Telecom Inc.",
  "as_domain": "apogee.us",
  "country_code": "US",
  "country": "United States",
  "continent_code": "NA",
  "continent": "North America"
}

EU Based IP

https://api.ipinfo.io/lite/89.239.174.87?token=$TOKEN
{
  "ip": "89.239.174.87",
  "asn": "AS12389",
  "as_name": "PJSC Rostelecom",
  "as_domain": "rt.ru",
  "country_code": "RU",
  "country": "Russia",
  "continent_code": "EU",
  "continent": "Europe"
}

Cloudflare IP

https://api.ipinfo.io/lite/1.1.1.1?token=$TOKEN
{
  "ip": "1.1.1.1",
  "asn": "AS13335",
  "as_name": "Cloudflare, Inc.",
  "as_domain": "cloudflare.com",
  "country_code": "AU",
  "country": "Australia",
  "continent_code": "OC",
  "continent": "Oceania"
}

Cogent IP

https://api.ipinfo.io/lite/38.206.217.73?token=$TOKEN
{
  "ip": "38.206.217.73",
  "asn": "AS174",
  "as_name": "Cogent Communications, LLC",
  "as_domain": "cogentco.com",
  "country_code": "US",
  "country": "United States",
  "continent_code": "NA",
  "continent": "North America"
}

API Endpoint Breakdown

The API endpoint also supports explicit declaration of IP address connections (IPv4/IPv6).

Description Endpoint type Endpoint
General (Dual Stacked) Self / Client IP curl https://api.ipinfo.io/lite/me?token=$TOKEN
Lookup / Target IP curl https://api.ipinfo.io/lite/8.8.8.8?token=$TOKEN
IPv4 Self / Client IP curl https://v4.api.ipinfo.io/lite/me?token=$TOKEN
Lookup / Target IP curl https://v4.api.ipinfo.io/lite/8.8.8.8?token=$TOKEN
IPv6 Self / Client IP curl https://v6.api.ipinfo.io/lite/me?token=$TOKEN
Lookup / Target IP curl https://v6.api.ipinfo.io/lite/8.8.8.8?token=$TOKEN

The general API endpoint is built to support both IPv4 and IPv6 connections, ensuring you can call it from either without any issues.

If the IP is anycast or bogon, an additional field is returned indicating that.

Check out the code snippets section for IPinfo Lite API related code and responses.

Bulk / Batch Enrichment

The bulk API endpoint can enrich up to 1,000 requests per call.

Your browser does not support the video tag.

JSON Array: Full Records

Full Record Lookup

Use a JSON array of IPs to return full Lite records for each IP.

curl -XPOST --data '["216.66.251.30", "187.206.182.231", "94.30.95.36", "31.251.149.240"]' "https://api.ipinfo.io/batch/lite?token=$TOKEN"

Response

{
  "216.66.251.30": {
    "ip": "216.66.251.30",
    "asn": "AS11123",
    "as_name": "Ultimate Internet Access, Inc",
    "as_domain": "uia.net",
    "country_code": "US",
    "country": "United States",
    "continent_code": "NA",
    "continent": "North America"
  },
  "31.251.149.240": {
    "ip": "31.251.149.240",
    "asn": "AS3320",
    "as_name": "Deutsche Telekom AG",
    "as_domain": "telekom.de",
    "country_code": "DE",
    "country": "Germany",
    "continent_code": "EU",
    "continent": "Europe"
  },
  "187.206.182.231": {
    "ip": "187.206.182.231",
    "asn": "AS8151",
    "as_name": "UNINET",
    "as_domain": "telmex.com",
    "country_code": "MX",
    "country": "Mexico",
    "continent_code": "NA",
    "continent": "North America"
  },
  "94.30.95.36": {
    "ip": "94.30.95.36",
    "asn": "AS5413",
    "as_name": "Wavenet Limited",
    "as_domain": "wavenet.co.uk",
    "country_code": "GB",
    "country": "United Kingdom",
    "continent_code": "EU",
    "continent": "Europe"
  }
}

JSON Array: Field Paths

Targeted Field Lookup

Use URL patterns in the array when you only need specific fields.

curl -XPOST --data '["140.225.129.233/asn", "99.85.48.135/country_code", "164.61.188.112/country", "91.242.168.212/continent_code"]' "https://api.ipinfo.io/batch/lite?token=$TOKEN"

Response

{
  "140.225.129.233/asn": "AS14763",
  "99.85.48.135/country_code": "US",
  "91.242.168.212/continent_code": "EU",
  "164.61.188.112/country": "Germany"
}

Text Input

Plain Text Input

Send space-separated IPs with text/plain for simple shell workflows.

curl -X POST https://api.ipinfo.io/batch/lite?token=$TOKEN -H 'Content-Type: text/plain' -d '216.66.251.30 31.251.149.240 187.206.182.231 94.30.95.36'

Response

{
  "31.251.149.240": {
    "ip": "31.251.149.240",
    "asn": "AS3320",
    "as_name": "Deutsche Telekom AG",
    "as_domain": "telekom.de",
    "country_code": "DE",
    "country": "Germany",
    "continent_code": "EU",
    "continent": "Europe"
  },
  "216.66.251.30": {
    "ip": "216.66.251.30",
    "asn": "AS11123",
    "as_name": "Ultimate Internet Access, Inc",
    "as_domain": "uia.net",
    "country_code": "US",
    "country": "United States",
    "continent_code": "NA",
    "continent": "North America"
  },
  "187.206.182.231": {
    "ip": "187.206.182.231",
    "asn": "AS8151",
    "as_name": "UNINET",
    "as_domain": "telmex.com",
    "country_code": "MX",
    "country": "Mexico",
    "continent_code": "NA",
    "continent": "North America"
  },
  "94.30.95.36": {
    "ip": "94.30.95.36",
    "asn": "AS5413",
    "as_name": "Wavenet Limited",
    "as_domain": "wavenet.co.uk",
    "country_code": "GB",
    "country": "United Kingdom",
    "continent_code": "EU",
    "continent": "Europe"
  }
}

@OjanaProkiti
Copy link
Copy Markdown

https://ojanapalash.info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants