API Documentation

Access BGP network data and submit traceroutes programmatically.

Overview

The BGPScout API allows you to query network data, retrieve ASN details, and submit traceroute results. All responses are JSON unless otherwise noted.

Base URL:https://bgpscout.io/api

Data Quality & Methodology

Trace Processing Pipeline

Every traceroute submitted to BGPScout goes through a multi-stage enrichment pipeline before being included in any analysis or public results:

  1. Submission — Raw MTR/traceroute data is received via the API or RIPE Atlas.
  2. Enrichment — Each hop IP is resolved to an ASN (via BGP prefix tables), geolocated (via geofeed, IPinfo, MaxMind), and classified (anycast, IXP, cloud, etc.).
  3. Quality Scoring — A 0-10 data quality score is computed based on: PTR record coverage, geo coverage, hop completion ratio, and path coherence.
  4. Display Gating — Traces with quality score ≤ 2 are auto-rejected. Scores 3-5 go to pending review. Scores 6+ are auto-approved. Only approved traces appear in search results and analysis.
Unenriched traces are never shown. Traces awaiting enrichment (quality_score IS NULL) are excluded from all public views, search results, and analysis tools. Users can see processing status on their submissions page.

Boomerang Detection

A "boomerang route" is detected when a traceroute from country A to a destination also in country A transits through a different country. This indicates suboptimal routing where domestic traffic unnecessarily crosses international borders.

Data Sources

  • Traceroutes — User-submitted MTR tests, RIPE Atlas measurements, automated probes in 30+ countries
  • ASN Data — ARIN, RIPE NCC, APNIC, LACNIC, AFRINIC registry data
  • PeeringDB — Facility presence, IXP memberships, port speeds
  • GeoIP — Geofeed (RFC 8805), IPinfo, MaxMind, PTR hostname analysis
  • Domain Intelligence — Certificate Transparency, DNS enumeration, WHOIS

Authentication

Some endpoints require an API key passed via the X-API-Key HTTP header. Public endpoints do not require authentication.

To obtain an API key, log in and visit your Account Settings page.

curl -H "X-API-Key: your_api_key_here" \
     https://bgpscout.io/api/traceroutes/submit

Rate Limits

All endpoints are rate-limited to 100 requests per hour per API key (or per IP for unauthenticated requests). Exceeding this limit returns a 429 response.

HeaderDescription
RateLimit-LimitMaximum requests per window
RateLimit-RemainingRequests remaining in current window
RateLimit-ResetSeconds until limit resets

Traceroute Statistics

GET/api/traceroutes/statsPublic

Returns aggregate statistics about all collected traceroutes.

Example Request

curl https://bgpscout.io/api/traceroutes/stats

Example Response

{
  "success": true,
  "stats": {
    "total_traces": 14523,
    "source_countries": 12,
    "unique_destinations": 987,
    "unique_source_asns": 45,
    "boomerang_count": 312,
    "leaves_country_count": 1804,
    "earliest_trace": "2025-01-15T00:00:00.000Z",
    "latest_trace": "2026-04-02T18:30:00.000Z"
  },
  "top_source_countries": [
    { "source_country": "CA", "trace_count": 9821 },
    { "source_country": "US", "trace_count": 3104 }
  ]
}

Submit Traceroutes

POST/api/traceroutes/submitRequires API Key

Submit one or more traceroute results for storage and analysis.

Maximum 50 traces per request. Body limit: 5MB.

Headers

NameRequiredDescription
X-API-KeyYesYour API key
Content-TypeYesapplication/json

Request Body

{
  "traces": [
    {
      "host": "example.com",
      "dest_ip": "93.184.216.34",
      "source_ip": "192.168.1.1",
      "source_country": "CA",
      "platform": "linux",
      "tool": "mtr",
      "completed": true,
      "hops": [
        {
          "hop_number": 1,
          "ip": "192.168.1.1",
          "hostname": "gateway.local",
          "rtt_avg": 1.2,
          "rtt_min": 0.8,
          "rtt_max": 2.1,
          "loss_pct": 0
        },
        {
          "hop_number": 2,
          "ip": "10.0.0.1",
          "rtt_avg": 5.4
        }
      ]
    }
  ]
}

Hop Fields

FieldTypeRequiredDescription
hop_numberintegerYesTTL hop position (1-64)
ipstringNoIP address of the hop (null for timeouts)
hostnamestringNoReverse DNS hostname
rtt_avgfloatNoAverage round-trip time in ms
rtt_minfloatNoMinimum RTT in ms
rtt_maxfloatNoMaximum RTT in ms
loss_pctfloatNoPacket loss percentage (0-100)

Example Response

{
  "success": true,
  "trace_ids": [1042, 1043],
  "count": 2
}

Error Response

{
  "success": false,
  "error": "Validation failed",
  "details": [
    { "trace_index": 0, "errors": ["Invalid dest_ip format"] }
  ]
}

ASN Information

GET/api/asn/:asnPublic

Returns detailed information about an ASN including peering quality and route scoring.

Parameters

NameTypeDescription
:asnintegerThe AS number to look up (e.g. 577)

Example Request

curl https://bgpscout.io/api/asn/577

Example Response

{
  "asn": 577,
  "name": "BACOM",
  "country": "CA",
  "rir": "arin",
  "traffic_level": "Medium",
  "network_type": "NSP",
  "on_ix": true,
  "peering_quality": {
    "crossing_rate": 0.12,
    "quality_tag": "Good"
  },
  "route_score": {
    "quality": 78.5,
    "route": 82.1,
    "overall": 80.3
  },
  "url": "https://bgpscout.io/asns/577"
}

Embeddable ASN Widget

GET/api/embed/asn/:asnPublic

Returns a self-contained HTML card for an ASN that can be embedded via an iframe.

Usage

<iframe src="https://bgpscout.io/api/embed/asn/577"
        width="320" height="200"
        frameborder="0"></iframe>

Preview

The widget displays the ASN name, country, peering quality badge, route score, and a link back to BGPScout.

MTR Client

The BGPScout MTR client collects traceroute data and submits it to the API automatically.

Download

Download Latest Release

Installation

# Linux / macOS
chmod +x bgpscout-mtr
sudo mv bgpscout-mtr /usr/local/bin/

# Verify installation
bgpscout-mtr --version

Configuration

# Set your API key (from /account)
bgpscout-mtr config --api-key YOUR_API_KEY

# Optionally set your source ASN
bgpscout-mtr config --source-asn 33185

Usage

# Run a single trace
bgpscout-mtr trace example.com

# Run against Tranco top sites (batch mode)
bgpscout-mtr batch --targets tranco-top100.txt

# Run with automatic submission
bgpscout-mtr trace --submit example.com

# Schedule recurring traces (cron-friendly)
bgpscout-mtr batch --targets targets.txt --submit --quiet

Example Output

$ bgpscout-mtr trace --submit google.ca
Tracing google.ca (142.250.80.67)...
 1  gateway.local (192.168.1.1)    1.2ms
 2  10.0.0.1                       5.4ms
 3  isp-core.example.net           12.1ms
 ...
Submitted trace ID: 1042

MCP Server (Model Context Protocol)

BGPScout exposes an MCP server that lets AI assistants (Claude, ChatGPT, Cursor, etc.) query network data, look up ASNs, search traceroutes, and run analysis using natural language.

MCP Server URL

https://bgpscout.io/mcp

Authentication

The MCP server supports two authentication methods:

MethodHowBest For
API KeyPass via X-API-Key headerClaude Desktop, Cursor, VS Code
OAuth 2.0Browser-based login (Google/PeeringDB)ChatGPT

Claude Desktop / Cursor Setup

Add this to your MCP client configuration:

{
  "mcpServers": {
    "bgpscout": {
      "url": "https://bgpscout.io/mcp",
      "headers": {
        "X-API-Key": "your_api_key_here"
      }
    }
  }
}

Get your API key from Account Settings.

Available Tools

Once connected, the MCP server provides these tools:

lookup_asnLook up detailed ASN information
search_asnsSearch ASNs by name, country, type
get_asn_tracesGet traceroute data for an ASN
get_ixp_infoLook up Internet Exchange Points
get_facility_infoLook up data center facilities
get_prefix_countsGet IPv4/IPv6 prefix counts for an ASN
get_boomerang_statsGet boomerang routing statistics by country

Example Prompts

"What ISPs in Canada have the highest boomerang rate?"

"Look up AS577 and tell me about their peering quality"

"Find all CDN networks in Germany with more than 5 IXP memberships"

"Which networks in Montreal are not peering at QIX?"

ChatGPT MCP Setup

To connect BGPScout to ChatGPT as an MCP app:

  1. Go to ChatGPT Settings > Apps > Add App
  2. Set Name to bgpscout.io
  3. Set MCP Server URL to:
    https://bgpscout.io/mcp
  4. Set Authentication to OAuth
  5. Click Advanced settings and set Registration method to User-Defined OAuth Client
  6. Fill in the fields:
    OAuth Client IDbgpscout-chatgpt
    OAuth Client SecretLeave empty
    Token endpoint auth methodnone
    Auth URLhttps://bgpscout.io/oauth/authorize
    Token URLhttps://bgpscout.io/oauth/token
  7. Check "I understand and want to continue"
  8. Click Create
When you first use the BGPScout app in ChatGPT, you'll be redirected to BGPScout to log in via Google or PeeringDB. After authenticating, you'll be sent back to ChatGPT with full access to all MCP tools.

OAuth Endpoints Reference

Authorizationhttps://bgpscout.io/oauth/authorize
Token Exchangehttps://bgpscout.io/oauth/token
Dynamic Registrationhttps://bgpscout.io/oauth/register
Protected Resource Metadatahttps://bgpscout.io/.well-known/oauth-protected-resource
Authorization Server Metadatahttps://bgpscout.io/.well-known/oauth-authorization-server