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
| Name | Type | Description |
|---|---|---|
| page | integer | Page number (default: 1) |
| per_page | integer | Results per page (default: 20, max: 100) |
| status | string | Filter 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
| Name | Type | Description |
|---|---|---|
| name required | string | Domain name for the zone |
| plan | string | Plan: 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
| Name | Type | Description |
|---|---|---|
| purge_everything | boolean | Purge all cached files |
| files | array | List of URLs to purge |
| tags | array | Cache 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
| Name | Type | Description |
|---|---|---|
| since | datetime | Start time (ISO 8601) |
| until | datetime | End time (ISO 8601) |
| granularity | string | minute, 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}
]
}
}