Skip to content
Start here

Get real-time BGP routes for a prefix

client.Radar.BGP.Routes.Realtime(ctx, query) (*BGPRouteRealtimeResponse, error)
GET/radar/bgp/routes/realtime

Retrieves real-time BGP routes for a prefix, using public real-time data collectors (RouteViews and RIPE RIS).

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
User Details WriteUser Details Read
ParametersExpand Collapse
query BGPRouteRealtimeParams
Format param.Field[BGPRouteRealtimeParamsFormat]Optional

Format in which results will be returned.

const BGPRouteRealtimeParamsFormatJson BGPRouteRealtimeParamsFormat = "JSON"
const BGPRouteRealtimeParamsFormatCsv BGPRouteRealtimeParamsFormat = "CSV"
Prefix param.Field[string]Optional
ReturnsExpand Collapse
type BGPRouteRealtimeResponse struct{…}
Meta BGPRouteRealtimeResponseMeta
ASNInfo []BGPRouteRealtimeResponseMetaASNInfo
AsName string

Name of the autonomous system.

ASN int64

AS number.

CountryCode string

Alpha-2 code for the AS’s registration country.

OrgID string

Organization ID.

OrgName string

Organization name.

Collectors []BGPRouteRealtimeResponseMetaCollector
Collector string

Public route collector ID.

LatestRealtimeTs string

Latest real-time stream timestamp for this collector.

LatestRibTs string

Latest RIB dump MRT file timestamp for this collector.

LatestUpdatesTs string

Latest BGP updates MRT file timestamp for this collector.

PeersCount int64

Total number of collector peers used from this collector.

PeersV4Count int64

Total number of collector peers used from this collector for IPv4 prefixes.

PeersV6Count int64

Total number of collector peers used from this collector for IPv6 prefixes.

DataTime string

The most recent data timestamp for from the real-time sources.

PrefixOrigins []BGPRouteRealtimeResponseMetaPrefixOrigin
Origin int64

Origin ASN.

Prefix string

IP prefix of this query.

RPKIValidation string

Prefix-origin RPKI validation: valid, invalid, unknown.

TotalPeers int64

Total number of peers.

TotalVisible int64

Total number of peers seeing this prefix.

Visibility float64

Ratio of peers seeing this prefix to total number of peers.

QueryTime string

The timestamp of this query.

Routes []BGPRouteRealtimeResponseRoute
AsPath []int64

AS-level path for this route, from collector to origin.

Collector string

Public collector ID for this route.

Communities []string

BGP community values.

Prefix string

IP prefix of this query.

Timestamp string

Latest timestamp of change for this route.

Get real-time BGP routes for a prefix

package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/cloudflare-go"
  "github.com/stainless-sdks/cloudflare-go/option"
  "github.com/stainless-sdks/cloudflare-go/radar"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  response, err := client.Radar.BGP.Routes.Realtime(context.TODO(), radar.BGPRouteRealtimeParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Meta)
}
{
  "result": {
    "meta": {
      "asn_info": [
        {
          "as_name": "as_name",
          "asn": 0,
          "country_code": "country_code",
          "org_id": "org_id",
          "org_name": "org_name"
        }
      ],
      "collectors": [
        {
          "collector": "collector",
          "latest_realtime_ts": "latest_realtime_ts",
          "latest_rib_ts": "latest_rib_ts",
          "latest_updates_ts": "latest_updates_ts",
          "peers_count": 0,
          "peers_v4_count": 0,
          "peers_v6_count": 0
        }
      ],
      "data_time": "data_time",
      "prefix_origins": [
        {
          "origin": 0,
          "prefix": "prefix",
          "rpki_validation": "rpki_validation",
          "total_peers": 0,
          "total_visible": 0,
          "visibility": 0
        }
      ],
      "query_time": "query_time"
    },
    "routes": [
      {
        "as_path": [
          0
        ],
        "collector": "collector",
        "communities": [
          "string"
        ],
        "prefix": "prefix",
        "timestamp": "timestamp"
      }
    ]
  },
  "success": true
}
Returns Examples
{
  "result": {
    "meta": {
      "asn_info": [
        {
          "as_name": "as_name",
          "asn": 0,
          "country_code": "country_code",
          "org_id": "org_id",
          "org_name": "org_name"
        }
      ],
      "collectors": [
        {
          "collector": "collector",
          "latest_realtime_ts": "latest_realtime_ts",
          "latest_rib_ts": "latest_rib_ts",
          "latest_updates_ts": "latest_updates_ts",
          "peers_count": 0,
          "peers_v4_count": 0,
          "peers_v6_count": 0
        }
      ],
      "data_time": "data_time",
      "prefix_origins": [
        {
          "origin": 0,
          "prefix": "prefix",
          "rpki_validation": "rpki_validation",
          "total_peers": 0,
          "total_visible": 0,
          "visibility": 0
        }
      ],
      "query_time": "query_time"
    },
    "routes": [
      {
        "as_path": [
          0
        ],
        "collector": "collector",
        "communities": [
          "string"
        ],
        "prefix": "prefix",
        "timestamp": "timestamp"
      }
    ]
  },
  "success": true
}