API Reference


Adds a new friend-relationship between two users.


bool friends.addFriend ( int uid1, int uid2 = NULL, bool autoConfirm = false, mixed twoWay = true )


NameTypeRequiredDefault valueDescription
uid1intRequirednoneThe ID of the user that will be added as a friend.
uid2intOptionalNULLIf uid2 is not specified the current logged in user will be used here.
autoConfirmboolOptionalfalseSet this to true to automatically confirm the friend-relationship status.
Note: This will work ONLY if a valid API KEY and BOTH user IDs are specified.

If autoConfirm is set to false (or not set), then the recipient of the friend-request will have to confirm the friendship in order for that relationship to show in the confirmed friendships ( where friend-status = 3 ) in functions getFriends and getMyFriends.

Possible values for friend status are 1, 2 and 3:
1 = friendship is unconfirmed. Friendship was requested from uid1 (waiting on uid2 to confirm the friendship)
2 = friendship not confirmed. Friendship was requested from uid2 (waiting on uid1 to confirm the friendship)
3 = confirmed (friendship status is confirmed).


Upon success the response will be 1.

responseINTThe response will be 1.

Sample Response

Code examples


Be the first to comment on addFriend.

Add a Comment

  • captcha