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)
| Field | Type | Description |
|---|---|---|
file | binary (required) | The video file itself. |
path | string (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
| Status | Error | Fix |
|---|---|---|
400 | Invalid file type | Use MP4, WebM, OGG or MOV. |
400 | File too large | Max size is 50 MB. |
403 | Storage limit exceeded | Delete files or upgrade your plan. |
404 | File not found | Upload 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.