Skip to main content

Videos

Video files use a dedicated endpoint with multipart/form-data upload — bypassing the JSON + base64 overhead of the generic file upload. The file is stored on object storage and served with the same pretty URL as the rest of your site.

POST /api/v1/videos/upload​

Upload a single video file.

Headers​

X-API-Key: YOUR_API_KEY
Content-Type: multipart/form-data

Body (multipart fields)​

FieldTypeDescription
filebinary (required)The video file itself.
pathstring (required)Destination path, e.g. videos/background.mp4.

Supported formats​

MP4, WebM, OGG, MOV.

Max size​

50 MB per video.

cURL example​

cURL
curl -X POST https://www.flexweg.com/api/v1/videos/upload \
-H "X-API-Key: YOUR_API_KEY" \
-F "file=@/path/to/video.mp4" \
-F "path=videos/background.mp4"

Response​

200 OK
{
"success": true,
"url": "https://your-site.flexweg.com/videos/background.mp4",
"path": "videos/background.mp4",
"size": 12345678,
"message": "Video uploaded successfully"
}

JavaScript example​

upload-video.js
async function uploadVideo(file, path, apiKey) {
const formData = new FormData();
formData.append('file', file);
formData.append('path', path);

const response = await fetch('https://www.flexweg.com/api/v1/videos/upload', {
method: 'POST',
headers: { 'X-API-Key': apiKey },
body: formData,
});

return response.json();
}

const fileInput = document.querySelector('input[type=file]');
uploadVideo(fileInput.files[0], 'videos/bg.mp4', 'YOUR_API_KEY')
.then(result => console.log('Video URL:', result.url));

Error responses​

StatusErrorFix
400Invalid file typeUse MP4, WebM, OGG or MOV.
400File too largeMax size is 50 MB.
403Storage limit exceededDelete files or upgrade your plan.
404File not foundUpload was aborted — retry the request.
Large files? Stream it

This endpoint is optimized for direct multipart uploads — no JSON encoding, no base64 inflation. Use it over the generic file upload whenever you're dealing with anything bigger than a megabyte of binary content.