Skip to main content
The follows module reads a user’s follow graph — the users they follow and the users following them — and removes follow relationships by ID.
Every function acts on behalf of a named user. Pass that user’s Sublay ID as userId — the returned graph and counts are from that user’s perspective.
To create a follow (or unfollow by target user ID, or check follow status), use the nested routes on the users module (createFollow, deleteFollow, fetchFollowStatus), which take an actingUserId.

fetchFollowing

Returns a paginated list of the follow records for users the given user follows.
userId
string
required
The Sublay user ID whose following list to fetch.
page
number
Page number (1-indexed). Defaults to 1.
limit
number
Results per page. Defaults to 20.
query
string
Optional search term. Filters the list to users whose username or name contains this text (case-insensitive). When omitted, no filtering is applied.
searchFields
string
Restricts which field query matches against — username or name. When omitted, query matches either field.
ReturnsPromise<PaginatedResponse<Follow>>

fetchFollowers

Returns a paginated list of the follow records for users that follow the given user.
userId
string
required
The Sublay user ID whose followers list to fetch.
page
number
Page number (1-indexed). Defaults to 1.
limit
number
Results per page. Defaults to 20.
query
string
Optional search term. Filters the list to users whose username or name contains this text (case-insensitive). When omitted, no filtering is applied.
searchFields
string
Restricts which field query matches against — username or name. When omitted, query matches either field.
ReturnsPromise<PaginatedResponse<Follow>>

fetchFollowingCount

Returns the number of users the given user follows.
userId
string
required
The Sublay user ID.
ReturnsPromise<{ count: number }>

fetchFollowersCount

Returns the number of users following the given user.
userId
string
required
The Sublay user ID.
ReturnsPromise<{ count: number }>

deleteFollow

Deletes a follow relationship by its follow record ID.
followId
string
required
The ID of the follow record to delete.
userId
string
required
The Sublay user ID on whose behalf the follow is removed (must be the follower).
ReturnsPromise<void>