For the complete documentation index, see llms.txt. This page is also available as Markdown.

Users

User management operations

Get Current User Profile

get

Retrieves the profile of the currently authenticated user.

Authorizations
AuthorizationstringRequired

JWT Access Token obtained via login/register/refresh

Responses
200

Current user profile data.

application/json
get/users/current
GET /api/v1/users/current HTTP/1.1
Host: blog-api.codewithsadee.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "user": {
    "_id": "text",
    "username": "text",
    "email": "name@gmail.com",
    "role": "user",
    "firstName": "text",
    "lastName": "text",
    "socialLinks": {
      "website": "text",
      "facebook": "text",
      "instagram": "text",
      "linkedin": "text",
      "x": "text",
      "youtube": "text"
    },
    "createdAt": "2026-01-01T00:00:00.000Z",
    "updatedAt": "2026-01-01T00:00:00.000Z"
  }
}

Update Current User Profile

put

Updates the profile of the currently authenticated user.

Authorizations
AuthorizationstringRequired

JWT Access Token obtained via login/register/refresh

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
put/users/current
PUT /api/v1/users/current HTTP/1.1
Host: blog-api.codewithsadee.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 201

{
  "username": "text",
  "email": "name@gmail.com",
  "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": "name@gmail.com",
    "role": "user",
    "firstName": "text",
    "lastName": "text",
    "socialLinks": {
      "website": "text",
      "facebook": "text",
      "instagram": "text",
      "linkedin": "text",
      "x": "text",
      "youtube": "text"
    },
    "createdAt": "2026-01-01T00:00:00.000Z",
    "updatedAt": "2026-01-01T00:00:00.000Z"
  }
}

Delete Current User Account

delete

Deletes the account of the currently authenticated user and their associated data.

Authorizations
AuthorizationstringRequired

JWT Access Token obtained via login/register/refresh

Responses
204

Request successful, no response body.

No content

delete/users/current
DELETE /api/v1/users/current HTTP/1.1
Host: blog-api.codewithsadee.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*

No content

Get All Users (Admin)

get

Retrieves a paginated list of all users. Admin role required.

Authorizations
AuthorizationstringRequired

JWT Access Token obtained via login/register/refresh

Query parameters
limitinteger · min: 1 · max: 50Optional

Maximum number of items to return.

Default: 20
offsetintegerOptional

Number of items to skip for pagination.

Default: 0
Responses
200

A list of users.

application/json
limitintegerOptional
offsetintegerOptional
totalintegerOptional
get/users/
GET /api/v1/users/ HTTP/1.1
Host: blog-api.codewithsadee.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "limit": 1,
  "offset": 1,
  "total": 1,
  "users": [
    {
      "_id": "text",
      "username": "text",
      "email": "name@gmail.com",
      "role": "user",
      "firstName": "text",
      "lastName": "text",
      "socialLinks": {
        "website": "text",
        "facebook": "text",
        "instagram": "text",
        "linkedin": "text",
        "x": "text",
        "youtube": "text"
      },
      "createdAt": "2026-01-01T00:00:00.000Z",
      "updatedAt": "2026-01-01T00:00:00.000Z"
    }
  ]
}

Get User by ID (Admin)

get

Retrieves profile information for a specific user. Admin role required.

Authorizations
AuthorizationstringRequired

JWT Access Token obtained via login/register/refresh

Path parameters
userIdstring · objectidRequired

ID of the user.

Responses
200

Specific user profile data.

application/json
get/users/{userId}
GET /api/v1/users/{userId} HTTP/1.1
Host: blog-api.codewithsadee.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "user": {
    "_id": "text",
    "username": "text",
    "email": "name@gmail.com",
    "role": "user",
    "firstName": "text",
    "lastName": "text",
    "socialLinks": {
      "website": "text",
      "facebook": "text",
      "instagram": "text",
      "linkedin": "text",
      "x": "text",
      "youtube": "text"
    },
    "createdAt": "2026-01-01T00:00:00.000Z",
    "updatedAt": "2026-01-01T00:00:00.000Z"
  }
}

Delete User by ID (Admin)

delete

Deletes a specific user account and their associated data. Admin role required.

Authorizations
AuthorizationstringRequired

JWT Access Token obtained via login/register/refresh

Path parameters
userIdstring · objectidRequired

ID of the user.

Responses
204

Request successful, no response body.

No content

delete/users/{userId}
DELETE /api/v1/users/{userId} HTTP/1.1
Host: blog-api.codewithsadee.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*

No content

Last updated

Was this helpful?