## 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. ### Parameters - `query BGPTimeseriesParams` - `AggInterval param.Field[BGPTimeseriesParamsAggInterval]` Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). Refer to [Aggregation intervals](https://edgetunnel-b2h.pages.dev/radar/concepts/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]` 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]` 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]` Filters results by relative date range ending at the current time, with each value producing a separate series. Use `d` for days (up to `364d`) or `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]` 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]` Format in which results will be returned. - `const BGPTimeseriesParamsFormatJson BGPTimeseriesParamsFormat = "JSON"` - `const BGPTimeseriesParamsFormatCsv BGPTimeseriesParamsFormat = "CSV"` - `Name param.Field[[]string]` Array of names used to label the series in the response. - `Prefix param.Field[[]string]` Filters results by BGP network prefix. - `UpdateType param.Field[[]BGPTimeseriesParamsUpdateType]` Filters results by BGP update type. - `const BGPTimeseriesParamsUpdateTypeAnnouncement BGPTimeseriesParamsUpdateType = "ANNOUNCEMENT"` - `const BGPTimeseriesParamsUpdateTypeWithdrawal BGPTimeseriesParamsUpdateType = "WITHDRAWAL"` ### Returns - `type BGPTimeseriesResponse struct{…}` - `Meta BGPTimeseriesResponseMeta` - `AggInterval BGPTimeseriesResponseMetaAggInterval` - `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. - `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` - `EventType BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventType` Event type for annotations. - `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` - `StartDate Time` - `Tags []string` - `Level int64` Provides an indication of how much confidence Cloudflare has in the data. - `DateRange []BGPTimeseriesResponseMetaDateRange` - `EndTime Time` Adjusted end of date range. - `StartTime Time` Adjusted start of date range. - `LastUpdated Time` - `Serie0 BGPTimeseriesResponseSerie0` - `Timestamps []Time` - `Values []string` ### Example ```go 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) } ``` #### Response ```json { "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 } ```