By FilesFile Trend

File Trend

Returns per-time-bucket metrics for a specific file path.

curl -X POST "https://api.5centscdn.com/v2/analytics/traffic/file/line" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
  "r": "2026-01-01 00:00:00 - 2026-01-31 23:59:59",
  "resource_type": "push",
  "resource_hashes": [
    "abc12hash",
    "def34hash",
    "ghi56hash"
  ],
  "granularity": "1h",
  "match": "/assets/images/banner-ad.png"
}'
{
  "info": {
    "granularity": "1m",
    "dateFormat": "Y-m-d H:i:00"
  },
  "summary": {
    "traffic": {
      "bytes": 1262343731219,
      "formatted": "1.26 TB",
      "percent": "+35.67%"
    },
    "traffic_cached": {
      "bytes": 1262343731219,
      "formatted": "1.26 TB",
      "percent": "+35.67%"
    },
    "hits": {
      "count": 1172166,
      "formatted": "1.172M",
      "percent": "+51.24%"
    },
    "requests": {
      "count": 1172166,
      "formatted": "1.172M",
      "percent": "+51.24%"
    },
    "unique_visitors": {
      "count": 1172166,
      "formatted": "1.172M",
      "percent": "+51.24%"
    },
    "caching_efficiency": {
      "percent": 0.71,
      "formatted": "+71%"
    },
    "traffic_efficiency": {
      "percent": 0.71,
      "formatted": "+71%"
    }
  },
  "data": [
    {
      "key": "example_string",
      "traffic": {
        "bytes": 1262343731219,
        "formatted": "1.26 TB",
        "percent": "+35.67%"
      },
      "traffic_cached": {
        "bytes": 1262343731219,
        "formatted": "1.26 TB",
        "percent": "+35.67%"
      },
      "hits": {
        "count": 1172166,
        "formatted": "1.172M",
        "percent": "+51.24%"
      },
      "requests": {
        "count": 1172166,
        "formatted": "1.172M",
        "percent": "+51.24%"
      },
      "unique_visitors": {
        "count": 1172166,
        "formatted": "1.172M",
        "percent": "+51.24%"
      },
      "caching_efficiency": {
        "percent": 0.71,
        "formatted": "+71%"
      },
      "traffic_efficiency": {
        "percent": 0.71,
        "formatted": "+71%"
      }
    }
  ]
}
POST
/analytics/traffic/file/line
POST
Base URLstring

Target server for requests. Edit to use your own host.

API Key (header: X-API-Key)
X-API-Keystring
Required

API key (sent in header)

Content-Typestring
Required

The media type of the request body

Options: application/json
rstring
Required

Date range in "YYYY-MM-DD HH:mm:ss - YYYY-MM-DD HH:mm:ss" format (UTC).

resource_typestring

Resource category to filter by. Use all to include all resources (omit resource_hashes when using all).

Options: push, pull, all, livestream
resource_hashesarray

Array of resource hashes to filter by (from /analytics/traffic/resources). Required when resource_type is push, pull, or livestream. Omit when resource_type is all.

granularitystring

Defines the time interval for data aggregation.

Options: 1m, 5m, 15m, 30m, 1h, 3h, 6h, 12h, 24h
matchstring
Required

File path or URL to filter by. Must match the key field returned in the breakdown response.

Request Preview
Response

Response will appear here after sending the request

Authentication

header
X-API-Keystring
Required

API Key for authentication. Provide your API key in the header.

Body

application/json
rstring
Required

Date range in "YYYY-MM-DD HH:mm:ss - YYYY-MM-DD HH:mm:ss" format (UTC).

Example:
2026-01-01 00:00:00 - 2026-01-31 23:59:59
resource_typestring

Resource category to filter by. Use all to include all resources (omit resource_hashes when using all).

Allowed values:pushpullalllivestream
resource_hashesarray

Array of resource hashes to filter by (from /analytics/traffic/resources). Required when resource_type is push, pull, or livestream. Omit when resource_type is all.

Example:
["abc12hash","def34hash","ghi56hash"]
granularitystring

Defines the time interval for data aggregation.

Allowed values:1m5m15m30m1h3h6h12h24h
matchstring
Required

File path or URL to filter by. Must match the key field returned in the breakdown response.

Example:
/assets/images/banner-ad.png

Responses

infoobject

Time-series metadata returned alongside data by all /line endpoints.

summaryobject

Aggregate traffic metrics for a period or resource, including bandwidth, request counts, unique visitors, and efficiency ratios.

dataarray

Time-series data points ordered chronologically, one entry per granularity bucket. The key field on each item is a Unix timestamp.