Content Delivery Network (CDN)

Overview

Scenario's Content Delivery Network provides secure, signed access to your assets with real-time transformation capabilities. The CDN delivers images, 3D models, and videos with features including resizing, format conversion, and optimization.

CDN Domain: cdn.cloud.scenario.com

URL Structure

Path Patterns

PatternPurposeAccess
/assets/*Original asset filesRequires signed URL
/assets-transform/*Transformed assets (resized, converted, etc.)Requires signed URL
/thumbnails/*Asset thumbnailsPublic

Signed URLs

All asset URLs (except thumbnails) are signed for security and expire automatically.

Expiration Policy

Signed URLs use a rolling expiration window optimized for caching:

Date RangeExpiration Date
1st - 7th14th of same month
8th - 14th21st of same month
15th - 21stLast day of same month
22nd - 31st7th of next month

Minimum expiration: 24 hours from generation

Signed URLs include signature parameters (Policy, Signature, Key-Pair-Id) that are automatically added by the API.

⚠️ Never change the given signature query strings, it would result in an Access Denied Error.

Asset Transformation

Transform assets on-the-fly using the /assets-transform/{assetId} endpoint with query parameters.

Image Transformation Parameters

ParameterTypeDefaultValuesDescription
widthinteger | "auto"auto> 0Target width in pixels
heightinteger | "auto"auto> 0Target height in pixels
qualityinteger1001-100Compression quality
formatstringoriginSee belowOutput format
fitstringcovercover, contain, fill, inside, outsideResize mode
rotateinteger00-360Rotation in degrees
blurinteger00-100Blur strength
greyscalebooleanfalsetrue, falseConvert to greyscale
flattenbooleanfalsetrue, falseRemove transparency
backgroundstringffffffHex (no #)Background color when flattening

Supported Formats

Image Formats:

  • jpeg / jpg - JPEG
  • png - PNG with transparency
  • webp - Modern WebP format
  • avif - Next-gen AVIF format
  • tiff / tif - TIFF
  • origin - Keep original format
  • auto - Auto-select best format

3D Model Formats:

  • glb - Binary glTF
  • obj - Wavefront OBJ
  • fbx - Autodesk FBX

Resize Modes (fit parameter)

  • cover (default) - Crop to fill dimensions, maintains aspect ratio
  • contain - Scale to fit within dimensions, may add letterboxing
  • fill - Stretch to exact dimensions, may distort
  • inside - Scale down to fit within dimensions only
  • outside - Scale to cover dimensions, may crop

Example Transformations

# Resize to 512x512, convert to WebP
https://cdn.cloud.scenario.com/assets-transform/{assetId}?width=512&height=512&format=webp&quality=90&Policy=...&Signature=...&Key-Pair-Id=...

# Auto-width, 1024px height, maintain aspect ratio
https://cdn.cloud.scenario.com/assets-transform/{assetId}?height=1024&width=auto&fit=inside&Policy=...&Signature=...&Key-Pair-Id=...

# Convert to greyscale with slight blur
https://cdn.cloud.scenario.com/assets-transform/{assetId}?greyscale=true&blur=5&Policy=...&Signature=...&Key-Pair-Id=...

# Convert 3D model to GLB format
https://cdn.cloud.scenario.com/assets-transform/{assetId}?format=glb&Policy=...&Signature=...&Key-Pair-Id=...

# Flatten transparency with custom background
https://cdn.cloud.scenario.com/assets-transform/{assetId}?flatten=true&background=000000&Policy=...&Signature=...&Key-Pair-Id=...

API Usage

Get Asset Download URL

Generate a signed download URL with optional format conversion.

Endpoint: POST /v1/assets/{assetId}/download

Request:

{
  "targetFormat": "webp"  // Optional - any supported format
}

Response:

{
  "url": "https://cdn.cloud.scenario.com/assets-transform/{assetId}?format=webp&Policy=...&Signature=...&Key-Pair-Id=..."
}

Asset Object URLs

When retrieving assets through the API (e.g., GET /v1/assets), the response includes a pre-signed url field:

{
  "assets": [{
    "id": "asset-id",
    "url": "https://cdn.cloud.scenario.com/assets-transform/{assetId}?...",
    ...
  }]
}

These URLs are already signed and ready to use.

Caching

  • Transformed assets are cached for faster subsequent access
  • Cache duration: Up to 24 hours (respects signed URL expiration)
  • Cache key: Based on asset ID and transformation parameters

For consistent cache hits, use the same transformation parameters. Varying parameters (e.g., width=512 vs width=513) will create separate cache entries.

Best Practices

Performance

  1. Use WebP or AVIF for modern browsers to reduce bandwidth
  2. Specify exact dimensions when possible to optimize caching
  3. Set appropriate quality (80-90 typically sufficient for web)
  4. Use fit=inside to prevent upscaling small images

Format Selection

  • PNG: When transparency is required
  • JPEG: For photos without transparency
  • WebP: Best compression for modern browsers
  • AVIF: Smallest file size, newer browser support
  • Auto: Let the CDN choose based on browser support

Dimensions

  • Thumbnails: 256x256 or 512x512
  • Preview: 1024px on longest side
  • Full quality: 2048px or original size
  • Use auto for one dimension to maintain aspect ratio