{
  "openapi": "3.1.1",
  "info": {
    "title": "BGP Route Explorer API",
    "version": "1.0.0",
    "summary": "Who announces an IP or prefix in BGP: origin ASes, RPKI validity, visibility and origin changes.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://bgprouteexplorer.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Who announces an IP or prefix in BGP: origin ASes, RPKI validity, visibility and origin changes.",
        "description": "Looks up an IP address or prefix in RIPE RIS via the RIPEstat Data API: the covering announced prefix, origin AS(es) and holders, RPKI ROV state per origin, visibility among RIS full-feed peers, first/last seen, more-specifics announced by others, a timeline of origin changes and sample AS paths with upstreams.\n\nMethodology:\n- prefix-overview: the announced prefix covering the input (aligned to the first less-specific if the exact one is not announced), origin AS(es) and holder names.\n- routing-status: visibility = RIS full-feed peers seeing the prefix ÷ all RIS full-feed peers of that address family; first/last seen; more- and less-specific announcements; IRR route objects.\n- routing-history: per origin and prefix, the periods RIS saw the announcement (routes seen by fewer than 10 full-feed peers are excluded by RIPEstat); start/stop events form the origin timeline. Covering prefixes (e.g. bogus /3 or /8 leaks) also appear and are marked as related.\n- rpki-validation: Routinator's ROV state for each origin AS + prefix (valid, invalid_asn, invalid_length, unknown = no covering ROA).\n- looking-glass (optional): current AS paths at RIS collectors; the AS immediately before the origin in each path is counted as an observed upstream.",
        "tags": [
          "infrastructure"
        ],
        "x-mcp-tool": "bgp_route_explorer",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BgpRouteExplorerInput"
              },
              "examples": {
                "example1": {
                  "summary": "Pasted RIPEstat data for 193.0.0.0/21 (RIPE NCC)",
                  "value": {
                    "mode": "pasted",
                    "pasted": "{\"resource\":\"193.0.6.139\",\"prefixOverview\":{\"data\":{\"is_less_specific\":true,\"announced\":true,\"asns\":[{\"asn\":3333,\"holder\":\"RIPE-NCC-AS Reseaux IP Europeens Network Coordination Centre (RIPE NCC)\"}],\"resource\":\"193.0.0.0/21\",\"block\":{\"resource\":\"193.0.0.0/8\",\"desc\":\"RIPE NCC (Status: ALLOCATED)\"}}},\"routingStatus\":{\"data\":{\"first_seen\":{\"prefix\":\"193.0.0.0/21\",\"origin\":\"3333\",\"time\":\"2000-10-31T00:00:00\"},\"last_seen\":{\"prefix\":\"193.0.0.0/21\",\"origin\":\"3333\",\"time\":\"2026-10-14T08:00:00\"},\"visibility\":{\"v4\":{\"ris_peers_seeing\":327,\"total_ris_peers\":327},\"v6\":{\"ris_peers_seeing\":0,\"total_ris_peers\":0}},\"origins\":[{\"origin\":3333,\"route_objects\":[\"RIPE\"]}],\"less_specifics\":[],\"more_specifics\":[],\"resource\":\"193.0.0.0/21\"}},\"routingHistory\":{\"data\":{\"resource\":\"193.0.0.0/21\",\"query_starttime\":\"2000-08-01T00:00:00\",\"query_endtime\":\"2026-10-14T08:00:00\",\"time_granularity\":1036800,\"by_origin\":[{\"origin\":\"3333\",\"prefixes\":[{\"prefix\":\"193.0.0.0/21\",\"timelines\":[{\"starttime\":\"2000-10-26T00:00:00\",\"endtime\":\"2000-11-06T23:59:59\",\"full_peers_seeing\":28},{\"starttime\":\"2001-01-18T00:00:00\",\"endtime\":\"2026-10-14T08:00:00\",\"full_peers_seeing\":327}]},{\"prefix\":\"193.0.0.0/22\",\"timelines\":[{\"starttime\":\"2000-08-15T00:00:00\",\"endtime\":\"2000-09-07T23:59:59\",\"full_peers_seeing\":12}]}]},{\"origin\":\"3352\",\"prefixes\":[{\"prefix\":\"193.0.0.0/8\",\"timelines\":[{\"starttime\":\"2007-08-15T00:00:00\",\"endtime\":\"2007-08-26T23:59:59\",\"full_peers_seeing\":40}]}]},{\"origin\":\"15962\",\"prefixes\":[{\"prefix\":\"192.0.0.0/3\",\"timelines\":[{\"starttime\":\"2020-08-06T00:00:00\",\"endtime\":\"2020-08-17T23:59:59\",\"full_peers_seeing\":11}]}]}]}},\"rpki\":[{\"origin\":3333,\"data\":{\"data\":{\"resource\":\"3333\",\"prefix\":\"193.0.0.0/21\",\"validating_roas\":[{\"origin\":\"3333\",\"prefix\":\"193.0.0.0/21\",\"validity\":\"valid\",\"max_length\":21}],\"status\":\"valid\",\"validator\":\"routinator\"}}}],\"lookingGlass\":{\"data\":{\"rrcs\":[{\"rrc\":\"RRC01\",\"location\":\"London, GB\",\"peers\":[{\"asn_origin\":\"3333\",\"as_path\":\"15692 174 1273 3333\",\"prefix\":\"193.0.0.0/21\",\"peer\":\"5.57.80.113\",\"last_updated\":\"2026-10-08T22:38:44\"},{\"asn_origin\":\"3333\",\"as_path\":\"8218 3333\",\"prefix\":\"193.0.0.0/21\",\"peer\":\"5.57.80.210\",\"last_updated\":\"2026-09-01T20:43:50\"},{\"asn_origin\":\"3333\",\"as_path\":\"48070 20562 1103 1103 3333\",\"prefix\":\"193.0.0.0/21\",\"peer\":\"5.57.80.99\",\"last_updated\":\"2026-10-08T20:43:29\"}]}]}}}"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BgpRouteExplorerResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "BgpRouteExplorerInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "mode": {
            "title": "Mode",
            "type": "string",
            "enum": [
              "live",
              "pasted"
            ],
            "default": "live"
          },
          "resource": {
            "title": "IP address or prefix",
            "type": "string",
            "maxLength": 60
          },
          "lookingGlass": {
            "title": "Include current AS paths (RIS looking glass)",
            "type": "boolean",
            "default": true
          },
          "pasted": {
            "title": "RIPEstat responses (JSON)",
            "description": "Pasted mode: {resource?, prefixOverview, routingStatus?, routingHistory?, rpki?: [{origin, data}], lookingGlass?} — full RIPEstat responses or their \"data\" objects.",
            "type": "string",
            "maxLength": 200000
          }
        },
        "required": []
      },
      "BgpRouteExplorerResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "queried",
              "prefix",
              "family",
              "announced",
              "block",
              "origins",
              "visibility",
              "firstSeen",
              "lastSeen",
              "moreSpecifics",
              "moreSpecificsCount",
              "lessSpecifics",
              "history",
              "historicalOrigins",
              "events",
              "lookingGlass",
              "findings"
            ],
            "properties": {
              "queried": {
                "type": "string"
              },
              "prefix": {
                "type": "string"
              },
              "family": {
                "type": "string",
                "enum": [
                  "IPv4",
                  "IPv6"
                ]
              },
              "announced": {
                "type": "boolean"
              },
              "block": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "required": [
                  "resource",
                  "description"
                ],
                "properties": {
                  "resource": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  }
                }
              },
              "origins": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "asn",
                    "holder",
                    "rpki",
                    "validatingRoas",
                    "irrRouteObjects"
                  ],
                  "properties": {
                    "asn": {
                      "type": "integer"
                    },
                    "holder": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "rpki": {
                      "type": "string",
                      "enum": [
                        "valid",
                        "invalid_asn",
                        "invalid_length",
                        "unknown",
                        "not-checked"
                      ]
                    },
                    "validatingRoas": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "origin",
                          "prefix",
                          "maxLength",
                          "validity"
                        ],
                        "properties": {
                          "origin": {
                            "type": "integer"
                          },
                          "prefix": {
                            "type": "string"
                          },
                          "maxLength": {
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "validity": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "irrRouteObjects": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "visibility": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "family",
                  "peersSeeing",
                  "totalPeers",
                  "percent"
                ],
                "properties": {
                  "family": {
                    "type": "string"
                  },
                  "peersSeeing": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "totalPeers": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "percent": {
                    "type": [
                      "number",
                      "null"
                    ]
                  }
                }
              },
              "firstSeen": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "required": [
                  "time",
                  "origin",
                  "prefix"
                ],
                "properties": {
                  "time": {
                    "type": "string"
                  },
                  "origin": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "prefix": {
                    "type": "string"
                  }
                }
              },
              "lastSeen": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "required": [
                  "time",
                  "origin",
                  "prefix"
                ],
                "properties": {
                  "time": {
                    "type": "string"
                  },
                  "origin": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "prefix": {
                    "type": "string"
                  }
                }
              },
              "moreSpecifics": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "prefix",
                    "origin"
                  ],
                  "properties": {
                    "prefix": {
                      "type": "string"
                    },
                    "origin": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    }
                  }
                }
              },
              "moreSpecificsCount": {
                "type": "integer"
              },
              "lessSpecifics": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "prefix",
                    "origin"
                  ],
                  "properties": {
                    "prefix": {
                      "type": "string"
                    },
                    "origin": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    }
                  }
                }
              },
              "history": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "origin",
                    "prefix",
                    "firstSeen",
                    "lastSeen",
                    "segments",
                    "current",
                    "maxPeersSeeing"
                  ],
                  "properties": {
                    "origin": {
                      "type": "integer"
                    },
                    "prefix": {
                      "type": "string"
                    },
                    "firstSeen": {
                      "type": "string"
                    },
                    "lastSeen": {
                      "type": "string"
                    },
                    "segments": {
                      "type": "integer"
                    },
                    "current": {
                      "type": "boolean"
                    },
                    "maxPeersSeeing": {
                      "type": [
                        "number",
                        "null"
                      ]
                    }
                  }
                }
              },
              "historicalOrigins": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              },
              "events": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "time",
                    "label",
                    "detail",
                    "tone"
                  ],
                  "properties": {
                    "time": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    },
                    "detail": {
                      "type": "string"
                    },
                    "tone": {
                      "type": "string"
                    }
                  }
                }
              },
              "lookingGlass": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "required": [
                  "collectors",
                  "peers",
                  "upstreams",
                  "averagePathLength",
                  "samplePaths"
                ],
                "properties": {
                  "collectors": {
                    "type": "integer"
                  },
                  "peers": {
                    "type": "integer"
                  },
                  "averagePathLength": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "upstreams": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "asn",
                        "paths"
                      ],
                      "properties": {
                        "asn": {
                          "type": "integer"
                        },
                        "paths": {
                          "type": "integer"
                        }
                      }
                    }
                  },
                  "samplePaths": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "collector",
                        "peer",
                        "path",
                        "lastUpdated"
                      ],
                      "properties": {
                        "collector": {
                          "type": "string"
                        },
                        "peer": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "lastUpdated": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              "findings": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "severity",
                    "area",
                    "finding"
                  ],
                  "properties": {
                    "severity": {
                      "type": "string",
                      "enum": [
                        "high",
                        "medium",
                        "low",
                        "info"
                      ]
                    },
                    "area": {
                      "type": "string"
                    },
                    "finding": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}