> ## Documentation Index
> Fetch the complete documentation index at: https://gcore-doc-1256a.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Aggregated statistics

> Get information about monthly CDN traffic data.

Request URL parameters should be added as a query string after the endpoint.



## OpenAPI

````yaml /api-reference/services_docs_mintlify/cdn_reseller_api.yaml get /cdn/statistics/aggregate/stats
openapi: 3.1.0
info:
  title: Gcore OpenAPI – CDN Reseller API
  description: >-
    This OpenAPI is an aggregated OpenAPI specification that unifies all Gcore
    products into a single file. It covers Cloud, CDN, DNS, WAAP, DDoS
    Protection, Object Storage, Streaming, and FastEdge services.
  version: 374b36dbeac8
servers:
  - url: https://api.gcore.com
security:
  - APIKey: []
tags:
  - name: Account
    description: Information about CDN product settings in your account.
  - name: CDN service
    description: Information about the current state of CDN service in your account.
  - name: Features
    description: Information about free and paid features available for you account.
  - name: Balancer
    description: >-
      Balancer allows choosing CDN server locations that will be used for
      content delivery.


      To activate balancer, [set client’s balancer
      settings](/api-reference/cdn-resellers/balancer/set-client-balancer-settings).
  - name: CDN activity logs
    description: |-
      Get the history of users requests to CDN.
      It contains requests made both via the API and via the control panel.

      The following methods are not tracked in the activity logs:
      - HEAD
      - OPTIONS
  - name: Logs uploader
    description: Manage logs uploader configs for reseller accounts.
  - name: Statistics
    description: Statistics CDN usage and paid features usage.
  - name: Origin shielding
    description: >-
      Origin shielding helps protect your origin server from being overloaded
      with requests from multiple CDN servers.

      The option accumulates all CDN server requests at a special server called
      a shield or precache server.


      When shielding is enabled, only one precache server communicates with the
      origin host, not the entire CDN.
paths:
  /cdn/statistics/aggregate/stats:
    get:
      tags:
        - Statistics
      summary: Aggregated statistics
      description: >-
        Get information about monthly CDN traffic data.


        Request URL parameters should be added as a query string after the
        endpoint.
      operationId: aggregated-statistics
      parameters:
        - $ref: '#/components/parameters/query_statistics_Service'
        - $ref: '#/components/parameters/query_statistics_From'
        - $ref: '#/components/parameters/query_statistics_To'
        - $ref: '#/components/parameters/query_statistics_Granularity'
        - $ref: '#/components/parameters/query_statistics_MetricsAggregated'
        - $ref: '#/components/parameters/query_statistics_GroupByTraffic'
        - $ref: '#/components/parameters/query_statistics_Countries'
        - $ref: '#/components/parameters/query_statistics_Regions'
        - $ref: '#/components/parameters/query_statistics_Resource'
        - $ref: '#/components/parameters/query_statistics_Client'
      responses:
        '200':
          $ref: '#/components/responses/StatisticsTrafficAggregated'
        '204':
          description: There is no data for the requested time period.
components:
  parameters:
    query_statistics_Service:
      in: query
      name: service
      schema:
        type: string
      required: true
      description: |-
        Service name.

        Possible value:
        - CDN
    query_statistics_From:
      in: query
      name: from
      schema:
        type: string
      required: true
      description: |-
        Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.)

        Example:
        - &from=2018-12-01T00:00:00.000
    query_statistics_To:
      in: query
      name: to
      schema:
        type: string
      required: true
      description: |-
        End of the requested time period (ISO 8601/RFC 3339 format, UTC.)

        Example:
        - &to=2018-12-01T01:00:00.000
    query_statistics_Granularity:
      in: query
      name: granularity
      schema:
        type: string
      required: true
      description: |-
        Duration of time chunks into which the data will be divided.

        Possible values:
        - **1m** - available only for up to 1 month in the past.
        - **5m**
        - **15m**
        - **1h**
        - **1d**
    query_statistics_MetricsAggregated:
      in: query
      name: metrics
      schema:
        type: string
      required: true
      description: >-
        Types of statistics data.


        Possible values:

        - **`upstream_bytes`** - Traffic in bytes from an origin server to CDN
        servers or to origin shielding when used.

        - **`sent_bytes`** - Traffic in bytes from CDN servers to clients.

        - **`shield_bytes`** - Traffic in bytes from origin shielding to CDN
        servers.

        - **`total_bytes`** - `shield_bytes`, `upstream_bytes` and `sent_bytes`
        combined.

        - **`cdn_bytes`** - `sent_bytes` and `shield_bytes` combined.

        - **requests** - Number of requests to edge servers.

        - **`responses_2xx`** - Number of 2xx response codes.

        - **`responses_3xx`** - Number of 3xx response codes.

        - **`responses_4xx`** - Number of 4xx response codes.

        - **`responses_5xx`** - Number of 5xx response codes.

        - **`responses_hit`** - Number of responses with the header Cache: HIT.

        - **`responses_miss`** - Number of responses with the header Cache:
        MISS.

        - **`cache_hit_traffic_ratio`** - Formula: 1 - `upstream_bytes` /
        `sent_bytes`. We deduct the non-cached traffic from the total traffic
        amount.

        - **`shield_usage`** - Origin shielding usage. To get accurate results,
        you must use grouping or filtering by a client or by a CDN resource.

        - **`raw_logs_usage`** - Logs uploader usage. To get accurate results,
        you should use grouping or filtering by a client or by a CDN resource.
    query_statistics_GroupByTraffic:
      in: query
      name: group_by
      schema:
        type: string
      description: >-
        Output data grouping.


        Possible values:

        - **client** - Data is grouped by clients.

        - **resource** - Data is grouped by CDN resources.

        - **region** - Data is grouped by regions of CDN edge servers.

        - **country** - Data is grouped by countries of CDN edge servers.

        - **vhost** - Data is grouped by resources CNAMEs.

        - **`client_country`** - Data is grouped by countries, based on
        end-users' location.


        To request multiple values, use:

        - &`group_by`=client&`group_by`=resource
    query_statistics_Countries:
      in: query
      name: countries
      schema:
        type: string
      description: >-
        Names of countries for which data should be displayed.


        English short names from [ISO 3166 standard][1] without the definite
        article ("the") should be used.

         [1]: https://www.iso.org/obp/ui/#search/code/

        To request multiple values, use:

        - &countries=france&countries=denmark
    query_statistics_Regions:
      in: query
      name: regions
      schema:
        type: string
      description: |-
        Regions for which data is displayed.

        Possible values:
        - **na** - North America
        - **eu** - Europe
        - **cis** - Commonwealth of Independent States
        - **asia** - Asia
        - **au** - Australia
        - **latam** - Latin America
        - **me** - Middle East
        - **africa** - Africa
        - **sa** - South America
    query_statistics_Resource:
      in: query
      name: resource
      schema:
        type: integer
      description: |-
        CDN resources IDs.

        To request multiple values, use:
        - &resource=1&resource=2
    query_statistics_Client:
      in: query
      name: client
      schema:
        type: integer
      description: |-
        Client accounts IDs.

        To request multiple values, use:
        - &client=1&client=2
  responses:
    StatisticsTrafficAggregated:
      description: Successful.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/StatisticsTrafficAggregated'
          examples:
            default:
              $ref: '#/components/examples/StatisticsTrafficAggregated'
  schemas:
    StatisticsTrafficAggregated:
      type: object
      properties:
        client:
          allOf:
            - $ref: '#/components/schemas/body_response_statistics_Client'
        resource:
          allOf:
            - $ref: '#/components/schemas/body_response_statistics_Resource'
        region:
          allOf:
            - $ref: '#/components/schemas/body_response_statistics_RegionAggregated'
        metrics:
          allOf:
            - $ref: '#/components/schemas/body_response_statistics_Metrics'
        upstream_bytes:
          allOf:
            - $ref: >-
                #/components/schemas/body_response_statistics_UpstreamBytesAggregated
        sent_bytes:
          allOf:
            - $ref: >-
                #/components/schemas/body_response_statistics_SentBytesAggregated
        total_bytes:
          allOf:
            - $ref: >-
                #/components/schemas/body_response_statistics_TotalBytesAggregated
        shield_usage:
          allOf:
            - $ref: '#/components/schemas/body_response_statistics_ShieldUsage'
        raw_logs_usage:
          allOf:
            - $ref: '#/components/schemas/body_response_statistics_RawLogsUsage'
        requests:
          allOf:
            - $ref: '#/components/schemas/body_response_statistics_Requests'
        responses_2xx:
          allOf:
            - $ref: '#/components/schemas/body_response_statistics_Responses2xx'
        responses_3xx:
          allOf:
            - $ref: '#/components/schemas/body_response_statistics_Responses3xx'
        responses_4xx:
          allOf:
            - $ref: '#/components/schemas/body_response_statistics_Responses4xx'
        responses_5xx:
          allOf:
            - $ref: '#/components/schemas/body_response_statistics_Responses5xx'
        responses_hit:
          allOf:
            - $ref: '#/components/schemas/body_response_statistics_ResponsesHit'
        responses_miss:
          allOf:
            - $ref: '#/components/schemas/body_response_statistics_ResponsesMiss'
        cache_hit_traffic_ratio:
          allOf:
            - $ref: >-
                #/components/schemas/body_response_statistics_CacheHitTrafficRatio
        95_percentile:
          allOf:
            - $ref: '#/components/schemas/body_response_statistics_95Percentile'
        min_bandwidth:
          allOf:
            - $ref: '#/components/schemas/body_response_statistics_MinBandwidth'
        max_bandwidth:
          allOf:
            - $ref: '#/components/schemas/body_response_statistics_MaxBandwidth'
    body_response_statistics_Client:
      type: object
      description: Statistics information grouped by client accounts IDs.
    body_response_statistics_Resource:
      type: object
      description: Statistics information grouped by CDN resources.
    body_response_statistics_RegionAggregated:
      type: object
      description: Statistics information grouped by regions.
    body_response_statistics_Metrics:
      type: object
      description: Statistics parameters.
    body_response_statistics_UpstreamBytesAggregated:
      type: integer
      description: Traffic in bytes from the upstream to CDN servers.
    body_response_statistics_SentBytesAggregated:
      type: integer
      description: Traffic in bytes from CDN servers to clients.
    body_response_statistics_TotalBytesAggregated:
      type: integer
      description: Upstream bytes and `sent_bytes` combined.
    body_response_statistics_ShieldUsage:
      type: string
      description: Number of CDN resources that used origin shielding.
    body_response_statistics_RawLogsUsage:
      type: string
      description: Number of CDN resources that used Logs uploader.
    body_response_statistics_Requests:
      type: integer
      description: Number of requests to edge servers.
    body_response_statistics_Responses2xx:
      type: integer
      description: Number of 2xx response codes.
    body_response_statistics_Responses3xx:
      type: integer
      description: Number of 3xx response codes.
    body_response_statistics_Responses4xx:
      type: integer
      description: Number of 4xx response codes.
    body_response_statistics_Responses5xx:
      type: integer
      description: Number of 5xx response codes.
    body_response_statistics_ResponsesHit:
      type: integer
      description: 'Number of responses with the header Cache: HIT.'
    body_response_statistics_ResponsesMiss:
      type: integer
      description: 'Number of responses with the header Cache: MISS.'
    body_response_statistics_CacheHitTrafficRatio:
      type: integer
      description: >-
        Formula: 1 - `upstream_bytes` / `sent_bytes`. We deduct the non-cached
        traffic from the total traffic amount.
    body_response_statistics_95Percentile:
      type: integer
      description: 95 percentile bandwidth value.
    body_response_statistics_MinBandwidth:
      type: integer
      description: Minimum bandwidth.
    body_response_statistics_MaxBandwidth:
      type: integer
      description: Maximum bandwidth.
  examples:
    StatisticsTrafficAggregated:
      value:
        resource:
          '1':
            region:
              cis:
                metrics:
                  95_percentile: 20023536
                  cache_hit_traffic_ratio: 0.9958449964158854
                  max_bandwidth: 34794756
                  min_bandwidth: 379257
                  requests: 21575631
                  responses_2xx: 21095299
                  responses_3xx: 278225
                  responses_4xx": 202026
                  responses_5xx": 81
                  sent_bytes": 22014089592053
                  total_bytes": 22105558213209
                  upstream_bytes": 91468621156
                  responses_hit": 63368252
                  responses_miss": 866237
              eu:
                metrics:
                  95_percentile: 14324356
                  cache_hit_traffic_ratio: 0.9852247660029627
                  max_bandwidth: 22215199
                  min_bandwidth: 299608
                  requests: 64234595
                  responses_2xx: 62616980
                  responses_3xx: 1196666
                  responses_4xx: 420718
                  responses_5xx: 216
                  sent_bytes: 16552226067556
                  total_bytes: 16796789080876
                  upstream_bytes: 244563013320
                  responses_hit: 21235829
                  responses_miss": 339566
  securitySchemes:
    APIKey:
      description: >-
        API key for authentication. Make sure to include the word `apikey`,
        followed by a single space and then your token.

        Example: `apikey 1234$abcdef`
      type: apiKey
      in: header
      name: Authorization

````