HTTP API Reference
Complete HTTP API reference for easyCDN, including all endpoints, request/response formats, and authentication details.
Authentication Required
All endpoints require authentication. See the Auth & Basic Usage section for complete authentication details and examples.
Endpoints
GET /health
Check the health and connectivity of the easyCDN service
Request
GET https://api.easycdn.co/health
Authorization: Bearer YOUR_SECRET_KEY
Parameters
Query Parameters (optional):
fail
(boolean) - Force a failure response for testing
Response
{
"status": "ok",
"date": "2024-01-15T10:30:00.000Z"
}
Response Fields
status
(string) - Always "ok" for successful responsesdate
(string) - ISO 8601 timestamp from the server
Example
curl -X GET https://api.easycdn.co/health \
-H "Authorization: Bearer ${EASYCDN_SECRET_KEY}"
POST /asset/upload/persist
Persist a temporary asset uploaded from the client-side Dropzone, converting it to a permanent asset
Request
POST https://api.easycdn.co/asset/upload/persist
Authorization: Bearer YOUR_SECRET_KEY
Content-Type: application/json
Request Body
{
"tempAssetId": "temp_abc123"
}
Request Parameters
tempAssetId
(string, required) - The temporary asset ID from client-side upload
Response
{
"asset": {
"_id": "507f1f77bcf86cd799439011",
"bucket": "easycdn-assets",
"key": "uploads/2024/01/15/image.jpg",
"name": "image.jpg",
"size": 1024000,
"type": "image/jpeg",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z",
"projectId": "507f1f77bcf86cd799439012",
"url": "https://cdn.easycdn.co/uploads/2024/01/15/image.jpg",
"expiresAt": null,
"userId": "507f1f77bcf86cd799439013"
},
"preview": {
"_id": "507f1f77bcf86cd799439014",
"bucket": "easycdn-assets",
"key": "previews/2024/01/15/image-preview.jpg",
"name": "image-preview.jpg",
"size": 256000,
"type": "image/jpeg",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z",
"projectId": "507f1f77bcf86cd799439012",
"url": "https://cdn.easycdn.co/previews/2024/01/15/image-preview.jpg",
"expiresAt": null,
"userId": "507f1f77bcf86cd799439013"
}
}
Response Fields
asset (object, required) - The persisted asset
_id
(string) - Unique asset identifierbucket
(string) - Storage bucket namekey
(string) - Storage key/pathname
(string) - Original filenamesize
(number) - File size in bytestype
(string) - MIME typecreatedAt
(string) - ISO 8601 creation timestampupdatedAt
(string) - ISO 8601 update timestampprojectId
(string) - Project identifierurl
(string) - Public CDN URLexpiresAt
(string|null) - Expiration timestamp if applicableuserId
(string) - User identifier
preview (object, optional) - Generated preview/thumbnail asset (for images/videos)
Contains the same fields as the main asset object
Example
curl -X POST https://api.easycdn.co/asset/upload/persist \
-H "Authorization: Bearer ${EASYCDN_SECRET_KEY}" \
-H "Content-Type: application/json" \
-d '{
"tempAssetId": "temp_abc123"
}'
Need More Endpoints?
This HTTP API reference currently covers the core endpoints. Additional endpoints are available through our Node.js SDK and React SDK. More HTTP endpoints will be documented here as they become available.