Skip to main content

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.

The Likes API uses a toggle pattern — calling a like endpoint when you’ve already liked that item removes the like. All four endpoints require authentication. The GET /likes/videos endpoint returns the full list of videos you’ve liked.

POST /api/v1/likes/video/:videoId

Protected — requires Authorization: Bearer <accessToken>
Like a video. If you’ve already liked it, this call removes the like (toggle).
videoId
string
required
MongoDB ObjectId of the video to like or unlike.
# Like a video
curl -X POST https://vidtube-ke5w.onrender.com/api/v1/likes/video/664vid123... \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

# Calling again with the same videoId removes the like
curl -X POST https://vidtube-ke5w.onrender.com/api/v1/likes/video/664vid123... \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Response — liked (200)
{
  "statusCode": 200,
  "data": { "_id": "664lk001...", "video": "664vid123...", "likedBy": "664usr789..." },
  "message": "Video Liked successfully.",
  "success": true
}
Response — unliked (200)
{ "statusCode": 200, "data": null, "message": "Video unliked successfully.", "success": true }
Error codes: 400 (missing videoId)

POST /api/v1/likes/comment/:commentId

Protected — requires Authorization: Bearer <accessToken>
Like or unlike a comment (toggle).
commentId
string
required
MongoDB ObjectId of the comment.
curl -X POST https://vidtube-ke5w.onrender.com/api/v1/likes/comment/664cmt456... \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Error codes: 400 (missing commentId)

POST /api/v1/likes/tweet/:tweetId

Protected — requires Authorization: Bearer <accessToken>
Like or unlike a tweet (toggle).
tweetId
string
required
MongoDB ObjectId of the tweet.
curl -X POST https://vidtube-ke5w.onrender.com/api/v1/likes/tweet/664twt789... \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Error codes: 400 (missing tweetId)

GET /api/v1/likes/videos

Protected — requires Authorization: Bearer <accessToken>
Retrieve all videos liked by the currently authenticated user. Returns like records with the full video document populated.
curl https://vidtube-ke5w.onrender.com/api/v1/likes/videos \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Response (200)
{
  "statusCode": 200,
  "data": [
    {
      "_id": "664lk001...",
      "video": {
        "_id": "664vid123...",
        "title": "Node.js Tutorial",
        "thumbnail": "https://res.cloudinary.com/...",
        "duration": "12: 30 seconds"
      },
      "likedBy": "664usr789..."
    }
  ],
  "message": "Liked Videos fetched successfully.",
  "success": true
}
Error codes: 404 (no liked videos found)

Build docs developers (and LLMs) love