These endpoints let authenticated users update their own account. Password changes verify the existing credential before persisting the new hash. Display name updates are sent as JSON, while avatar and cover image updates useDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/barcode8/VideoHub/llms.txt
Use this file to discover all available pages before exploring further.
multipart/form-data because Multer handles the file upload before passing control to the controller, which then pushes the file to Cloudinary and saves the returned URL to the user document.
Endpoints on this page
| Method | Path | Auth Required |
|---|---|---|
POST | /api/v1/users/change-password | Yes |
PATCH | /api/v1/users/change-details | Yes |
PATCH | /api/v1/users/change-avatar | Yes |
PATCH | /api/v1/users/change-coverimage | Yes |
Change password
POST /api/v1/users/change-password
Verifies the user’s current password against the stored bcrypt hash, then hashes and saves the new password. The validateBeforeSave: true option ensures Mongoose schema validators run on the updated document before it is persisted.
Request parameters
The user’s current plain-text password. Compared against the stored bcrypt hash via
isPasswordCorrect().The desired new password in plain text. Hashed with bcrypt (10 rounds) via the
pre("save") Mongoose hook before being stored.Response fields
Returns HTTP 200.An empty object
{}. No user data is returned after a password change."Password Changed Successfully"Error responses
| Status | Condition |
|---|---|
401 | oldPassword does not match the hash stored in the database. |
Example
Update display name
PATCH /api/v1/users/change-details
Updates the fullName field on the authenticated user’s account. Uses findByIdAndUpdate with { new: true } so the response contains the document as it appears after the update. The password field is stripped from the returned document via .select("-password").
Only
fullName is updated by this endpoint. The username and email fields are not modified here — the controller’s $set block contains only fullName.Request parameters
The new display name to show on the channel profile and across the platform.
Response fields
Returns HTTP 200 with the updated user object (password omitted).
The updated user document.
"Account details updated successfully"Example
Change avatar
PATCH /api/v1/users/change-avatar
Replaces the user’s avatar with a new image. The file is received by Multer (upload.single("avatar")), stored temporarily on disk, then uploaded to Cloudinary. The Cloudinary URL returned from the upload is saved to the user document, replacing the previous avatar URL.
Request parameters
The image file to use as the new avatar. Sent as
multipart/form-data with field name avatar. Supported formats depend on your Cloudinary plan (JPEG, PNG, WebP, and GIF are all accepted by default).Response fields
Returns HTTP 200 with the updated user object (password omitted).
The updated user document.
"Avatar image updated successfully"Error responses
| Status | Condition |
|---|---|
401 | No file was received (the avatar field is missing from the form). |
401 | Cloudinary upload succeeded but returned no URL (upload error). |
Example
Change cover image
PATCH /api/v1/users/change-coverimage
Replaces the user’s channel cover image with a new one. The upload flow is identical to the avatar endpoint: Multer receives the file via upload.single("coverImage"), uploads it to Cloudinary, and persists the returned URL on the user document.
Request parameters
The image file for the new channel cover. Sent as
multipart/form-data with field name coverImage.Response fields
Returns HTTP 200 with the updated user object (password omitted).
The updated user document.
"Cover image updated successfully"Error responses
| Status | Condition |
|---|---|
401 | No file was received (the coverImage field is missing from the form). |
401 | Cloudinary upload succeeded but returned no URL (upload error). |