Find a User
POST /api/users/get
Look up any registered user by their username or numeric user ID.
string
The target user’s username.
number
The target user’s numeric ID. Supply either
username or id — not both.Some users set their profile to private by disabling friend requests. If you are not already friends with them, the server returns
403 Forbidden. You will not be able to view their profile or send them a request.Send a Friend Request
POST /api/friends/send_request
string
required
The username of the person you want to add.
friend_request Socket.IO event:
- The user has disabled friend requests (
accepts_friend_requestssetting). - You are on the user’s block list.
- You are already friends.
- You supplied your own username.
View Your Friends and Pending Requests
GET /api/friends/get
Returns your current social graph in one call.
array of numbers
User IDs of confirmed friends.
array of numbers
User IDs you have blocked.
array of numbers
User IDs of people who have sent you a pending friend request.
Accept or Decline a Friend Request
POST /api/friends/request
number
required
The user ID of the person who sent you the request.
number
required
1 to accept, 0 to decline.accept_request event: {"id": <your_user_id>}. Both users are added to each other’s friends list immediately.
Decline:
reject_request event: {"id": <your_user_id>}.
Remove a Friend
POST /api/friends/unfriend
number
required
The user ID of the friend you want to remove.
Block a User
POST /api/friends/set_enemy
number
required
The user ID to block or unblock.
number
required
1 to block, 0 to unblock.- Removes them from your friends list (and removes you from theirs).
- Prevents them from sending you friend requests in the future.
- Stops them from viewing your profile.
Real-Time Friend Events
Friend activity arrives on the main/ Socket.IO namespace. See Real-Time Events for connection details.