Skip to content

API for metrics

Information

The API is designed to retrieve CDN traffic metrics in JSON format. All responses, including errors, are returned in JSON format.

Base URL: https://api.cdnvideo.ru/app/metrics/v1/

Metrics API

  • Required headers: CDN-AUTH-TOKEN (см. Authorization)
  • Response Content-Type: application/json
  • Response structure: key status, on success — data, on error — description

Authorization

Access to the API is performed using a token. For details on obtaining a token, see Authorization.

To get a list of available accounts, see Getting the list of accounts.

Limitations

The limitations below apply to the / and /resources endpoints.

  • Return data for a period of 1 to 10 minutes.
  • "All time parameters must be accurate to the minute: seconds must always be 00. If seconds other than 00 are specified, an error "Invalid time format. Time must be at minute precision"
  • Parameters account, start, end are required.
  • Filtering by metrics (metric) and resources (resource) is available.

Response Codes Description

HTTP code Status Description
200 OK Successful request
403 Forbidden Invalid token or no access
422 Unprocessable Entity Invalid request parameters
500 Internal Server Error Server error
504 Gateway Timeout Request execution timeout exceeded

For a successful HTTP 200 response, the body contains JSON with the fields start, end, account, metrics, data.

API Methods

Aggregated data for a period (/)

Description:
Retrieve aggregated data for the specified period for the selected account with optional filtering by metrics and resource.

  • Method: GET
  • URL: https://api.cdnvideo.ru/app/metrics/v1/
  • Headers:
  • CDN-AUTH-TOKEN — authorization token (see Authorization)
  • Response format: JSON

Query parameters

Parameter Type Required Description
account string yes Account name
start string yes Interval start in the format YYYY-MM-DDThh:mm:00 (UTC, seconds = 00)
end string yes Interval end in the format YYYY-MM-DDThh:mm:00 (UTC, seconds = 00)
metric string no Metric filter. Multiple values are passed as repeated query parameters: metric=value1&metric=value2&....
resource string no Resource filter (resource identifier)

Response codes

Use the codes from Response Codes Description.

Request examples

Request example with a single metric

curl -H "CDN-AUTH-TOKEN: $TOKEN" \ 'https://api.cdnvideo.ru/app/metrics/v1/?account=test_account&start=2025-07-16T11:00:00&end=2025-07-16T11:01:00&metric=edge_hit_bytes'

Successful response example

{
  "start": "2025-07-16T11:00:00",
  "end": "2025-07-16T11:01:00",
  "account": "test_account",
  "metrics": ["edge_hit_bytes"],
  "data": [
    { "edge_hit_bytes": 54123511411 }
  ]
}

Response fields description

Field Description
start start of the requested period
end end of the requested period
account account name
metrics edge_hit_bytes – amount of cached traffic on _edge
data data for the edge_hit_bytes metric

Request example with multiple metrics

curl -H "CDN-AUTH-TOKEN: $TOKEN" \ 'https://api.cdnvideo.ru/app/metrics/v1/?account=test_account&start=2026-02-22T15:33:00&end=2026-02-22T15:35:00&metric=edge_status_2xx&metric=edge_hit_ratio&metric=edge_hit_bytes'

Successful response example

{
  "start": "2026-02-22T15:33:00",
  "end": "2026-02-22T15:35:00",
  "account": "test_account",
  "metrics": [
    "edge_status_2xx",
    "edge_hit_ratio",
    "edge_hit_bytes"
  ],
  "data": [
    {
      "edge_status_2xx": 3864464,
      "edge_hit_ratio": 0.9380079224014987,
      "edge_hit_bytes": 2046651070084
    }
  ]
}

Response fields description

Field Description
start start of the requested period
end end of the requested period
account account name
metrics edge_status_2xx – number of requests with 2xx status at the edge, edge_hit_ratio – cached traffic ratio, edge_hit_bytes – amount of cached traffic on _edge
data data for metrics: edge_status_2xx, edge_hit_ratio, edge_hit_bytes

Period data with breakdown by resources (/resources)

Description:

Retrieve aggregated data for the specified period for the selected account with breakdown by resources and optional filtering by metrics and resource. Returns the same metrics but with breakdown by resources (fields: resource, resource_name, cname). Each data element corresponds to one resource.

  • Method: GET
  • URL: https://api.cdnvideo.ru/app/metrics/v1/resources
  • Headers:
  • CDN-AUTH-TOKEN — authorization token (see Authorization)
  • Response format: JSON

Query parameters

Parameter Type Required Description
account string yes Account name
start string yes Interval start in the format YYYY-MM-DDThh:mm:00 (UTC, seconds = 00)
end string yes Interval end in the format YYYY-MM-DDThh:mm:00 (UTC, seconds = 00)
metric string no Metric filter. Multiple values are passed as repeated query parameters: metric=value1&metric=value2&....
resource string no Resource filter (resource identifier)

Response codes

Use the codes from Response Codes Description.

Request examples

Request example with a single metric

curl -H "CDN-AUTH-TOKEN: $TOKEN" \ 'https://api.cdnvideo.ru/app/metrics/v1/resources?account=test_account&start=2025-07-23T08:00:00&end=2025-07-23T08:05:00&metric=origin_requests_total'

Successful response example

{
  "start": "2025-07-23T08:00:00",
  "end": "2025-07-23T08:05:00",
  "account": "test_account",
  "metrics": ["origin_requests_total"],
  "data": [
    {
      "cname": "test_cname",
      "origin_requests_total": 225638,
      "resource": "test_resource",
      "resource_name": "test_resource_name"
    }
  ]
}

Response fields description

Field Description
start start of the requested period
end end of the requested period
account account name
metrics origin_requests_total - number of requests to _origin
data cname - host name
data for the origin_requests_total metric
resource - resource
resource_name - resource name

Request example with multiple metrics

curl -H "CDN-AUTH-TOKEN: $TOKEN" \ 'https://api.cdnvideo.ru/app/metrics/v1/resources?account=test_account&start=2026-02-22T12:00:00&end=2026-02-22T12:05:00&metric=edge_status_2xx&metric=edge_hit_bytes'

Successful response example

{
  "start": "2026-02-22T12:00:00",
  "end": "2026-02-22T12:05:00",
  "account": "test_account",
  "metrics": [
      "edge_status_2xx",
      "edge_hit_bytes"
  ],
  "data": [
      {
        "cname": "test_cname",
        "edge_status_2xx": 4353253,
        "edge_hit_bytes": 4721746395190,
        "resource": "test_resource",
        "resource_name": "test_resource_name"
      }
   ]
}

Response fields description

Field Description
start start of the requested period
end end of the requested period
account account name
metrics edge_status_2xx - number of requests with 2xx status at the edge, edge_hit_bytes - amount of cached traffic on _edge
data cname - host name
data for metrics: edge_status_2xx, edge_hit_bytes
resource - resource
resource_name - resource name

Available metrics

Below are the metrics available in JSON responses of the / and /resources endpoints.

Origin metrics

Metric Description
origin_bandwidth Bandwidth from the end user to the origin server (bits per second)
origin_status_200 Number of requests with status 200 on origin for the specified time period
origin_status_204 Number of requests with status 204 on origin for the specified time period
origin_status_206 Number of requests with status 206 on origin for the specified time period
origin_status_2xx Number of requests with status 2xx on origin for the specified time period
origin_status_301 Number of requests with status 301 on origin for the specified time period
origin_status_302 Number of requests with status 302 on origin for the specified time period
origin_status_304 Number of requests with status 304 on origin for the specified time period
origin_status_3xx Number of requests with status 3xx on origin for the specified time period
origin_status_400 Number of requests with status 400 on origin for the specified time period
origin_status_401 Number of requests with status 401 on origin for the specified time period
origin_status_403 Number of requests with status 403 on origin for the specified time period
origin_status_404 Number of requests with status 404 on origin for the specified time period
origin_status_416 Number of requests with status 416 on origin for the specified time period
origin_status_429 Number of requests with status 429 on origin for the specified time period
origin_status_4xx Number of requests with status 4xx on origin for the specified time period
origin_status_500 Number of requests with status 500 on origin for the specified time period
origin_status_501 Number of requests with status 501 on origin for the specified time period
origin_status_502 Number of requests with status 502 on origin for the specified time period
origin_status_503 Number of requests with status 503 on origin for the specified time period
origin_status_504 Number of requests with status 504 on origin for the specified time period
origin_status_505 Number of requests with status 505 on origin for the specified time period
origin_status_5xx Number of requests with status 5xx on origin for the specified time period
origin_request_time Load time from origin servers for the specified time interval. This is the median processing/load time in seconds for successful (HTTP 2xx) responses within the given size range.
Response size ranges:
0_250k — 0–250 KB
250k_500k — 250–500 KB
500k_750k — 500–750 KB
750k_1m — 750 KB – 1 MB
1m_2m — 1–2 MB
2m_3m — 2–3 MB
3m_4m — 3–4 MB
4M+ — more than 4 MB
origin_requests_total Number of requests to origin servers for the specified time interval

Edge metrics

Metric Description
edge_bandwidth Bandwidth from the end user to the edge server (bits per second)
edge_status_200 Number of requests with status 200 on edge for the specified time period
edge_status_204 Number of requests with status 204 on edge for the specified time period
edge_status_206 Number of requests with status 206 on edge for the specified time period
edge_status_2xx Number of requests with status 2xx on edge for the specified time period
edge_status_301 Number of requests with status 301 on edge for the specified time period
edge_status_302 Number of requests with status 302 on edge for the specified time period
edge_status_304 Number of requests with status 304 on edge for the specified time period
edge_status_3xx Number of requests with status 3xx on edge for the specified time period
edge_status_400 Number of requests with status 400 on edge for the specified time period
edge_status_401 Number of requests with status 401 on edge for the specified time period
edge_status_403 Number of requests with status 403 on edge for the specified time period
edge_status_404 Number of requests with status 404 on edge for the specified time period
edge_status_416 Number of requests with status 416 on edge for the specified time period
edge_status_429 Number of requests with status 429 on edge for the specified time period
edge_status_4xx Number of requests with status 4xx on edge for the specified time period
edge_status_500 Number of requests with status 500 on edge for the specified time period
edge_status_501 Number of requests with status 501 on edge for the specified time period
edge_status_502 Number of requests with status 502 on edge for the specified time period
edge_status_503 Number of requests with status 503 on edge for the specified time period
edge_status_504 Number of requests with status 504 on edge for the specified time period
edge_status_505 Number of requests with status 505 on edge for the specified time period
edge_status_5xx Number of requests with status 5xx on edge for the specified time period
edge_request_time Load time from edge servers for the specified time interval. This is the median processing/load time in seconds for successful (HTTP 2xx) responses within the given size range.
Response size ranges:
0_250k — 0–250 KB
250k_500k — 250–500 KB
500k_750k — 500–750 KB
750k_1m — 750 KB – 1 MB
1m_2m — 1–2 MB
2m_3m — 2–3 MB
3m_4m — 3–4 MB
4M+ — more than 4 MB
edge_requests_total Number of requests to edge servers for the specified time interval
edge_hit_ratio Share of cached traffic for the specified time interval. Calculated as: cached traffic / total traffic
edge_hit_bytes Number of bytes returned from cache hits for the specified time interval