The Videos API lets you publish videos with thumbnails, browse the full video library with pagination and search, and manage individual video records. Video files are stored on Cloudinary and duration is auto-detected via FFmpeg after upload.Documentation 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.
GET /api/v1/videos/getAllVideos
List all published videos with optional filtering, sorting, and pagination.Page number (1-indexed). Defaults to
1.Videos per page. Defaults to
10, maximum 100.Search term. Matches against video
title and description (case-insensitive).Field to sort by. One of
createdAt, views, likes. Defaults to createdAt.Sort direction.
asc or desc. Defaults to desc.Filter videos by owner’s user ID.
400 (invalid page or limit)
GET /api/v1/videos/getVideoById/:videoId
Fetch a single video by its ID.MongoDB ObjectId of the video.
404 (video not found)
POST /api/v1/videos/publishVideo
Protected — requires
Authorization: Bearer <accessToken>multipart/form-data. Duration is extracted automatically from the video file using FFprobe before uploading to Cloudinary.
Video title.
Video description. Defaults to
"No description provided" if omitted.Video file to upload.
Thumbnail image file.
If the Cloudinary upload fails, any already-uploaded files are automatically deleted to prevent orphaned assets.
400 (missing title or video file), 500 (upload failed)
PATCH /api/v1/videos/updateVideo/:videoId
Protected — requires
Authorization: Bearer <accessToken>MongoDB ObjectId of the video to update.
New video title.
New video description.
Replacement video file. Duration is re-detected automatically.
Replacement thumbnail image.
400 (invalid videoId, no fields provided), 401
DELETE /api/v1/videos/deleteVideo/:videoId
Protected — requires
Authorization: Bearer <accessToken>MongoDB ObjectId of the video to delete.
400 (missing videoId), 404 (video not found)
PATCH /api/v1/videos/togglePublish/:videoId
Protected — requires
Authorization: Bearer <accessToken>isPublished: 1 means public; isPublished: 0 means private. Each call flips the current value.
MongoDB ObjectId of the video.
isPublished value.
Error codes: 400 (invalid videoId), 404 (video not found)