Skip to main content

Add a friend

Send a friend request.

Request method

POST: https://Base URL/v4/friend/add

Rate limit: 100 requests per second

Signature required: All server API requests require signature verification. See API request signature.

Request body

The request body is in application/json format and supports the following parameters:

ParameterTypeRequiredDescription
userIdStringYesThe user ID initiating the friend request.
targetIdStringYesThe user ID to add as a friend.
actionNumberNoRequest type: 1 = add according to the target user's friend request verification level (default). 2 = add directly without requiring the target user's approval.
extraStringNoAdditional information for the friend request. Maximum 128 characters.

Request example

HTTP
POST /v4/friend/add HTTP/1.1
Host: api.sg-light-api.com
App-Key: uwd1c0sxdlx2
Nonce: 14314
Timestamp: 1408710653491
Signature: 45beb7cc7307889a8e711219a47b7cf6a5b000e8
Content-Type: application/json

{
"userId": "id1",
"targetId": "id2",
"action": 2,
"extra": "something"
}

Response

FieldTypeDescription
codeNumberStatus code. 0 indicates success.

Response example

HTTP
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
"code": 0
}