Skip to content
Start here

List ASes from global routing tables

client.Radar.BGP.Routes.Ases(ctx, query) (*BGPRouteAsesResponse, error)
GET/radar/bgp/routes/ases

Retrieves all ASes in the current global routing tables with routing statistics.

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 BGPRouteAsesParams
Format param.Field[BGPRouteAsesParamsFormat]Optional

Format in which results will be returned.

const BGPRouteAsesParamsFormatJson BGPRouteAsesParamsFormat = "JSON"
const BGPRouteAsesParamsFormatCsv BGPRouteAsesParamsFormat = "CSV"
Limit param.Field[int64]Optional

Limits the number of objects returned in the response.

exclusiveMinimum
minimum0
Location param.Field[string]Optional

Filters results by location. Specify an alpha-2 location code.

maxLength2
minLength2
SortBy param.Field[BGPRouteAsesParamsSortBy]Optional

Sorts results by the specified field.

const BGPRouteAsesParamsSortByCone BGPRouteAsesParamsSortBy = "cone"
const BGPRouteAsesParamsSortByPfxs BGPRouteAsesParamsSortBy = "pfxs"
const BGPRouteAsesParamsSortByIPV4 BGPRouteAsesParamsSortBy = "ipv4"
const BGPRouteAsesParamsSortByIPV6 BGPRouteAsesParamsSortBy = "ipv6"
const BGPRouteAsesParamsSortByRPKIValid BGPRouteAsesParamsSortBy = "rpki_valid"
const BGPRouteAsesParamsSortByRPKIInvalid BGPRouteAsesParamsSortBy = "rpki_invalid"
const BGPRouteAsesParamsSortByRPKIUnknown BGPRouteAsesParamsSortBy = "rpki_unknown"
SortOrder param.Field[BGPRouteAsesParamsSortOrder]Optional

Sort order.

const BGPRouteAsesParamsSortOrderAsc BGPRouteAsesParamsSortOrder = "ASC"
const BGPRouteAsesParamsSortOrderDesc BGPRouteAsesParamsSortOrder = "DESC"
ReturnsExpand Collapse
type BGPRouteAsesResponse struct{…}
ASNs []BGPRouteAsesResponseASN
ASN int64
ConeSize int64

AS’s customer cone size.

Country string

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

IPV4Count int64

Number of IPv4 addresses originated by the AS.

IPV6Count string

Number of IPv6 addresses originated by the AS.

Name string

Name of the AS.

PfxsCount int64

Number of total IP prefixes originated by the AS.

RPKIInvalid int64

Number of RPKI invalid prefixes originated by the AS.

RPKIUnknown int64

Number of RPKI unknown prefixes originated by the AS.

RPKIValid int64

Number of RPKI valid prefixes originated by the AS.

Meta BGPRouteAsesResponseMeta
DataTime string

The timestamp of when the data is generated.

QueryTime string

The timestamp of the query.

TotalPeers int64

Total number of route collector peers used to generate this data.

List ASes from global routing tables

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.Ases(context.TODO(), radar.BGPRouteAsesParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.ASNs)
}
{
  "result": {
    "asns": [
      {
        "asn": 0,
        "coneSize": 0,
        "country": "US",
        "ipv4Count": 0,
        "ipv6Count": "1.21e24",
        "name": "name",
        "pfxsCount": 0,
        "rpkiInvalid": 0,
        "rpkiUnknown": 0,
        "rpkiValid": 0
      }
    ],
    "meta": {
      "dataTime": "2024-06-03T14:00:00",
      "queryTime": "2024-06-03T14:00:00",
      "totalPeers": 0
    }
  },
  "success": true
}
Returns Examples
{
  "result": {
    "asns": [
      {
        "asn": 0,
        "coneSize": 0,
        "country": "US",
        "ipv4Count": 0,
        "ipv6Count": "1.21e24",
        "name": "name",
        "pfxsCount": 0,
        "rpkiInvalid": 0,
        "rpkiUnknown": 0,
        "rpkiValid": 0
      }
    ],
    "meta": {
      "dataTime": "2024-06-03T14:00:00",
      "queryTime": "2024-06-03T14:00:00",
      "totalPeers": 0
    }
  },
  "success": true
}