IP2ASN

Free IP to Autonomous System Number Lookup Service

What is IP2ASN?

IP2ASN is a free service that maps IP addresses (both IPv4 and IPv6) to their origin Autonomous System Numbers (ASNs). An Autonomous System is a collection of IP networks and routers under the control of a single organization that presents a common routing policy to the internet.

REST API

Simple JSON API with no authentication required. Perfect for scripts and automation.

MCP Server

Model Context Protocol server for AI assistants to perform IP lookups programmatically.

Real-time Data

Queries live BGP routing data for accurate, up-to-date results.

Try It Now

Enter an IP address to look up its origin ASN

REST API

Endpoint

GET /json?ip=<address>

Parameters

Parameter Type Required Description
ip string Yes IPv4 or IPv6 address to lookup

Response Format

Successful response (HTTP 200):

{
  "origins": [15169]
}

The origins array contains the unique ASNs found in the BGP routing table for the given IP address. Multiple ASNs may be returned if the IP is multi-homed.

Error Responses

Status Code Description
400 Invalid IP address format
451 IP address is in private/reserved/multicast range
500 Backend lookup failed or timeout

Examples

cURL

curl https://ip2asn.net/json?ip=8.8.8.8

Python

import requests

response = requests.get('https://ip2asn.net/json?ip=8.8.8.8')
data = response.json()
print(f"ASNs: {data['origins']}")

JavaScript

fetch('https://ip2asn.net/json?ip=8.8.8.8')
  .then(response => response.json())
  .then(data => console.log('ASNs:', data.origins));

Go

resp, err := http.Get("https://ip2asn.net/json?ip=8.8.8.8")
if err != nil {
    log.Fatal(err)
}
defer resp.Body.Close()

var result struct {
    Origins []int `json:"origins"`
}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println("ASNs:", result.Origins)

Use Cases

Limitations

MCP Server

The service includes a Model Context Protocol (MCP) server at /mcp that exposes IP-to-ASN lookup functionality to AI assistants and other MCP clients.

MCP Tools

MCP Resources

Example MCP Request

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "lookup_asn",
    "arguments": {
      "ip": "8.8.8.8"
    }
  }
}

The MCP server follows the Model Context Protocol specification and supports initialize, tools/list, tools/call, resources/list, and resources/read methods.

Additional Endpoints

Service Metrics

Real-time service statistics:

Service Metrics
Terms of Use: This is a free service provided without warranty. By using this service, you agree that: