API Reference

Programmatically manage your CDN configuration, purge cache, and access analytics with our RESTful API.

Base URL https://api.stoniescdn.com/v1

Authentication

All API requests require authentication using an API key. Include your key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

API keys can be generated in your dashboard. Keep your keys secure and never expose them in client-side code.

Zones

GET /zones List all zones

Query Parameters

NameTypeDescription
pageintegerPage number (default: 1)
per_pageintegerResults per page (default: 20, max: 100)
statusstringFilter by status: active, pending, deleted

Response (200 OK)

{
  "success": true,
  "data": [
    {
      "id": "zone_abc123",
      "name": "example.com",
      "status": "active",
      "created_at": "2024-01-15T10:30:00Z"
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 20,
    "total": 1
  }
}
POST /zones Create a new zone

Request Body

NameTypeDescription
name requiredstringDomain name for the zone
planstringPlan: free, pro, business, enterprise
curl -X POST https://api.stoniescdn.com/v1/zones \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "example.com", "plan": "pro"}'

Cache Operations

POST /zones/{zone_id}/purge Purge cached content

Request Body

NameTypeDescription
purge_everythingbooleanPurge all cached files
filesarrayList of URLs to purge
tagsarrayCache tags to purge
curl -X POST https://api.stoniescdn.com/v1/zones/zone_abc123/purge \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"files": ["https://example.com/style.css"]}'

Analytics

GET /zones/{zone_id}/analytics/traffic Get traffic analytics

Query Parameters

NameTypeDescription
sincedatetimeStart time (ISO 8601)
untildatetimeEnd time (ISO 8601)
granularitystringminute, hour, day

Response (200 OK)

{
  "success": true,
  "data": {
    "totals": {
      "requests": 1542893,
      "bandwidth": 52428800000,
      "cache_hit_rate": 0.94
    },
    "timeseries": [
      {"timestamp": "2024-01-15T00:00:00Z", "requests": 15420, "bandwidth": 524288000}
    ]
  }
}