.api-ref-table { width: 100%; border-collapse: collapse; margin: 10px 0 16px; } .api-ref-table th, .api-ref-table td { border: 1px solid #94a3b8; padding: 8px 10px; text-align: left; vertical-align: top; } .api-ref-table th { background: #f1f5f9; }
CDNShark User API Reference
All endpoints require a Bearer token generated from the token API.
Base URL: /api
Authentication
Authorization: Bearer YOUR_TOKEN
Create API Token
curl -X POST "$BASE_URL/api/tokens" \
-H "Authorization: Bearer $LOGIN_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name":"My API Token",
"abilities":[
"domains:read","domains:write",
"dns:read","dns:write",
"pullzones:read","pullzones:write",
"storage:read","storage:write",
"streams:read","streams:write"
]
}'
Domains
| Method | Endpoint | Description |
| GET | /api/domains | List domains |
| POST | /api/domains | Create domain |
| PUT | /api/domains/{id} | Update domain |
| DELETE | /api/domains/{domainName} | Delete domain |
curl -X PUT "$BASE_URL/api/domains/12" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"status":"active","nameservers":"ns1.example.com,ns2.example.com"}'
DNS
| Method | Endpoint | Description |
| GET | /api/dns | List zones |
| GET | /api/dns/{zone} | List records in zone |
| POST | /api/dns/{zone}/records | Create record |
| PUT | /api/dns/{zone}/records | Update record |
| DELETE | /api/dns/{zone}/records | Delete record |
Pull Zones
| Method | Endpoint | Description |
| GET | /api/pullzones | List pull zones |
| POST | /api/pullzones | Create pull zone |
| PUT | /api/pullzones/{id} | Update pull zone |
| DELETE | /api/pullzones/{id} | Delete pull zone |
curl -X POST "$BASE_URL/api/pullzones" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"label":"Main Site",
"name":"main-site-zone",
"origin_url":"https://origin.example.com",
"cache_ttl":3600,
"is_cached":true
}'
Storage Buckets
| Method | Endpoint | Description |
| GET | /api/storage/buckets | List buckets |
| POST | /api/storage/buckets | Create bucket |
| GET | /api/storage/buckets/{bucketName}/credentials | Get bucket credentials |
| DELETE | /api/storage/buckets/{bucketName} | Delete bucket |
curl -X GET "$BASE_URL/api/storage/buckets/my-bucket/credentials" \
-H "Authorization: Bearer $TOKEN"
Stream Libraries
| Method | Endpoint | Description |
| GET | /api/video/libraries | List stream libraries |
| POST | /api/video/libraries | Create stream library |
| DELETE | /api/video/libraries/{id} | Delete stream library |
curl -X POST "$BASE_URL/api/video/libraries" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"Movies Library"}'
Access Policy
User service APIs require an active paid service and no unpaid service invoices. If access is blocked, API returns HTTP 402 with a message.