CDNShark Documentation

Reseller API

← Back to Documentation

Reseller API — Usage & Metering

If you resell bandwidth or storage at your own markup, these endpoints give you the numbers to bill from.

All customers

GET /api/reseller/usage?from=2026-07-01&to=2026-07-31

Both parameters are optional; the window defaults to the current calendar month. Results are ranked by bandwidth, largest first, with platform totals alongside.

{
  "period": {"from": "2026-07-01T00:00:00+00:00", "to": "2026-07-31T23:59:59+00:00"},
  "totals": {
    "bandwidth_bytes": 8813452194,
    "bandwidth_gb": 8.2081,
    "requests": 1904221,
    "cache_hits": 1755903,
    "storage_bytes": 43221990400,
    "storage_gb": 40.2537
  },
  "data": [
    {
      "customer_id": 4210,
      "email": "jane@example.com",
      "bandwidth_bytes": 6120044032,
      "bandwidth_gb": 5.6997,
      "requests": 1204118,
      "cache_hits": 1122540,
      "cache_hit_ratio": 0.9322,
      "storage_bytes": 21474836480,
      "storage_gb": 20.0,
      "storage_buckets": 3
    }
  ]
}

A single customer

GET /api/reseller/customers/4210/usage?from=2026-07-01&to=2026-07-31

Adds a per-host breakdown and a daily series, which is what you want for an itemised invoice or a usage graph in your own panel.

Two things to know before you bill

Storage is a current reading, not a window average. Bandwidth is summed over the period you request, but storage reports how much is stored right now. A customer who deleted a large object yesterday shows the smaller figure today. If you bill on peak or average storage, sample this endpoint on a schedule and keep your own history.

Bill on bytes, not requests. Request counts include automated traffic — health probes, apex hits, nameserver lookups — and run far ahead of what content delivery alone would suggest. The bandwidth_bytes figure is the one that reflects real delivery.

Limits

The reporting window cannot exceed 366 days, and from must precede to; both return 422 otherwise. Bandwidth comes from hourly rollups, so very recent traffic may lag by up to an hour.