Skip to content
Start here

Get speed tests histogram

client.Radar.Quality.Speed.Histogram(ctx, query) (*QualitySpeedHistogramResponse, error)
GET/radar/quality/speed/histogram

Retrieves a histogram from the previous 90 days of Cloudflare Speed Test data, split into fixed bandwidth (Mbps), latency (ms), or jitter (ms) buckets.

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 QualitySpeedHistogramParams
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.

BucketSize param.Field[int64]Optional

Specifies the width for every bucket in the histogram.

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).

Format param.Field[QualitySpeedHistogramParamsFormat]Optional

Format in which results will be returned.

const QualitySpeedHistogramParamsFormatJson QualitySpeedHistogramParamsFormat = "JSON"
const QualitySpeedHistogramParamsFormatCsv QualitySpeedHistogramParamsFormat = "CSV"
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.

MetricGroup param.Field[QualitySpeedHistogramParamsMetricGroup]Optional

Metrics to be returned.

const QualitySpeedHistogramParamsMetricGroupBandwidth QualitySpeedHistogramParamsMetricGroup = "BANDWIDTH"
const QualitySpeedHistogramParamsMetricGroupLatency QualitySpeedHistogramParamsMetricGroup = "LATENCY"
const QualitySpeedHistogramParamsMetricGroupJitter QualitySpeedHistogramParamsMetricGroup = "JITTER"
Name param.Field[[]string]Optional

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

ReturnsExpand Collapse
type QualitySpeedHistogramResponse struct{…}
Histogram0 QualitySpeedHistogramResponseHistogram0
BandwidthDownload []string
BandwidthUpload []string
BucketMin []string
Meta QualitySpeedHistogramResponseMeta

Metadata for the results.

BucketSize int64

The width for every bucket in the histogram.

ConfidenceInfo QualitySpeedHistogramResponseMetaConfidenceInfo
Annotations []QualitySpeedHistogramResponseMetaConfidenceInfoAnnotation
DataSource QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource

Data source for annotations.

One of the following:
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceAll QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "ALL"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceAIBots QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "AI_BOTS"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceAIGateway QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "AI_GATEWAY"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceBGP QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "BGP"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceBots QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "BOTS"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceConnectionAnomaly QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "CONNECTION_ANOMALY"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceCT QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "CT"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceDNS QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "DNS"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceDNSMagnitude QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "DNS_MAGNITUDE"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceDNSAS112 QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "DNS_AS112"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceDos QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "DOS"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceEmailRouting QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "EMAIL_ROUTING"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceEmailSecurity QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "EMAIL_SECURITY"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceFw QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "FW"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceFwPg QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "FW_PG"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceHTTP QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceHTTPControl QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP_CONTROL"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceHTTPCrawlerReferer QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP_CRAWLER_REFERER"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceHTTPOrigins QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP_ORIGINS"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceIQI QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "IQI"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceLeakedCredentials QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "LEAKED_CREDENTIALS"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceNet QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "NET"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceRobotsTXT QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "ROBOTS_TXT"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceSpeed QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "SPEED"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSourceWorkersAI QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsDataSource = "WORKERS_AI"
Description string
EndDate Time
formatdate-time
EventType QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsEventType

Event type for annotations.

One of the following:
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsEventTypeEvent QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsEventType = "EVENT"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsEventTypeGeneral QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsEventType = "GENERAL"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsEventTypeOutage QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsEventType = "OUTAGE"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsEventTypePartialProjection QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsEventType = "PARTIAL_PROJECTION"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsEventTypePipeline QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsEventType = "PIPELINE"
const QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsEventTypeTrafficAnomaly QualitySpeedHistogramResponseMetaConfidenceInfoAnnotationsEventType = "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 []QualitySpeedHistogramResponseMetaDateRange
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 QualitySpeedHistogramResponseMetaNormalization

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

One of the following:
const QualitySpeedHistogramResponseMetaNormalizationPercentage QualitySpeedHistogramResponseMetaNormalization = "PERCENTAGE"
const QualitySpeedHistogramResponseMetaNormalizationMin0Max QualitySpeedHistogramResponseMetaNormalization = "MIN0_MAX"
const QualitySpeedHistogramResponseMetaNormalizationMinMax QualitySpeedHistogramResponseMetaNormalization = "MIN_MAX"
const QualitySpeedHistogramResponseMetaNormalizationRawValues QualitySpeedHistogramResponseMetaNormalization = "RAW_VALUES"
const QualitySpeedHistogramResponseMetaNormalizationPercentageChange QualitySpeedHistogramResponseMetaNormalization = "PERCENTAGE_CHANGE"
const QualitySpeedHistogramResponseMetaNormalizationRollingAverage QualitySpeedHistogramResponseMetaNormalization = "ROLLING_AVERAGE"
const QualitySpeedHistogramResponseMetaNormalizationOverlappedPercentage QualitySpeedHistogramResponseMetaNormalization = "OVERLAPPED_PERCENTAGE"
const QualitySpeedHistogramResponseMetaNormalizationRatio QualitySpeedHistogramResponseMetaNormalization = "RATIO"
TotalTests []int64
Units []QualitySpeedHistogramResponseMetaUnit

Measurement units for the results.

Name string
Value string

Get speed tests histogram

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.Quality.Speed.Histogram(context.TODO(), radar.QualitySpeedHistogramParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Histogram0)
}
{
  "result": {
    "histogram_0": {
      "bandwidthDownload": [
        "83681"
      ],
      "bandwidthUpload": [
        "181079"
      ],
      "bucketMin": [
        "0"
      ]
    },
    "meta": {
      "bucketSize": 0,
      "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",
      "totalTests": [
        0
      ],
      "units": [
        {
          "name": "*",
          "value": "requests"
        }
      ]
    }
  },
  "success": true
}
Returns Examples
{
  "result": {
    "histogram_0": {
      "bandwidthDownload": [
        "83681"
      ],
      "bandwidthUpload": [
        "181079"
      ],
      "bucketMin": [
        "0"
      ]
    },
    "meta": {
      "bucketSize": 0,
      "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",
      "totalTests": [
        0
      ],
      "units": [
        {
          "name": "*",
          "value": "requests"
        }
      ]
    }
  },
  "success": true
}