Skip to main content
POST
/
api
/
unfollow
Unfollow User
curl --request POST \
  --url https://api.example.com/api/unfollow \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "username": "<string>"
}
'
{
  "200": {},
  "400": {},
  "401": {},
  "message": "<string>"
}
Removes a following relationship between the authenticated user and a target user. Updates follower and following counts automatically.

Headers

Authorization
string
required
Authentication token for the current user

Body Parameters

username
string
required
The username of the user to unfollow

Response

message
string
Confirmation message indicating successful unfollow action

Status Codes

200
Success
User unfollowed successfully
{
  "message": "unfollowed {username}"
}
400
Error
Bad request - missing fields or not following the userMissing fields:
{
  "error": "missing fields"
}
Not following:
{
  "error": "not following this user"
}
401
Error
Unauthorized - invalid or missing authentication token
{
  "error": "unauthorized"
}

Example Request

curl -X POST https://api.example.com/api/unfollow \
  -H "Authorization: your-auth-token" \
  -H "Content-Type: application/json" \
  -d '{
    "username": "johndoe"
  }'

Example Response

{
  "message": "unfollowed johndoe"
}

Build docs developers (and LLMs) love