BGPv6.com API v1
Free REST API for global BGP routing data, ASN intelligence, and GeoIP lookups. No authentication required.
https://bgpv6.com/api/v1
/api/v1/lookup/{ip}
Look up BGP routing information for any IP address. Returns the matching prefix, origin ASN, AS path, RPKI status, and optional GeoIP data.
Parameters
| Name | Type | Required |
|---|---|---|
| ip | string | required |
Accepts IPv4 or IPv6. Example: 8.8.8.8, 2001:4860:4860::8888
Request
curl https://bgpv6.com/api/v1/lookup/8.8.8.8
Response
{
"data": {
"prefix": "8.8.8.0/24",
"origin_asn": 15169,
"as_path": [13335, 15169],
"rpki_status": "valid",
"is_ipv6": false
},
"geoip": {
"country": "US",
"city": "Mountain View",
"latitude": 37.386,
"longitude": -122.0838
}
}
/api/v1/asn/{asn}
Retrieve full ASN details including organization name, RIR, country, prefix counts, upstream and downstream peer relationships.
Parameters
| Name | Type | Required |
|---|---|---|
| asn | integer | required |
Accepts plain number or AS prefix: 13335 or AS13335
Request
curl https://bgpv6.com/api/v1/asn/13335
Response
{
"asn": 13335,
"name": "CLOUDFLARENET",
"description": "Cloudflare, Inc.",
"country": "US",
"rir": "ARIN",
"prefix_v4": 1524,
"prefix_v6": 142,
"website": "https://cloudflare.com",
"peers": {
"upstream": [174, 3356, ...],
"downstream": [...]
}
}
/api/v1/asn/{asn}/prefixes
List all prefixes originated by an ASN. Supports filtering by IP version and pagination.
Query Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| asn | integer | — | AS number required |
| filter | string | all | all · v4 · v6 |
| page | integer | 1 | Page number |
| per_page | integer | 100 | Results per page (max 1000) |
Request
curl "https://bgpv6.com/api/v1/asn/13335/prefixes?filter=v6&per_page=25"
Response shape
{ "data": [...], "total": 142, "page": 1, "per_page": 25, "total_pages": 6 }
/api/v1/prefix/{prefix}
NEW
Get all routing table entries for a specific BGP prefix. Returns per-source data including origin ASN, AS path, RPKI status, communities, and first/last seen timestamps.
Parameters
| Name | Type | Required |
|---|---|---|
| prefix | string | required |
CIDR notation: 1.1.1.0/24 or 2606:4700::/32
Request
curl https://bgpv6.com/api/v1/prefix/1.1.1.0/24
Response
{
"prefix": "1.1.1.0/24",
"total": 5,
"data": [{
"prefix": "1.1.1.0/24",
"origin_asn": 13335,
"as_path": [...],
"rpki_status": "valid",
"communities": [...],
"source": "ris",
"first_seen": "2024-01-01T00:00:00Z",
"last_seen": "2026-05-23T12:00:00Z"
}, ...]
}
/api/v1/search
Search for ASNs by number, name, or description; or search for prefixes by CIDR. Returns up to 500 results.
Query Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| q | string | — | Search query required |
| type | string | all | all · asn · prefix |
| limit | integer | 50 | Max results (max 500) |
Request
curl "https://bgpv6.com/api/v1/search?q=cloudflare&type=asn"
Response shape
{ "asns": [...], "asn_total": 12,
"prefixes": [...], "prefix_total": 3 }
/api/v1/stats
NEW
Get global routing table statistics: total ASNs, IPv4 prefixes, IPv6 prefixes, and country count. Updated every ~30 minutes with each pipeline run.
Request
curl https://bgpv6.com/api/v1/stats
Response
{
"total_asns": 86753,
"total_prefixes": 1444854,
"total_v4": 958201,
"total_v6": 486653,
"total_countries": 237
}
/api/v1/geoip/{ip}
Get geographic location data for an IP address. Powered by MaxMind GeoLite2 databases.
Request
curl https://bgpv6.com/api/v1/geoip/8.8.8.8
Response
{
"ip": "8.8.8.8",
"country": "US",
"city": "Mountain View",
"latitude": 37.386,
"asn": 15169,
"org": "Google LLC"
}
Export / Download
Download full prefix lists for any ASN. No authentication or pagination required — returns the complete dataset.
Error Handling
All errors return a JSON object with an error string and the appropriate HTTP status code.
| Status | Meaning |
|---|---|
| 200 | Success |
| 400 | Bad request / invalid parameter |
| 404 | Resource not found |
| 429 | Rate limit exceeded (60/min) |
| 500 | Server error |
| 503 | Service unavailable (GeoIP not loaded) |
Error response
{
"error": "Invalid ASN"
}
Code Examples
# IP lookup
curl https://bgpv6.com/api/v1/lookup/8.8.8.8
# ASN info
curl https://bgpv6.com/api/v1/asn/13335
# Prefix info
curl https://bgpv6.com/api/v1/prefix/1.1.1.0/24
# Search
curl "https://bgpv6.com/api/v1/search?q=cloudflare&type=asn"
# Global stats
curl https://bgpv6.com/api/v1/stats
// IP lookup
const res = await fetch('https://bgpv6.com/api/v1/lookup/8.8.8.8');
const data = await res.json();
console.log(data.data.origin_asn); // 15169
// ASN prefixes
const prefixes = await fetch(
'https://bgpv6.com/api/v1/asn/13335/prefixes?filter=v6'
).then(r => r.json());
console.log(`${prefixes.total} IPv6 prefixes`);
import requests
# IP lookup
r = requests.get('https://bgpv6.com/api/v1/lookup/8.8.8.8')
data = r.json()
print(data['data']['origin_asn']) # 15169
# Global stats
stats = requests.get('https://bgpv6.com/api/v1/stats').json()
print(f"{stats['total_asns']:,} ASNs in routing table")
package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
resp, _ := http.Get("https://bgpv6.com/api/v1/stats")
var stats map[string]int64
json.NewDecoder(resp.Body).Decode(&stats)
fmt.Println(stats["total_asns"])
}