users module reads and updates user profiles and lets the logged-in user act on the social graph of an arbitrary target user, addressed by userId.
In the follow and connection helpers below, userId is always the target — the user being followed, the other party in a connection, or the user whose followers you’re reading. The actor is always the logged-in token holder. To act on your own graph (your own followers, the users you follow, your own connections and pending requests), use the follows and connections modules instead.
fetchUserById
Fetches a user by their internal Sublay user ID.string
required
The Sublay user ID.
string
Comma-separated list of associations to populate.
string
Opts the returned user into a
spaceReputation number. Accepts a space <uuid> or "none" (the project-general bucket) only — "context" is rejected (400), since a bare user lookup has no space context. The empty string and the legacy general / null aliases are also rejected. See Reputation.boolean
Only honored alongside an explicit space
<uuid>. When true, spaceReputation is the subtree sum — the named space plus all of its descendants.Promise<User>
fetchUserByForeignId
Fetches a user by your application’s own user identifier.string
required
Your application’s user identifier.
string
Comma-separated list of associations to populate.
string
Opts the returned user into a
spaceReputation number. Accepts a space <uuid> or "none" (the project-general bucket) only — "context" is rejected (400), since a bare user lookup has no space context. The empty string and the legacy general / null aliases are also rejected. See Reputation.boolean
Only honored alongside an explicit space
<uuid>. When true, spaceReputation is the subtree sum — the named space plus all of its descendants.Promise<User>
fetchUserByUsername
Fetches a user by their username.string
required
The user’s unique username.
string
Comma-separated list of associations to populate.
string
Opts the returned user into a
spaceReputation number. Accepts a space <uuid> or "none" (the project-general bucket) only — "context" is rejected (400), since a bare user lookup has no space context. The empty string and the legacy general / null aliases are also rejected. See Reputation.boolean
Only honored alongside an explicit space
<uuid>. When true, spaceReputation is the subtree sum — the named space plus all of its descendants.Promise<User>
fetchUserSuggestions
Returns users whose name or username matches a partial query string. Useful for mention autocomplete.string
required
Partial name or username to search for.
string
Opts each returned user into a
spaceReputation number. Accepts a space <uuid> or "none" (the project-general bucket) only — "context" is rejected (400), since this lookup has no space context. The empty string and the legacy general / null aliases are also rejected. See Reputation.boolean
Only honored alongside an explicit space
<uuid>. When true, spaceReputation is the subtree sum — the named space plus all of its descendants.Promise<User[]>
checkUsernameAvailability
Checks whether a username is available.string
required
The username to check.
Promise<{ available: boolean }>
updateUser
Updates a user’s profile, optionally uploading a new avatar and/or banner image. A user token may only update its own profile.string
required
The Sublay user ID to update. A user token may only update itself.
string
New display name.
string
New username. Must be available.
string
New avatar URL.
string
New bio text.
string
ISO 8601 date string for the user’s birthdate.
object
Geographic location
{ latitude: number; longitude: number }, or null to clear it.object
Updated public metadata (
Record<string, any>).object
Updated secure metadata (
Record<string, any>, not exposed in public responses).object
A new avatar image to upload:
{ file: Blob | File; options: ImageOptions }.object
A new banner image to upload:
{ file: Blob | File; options: ImageOptions }.When
avatarFile or bannerFile is supplied the request is sent as
multipart/form-data carrying the browser File/Blob. The image options
(an ImageOptions object whose mode selects a processing strategy) are sent
alongside the file.Promise<AuthUser>
fetchFollowersByUserId
Returns a paginated list of users following the target user.string
required
The Sublay user ID whose followers to fetch.
number
Page number (1-indexed). Defaults to
1.number
Results per page. Defaults to
20.string
Opts each returned follower into a
spaceReputation number. Accepts a space <uuid> or "none" (the project-general bucket) only — "context" is rejected (400), since this list has no space context. The empty string and the legacy general / null aliases are also rejected. See Reputation.boolean
Only honored alongside an explicit space
<uuid>. When true, spaceReputation is the subtree sum — the named space plus all of its descendants.Promise<PaginatedResponse<FollowListItem>>
fetchFollowersCountByUserId
Returns the total number of followers for the target user.string
required
The Sublay user ID.
Promise<{ count: number }>
fetchFollowingByUserId
Returns a paginated list of users that the target user is following.string
required
The Sublay user ID whose following list to fetch.
number
Page number (1-indexed). Defaults to
1.number
Results per page. Defaults to
20.string
Opts each returned user into a
spaceReputation number. Accepts a space <uuid> or "none" (the project-general bucket) only — "context" is rejected (400), since this list has no space context. The empty string and the legacy general / null aliases are also rejected. See Reputation.boolean
Only honored alongside an explicit space
<uuid>. When true, spaceReputation is the subtree sum — the named space plus all of its descendants.Promise<PaginatedResponse<FollowListItem>>
fetchFollowingCountByUserId
Returns the number of users the target user is following.string
required
The Sublay user ID.
Promise<{ count: number }>
fetchConnectionsByUserId
Returns a paginated list of the target user’s established connections.string
required
The Sublay user ID whose connections to fetch.
number
Page number (1-indexed). Defaults to
1.number
Results per page. Defaults to
20.string
Opts each returned connection’s user into a
spaceReputation number. Accepts a space <uuid> or "none" (the project-general bucket) only — "context" is rejected (400), since this list has no space context. The empty string and the legacy general / null aliases are also rejected. See Reputation.boolean
Only honored alongside an explicit space
<uuid>. When true, spaceReputation is the subtree sum — the named space plus all of its descendants.Promise<PaginatedResponse<EstablishedConnection>>
fetchConnectionsCountByUserId
Returns the number of established connections for the target user.string
required
The Sublay user ID.
Promise<{ count: number }>
createFollow
The logged-in user follows the target user.string
required
The user being followed (the target).
Promise<Follow>
deleteFollow
The logged-in user unfollows the target user.string
required
The user being unfollowed (the target).
This unfollows by the target’s
userId. To delete one of your own follow
relationships by its record ID, use
follows.deleteFollow, which takes a followId.Promise<void>
fetchFollowStatus
Returns whether the logged-in user follows the target user.string
required
The user whose follow relationship is being checked (the target).
Promise<{ isFollowing: boolean; followId?: string; followedAt?: string }>
requestConnection
Sends a connection request from the logged-in user to the target user.string
required
The user the connection is requested with (the target).
string
Optional message to include with the request.
Promise<ConnectionRequestResponse> — the created/pending connection.
fetchConnectionStatus
Returns the connection status between the logged-in user and the target user.string
required
The other user in the connection (the target).
Promise<ConnectionStatusResponse>
removeConnectionByUserId
Removes the connection with the target user — withdrawing a sent request, declining a received one, or disconnecting an established connection, depending on the current state.string
required
The other user in the connection (the target).
Promise<RemoveConnectionByUserIdResponse>
