Skip to main content

Endpoint

GET /api/users/{username}/following

Authentication

This endpoint requires authentication.

Path Parameters

username
string
required
The username of the user whose following list you want to retrieve

Response

followingCount
number
The total number of users being followed
Followers
array
Array of user objects that are being followed

Request Example

cURL
curl -X GET "https://api.example.com/api/users/johndoe/following" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response Example

{
  "followingCount": 3,
  "Followers": [
    {
      "UserId": 789,
      "userName": "alice_wonder",
      "firstName": "Alice",
      "lastName": "Wonder",
      "profileImage_MediaUrl": "https://example.com/images/alice.png"
    },
    {
      "UserId": 321,
      "userName": "charlie_brown",
      "firstName": "Charlie",
      "lastName": "Brown",
      "profileImage_MediaUrl": "https://defaults.com/default.png"
    },
    {
      "UserId": 654,
      "userName": "eve_tech",
      "firstName": "Eve",
      "lastName": "Tech",
      "profileImage_MediaUrl": "https://example.com/images/eve.png"
    }
  ]
}

Error Responses

404
error
Not Found - The specified user account does not exist

Implementation Details

This endpoint uses an optimized projection query similar to the followers endpoint:
  • The query first retrieves the following account IDs (follow.list.cs:43-47)
  • A second query fetches the full user details for those IDs (follow.list.cs:49-50)
  • AsNoTracking() is used for read-only queries to improve performance (follow.list.cs:47)
  • Username comparison is case-insensitive (follow.list.cs:43)

Build docs developers (and LLMs) love