Skip to content
Start here

Get top layer 7 attack pairs (origin and target locations)

client.Radar.Attacks.Layer7.Top.Attacks(ctx, query) (*AttackLayer7TopAttacksResponse, error)
GET/radar/attacks/layer7/top/attacks

Retrieves the top attacks from origin to target location. Values are percentages of the total layer 7 attacks (with billing country). The attack magnitude can be defined by the number of mitigated requests or by the number of zones affected. You can optionally limit the number of attacks by origin/target location (useful if all the top attacks are from or to the same location).

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

DateRange param.Field[[]string]Optional

Filters results by date range. For example, use 7d and 7dcontrol to compare this week with the previous week. Use this parameter or set specific start and end dates (dateStart and dateEnd parameters).

DateStart param.Field[[]Time]Optional

Start of the date range.

Format param.Field[AttackLayer7TopAttacksParamsFormat]Optional

Format in which results will be returned.

const AttackLayer7TopAttacksParamsFormatJson AttackLayer7TopAttacksParamsFormat = "JSON"
const AttackLayer7TopAttacksParamsFormatCsv AttackLayer7TopAttacksParamsFormat = "CSV"
Limit param.Field[int64]Optional

Limits the number of objects returned in the response.

exclusiveMinimum
minimum0
LimitDirection param.Field[AttackLayer7TopAttacksParamsLimitDirection]Optional

Specifies whether the limitPerLocation applies to the source or target location.

const AttackLayer7TopAttacksParamsLimitDirectionOrigin AttackLayer7TopAttacksParamsLimitDirection = "ORIGIN"
const AttackLayer7TopAttacksParamsLimitDirectionTarget AttackLayer7TopAttacksParamsLimitDirection = "TARGET"
LimitPerLocation param.Field[int64]Optional

Limits the number of attacks per origin/target (refer to limitDirection parameter) location.

exclusiveMinimum
minimum0
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.

MitigationProduct param.Field[[]AttackLayer7TopAttacksParamsMitigationProduct]Optional

Filters the results by layer 7 mitigation product.

const AttackLayer7TopAttacksParamsMitigationProductDDoS AttackLayer7TopAttacksParamsMitigationProduct = "DDOS"
const AttackLayer7TopAttacksParamsMitigationProductWAF AttackLayer7TopAttacksParamsMitigationProduct = "WAF"
const AttackLayer7TopAttacksParamsMitigationProductBotManagement AttackLayer7TopAttacksParamsMitigationProduct = "BOT_MANAGEMENT"
const AttackLayer7TopAttacksParamsMitigationProductAccessRules AttackLayer7TopAttacksParamsMitigationProduct = "ACCESS_RULES"
const AttackLayer7TopAttacksParamsMitigationProductIPReputation AttackLayer7TopAttacksParamsMitigationProduct = "IP_REPUTATION"
const AttackLayer7TopAttacksParamsMitigationProductAPIShield AttackLayer7TopAttacksParamsMitigationProduct = "API_SHIELD"
const AttackLayer7TopAttacksParamsMitigationProductDataLossPrevention AttackLayer7TopAttacksParamsMitigationProduct = "DATA_LOSS_PREVENTION"
Name param.Field[[]string]Optional

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

Normalization param.Field[AttackLayer7TopAttacksParamsNormalization]Optional

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

const AttackLayer7TopAttacksParamsNormalizationPercentage AttackLayer7TopAttacksParamsNormalization = "PERCENTAGE"
const AttackLayer7TopAttacksParamsNormalizationMinMax AttackLayer7TopAttacksParamsNormalization = "MIN_MAX"
ReturnsExpand Collapse
type AttackLayer7TopAttacksResponse struct{…}
Meta AttackLayer7TopAttacksResponseMeta

Metadata for the results.

ConfidenceInfo AttackLayer7TopAttacksResponseMetaConfidenceInfo
Annotations []AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotation
DataSource AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource

Data source for annotations.

One of the following:
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceAll AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "ALL"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceAIBots AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "AI_BOTS"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceAIGateway AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "AI_GATEWAY"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceBGP AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "BGP"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceBots AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "BOTS"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceConnectionAnomaly AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "CONNECTION_ANOMALY"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceCT AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "CT"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceDNS AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "DNS"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceDNSMagnitude AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "DNS_MAGNITUDE"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceDNSAS112 AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "DNS_AS112"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceDos AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "DOS"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceEmailRouting AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "EMAIL_ROUTING"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceEmailSecurity AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "EMAIL_SECURITY"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceFw AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "FW"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceFwPg AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "FW_PG"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceHTTP AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceHTTPControl AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP_CONTROL"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceHTTPCrawlerReferer AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP_CRAWLER_REFERER"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceHTTPOrigins AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP_ORIGINS"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceIQI AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "IQI"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceLeakedCredentials AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "LEAKED_CREDENTIALS"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceNet AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "NET"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceRobotsTXT AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "ROBOTS_TXT"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceSpeed AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "SPEED"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSourceWorkersAI AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsDataSource = "WORKERS_AI"
Description string
EndDate Time
formatdate-time
EventType AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsEventType

Event type for annotations.

One of the following:
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsEventTypeEvent AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsEventType = "EVENT"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsEventTypeGeneral AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsEventType = "GENERAL"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsEventTypeOutage AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsEventType = "OUTAGE"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsEventTypePartialProjection AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsEventType = "PARTIAL_PROJECTION"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsEventTypePipeline AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsEventType = "PIPELINE"
const AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsEventTypeTrafficAnomaly AttackLayer7TopAttacksResponseMetaConfidenceInfoAnnotationsEventType = "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 []AttackLayer7TopAttacksResponseMetaDateRange
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 AttackLayer7TopAttacksResponseMetaNormalization

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

One of the following:
const AttackLayer7TopAttacksResponseMetaNormalizationPercentage AttackLayer7TopAttacksResponseMetaNormalization = "PERCENTAGE"
const AttackLayer7TopAttacksResponseMetaNormalizationMin0Max AttackLayer7TopAttacksResponseMetaNormalization = "MIN0_MAX"
const AttackLayer7TopAttacksResponseMetaNormalizationMinMax AttackLayer7TopAttacksResponseMetaNormalization = "MIN_MAX"
const AttackLayer7TopAttacksResponseMetaNormalizationRawValues AttackLayer7TopAttacksResponseMetaNormalization = "RAW_VALUES"
const AttackLayer7TopAttacksResponseMetaNormalizationPercentageChange AttackLayer7TopAttacksResponseMetaNormalization = "PERCENTAGE_CHANGE"
const AttackLayer7TopAttacksResponseMetaNormalizationRollingAverage AttackLayer7TopAttacksResponseMetaNormalization = "ROLLING_AVERAGE"
const AttackLayer7TopAttacksResponseMetaNormalizationOverlappedPercentage AttackLayer7TopAttacksResponseMetaNormalization = "OVERLAPPED_PERCENTAGE"
const AttackLayer7TopAttacksResponseMetaNormalizationRatio AttackLayer7TopAttacksResponseMetaNormalization = "RATIO"
Units []AttackLayer7TopAttacksResponseMetaUnit

Measurement units for the results.

Name string
Value string
Top0 []AttackLayer7TopAttacksResponseTop0
OriginCountryAlpha2 string
OriginCountryName string
TargetCountryAlpha2 string
TargetCountryName string
Value string

Get top layer 7 attack pairs (origin and target locations)

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.Attacks.Layer7.Top.Attacks(context.TODO(), radar.AttackLayer7TopAttacksParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Meta)
}
{
  "result": {
    "meta": {
      "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"
        }
      ]
    },
    "top_0": [
      {
        "originCountryAlpha2": "US",
        "originCountryName": "United States",
        "targetCountryAlpha2": "FR",
        "targetCountryName": "France",
        "value": "4.323214"
      }
    ]
  },
  "success": true
}
Returns Examples
{
  "result": {
    "meta": {
      "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"
        }
      ]
    },
    "top_0": [
      {
        "originCountryAlpha2": "US",
        "originCountryName": "United States",
        "targetCountryAlpha2": "FR",
        "targetCountryName": "France",
        "value": "4.323214"
      }
    ]
  },
  "success": true
}