Upload Videos
Upload videos to Castiz using presigned URLs for direct upload or import from a URL.
Upload Methods
Presigned URL Upload
Best for user-initiated uploads. Get a presigned URL and upload directly to our CDN.
- Files up to 5GB
- Direct browser upload
- Progress tracking
URL Import
Import videos from any public URL. Great for migrations and automated workflows.
- Server-side download
- Background processing
- Works with any URL
Method 1: Presigned URL Upload
1Get a Presigned URL
Request a presigned URL for your upload. This creates a video record and returns a temporary URL valid for 1 hour.
curl -X POST "https://api.castiz.com/upload/presigned" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"workspace_id": "YOUR_WORKSPACE_ID",
"filename": "my-video.mp4",
"content_type": "video/mp4",
"file_size": 104857600
}'{
"upload_url": "https://storage.castiz.com/...",
"storage_key": "originals/workspace-id/video-id/my-video.mp4",
"video_id": "550e8400-e29b-41d4-a716-446655440000"
}2Upload the File
Upload your file directly to the presigned URL using a PUT request.
curl -X PUT "PRESIGNED_UPLOAD_URL" \
-H "Content-Type: video/mp4" \
--data-binary @my-video.mp43Confirm the Upload
After the file is uploaded, confirm the upload to finalize processing. Your video is ready for playback immediately!
curl -X POST "https://api.castiz.com/upload/confirm/VIDEO_ID" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"{
"success": true,
"data": {
"video_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "ready"
}
}Method 2: Import from URL
Import a video from any publicly accessible URL. The video is downloaded and processed in the background.
curl -X POST "https://api.castiz.com/upload/from-url" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"workspace_id": "YOUR_WORKSPACE_ID",
"url": "https://example.com/video.mp4",
"title": "My Imported Video",
"description": "Optional description"
}'{
"success": true,
"data": {
"video_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "processing",
"message": "Video is being downloaded and will be processed shortly"
}
}Video Status
After upload, you can check the video status by fetching the video details.
| Status | Description |
|---|---|
uploading | File is being uploaded |
processing | Video is being processed/transcoded |
ready | Video is ready for playback |
failed | Processing failed (check error_message) |
Pro Tip: Use Webhooks
Instead of polling for status, set up a webhook to get notified when your video is ready.