Skip to main content
POST
/
api
/
follow
Follow User
curl --request POST \
  --url https://api.example.com/api/follow \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "username": "<string>"
}
'
{
  "200": {},
  "400": {},
  "401": {},
  "404": {},
  "message": "<string>"
}
Creates 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 follow

Response

message
string
Confirmation message indicating successful follow action

Status Codes

200
Success
User followed successfully
{
  "message": "now following {username}"
}
400
Error
Bad request - missing fields or already followingMissing fields:
{
  "error": "missing fields"
}
Already following:
{
  "error": "already following"
}
401
Error
Unauthorized - invalid or missing authentication token
{
  "error": "unauthorized"
}
404
Error
Target user not found
{
  "error": "user not found"
}

Example Request

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

Example Response

{
  "message": "now following johndoe"
}

Build docs developers (and LLMs) love