Users
User management operations
Retrieves the profile of the currently authenticated user.
Current user profile data.
Authentication information is missing or invalid (e.g., missing/expired token).
An unexpected error occurred on the server.
GET /api/v1/users/current HTTP/1.1
Host: blog-api.codewithsadee.com
Authorization: Bearer JWT
Accept: */*
{
"user": {
"_id": "text",
"username": "text",
"email": "[email protected]",
"role": "user",
"firstName": "text",
"lastName": "text",
"socialLinks": {
"website": "text",
"facebook": "text",
"instagram": "text",
"linkedin": "text",
"x": "text",
"youtube": "text"
},
"createdAt": "2025-09-14T10:41:48.796Z",
"updatedAt": "2025-09-14T10:41:48.796Z"
}
}
Updates the profile of the currently authenticated user.
User's unique username
User's unique email address
New password (min 8 chars)
User's first name
User's last name
User profile updated successfully.
Invalid input data provided. See errors object for details.
Authentication information is missing or invalid (e.g., missing/expired token).
The specified resource was not found.
An unexpected error occurred on the server.
PUT /api/v1/users/current HTTP/1.1
Host: blog-api.codewithsadee.com
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 201
{
"username": "text",
"email": "[email protected]",
"password": "text",
"first_name": "text",
"last_name": "text",
"website": "text",
"facebook": "text",
"instagram": "text",
"linkedin": "text",
"x": "text",
"youtube": "text"
}
{
"user": {
"_id": "text",
"username": "text",
"email": "[email protected]",
"role": "user",
"firstName": "text",
"lastName": "text",
"socialLinks": {
"website": "text",
"facebook": "text",
"instagram": "text",
"linkedin": "text",
"x": "text",
"youtube": "text"
},
"createdAt": "2025-09-14T10:41:48.796Z",
"updatedAt": "2025-09-14T10:41:48.796Z"
}
}
Deletes the account of the currently authenticated user and their associated data.
Request successful, no response body.
No content
Authentication information is missing or invalid (e.g., missing/expired token).
An unexpected error occurred on the server.
DELETE /api/v1/users/current HTTP/1.1
Host: blog-api.codewithsadee.com
Authorization: Bearer JWT
Accept: */*
No content
Retrieves a paginated list of all users. Admin role required.
Maximum number of items to return.
20
Number of items to skip for pagination.
0
A list of users.
Invalid input data provided. See errors object for details.
Authentication information is missing or invalid (e.g., missing/expired token).
Access denied due to insufficient permissions.
An unexpected error occurred on the server.
GET /api/v1/users/ HTTP/1.1
Host: blog-api.codewithsadee.com
Authorization: Bearer JWT
Accept: */*
{
"limit": 1,
"offset": 1,
"total": 1,
"users": [
{
"_id": "text",
"username": "text",
"email": "[email protected]",
"role": "user",
"firstName": "text",
"lastName": "text",
"socialLinks": {
"website": "text",
"facebook": "text",
"instagram": "text",
"linkedin": "text",
"x": "text",
"youtube": "text"
},
"createdAt": "2025-09-14T10:41:48.796Z",
"updatedAt": "2025-09-14T10:41:48.796Z"
}
]
}
Retrieves profile information for a specific user. Admin role required.
ID of the user.
Specific user profile data.
Invalid input data provided. See errors object for details.
Authentication information is missing or invalid (e.g., missing/expired token).
Access denied due to insufficient permissions.
The specified resource was not found.
An unexpected error occurred on the server.
GET /api/v1/users/{userId} HTTP/1.1
Host: blog-api.codewithsadee.com
Authorization: Bearer JWT
Accept: */*
{
"user": {
"_id": "text",
"username": "text",
"email": "[email protected]",
"role": "user",
"firstName": "text",
"lastName": "text",
"socialLinks": {
"website": "text",
"facebook": "text",
"instagram": "text",
"linkedin": "text",
"x": "text",
"youtube": "text"
},
"createdAt": "2025-09-14T10:41:48.796Z",
"updatedAt": "2025-09-14T10:41:48.796Z"
}
}
Deletes a specific user account and their associated data. Admin role required.
ID of the user.
Request successful, no response body.
No content
Invalid input data provided. See errors object for details.
Authentication information is missing or invalid (e.g., missing/expired token).
Access denied due to insufficient permissions.
The specified resource was not found.
An unexpected error occurred on the server.
DELETE /api/v1/users/{userId} HTTP/1.1
Host: blog-api.codewithsadee.com
Authorization: Bearer JWT
Accept: */*
No content
Was this helpful?