VidTube handles video uploads through a multipart pipeline: files are received by the server, their duration is measured with FFprobe, and then both the video and thumbnail are pushed to Cloudinary. The original local files are deleted from the server once the upload succeeds. All write operations require a validDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Pragyat-Nikunj/VidTube/llms.txt
Use this file to discover all available pages before exploring further.
Authorization: Bearer <token> header; the read-only listing and detail endpoints are public.
Publishing a video
Prepare your files
You need at least a video file and a title. A thumbnail is strongly recommended — if you omit it, the upload will still fail because the server requires a thumbnail URL in the database. Have both files ready on disk.
Send the multipart request
Use the
-F flag in curl to send fields and files as multipart/form-data.| Field | Type | Required | Description |
|---|---|---|---|
title | string | Yes | Video title |
description | string | No | Video description (defaults to “No description provided”) |
video | file | Yes | The video file (any format FFprobe can read) |
thumbnail | file | Yes | Thumbnail image |
Check the response
A successful upload returns HTTP The
200 with the new video document.duration field is auto-computed by FFprobe from the uploaded file. The isPublished field defaults to true (the integer 1 is also used — see toggling publish status).Files are uploaded to Cloudinary with
resource_type: "auto", so any video or image format that Cloudinary supports is accepted. If the Cloudinary upload fails after the video has already been uploaded, the server automatically calls deleteFromCloudinary to clean up the partial upload before returning an error.Listing videos
GET /api/v1/videos/getAllVideos is public — no token required. Use query parameters to filter, sort, and paginate.
| Parameter | Default | Allowed values | Description |
|---|---|---|---|
page | 1 | Any integer ≥ 1 | Page number |
limit | 10 | 1–100 | Results per page |
query | — | Any string | Case-insensitive search against title and description |
sortBy | createdAt | createdAt, views, likes | Field to sort by |
sortType | desc | asc, desc | Sort direction |
userId | — | A valid user ID | Filter to videos owned by a specific user |
Getting a video by ID
404 if the ID does not exist. This endpoint is public.
Updating a video
Send aPATCH request with any combination of fields you want to change. You must provide at least one field — the request is rejected if all four are absent.
| Field | Type | Description |
|---|---|---|
title | string | New video title |
description | string | New description |
video | file | Replacement video file (duration is re-computed) |
thumbnail | file | Replacement thumbnail image |
Deleting a video
404 if not found.
Deleting a video through this endpoint removes the database record, but does not automatically purge the Cloudinary assets. You may want to handle Cloudinary cleanup on your own if storage usage is a concern.
Toggling publish status
Call this endpoint to flip a video between published and unpublished. TheisPublished field is stored as a number: 1 is published, 0 is unpublished. Calling the endpoint again reverses the state.
Endpoint summary
| Method | Path | Auth | Description |
|---|---|---|---|
GET | /api/v1/videos/getAllVideos | Public | List and search videos |
GET | /api/v1/videos/getVideoById/:videoId | Public | Fetch a single video |
POST | /api/v1/videos/publishVideo | Required | Upload a new video |
PATCH | /api/v1/videos/updateVideo/:videoId | Required | Update video metadata/files |
DELETE | /api/v1/videos/deleteVideo/:videoId | Required | Delete a video |
PATCH | /api/v1/videos/togglePublish/:videoId | Required | Toggle published/unpublished |