Skip to content
Start here

Get time series distribution of network traffic by dimension

client.Radar.NetFlows.TimeseriesGroups(ctx, dimension, query) (*NetFlowsTimeseriesGroupsResponse, error)
GET/radar/netflows/timeseries_groups/{dimension}

Retrieves the distribution of NetFlows traffic, grouped by the specified dimension over time.

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

Specifies the NetFlows attribute by which to group the results.

One of the following:
const NetFlowsTimeseriesGroupsParamsDimensionAdm1 NetFlowsTimeseriesGroupsParamsDimension = "ADM1"
const NetFlowsTimeseriesGroupsParamsDimensionAs NetFlowsTimeseriesGroupsParamsDimension = "AS"
const NetFlowsTimeseriesGroupsParamsDimensionLocation NetFlowsTimeseriesGroupsParamsDimension = "LOCATION"
const NetFlowsTimeseriesGroupsParamsDimensionProduct NetFlowsTimeseriesGroupsParamsDimension = "PRODUCT"
query NetFlowsTimeseriesGroupsParams
AggInterval param.Field[NetFlowsTimeseriesGroupsParamsAggInterval]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 NetFlowsTimeseriesGroupsParamsAggInterval15m NetFlowsTimeseriesGroupsParamsAggInterval = "15m"
const NetFlowsTimeseriesGroupsParamsAggInterval1h NetFlowsTimeseriesGroupsParamsAggInterval = "1h"
const NetFlowsTimeseriesGroupsParamsAggInterval1d NetFlowsTimeseriesGroupsParamsAggInterval = "1d"
const NetFlowsTimeseriesGroupsParamsAggInterval1w NetFlowsTimeseriesGroupsParamsAggInterval = "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.

Continent param.Field[[]string]Optional

Filters results by continent. Specify a comma-separated list of alpha-2 codes. Prefix with - to exclude continents from results. For example, -EU,NA excludes results from EU, but includes results from NA.

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[NetFlowsTimeseriesGroupsParamsFormat]Optional

Format in which results will be returned.

const NetFlowsTimeseriesGroupsParamsFormatJson NetFlowsTimeseriesGroupsParamsFormat = "JSON"
const NetFlowsTimeseriesGroupsParamsFormatCsv NetFlowsTimeseriesGroupsParamsFormat = "CSV"
GeoID param.Field[[]string]Optional

Filters results by Geolocation. Specify a comma-separated list of GeoNames IDs. Prefix with - to exclude geoIds from results. For example, -2267056,360689 excludes results from the 2267056 (Lisbon), but includes results from 5128638 (New York).

LimitPerGroup param.Field[int64]Optional

Limits the number of objects per group to the top items within the specified time range. When item count exceeds the limit, extra items appear grouped under an “other” category. Only supported on high-cardinality dimensions; otherwise the request is rejected. Minimum value is 2.

Location param.Field[[]string]Optional

Filters results by location. Specify a comma-separated list of alpha-2 codes. Prefix with - to exclude locations from results. For example, -US,PT excludes results from the US, but includes results from PT.

Name param.Field[[]string]Optional

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

Normalization param.Field[NetFlowsTimeseriesGroupsParamsNormalization]Optional

Normalization method applied to the results. Refer to Normalization methods. PERCENTAGE_CHANGE requires exactly one comparison series (e.g. a control date range).

const NetFlowsTimeseriesGroupsParamsNormalizationPercentage NetFlowsTimeseriesGroupsParamsNormalization = "PERCENTAGE"
const NetFlowsTimeseriesGroupsParamsNormalizationMin0Max NetFlowsTimeseriesGroupsParamsNormalization = "MIN0_MAX"
const NetFlowsTimeseriesGroupsParamsNormalizationPercentageChange NetFlowsTimeseriesGroupsParamsNormalization = "PERCENTAGE_CHANGE"
Product param.Field[[]NetFlowsTimeseriesGroupsParamsProduct]Optional

Filters the results by network traffic product types.

const NetFlowsTimeseriesGroupsParamsProductHTTP NetFlowsTimeseriesGroupsParamsProduct = "HTTP"
const NetFlowsTimeseriesGroupsParamsProductAll NetFlowsTimeseriesGroupsParamsProduct = "ALL"
ReturnsExpand Collapse
type NetFlowsTimeseriesGroupsResponse struct{…}
Meta NetFlowsTimeseriesGroupsResponseMeta

Metadata for the results.

AggInterval NetFlowsTimeseriesGroupsResponseMetaAggInterval

Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). Refer to Aggregation intervals.

One of the following:
const NetFlowsTimeseriesGroupsResponseMetaAggIntervalFifteenMinutes NetFlowsTimeseriesGroupsResponseMetaAggInterval = "FIFTEEN_MINUTES"
const NetFlowsTimeseriesGroupsResponseMetaAggIntervalOneHour NetFlowsTimeseriesGroupsResponseMetaAggInterval = "ONE_HOUR"
const NetFlowsTimeseriesGroupsResponseMetaAggIntervalOneDay NetFlowsTimeseriesGroupsResponseMetaAggInterval = "ONE_DAY"
const NetFlowsTimeseriesGroupsResponseMetaAggIntervalOneWeek NetFlowsTimeseriesGroupsResponseMetaAggInterval = "ONE_WEEK"
const NetFlowsTimeseriesGroupsResponseMetaAggIntervalOneMonth NetFlowsTimeseriesGroupsResponseMetaAggInterval = "ONE_MONTH"
ConfidenceInfo NetFlowsTimeseriesGroupsResponseMetaConfidenceInfo
Annotations []NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotation
DataSource NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource

Data source for annotations.

One of the following:
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceAll NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "ALL"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceAIBots NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "AI_BOTS"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceAIGateway NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "AI_GATEWAY"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceBGP NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "BGP"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceBots NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "BOTS"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceConnectionAnomaly NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "CONNECTION_ANOMALY"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceCT NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "CT"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceDNS NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "DNS"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceDNSMagnitude NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "DNS_MAGNITUDE"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceDNSAS112 NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "DNS_AS112"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceDos NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "DOS"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceEmailRouting NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "EMAIL_ROUTING"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceEmailSecurity NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "EMAIL_SECURITY"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceFw NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "FW"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceFwPg NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "FW_PG"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceHTTP NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceHTTPControl NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP_CONTROL"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceHTTPCrawlerReferer NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP_CRAWLER_REFERER"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceHTTPOrigins NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP_ORIGINS"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceIQI NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "IQI"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceLeakedCredentials NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "LEAKED_CREDENTIALS"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceNet NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "NET"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceRobotsTXT NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "ROBOTS_TXT"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceSpeed NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "SPEED"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSourceWorkersAI NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsDataSource = "WORKERS_AI"
Description string
EndDate Time
formatdate-time
EventType NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsEventType

Event type for annotations.

One of the following:
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsEventTypeEvent NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsEventType = "EVENT"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsEventTypeGeneral NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsEventType = "GENERAL"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsEventTypeOutage NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsEventType = "OUTAGE"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsEventTypePartialProjection NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsEventType = "PARTIAL_PROJECTION"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsEventTypePipeline NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsEventType = "PIPELINE"
const NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsEventTypeTrafficAnomaly NetFlowsTimeseriesGroupsResponseMetaConfidenceInfoAnnotationsEventType = "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 []NetFlowsTimeseriesGroupsResponseMetaDateRange
EndTime Time

Adjusted end of date range.

formatdate-time
StartTime Time

Adjusted start of date range.

formatdate-time
LastUpdated Time

Timestamp of the last dataset update.

formatdate-time
Normalization NetFlowsTimeseriesGroupsResponseMetaNormalization

Normalization method applied to the results. Refer to Normalization methods.

One of the following:
const NetFlowsTimeseriesGroupsResponseMetaNormalizationPercentage NetFlowsTimeseriesGroupsResponseMetaNormalization = "PERCENTAGE"
const NetFlowsTimeseriesGroupsResponseMetaNormalizationMin0Max NetFlowsTimeseriesGroupsResponseMetaNormalization = "MIN0_MAX"
const NetFlowsTimeseriesGroupsResponseMetaNormalizationMinMax NetFlowsTimeseriesGroupsResponseMetaNormalization = "MIN_MAX"
const NetFlowsTimeseriesGroupsResponseMetaNormalizationRawValues NetFlowsTimeseriesGroupsResponseMetaNormalization = "RAW_VALUES"
const NetFlowsTimeseriesGroupsResponseMetaNormalizationPercentageChange NetFlowsTimeseriesGroupsResponseMetaNormalization = "PERCENTAGE_CHANGE"
const NetFlowsTimeseriesGroupsResponseMetaNormalizationRollingAverage NetFlowsTimeseriesGroupsResponseMetaNormalization = "ROLLING_AVERAGE"
const NetFlowsTimeseriesGroupsResponseMetaNormalizationOverlappedPercentage NetFlowsTimeseriesGroupsResponseMetaNormalization = "OVERLAPPED_PERCENTAGE"
const NetFlowsTimeseriesGroupsResponseMetaNormalizationRatio NetFlowsTimeseriesGroupsResponseMetaNormalization = "RATIO"
Units []NetFlowsTimeseriesGroupsResponseMetaUnit

Measurement units for the results.

Name string
Value string
Serie0 NetFlowsTimeseriesGroupsResponseSerie0
Timestamps []Time

Get time series distribution of network traffic by dimension

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.NetFlows.TimeseriesGroups(
    context.TODO(),
    radar.NetFlowsTimeseriesGroupsParamsDimensionAdm1,
    radar.NetFlowsTimeseriesGroupsParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Meta)
}
{
  "result": {
    "meta": {
      "aggInterval": "FIFTEEN_MINUTES",
      "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",
      "normalization": "PERCENTAGE",
      "units": [
        {
          "name": "*",
          "value": "requests"
        }
      ]
    },
    "serie_0": {
      "timestamps": [
        "2023-08-08T10:15:00Z"
      ]
    }
  },
  "success": true
}
Returns Examples
{
  "result": {
    "meta": {
      "aggInterval": "FIFTEEN_MINUTES",
      "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",
      "normalization": "PERCENTAGE",
      "units": [
        {
          "name": "*",
          "value": "requests"
        }
      ]
    },
    "serie_0": {
      "timestamps": [
        "2023-08-08T10:15:00Z"
      ]
    }
  },
  "success": true
}