VIDEO API FOR DEVELOPERS

Build Video Features,
Not Video Infrastructure

You need video in your app. Upload video, get HLS stream, embed anywhere. A few API calls, predictable pricing, focus on your product.

The Build vs Buy Decision

You need video in your app. You have three options:

1. Build everything yourself

S3 + FFmpeg + CloudFront + custom player. Weeks of work, ongoing maintenance, encoding edge cases, mobile codec issues.

2. Use a heavyweight platform

Brightcove, Kaltura. Enterprise sales cycles, complex SDKs, pricing that requires a spreadsheet.

3. Use a developer-first API

Upload video, get HLS stream, embed anywhere. A few API calls, predictable pricing, focus on your product.

Castiz is option 3.

WHAT DEVELOPERS NEED

Core Requirements

Core Requirements

Simple REST API

No SDKs required, works with any language

Fast transcoding

Users don't wait minutes for processing

Adaptive streaming

Works on any device, any connection

Reliable CDN

Global delivery without managing infrastructure

Predictable pricing

No surprise bills from bandwidth spikes

Integration Requirements

Webhooks

Know when transcoding completes

Presigned uploads

Direct-to-storage from client, no server bottleneck

Embeddable player

iframe or JavaScript, your choice

API tokens

Secure, revocable, scoped access

API PLATFORM COMPARISON

The Major Players

PlatformApproachPricing ModelBest For
MuxAPI-first, developer experiencePer-minute stored + deliveredHigh-scale UGC, streaming apps
Cloudflare StreamCloudflare ecosystemPer-minute stored + deliveredCloudflare customers
api.videoSimple API, global reachPer-minute + bandwidthQuick integrations
Bunny StreamCDN-nativeStorage + bandwidthCost-sensitive apps
CastizFull-featured hosting APIStorage tiers, unlimited bandwidthSaaS, course platforms, internal tools

Pricing Comparison (1,000 videos, 10 min avg, 100K views/month)

PlatformStorage CostDelivery CostTotal Monthly
Mux$25 (encoding) + $7 (storage)~$50-100~$80-130
Cloudflare Stream~$50Included~$50
Castiz Pro$49 flatIncluded$49

*Costs vary based on actual usage. Castiz advantage: unlimited bandwidth means no delivery cost surprises.

CASTIZ API OVERVIEW

Simple REST API

Authentication

# All requests use Bearer token
curl -H "Authorization: Bearer YOUR_API_KEY" \
  https://api.castiz.io/v1/videos

API keys are scoped per workspace. Create read-only keys for public endpoints, full-access keys for management.

Upload Flow

# 1. Initialize upload
POST /api/v1/upload/init
{
  "filename": "product-demo.mp4",
  "size": 104857600,
  "content_type": "video/mp4"
}

# Response
{
  "video_id": "vid_abc123",
  "upload_url": "https://upload.castiz.io/presigned/...",
  "expires_in": 3600
}

# 2. Upload directly to storage (client-side OK)
PUT {upload_url}
Content-Type: video/mp4
[binary data]

# 3. Mark upload complete
POST /api/v1/upload/complete
{ "video_id": "vid_abc123" }

Transcoding Status

# Poll for status
GET /api/v1/videos/vid_abc123

{
  "id": "vid_abc123",
  "status": "ready",  # pending_upload, processing, ready, failed
  "duration_seconds": 342.5,
  "hls_url": "https://cdn.castiz.io/.../master.m3u8",
  "thumbnail_url": "https://cdn.castiz.io/.../poster.jpg"
}

Webhook Events

video.uploaded

Upload complete, transcoding starting

video.ready

Transcoding complete, ready to play

video.failed

Transcoding failed (includes error details)

video.deleted

Video removed

Playback Integration

<!-- Simple iframe embed -->
<iframe 
  src="https://player.castiz.io/embed/vid_abc123"
  width="640" 
  height="360"
  frameborder="0"
  allowfullscreen>
</iframe>
// Or use HLS.js directly with signed URL
import Hls from 'hls.js';

const video = document.getElementById('video');
const hls = new Hls();

const signedUrl = await fetch('/api/video-url/vid_abc123')
  .then(r => r.json())
  .then(d => d.url);

hls.loadSource(signedUrl);
hls.attachMedia(video);
TECHNICAL SPECIFICATIONS

What We Support

Supported Input Formats

ContainersMP4, MOV, MKV, WebM, AVI
Video codecsH.264, H.265/HEVC, VP8, VP9, AV1
Audio codecsAAC, MP3, Opus, FLAC
Max file size10 GB per upload
Max durationNo limit

Output Format (HLS)

ContainerfMP4 segments
Video codecH.264 (broad compatibility)
Audio codecAAC
Resolutions360p, 720p, 1080p (adaptive based on source)
Segment length6 seconds

CDN & Performance

Global PoPs100+ locations via Bunny CDN
Cache hit ratio>95% for video segments
Time to first byte<100ms (cached content)
Transcoding time~1x realtime (10 min video ≈ 10 min processing)

Why Not Just Use S3 + CloudFront?

You can. Here's what you'll build and maintain:

ComponentDIY Effort
Upload handlingPresigned URLs, multipart for large files
TranscodingFFmpeg setup, queue management, error handling
HLS packagingSegment generation, manifest files, multiple resolutions
Thumbnail generationFrame extraction, multiple sizes
CDN configurationCache rules, signed URLs, CORS
PlayerHLS.js integration, mobile handling, quality switching
MonitoringEncoding failures, CDN errors, cost tracking

Estimated engineering time: 2-4 weeks for MVP, ongoing maintenance.

Or: use Castiz API, ship today, focus on your actual product.

PRICING FOR DEVELOPERS

No Per-Minute Fees

Unlike Mux ($0.007/min stored) or Cloudflare Stream ($0.005/min stored), Castiz uses simple storage tiers. Store 500 GB of video for $49/month, regardless of total minutes.

PlanMonthlyStorageBandwidthAPI Access
Free$05 GB20 GB
Starter$19100 GBUnlimited
Pro$49500 GBUnlimited
Business$1492 TBUnlimited

No Bandwidth Surprises. Your video goes viral? Great. Your bill stays the same.

API Reference

Full documentation at docs.castiz.io

EndpointMethodDescription
/upload/initPOSTInitialize upload, get presigned URL
/upload/completePOSTMark upload complete, start transcoding
/videosGETList videos in workspace
/videos/{id}GETGet video details and URLs
/videos/{id}PATCHUpdate title, description, visibility
/videos/{id}DELETEDelete video and all files
/playback/{id}GETGet signed playback URLs
/foldersGET/POSTManage folder organization
/webhooksPOSTConfigure webhook endpoints

Frequently Asked Questions

Getting Started

# 1. Sign up at castiz.io (no credit card for free tier)

# 2. Get your API key from dashboard

# 3. Test the API
curl -H "Authorization: Bearer YOUR_API_KEY" \
  https://api.castiz.io/v1/videos

# 4. Upload your first video (See upload flow above)

# 5. Embed and ship