Friends
Friend-request lifecycle — send, accept, reject, block, unblock; list accepted + pending.
Friendships are a single row with requester_id + addressee_id. Blocking preserves the row but switches status; unblocking deletes it.
Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /client/friends/request | Send a friend request. |
| POST | /client/friends/:friendshipId/accept | Accept a pending request (only the addressee can). |
| POST | /client/friends/:friendshipId/reject | Delete a pending request (only the addressee can). |
| POST | /client/friends/:friendshipId/block | Block — either participant can. |
| POST | /client/friends/:friendshipId/unblock | Delete a blocked row. |
| GET | /client/friends | Accepted + pending friendships with user detail. |
| GET | /client/friends/pending | Pending requests addressed to the caller. |
POST /client/friends/request
Request (SendFriendRequestInput)
| Field | Type | Required |
|---|---|---|
addressee_id | uuid | yes |
user_id is accepted in place of addressee_id.
Every friendship this router returns carries the SDKs' Friendship fields from the caller's side: user_id (the caller), friend_id (the other user) and state (the row's status).
Response 201
Errors
400 INVALID_REQUEST— can't friend yourself.403 BLOCKED— existing row isblocked.409 ALREADY_EXISTS— a friendship already exists in either direction.500 CREATE_FAILED.
Try it:
/client/friends/requestcurl -X POST 'https://api.amba.dev/v1/client/friends/request' \
-H 'Content-Type: application/json' \
-d '{
"addressee_id": "<app_user_id>"
}'Curl:
POST /client/friends/:friendshipId/accept
Only succeeds if the caller is addressee_id and status is pending.
Errors
404 ACCEPT_FAILED— no pending request matched.500 ACCEPT_FAILED.
Try it:
/client/friends/%7B%7BfriendshipId%7D%7D/acceptcurl -X POST 'https://api.amba.dev/v1/client/friends/%7B%7BfriendshipId%7D%7D/accept'Curl:
POST /client/friends/:friendshipId/reject
Same eligibility as accept. Deletes the row.
Response 200
Try it:
/client/friends/%7B%7BfriendshipId%7D%7D/rejectcurl -X POST 'https://api.amba.dev/v1/client/friends/%7B%7BfriendshipId%7D%7D/reject'Curl:
POST /client/friends/:friendshipId/block
Either participant can block.
Errors
404 BLOCK_FAILED.
Try it:
/client/friends/%7B%7BfriendshipId%7D%7D/blockcurl -X POST 'https://api.amba.dev/v1/client/friends/%7B%7BfriendshipId%7D%7D/block'Curl:
POST /client/friends/:friendshipId/unblock
Deletes a blocked row owned by either participant.
Response 200
Try it:
/client/friends/%7B%7BfriendshipId%7D%7D/unblockcurl -X POST 'https://api.amba.dev/v1/client/friends/%7B%7BfriendshipId%7D%7D/unblock'Curl:
GET /client/friends
The caller's accepted friendships, then pending requests in both directions, each newest first, with both user records attached. A pending row is incoming when addressee_id is the caller and outgoing when requester_id is. Blocked rows are left out: the table doesn't record which side blocked.
Query
| Param | Description |
|---|---|
state | accepted or pending lists that state alone. Omit it to list both. |
limit | Rows per page, at most 1000 (the default). |
offset | Rows to skip (default 0). |
Response 200
Errors
400 INVALID_STATE—stateis something other thanacceptedorpending.
Try it:
/client/friendscurl -X GET 'https://api.amba.dev/v1/client/friends'Curl:
GET /client/friends/pending
Pending requests where the caller is the addressee.
Response 200
Try it:
/client/friends/pendingcurl -X GET 'https://api.amba.dev/v1/client/friends/pending'Curl: