> ## Documentation Index
> Fetch the complete documentation index at: https://gcore.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# CDN resource statistics

> Get CDN resources statistics for up to 365 days starting today.



## OpenAPI

````yaml /api-reference/services_documented/cdn_api.yaml get /cdn/statistics/series
openapi: 3.1.0
info:
  title: Gcore OpenAPI – CDN 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: '2026-05-14T07:00:22.640261+00:00'
servers:
  - url: https://api.gcore.com
security:
  - APIKey: []
tags:
  - name: CDN service
    description: Information about the current state of the CDN service in your account.
    x-displayName: CDN service
  - name: CDN resources
    x-displayName: CDN resources
  - name: Origins
    x-displayName: Origins
  - name: Rules
    description: >-
      Rules allow to set up custom settings for certain file types or paths.

      By default, the rule inherits all options values from the related CDN
      resource.


      Each option in rule settings can be in one of the following states:

      - **Inherit** - Option is not added to the rule. Option inherits its value
      from the CDN resource settings. In this case, the option value is
      **null**.

      - **ON** - Option is added to the rule and enabled. Option values
      configured in the rule will override values from the CDN resource
      settings.

      - **OFF** - Option is added to the rule and disabled. Option will be
      turned off.
    x-displayName: Rules
  - name: Rule templates
    x-displayName: Rule templates
  - name: SSL certificates
    x-displayName: SSL certificates
  - name: Let's Encrypt certificates
    x-displayName: Let's Encrypt certificates
  - name: CA certificates
    x-displayName: CA certificates
  - 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
    x-displayName: CDN activity logs
  - name: Log viewer
    description: >-
      Log viewer provides you with general information about CDN operation. This
      information does not contain all possible

      sets of fields and restricted by time. To receive full data, use Logs
      Uploader.
    x-displayName: Log viewer
  - name: Logs uploader
    description: >-
      Logs uploader allows you to upload logs with desired format to desired
      storages.


      Consists of three main parts:

      - **Policies** - rules that define which logs are uploaded and how they
      are uploaded.

      - **Targets** - destinations where logs are uploaded.

      - **Configs** - combinations of logs uploader policies, targets and
      resources to which they are applied.
    x-displayName: Logs uploader
  - name: Tools
    x-displayName: Tools
  - name: CDN Statistics
    description: >-
      Consumption statistics is updated in near real-time as a standard
      practice.

      However, the frequency of updates can vary, but they are typically
      available within a 24-hour period.

      Exceptions, such as maintenance periods, may delay data beyond 24 hours
      until servers resume and fill in the missing statistics.
    x-displayName: Statistics
  - name: Advanced analytics
    description: >-
      Advanced analytics allows to get statistics about unique visitors,
      traffic, and requests for countries, directories, browsers, devices, and
      operation systems for up to 90 days starting from today.


      Advanced analytics API is based on the [GraphQL
      framework](https://graphql.org/).


      Advanced analytics API has one single endpoint:

       https://api.gcore.com/cdn/advanced/v2/query

      You can pass the query parameters as a JSON object in the payload of a
      POST request to this endpoint.

      You can use curl to make requests to the Advanced analytics API.
      Alternatively, you can use a GraphQL client

      to construct queries and pass requests to the Advanced analytics API.


      You can write queries in GraphQL much like in SQL: specify the data set
      (CDN resource), the metrics

      to retrieve (such as unique visitors and traffic), and filter or group by
      dimensions (for example, a country).
    x-displayName: Advanced analytics
  - name: Origin shielding
    x-displayName: Origin shielding
  - name: IP addresses list
    x-displayName: IP addresses list
  - name: Purge history
    x-displayName: Purge history
paths:
  /cdn/statistics/series:
    get:
      tags:
        - CDN Statistics
      summary: CDN resource statistics
      description: Get CDN resources statistics for up to 365 days starting today.
      operationId: cdn-resource-statistics
      parameters:
        - $ref: '#/components/parameters/service'
        - $ref: '#/components/parameters/query-from'
        - $ref: '#/components/parameters/query-to'
        - $ref: '#/components/parameters/granularity'
        - $ref: '#/components/parameters/metrics'
        - $ref: '#/components/parameters/group_by'
        - $ref: '#/components/parameters/countries'
        - $ref: '#/components/parameters/regions'
        - $ref: '#/components/parameters/resource'
      responses:
        '200':
          description: Successful.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetSeriesResponse'
        '204':
          description: There is no data for the requested time period.
        '400':
          description: Bad Request. Required parameter is missing.
        '401':
          description: >-
            Unauthorized. Provided credentials are invalid or your API token has
            expired.
        '403':
          description: Forbidden. Access denied. You do not have enough rights.
        '500':
          description: Server errors. Something is wrong on our side.
      x-codeSamples:
        - lang: Python
          source: >-
            import os

            from gcore import Gcore


            client = Gcore(
                api_key=os.environ.get("GCORE_API_KEY"),  # This is the default and can be omitted
            )

            resource_usage_stats =
            client.cdn.statistics.get_resource_usage_series(
                from_="from",
                granularity="granularity",
                metrics="metrics",
                service="service",
                to="to",
            )

            print(resource_usage_stats._1_example)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/G-Core/gcore-go\"\n\t\"github.com/G-Core/gcore-go/cdn\"\n\t\"github.com/G-Core/gcore-go/option\"\n)\n\nfunc main() {\n\tclient := gcore.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresourceUsageStats, err := client.CDN.Statistics.GetResourceUsageSeries(context.TODO(), cdn.StatisticGetResourceUsageSeriesParams{\n\t\tFrom:        \"from\",\n\t\tGranularity: \"granularity\",\n\t\tMetrics:     \"metrics\",\n\t\tService:     \"service\",\n\t\tTo:          \"to\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", resourceUsageStats.Number1Example)\n}\n"
components:
  parameters:
    service:
      in: query
      name: service
      schema:
        type: string
      required: true
      description: |-
        Service name.

        Possible value:
        - CDN
    query-from:
      in: query
      name: from
      schema:
        type: string
      required: true
      description: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.)
    query-to:
      in: query
      name: to
      schema:
        type: string
      required: true
      description: End of the requested time period (ISO 8601/RFC 3339 format, UTC.)
    granularity:
      in: query
      name: granularity
      schema:
        type: string
      required: true
      description: |-
        Duration of the time blocks into which the data will be divided.

        Possible values:
        - **1m** - available only for up to 1 month in the past.
        - **5m**
        - **15m**
        - **1h**
        - **1d**
    metrics:
      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.

        - **`backblaze_bytes`** - Traffic in bytes from Backblaze origin.

        - **`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.

        - **`response_types`** – Statistics by content type. It returns a number
        of responses for content with different MIME types.

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

        - **`cache_hit_requests_ratio`** – Formula: `responses_hit` / requests.
        The share of sending cached content.

        - **`shield_traffic_ratio`** – Formula: (`shield_bytes` -
        `upstream_bytes`) / `shield_bytes`. The efficiency of the Origin
        Shielding: how much more traffic is sent from the Origin Shielding than
        from the origin.

        - **`image_processed`** - Number of images transformed on the Image
        optimization service.

        - **`request_time`** - Time elapsed between the first bytes of a request
        were processed and logging after the last bytes were sent to a user.

        - **`upstream_response_time`** - Number of milliseconds it took to
        receive a response from an origin. If upstream `response_time_` contains
        several indications for one request (in case of more than 1 origin), we
        summarize them. In case of aggregating several queries, the average of
        this amount is calculated.


        Metrics **`upstream_response_time`** and **`request_time`** should be
        requested separately from other metrics
    group_by:
      in: query
      name: group_by
      schema:
        type: string
      description: >-
        Output data grouping.


        Possible values:

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

        - **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`=region&`group_by`=resource
    countries:
      in: query
      name: countries
      schema:
        type: string
      description: >-
        Names of countries for which data should be displayed.

        English short name 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
    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
    resource:
      in: query
      name: resource
      schema:
        type: integer
      description: >-
        CDN resources IDs by that statistics data is grouped.


        To request multiple values, use:

        - &resource=1&resource=2


        If CDN resource ID is not specified, data related to all CDN resources
        is returned.
  schemas:
    GetSeriesResponse:
      type: object
      properties:
        resource:
          type: object
          description: Resources IDs by which statistics data is grouped.
        1 (example):
          type: object
          description: ID of CDN resource for which statistics data is shown.
        region:
          type: object
          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
        metrics:
          type: object
          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.

            - **`backblaze_bytes`** - Traffic in bytes from Backblaze origin.

            - **`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.

            - **`response_types`** – Statistics by content type. It returns a
            number of responses for content with different MIME types.

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

            - **`cache_hit_requests_ratio`** – Formula: `responses_hit` /
            requests. The share of sending cached content.

            - **`shield_traffic_ratio`** – Formula: (`shield_bytes` -
            `upstream_bytes`) / `shield_bytes`. The efficiency of the Origin
            Shielding: how much more traffic is sent from the Origin Shielding
            than from the origin.

            - **`image_processed`** - Number of images transformed on the Image
            optimization service.

            - **`request_time`** - Time elapsed between the first bytes of a
            request were processed and logging after the last bytes were sent to
            a user.

            - **`upstream_response_time`** - Number of milliseconds it took to
            receive a response from an origin. If upstream `response_time_`
            contains several indications for one request (in case of more than 1
            origin), we summarize them. In case of aggregating several queries,
            the average of this amount is calculated.


            Metrics **`upstream_response_time`** and **`request_time`** should
            be requested separately from other metrics
        upstream_bytes:
          type: array
          items:
            type: integer
          description: >-
            Bytes from the upstream to the CDN servers.


            Represented by two values:

            - 1543622400 — Time in the UNIX timestamp when statistics were
            received.

            - 17329220573 — Bytes.
        sent_bytes:
          type: array
          items:
            type: integer
          description: >-
            Bytes from CDN servers to the end-users.


            Represented by two values:

            - 1543622400 — Time in the UNIX timestamp when statistics were
            received.

            - 17329220573 — Bytes.
        total_bytes:
          type: array
          items:
            type: integer
          description: >-
            Upstream bytes and `sent_bytes` combined.


            Represented by two values:

            - 1543622400 — Time in the UNIX timestamp when statistics were
            received.

            - 17329220573 — Bytes.
        backblaze_bytes:
          type: array
          items:
            type: integer
          description: >-
            BackBlaze bytes from Backblaze origin.


            Represented by two values:

            - 1543622400 — Time in the UNIX timestamp when statistics were
            received.

            - 17329220573 — Bytes.
      example:
        resource:
          '1':
            region:
              asia:
                metrics:
                  sent_bytes:
                    - - 1543622400
                      - 17329220573
                  total_bytes:
                    - - 1543622400
                      - 17384617989
                  backblaze_bytes:
                    - - 1543622400
                      - 17384617989
                  upstream_bytes:
                    - - 1543622400
                      - 55397416
              cis:
                metrics:
                  sent_bytes:
                    - - 1543622400
                      - 234582406061
                  total_bytes:
                    - - 1543622400
                      - 234677982848
                  backblaze_bytes:
                    - - 1543622400
                      - 234677982848
                  upstream_bytes:
                    - - 1543622400
                      - 95576787
              eu:
                metrics:
                  sent_bytes:
                    - - 1543622400
                      - 243212514764
                  total_bytes:
                    - - 1543622400
                      - 243297296511
                  backblaze_bytes:
                    - - 1543622400
                      - 243297296511
                  upstream_bytes:
                    - - 1543622400
                      - 84781747
              latam:
                metrics:
                  sent_bytes:
                    - - 1543622400
                      - 59819837564
                  total_bytes:
                    - - 1543622400
                      - 59927133387
                  backblaze_bytes:
                    - - 1543622400
                      - 59927133387
                  upstream_bytes:
                    - - 1543622400
                      - 107295823
              me:
                metrics:
                  sent_bytes:
                    - - 1543622400
                      - 13643432427
                  total_bytes:
                    - - 1543622400
                      - 13644762375
                  backblaze_bytes:
                    - - 1543622400
                      - 13644762375
                  upstream_bytes:
                    - - 1543622400
                      - 1329948
              na:
                metrics:
                  sent_bytes:
                    - - 1543622400
                      - 234004049506
                  total_bytes:
                    - - 1543622400
                      - 234655863540
                  backblaze_bytes:
                    - - 1543622400
                      - 234655863540
                  upstream_bytes:
                    - - 1543622400
                      - 651814034
          '4777':
            region:
              au:
                metrics:
                  sent_bytes:
                    - - 1543622400
                      - 490800672
  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

````