Upload Media
Securely upload raw image or video files directly to our Google Cloud Storage bucket by requesting a Signed Upload URL.
Because serverless API routes have strict payload limits (4.5MB), Viral Vibes uses aDirect-to-Cloud architecture for large file uploads.
Step 1: Get a Signed URL
POST/api/v1/media/upload
Request an upload ticket for your specific file.
// Request body
{
"fileName": "my-video.mp4",
"fileType": "video/mp4"
}Response:
{
"status": "success",
"uploadUrl": "https://storage.googleapis.com/...", // The temporary signed URL
"path": "post-media/cuid123/123456789-my-video.mp4",
"publicUrl": "https://storage.googleapis.com/viral-vibes-media/..." // The final URL
}Step 2: Upload the File
Perform an HTTP PUT request directly to the uploadUrl you received in Step 1, with your binary file as the body.
fetch(uploadUrl, {
method: 'PUT',
headers: {
'Content-Type': 'video/mp4' // Must match the fileType from Step 1 exactly
},
body: fileData
})Step 3: Attach to Post
Once the PUT request succeeds, you can take the publicUrl from Step 1 and pass it inside the mediaUrls array of the Create Post API endpoint.
Platform Limits
- X (Twitter): Up to 4 images, or 1 video (max 512MB).
- LinkedIn: Up to 9 images (max 5MB each), or 1 video (max 500MB). Documents up to 100MB.