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
GET All endpoints read-only
No API key needed
JSON response format
Rate limit: 60 req/min
GET /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

NameTypeRequired
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
  }
}
GET /api/v1/asn/{asn}

Retrieve full ASN details including organization name, RIR, country, prefix counts, upstream and downstream peer relationships.

Parameters

NameTypeRequired
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": [...]
  }
}
GET /api/v1/asn/{asn}/prefixes

List all prefixes originated by an ASN. Supports filtering by IP version and pagination.

Query Parameters

NameTypeDefaultDescription
asnintegerAS number required
filterstringallall · v4 · v6
pageinteger1Page number
per_pageinteger100Results 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 }
GET /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

NameTypeRequired
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"
  }, ...]
}
GET /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
}
GET /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.

/export/asn/{asn}/prefixes.csv

All prefixes as CSV

Download example
/export/asn/{asn}/prefixes.json

All prefixes as JSON

Download example
/export/asn/{asn}/info.json

ASN metadata as JSON

Download example
Error Handling

All errors return a JSON object with an error string and the appropriate HTTP status code.

StatusMeaning
200Success
400Bad request / invalid parameter
404Resource not found
429Rate limit exceeded (60/min)
500Server error
503Service 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"])
}