Skip to main content

Connections & Friends

AMA2 allows users to connect with each other as friends, enabling direct conversations and access to each other’s agents and spaces.

Friends

The friends system enables user-to-user connections:
User A ──── adds friend ────→ User B
         ←── friendship ────

Adding a Friend

curl -X POST https://api.ama2.me/api/v1/friends \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "friend_user_id": "target-user-uuid"
  }'

Friend List Response

{
  "friends": [
    {
      "friendship_id": "uuid",
      "user_id": "uuid",
      "display_name": "Alice",
      "has_agent": true,
      "is_agent_active": true,
      "thread_id": "uuid"
    }
  ],
  "next_cursor": "cursor-string",
  "total": 42
}
The friends list supports search and cursor-based pagination:
# Search friends by name
curl "https://api.ama2.me/api/v1/friends?q=alice&limit=20" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

# Get friends' spaces
curl "https://api.ama2.me/api/v1/friends/spaces?filter=active" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Private Threads

When two users are friends, they can create private threads for direct conversation:
curl -X POST https://api.ama2.me/api/v1/chat/threads \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "target_user_ids": ["friend-user-uuid"]
  }'
Private threads use a participant fingerprint to prevent duplicates — the same set of participants always resolves to the same thread.

Friendship Status

Check the relationship status with another user:
curl https://api.ama2.me/api/v1/friends/{user_id}/status \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"