Skip to content
Start here

Get BGP time series

client.Radar.BGP.Timeseries(ctx, query) (*BGPTimeseriesResponse, error)
GET/radar/bgp/timeseries

Retrieves BGP updates over time. When requesting updates for an autonomous system, only BGP updates of type announcement are returned.

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 BGPTimeseriesParams
AggInterval param.Field[BGPTimeseriesParamsAggInterval]Optional

Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). Refer to Aggregation intervals. When omitted, the interval is auto-selected from the requested date range; finer intervals are only available for shorter ranges. If the requested interval is too granular for the date range, the request is rejected.

const BGPTimeseriesParamsAggInterval15m BGPTimeseriesParamsAggInterval = "15m"
const BGPTimeseriesParamsAggInterval1h BGPTimeseriesParamsAggInterval = "1h"
const BGPTimeseriesParamsAggInterval1d BGPTimeseriesParamsAggInterval = "1d"
const BGPTimeseriesParamsAggInterval1w BGPTimeseriesParamsAggInterval = "1w"
ASN param.Field[[]string]Optional

Filters results by Autonomous System. Specify one or more Autonomous System Numbers (ASNs) as a comma-separated list. Prefix with - to exclude ASNs from results. For example, -174, 3356 excludes results from AS174, but includes results from AS3356.

DateEnd param.Field[[]Time]Optional

End of the date range (inclusive). Alternative to dateRange; provide together with dateStart. When requesting comparison series, every series must resolve to the same duration as the main series. Each dateStart/dateEnd is floored to the nearest 15 minutes before evaluation, so windows whose durations match only before alignment may be rejected.

DateRange param.Field[[]string]Optional

Filters results by relative date range ending at the current time, with each value producing a separate series. Use <n>d for days (up to 364d) or <n>w for weeks (up to 52w). Append control to request the equivalent previous period for comparison: the comparison window is shifted back by the current window’s length rounded up to a whole number of weeks, so it keeps the same weekday alignment and does not overlap the current window (e.g. 7dcontrol covers days -14 to -7, 10dcontrol covers days -24 to -14). For example, pass 7d and 7dcontrol to compare this week with the previous week. All series must resolve to the same duration as the main series; relative ranges (including control) satisfy this automatically. Use this parameter or set specific start and end dates (dateStart and dateEnd parameters).

DateStart param.Field[[]Time]Optional

Start of the date range. Alternative to dateRange; provide together with dateEnd. When requesting comparison series, every series must resolve to the same duration as the main series. Each dateStart/dateEnd is floored to the nearest 15 minutes before evaluation, so windows whose durations match only before alignment may be rejected.

Format param.Field[BGPTimeseriesParamsFormat]Optional

Format in which results will be returned.

const BGPTimeseriesParamsFormatJson BGPTimeseriesParamsFormat = "JSON"
const BGPTimeseriesParamsFormatCsv BGPTimeseriesParamsFormat = "CSV"
Name param.Field[[]string]Optional

Array of names used to label the series in the response.

Prefix param.Field[[]string]Optional

Filters results by BGP network prefix.

UpdateType param.Field[[]BGPTimeseriesParamsUpdateType]Optional

Filters results by BGP update type.

const BGPTimeseriesParamsUpdateTypeAnnouncement BGPTimeseriesParamsUpdateType = "ANNOUNCEMENT"
const BGPTimeseriesParamsUpdateTypeWithdrawal BGPTimeseriesParamsUpdateType = "WITHDRAWAL"
ReturnsExpand Collapse
type BGPTimeseriesResponse struct{…}
Meta BGPTimeseriesResponseMeta
AggInterval BGPTimeseriesResponseMetaAggInterval
One of the following:
const BGPTimeseriesResponseMetaAggInterval15m BGPTimeseriesResponseMetaAggInterval = "15m"
const BGPTimeseriesResponseMetaAggInterval1h BGPTimeseriesResponseMetaAggInterval = "1h"
const BGPTimeseriesResponseMetaAggInterval1d BGPTimeseriesResponseMetaAggInterval = "1d"
const BGPTimeseriesResponseMetaAggInterval1w BGPTimeseriesResponseMetaAggInterval = "1w"
ConfidenceInfo BGPTimeseriesResponseMetaConfidenceInfo
Annotations []BGPTimeseriesResponseMetaConfidenceInfoAnnotation
DataSource BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource

Data source for annotations.

One of the following:
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceAll BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "ALL"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceAIBots BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "AI_BOTS"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceAIGateway BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "AI_GATEWAY"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceBGP BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "BGP"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceBots BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "BOTS"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceConnectionAnomaly BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "CONNECTION_ANOMALY"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceCT BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "CT"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceDNS BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "DNS"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceDNSMagnitude BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "DNS_MAGNITUDE"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceDNSAS112 BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "DNS_AS112"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceDos BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "DOS"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceEmailRouting BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "EMAIL_ROUTING"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceEmailSecurity BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "EMAIL_SECURITY"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceFw BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "FW"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceFwPg BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "FW_PG"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceHTTP BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceHTTPControl BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP_CONTROL"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceHTTPCrawlerReferer BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP_CRAWLER_REFERER"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceHTTPOrigins BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP_ORIGINS"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceIQI BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "IQI"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceLeakedCredentials BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "LEAKED_CREDENTIALS"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceNet BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "NET"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceRobotsTXT BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "ROBOTS_TXT"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceSpeed BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "SPEED"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceWorkersAI BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "WORKERS_AI"
Description string
EndDate Time
formatdate-time
EventType BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventType

Event type for annotations.

One of the following:
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventTypeEvent BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventType = "EVENT"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventTypeGeneral BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventType = "GENERAL"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventTypeOutage BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventType = "OUTAGE"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventTypePartialProjection BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventType = "PARTIAL_PROJECTION"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventTypePipeline BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventType = "PIPELINE"
const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventTypeTrafficAnomaly BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventType = "TRAFFIC_ANOMALY"
IsInstantaneous bool

Whether event is a single point in time or a time range.

LinkedURL string
formaturi
StartDate Time
formatdate-time
Tags []stringOptional
Level int64

Provides an indication of how much confidence Cloudflare has in the data.

DateRange []BGPTimeseriesResponseMetaDateRange
EndTime Time

Adjusted end of date range.

formatdate-time
StartTime Time

Adjusted start of date range.

formatdate-time
LastUpdated Time
formatdate-time
Serie0 BGPTimeseriesResponseSerie0
Timestamps []Time
Values []string

Get BGP time series

package main

import (
  "context"
  "fmt"

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

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

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Meta)
}
{
  "result": {
    "meta": {
      "aggInterval": "15m",
      "confidenceInfo": {
        "annotations": [
          {
            "dataSource": "ALL",
            "description": "Cable cut in Tonga",
            "endDate": "2019-12-27T18:11:19.117Z",
            "eventType": "EVENT",
            "isInstantaneous": true,
            "linkedUrl": "https://example.com",
            "startDate": "2019-12-27T18:11:19.117Z",
            "tags": [
              "BOT_CLASS"
            ]
          }
        ],
        "level": 0
      },
      "dateRange": [
        {
          "endTime": "2022-09-17T10:22:57.555Z",
          "startTime": "2022-09-16T10:22:57.555Z"
        }
      ],
      "lastUpdated": "2019-12-27T18:11:19.117Z"
    },
    "serie_0": {
      "timestamps": [
        "2019-12-27T18:11:19.117Z"
      ],
      "values": [
        "10"
      ]
    }
  },
  "success": true
}
Returns Examples
{
  "result": {
    "meta": {
      "aggInterval": "15m",
      "confidenceInfo": {
        "annotations": [
          {
            "dataSource": "ALL",
            "description": "Cable cut in Tonga",
            "endDate": "2019-12-27T18:11:19.117Z",
            "eventType": "EVENT",
            "isInstantaneous": true,
            "linkedUrl": "https://example.com",
            "startDate": "2019-12-27T18:11:19.117Z",
            "tags": [
              "BOT_CLASS"
            ]
          }
        ],
        "level": 0
      },
      "dateRange": [
        {
          "endTime": "2022-09-17T10:22:57.555Z",
          "startTime": "2022-09-16T10:22:57.555Z"
        }
      ],
      "lastUpdated": "2019-12-27T18:11:19.117Z"
    },
    "serie_0": {
      "timestamps": [
        "2019-12-27T18:11:19.117Z"
      ],
      "values": [
        "10"
      ]
    }
  },
  "success": true
}