Amba

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.

Source: apps/api/src/routes/client/friends.ts.

Endpoints

MethodPathDescription
POST/client/friends/requestSend a friend request.
POST/client/friends/:friendshipId/acceptAccept a pending request (only the addressee can).
POST/client/friends/:friendshipId/rejectDelete a pending request (only the addressee can).
POST/client/friends/:friendshipId/blockBlock — either participant can.
POST/client/friends/:friendshipId/unblockDelete a blocked row.
GET/client/friendsAccepted friendships with user detail.
GET/client/friends/pendingPending requests addressed to the caller.

POST /client/friends/request

Request (SendFriendRequestInput)

FieldTypeRequired
addressee_iduuidyes

Response 201

{ "data": { "id": "…", "requester_id": "…", "addressee_id": "…", "status": "pending" } }

Errors

  • 400 INVALID_REQUEST — can't friend yourself.
  • 403 BLOCKED — existing row is blocked.
  • 409 ALREADY_EXISTS — a friendship already exists in either direction.
  • 500 CREATE_FAILED.

Try it:

POST/client/friends/request
client auth
curl -X POST 'https://api.amba.dev/client/friends/request'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X POST '${BASE_URL}/client/friends/request' \
  -H 'X-Api-Key: ${CLIENT_API_KEY}' \
  -H 'Authorization: Bearer ${SESSION_TOKEN}' \
  -H 'Content-Type: application/json' \
  -d '{}'

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:

POST/client/friends/%7B%7BfriendshipId%7D%7D/accept
client auth
curl -X POST 'https://api.amba.dev/client/friends/%7B%7BfriendshipId%7D%7D/accept'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X POST '${BASE_URL}/client/friends/{friendshipId}/accept' \
  -H 'X-Api-Key: ${CLIENT_API_KEY}' \
  -H 'Authorization: Bearer ${SESSION_TOKEN}' \
  -H 'Content-Type: application/json' \
  -d '{}'

POST /client/friends/:friendshipId/reject

Same eligibility as accept. Deletes the row.

Response 200

{ "data": { "deleted": true } }

Try it:

POST/client/friends/%7B%7BfriendshipId%7D%7D/reject
client auth
curl -X POST 'https://api.amba.dev/client/friends/%7B%7BfriendshipId%7D%7D/reject'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X POST '${BASE_URL}/client/friends/{friendshipId}/reject' \
  -H 'X-Api-Key: ${CLIENT_API_KEY}' \
  -H 'Authorization: Bearer ${SESSION_TOKEN}' \
  -H 'Content-Type: application/json' \
  -d '{}'

POST /client/friends/:friendshipId/block

Either participant can block.

Errors

  • 404 BLOCK_FAILED.

Try it:

POST/client/friends/%7B%7BfriendshipId%7D%7D/block
client auth
curl -X POST 'https://api.amba.dev/client/friends/%7B%7BfriendshipId%7D%7D/block'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X POST '${BASE_URL}/client/friends/{friendshipId}/block' \
  -H 'X-Api-Key: ${CLIENT_API_KEY}' \
  -H 'Authorization: Bearer ${SESSION_TOKEN}' \
  -H 'Content-Type: application/json' \
  -d '{}'

POST /client/friends/:friendshipId/unblock

Deletes a blocked row owned by either participant.

Response 200

{ "data": { "deleted": true } }

Try it:

POST/client/friends/%7B%7BfriendshipId%7D%7D/unblock
client auth
curl -X POST 'https://api.amba.dev/client/friends/%7B%7BfriendshipId%7D%7D/unblock'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X POST '${BASE_URL}/client/friends/{friendshipId}/unblock' \
  -H 'X-Api-Key: ${CLIENT_API_KEY}' \
  -H 'Authorization: Bearer ${SESSION_TOKEN}' \
  -H 'Content-Type: application/json' \
  -d '{}'

GET /client/friends

Accepted friendships in either direction, with both user records attached.

Response 200

{
  "data": [
    {
      "id": "…",
      "requester_id": "…",
      "addressee_id": "…",
      "status": "accepted",
      "requester": { "id": "…", "display_name": "…", "avatar_url": "…" },
      "addressee": { "id": "…", "display_name": "…", "avatar_url": "…" }
    }
  ]
}

Try it:

GET/client/friends
client auth
curl -X GET 'https://api.amba.dev/client/friends'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X GET '${BASE_URL}/client/friends' \
  -H 'X-Api-Key: ${CLIENT_API_KEY}' \
  -H 'Authorization: Bearer ${SESSION_TOKEN}'

GET /client/friends/pending

Pending requests where the caller is the addressee.

Response 200

{
  "data": [
    {
      "id": "…",
      "status": "pending",
      "requester": { "id": "…", "display_name": "…", "avatar_url": "…" }
    }
  ]
}

Try it:

GET/client/friends/pending
client auth
curl -X GET 'https://api.amba.dev/client/friends/pending'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X GET '${BASE_URL}/client/friends/pending' \
  -H 'X-Api-Key: ${CLIENT_API_KEY}' \
  -H 'Authorization: Bearer ${SESSION_TOKEN}'