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
http
GET https://api.easycdn.co/health
Authorization: Bearer YOUR_SECRET_KEY
Parameters

Query Parameters (optional):

  • fail (boolean) - Force a failure response for testing
Response
json
{
  "status": "ok",
  "date": "2024-01-15T10:30:00.000Z"
}
Response Fields
  • status (string) - Always "ok" for successful responses
  • date (string) - ISO 8601 timestamp from the server
Example
bash
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
http
POST https://api.easycdn.co/asset/upload/persist
Authorization: Bearer YOUR_SECRET_KEY
Content-Type: application/json
Request Body
json
{
  "tempAssetId": "temp_abc123"
}
Request Parameters
  • tempAssetId (string, required) - The temporary asset ID from client-side upload
Response
json
{
  "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 identifier
  • bucket (string) - Storage bucket name
  • key (string) - Storage key/path
  • name (string) - Original filename
  • size (number) - File size in bytes
  • type (string) - MIME type
  • createdAt (string) - ISO 8601 creation timestamp
  • updatedAt (string) - ISO 8601 update timestamp
  • projectId (string) - Project identifier
  • url (string) - Public CDN URL
  • expiresAt (string|null) - Expiration timestamp if applicable
  • userId (string) - User identifier

preview (object, optional) - Generated preview/thumbnail asset (for images/videos)

Contains the same fields as the main asset object

Example
bash
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.