Downloads API

API endpoints for managing download tokens, tracking usage, and accessing download analytics.

List Download Tokens

Retrieve all download tokens for your organization with filtering and pagination.

GET /api/downloads/tokens

Query Parameters

  • productId - Filter by specific product
  • status - active, expired, used
  • customerEmail - Filter by customer
  • createdAfter - ISO date string
  • limit - Results per page (max 100)

Response

{
  "success": true,
  "data": {
    "tokens": [
      {
        "id": "token_abc123",
        "downloadUrl": "https://continuata.io/download?token=ct_xyz789",
        "productId": "epic-drums-v1",
        "customerEmail": "customer@example.com",
        "expiresAt": "2025-02-01T00:00:00Z",
        "maxDownloads": null,
        "usedCount": 2,
        "status": "active",
        "createdAt": "2025-01-01T00:00:00Z",
        "lastUsedAt": "2025-01-15T12:30:00Z",
        "metadata": {
          "orderId": "order_123"
        }
      }
    ]
  }
}

Download Analytics

Get detailed download statistics and performance metrics.

GET /api/analytics/downloads

Query Parameters

  • period - 7d, 30d, 90d, 1y
  • productId - Specific product analytics
  • groupBy - hour, day, week, month
  • metrics - count, bytes, speed, completion

Response

{
  "success": true,
  "data": {
    "period": "30d",
    "groupBy": "day",
    "downloads": [
      {
        "date": "2025-01-01",
        "count": 45,
        "bytes": 2147483648,
        "avgSpeed": 47200000,
        "completionRate": 0.946
      }
    ],
    "summary": {
      "totalDownloads": 1234,
      "totalBytes": 5432109876,
      "avgSpeed": 45300000,
      "completionRate": 0.938,
      "topProducts": [
        {
          "productId": "epic-drums-v1",
          "downloads": 567,
          "bytes": 2987654321
        }
      ]
    }
  }
}

Token Status Management

Get Token Details

GET /api/downloads/tokens/{tokenId}

Revoke Token

DELETE /api/downloads/tokens/{tokenId}

Extend Token Expiration

PATCH /api/downloads/tokens/{tokenId}

{
  "expiresAt": "2025-03-01T00:00:00Z",
  "maxDownloads": 5
}

Bandwidth Analytics

Track bandwidth usage across your organization for billing and optimization:

GET /api/analytics/bandwidth?period=30d&groupBy=day

Response

{
  "success": true,
  "data": {
    "usage": [
      {
        "date": "2025-01-01",
        "bytes": 10737418240,
        "downloads": 156,
        "avgSpeedMbps": 42.3
      }
    ],
    "summary": {
      "totalBytes": 107374182400,
      "limit": 1099511627776,
      "percentUsed": 9.8,
      "projectedMonthly": 112742891520
    }
  }
}

Real-time Events

For real-time tracking, use webhooks or Server-Sent Events:

Webhook Events

POST https://your-app.com/webhooks/continuata

{
  "event": "download.started",
  "tokenId": "token_abc123",
  "productId": "epic-drums-v1",
  "customerEmail": "customer@example.com",
  "timestamp": "2025-01-01T12:00:00Z",
  "metadata": {
    "browser": "Chrome",
    "os": "macOS",
    "country": "US"
  }
}

Available Events

download.startedDownload initiated
download.progress25%, 50%, 75% milestones
download.completedDownload finished
token.expiredToken reached expiration

Custom Analytics

Build custom analytics dashboards using these APIs. See ourAnalytics guide for implementation examples.