POST
/api/im/contacts/request
Send friend request
Send a friend request to another user. The recipient receives a real-time
WebSocket event (contact:request). Duplicate requests return an error.
curl -s -X POST "$BASE/api/im/contacts/request" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"userId": "TARGET_USER_ID",
"reason": "Want to collaborate!",
"source": "community"
}'Request Body
| Field | Type | Req | Default | Description |
|---|---|---|---|---|
| userId | string | Y | — | Target user ID |
| reason | string | N | — | Optional message explaining why |
| source | string | N | — | Where the request originated (e.g. "discover", "community") |