Users
User management operations
Retrieves the profile of the currently authenticated user.
Authorizations
Responses
200
Current user profile data.
application/json
401
Authentication information is missing or invalid (e.g., missing/expired token).
application/json
500
An unexpected error occurred on the server.
application/json
get
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-07-28T18:46:02.088Z",
"updatedAt": "2025-07-28T18:46:02.088Z"
}
}
Updates the profile of the currently authenticated user.
Authorizations
Body
usernamestring · max: 20Optional
User's unique username
emailstring · email · max: 50Optional
User's unique email address
passwordstring · min: 8Write-onlyOptional
New password (min 8 chars)
first_namestring · max: 20Optional
User's first name
last_namestring · max: 20Optional
User's last name
websitestring · url · max: 100Optional
facebookstring · url · max: 100Optional
instagramstring · url · max: 100Optional
linkedinstring · url · max: 100Optional
xstring · url · max: 100Optional
youtubestring · url · max: 100Optional
Responses
200
User profile updated successfully.
application/json
400
Invalid input data provided. See errors object for details.
application/json
401
Authentication information is missing or invalid (e.g., missing/expired token).
application/json
404
The specified resource was not found.
application/json
500
An unexpected error occurred on the server.
application/json
put
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-07-28T18:46:02.088Z",
"updatedAt": "2025-07-28T18:46:02.088Z"
}
}
Deletes the account of the currently authenticated user and their associated data.
Authorizations
Responses
204
Request successful, no response body.
401
Authentication information is missing or invalid (e.g., missing/expired token).
application/json
500
An unexpected error occurred on the server.
application/json
delete
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.
Authorizations
Query parameters
limitinteger · min: 1 · max: 50OptionalDefault:
Maximum number of items to return.
20
offsetintegerOptionalDefault:
Number of items to skip for pagination.
0
Responses
200
A list of users.
application/json
400
Invalid input data provided. See errors object for details.
application/json
401
Authentication information is missing or invalid (e.g., missing/expired token).
application/json
403
Access denied due to insufficient permissions.
application/json
500
An unexpected error occurred on the server.
application/json
get
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-07-28T18:46:02.088Z",
"updatedAt": "2025-07-28T18:46:02.088Z"
}
]
}
Retrieves profile information for a specific user. Admin role required.
Authorizations
Path parameters
userIdstring · objectidRequired
ID of the user.
Responses
200
Specific user profile data.
application/json
400
Invalid input data provided. See errors object for details.
application/json
401
Authentication information is missing or invalid (e.g., missing/expired token).
application/json
403
Access denied due to insufficient permissions.
application/json
404
The specified resource was not found.
application/json
500
An unexpected error occurred on the server.
application/json
get
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-07-28T18:46:02.088Z",
"updatedAt": "2025-07-28T18:46:02.088Z"
}
}
Deletes a specific user account and their associated data. Admin role required.
Authorizations
Path parameters
userIdstring · objectidRequired
ID of the user.
Responses
204
Request successful, no response body.
400
Invalid input data provided. See errors object for details.
application/json
401
Authentication information is missing or invalid (e.g., missing/expired token).
application/json
403
Access denied due to insufficient permissions.
application/json
404
The specified resource was not found.
application/json
500
An unexpected error occurred on the server.
application/json
delete
DELETE /api/v1/users/{userId} HTTP/1.1
Host: blog-api.codewithsadee.com
Authorization: Bearer JWT
Accept: */*
No content
Was this helpful?