Constructors
constructor
• new UsersClient(client): UsersClient
Creates a new users client instance
Parameters
| Name | Type | Description | 
|---|---|---|
client | Client | The main X API client instance | 
Returns
UsersClient
Defined in
users/client.ts:720Methods
getMentions
▸ getMentions(id, options?): Promise<Get2UsersIdMentionsResponse>
Get mentions
Retrieves a list of Posts that mention a specific User by their ID.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the User to lookup. | 
options | GetMentionsOptions | - | 
Returns
Promise<Get2UsersIdMentionsResponse>
Promise resolving to the API response
Defined in
users/client.ts:737getRepostsOfMe
▸ getRepostsOfMe(options?): Promise<Get2UsersRepostsOfMeResponse>
Get Reposts of me
Retrieves a list of Posts that repost content from the authenticated user.
Parameters
| Name | Type | 
|---|---|
options | GetRepostsOfMeOptions | 
Returns
Promise<Get2UsersRepostsOfMeResponse>
Promise resolving to the API response
Defined in
users/client.ts:849getBookmarks
▸ getBookmarks(id, options?): Promise<Get2UsersIdBookmarksResponse>
Get Bookmarks
Retrieves a list of Posts bookmarked by the authenticated user.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the authenticated source User for whom to return results. | 
options | GetBookmarksOptions | - | 
Returns
Promise<Get2UsersIdBookmarksResponse>
Promise resolving to the API response
Defined in
users/client.ts:938createBookmark
▸ createBookmark(id, body): Promise<BookmarkMutationResponse>
Create Bookmark
Adds a post to the authenticated user’s bookmarks.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the authenticated source User for whom to add bookmarks. | 
body | BookmarkAddRequest | Request body | 
Returns
Promise<BookmarkMutationResponse>
Promise resolving to the API response
Defined in
users/client.ts:1032getBlocking
▸ getBlocking(id, options?): Promise<Get2UsersIdBlockingResponse>
Get blocking
Retrieves a list of Users blocked by the specified User ID.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the authenticated source User for whom to return results. | 
options | GetBlockingOptions | - | 
Returns
Promise<Get2UsersIdBlockingResponse>
Promise resolving to the API response
Defined in
users/client.ts:1075getBookmarksByFolderId
▸ getBookmarksByFolderId(id, folderId): Promise<BookmarkFolderPostsResponse>
Get Bookmarks by folder ID
Retrieves Posts in a specific Bookmark folder by its ID for the authenticated user.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the authenticated source User for whom to return results. | 
folderId | string | The ID of the Bookmark Folder that the authenticated User is trying to fetch Posts for. | 
Returns
Promise<BookmarkFolderPostsResponse>
Promise resolving to the API response
Defined in
users/client.ts:1153getById
▸ getById(id, options?): Promise<Get2UsersIdResponse>
Get User by ID
Retrieves details of a specific User by their ID.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the User to lookup. | 
options | GetByIdOptions | - | 
Returns
Promise<Get2UsersIdResponse>
Promise resolving to the API response
Defined in
users/client.ts:1196unrepostPost
▸ unrepostPost(id, sourceTweetId): Promise<UsersRetweetsDeleteResponse>
Unrepost Post
Causes the authenticated user to unrepost a specific Post by its ID.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the authenticated source User that is requesting to repost the Post. | 
sourceTweetId | string | The ID of the Post that the User is requesting to unretweet. | 
Returns
Promise<UsersRetweetsDeleteResponse>
Promise resolving to the API response
Defined in
users/client.ts:1262getFollowers
▸ getFollowers(id, options?): Promise<Get2UsersIdFollowersResponse>
Get followers
Retrieves a list of Users who follow a specific User by their ID.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the User to lookup. | 
options | GetFollowersOptions | - | 
Returns
Promise<Get2UsersIdFollowersResponse>
Promise resolving to the API response
Defined in
users/client.ts:1308likePost
▸ likePost(id, options?): Promise<UsersLikesCreateResponse>
Like Post
Causes the authenticated user to Like a specific Post by its ID.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the authenticated source User that is requesting to like the Post. | 
options | LikePostOptions | - | 
Returns
Promise<UsersLikesCreateResponse>
Promise resolving to the API response
Defined in
users/client.ts:1382unlikePost
▸ unlikePost(id, tweetId): Promise<UsersLikesDeleteResponse>
Unlike Post
Causes the authenticated user to Unlike a specific Post by its ID.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the authenticated source User that is requesting to unlike the Post. | 
tweetId | string | The ID of the Post that the User is requesting to unlike. | 
Returns
Promise<UsersLikesDeleteResponse>
Promise resolving to the API response
Defined in
users/client.ts:1434unfollowList
▸ unfollowList(id, listId): Promise<ListFollowedResponse>
Unfollow List
Causes the authenticated user to unfollow a specific List by its ID.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the authenticated source User that will unfollow the List. | 
listId | string | The ID of the List to unfollow. | 
Returns
Promise<ListFollowedResponse>
Promise resolving to the API response
Defined in
users/client.ts:1478getFollowing
▸ getFollowing(id, options?): Promise<Get2UsersIdFollowingResponse>
Get following
Retrieves a list of Users followed by a specific User by their ID.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the User to lookup. | 
options | GetFollowingOptions | - | 
Returns
Promise<Get2UsersIdFollowingResponse>
Promise resolving to the API response
Defined in
users/client.ts:1521followUser
▸ followUser(id, options?): Promise<UsersFollowingCreateResponse>
Follow User
Causes the authenticated user to follow a specific user by their ID.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the authenticated source User that is requesting to follow the target User. | 
options | FollowUserOptions | - | 
Returns
Promise<UsersFollowingCreateResponse>
Promise resolving to the API response
Defined in
users/client.ts:1595getLikedPosts
▸ getLikedPosts(id, options?): Promise<Get2UsersIdLikedTweetsResponse>
Get liked Posts
Retrieves a list of Posts liked by a specific User by their ID.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the User to lookup. | 
options | GetLikedPostsOptions | - | 
Returns
Promise<Get2UsersIdLikedTweetsResponse>
Promise resolving to the API response
Defined in
users/client.ts:1643unfollowUser
▸ unfollowUser(sourceUserId, targetUserId): Promise<UsersFollowingDeleteResponse>
Unfollow User
Causes the authenticated user to unfollow a specific user by their ID.
Parameters
| Name | Type | Description | 
|---|---|---|
sourceUserId | string | The ID of the authenticated source User that is requesting to unfollow the target User. | 
targetUserId | string | The ID of the User that the source User is requesting to unfollow. | 
Returns
Promise<UsersFollowingDeleteResponse>
Promise resolving to the API response
Defined in
users/client.ts:1739unpinList
▸ unpinList(id, listId): Promise<ListUnpinResponse>
Unpin List
Causes the authenticated user to unpin a specific List by its ID.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the authenticated source User for whom to return results. | 
listId | string | The ID of the List to unpin. | 
Returns
Promise<ListUnpinResponse>
Promise resolving to the API response
Defined in
users/client.ts:1792repostPost
▸ repostPost(id, options?): Promise<UsersRetweetsCreateResponse>
Repost Post
Causes the authenticated user to repost a specific Post by its ID.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the authenticated source User that is requesting to repost the Post. | 
options | RepostPostOptions | - | 
Returns
Promise<UsersRetweetsCreateResponse>
Promise resolving to the API response
Defined in
users/client.ts:1832getPinnedLists
▸ getPinnedLists(id, options?): Promise<Get2UsersIdPinnedListsResponse>
Get pinned Lists
Retrieves a list of Lists pinned by the authenticated user.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the authenticated source User for whom to return results. | 
options | GetPinnedListsOptions | - | 
Returns
Promise<Get2UsersIdPinnedListsResponse>
Promise resolving to the API response
Defined in
users/client.ts:1880pinList
▸ pinList(id, body): Promise<ListPinnedResponse>
Pin List
Causes the authenticated user to pin a specific List by its ID.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the authenticated source User that will pin the List. | 
body | ListPinnedRequest | Request body | 
Returns
Promise<ListPinnedResponse>
Promise resolving to the API response
Defined in
users/client.ts:1944getListMemberships
▸ getListMemberships(id, options?): Promise<Get2UsersIdListMembershipsResponse>
Get List memberships
Retrieves a list of Lists that a specific User is a member of by their ID.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the User to lookup. | 
options | GetListMembershipsOptions | - | 
Returns
Promise<Get2UsersIdListMembershipsResponse>
Promise resolving to the API response
Defined in
users/client.ts:1984unmuteUser
▸ unmuteUser(sourceUserId, targetUserId): Promise<MuteUserMutationResponse>
Unmute User
Causes the authenticated user to unmute a specific user by their ID.
Parameters
| Name | Type | Description | 
|---|---|---|
sourceUserId | string | The ID of the authenticated source User that is requesting to unmute the target User. | 
targetUserId | string | The ID of the User that the source User is requesting to unmute. | 
Returns
Promise<MuteUserMutationResponse>
Promise resolving to the API response
Defined in
users/client.ts:2062blockDms
▸ blockDms(id): Promise<UsersDMBlockCreateResponse>
Block DMs
Blocks direct messages to or from a specific User by their ID for the authenticated user.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the target User that the authenticated user requesting to block dms for. | 
Returns
Promise<UsersDMBlockCreateResponse>
Promise resolving to the API response
Defined in
users/client.ts:2111getFollowedLists
▸ getFollowedLists(id, options?): Promise<Get2UsersIdFollowedListsResponse>
Get followed Lists
Retrieves a list of Lists followed by a specific User by their ID.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the User to lookup. | 
options | GetFollowedListsOptions | - | 
Returns
Promise<Get2UsersIdFollowedListsResponse>
Promise resolving to the API response
Defined in
users/client.ts:2149followList
▸ followList(id, options?): Promise<ListFollowedResponse>
Follow List
Causes the authenticated user to follow a specific List by its ID.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the authenticated source User that will follow the List. | 
options | FollowListOptions | - | 
Returns
Promise<ListFollowedResponse>
Promise resolving to the API response
Defined in
users/client.ts:2223getByIds
▸ getByIds(ids, options?): Promise<Get2UsersResponse>
Get Users by IDs
Retrieves details of multiple Users by their IDs.
Parameters
| Name | Type | Description | 
|---|---|---|
ids | any[] | A list of User IDs, comma-separated. You can specify up to 100 IDs. | 
options | GetByIdsOptions | - | 
Returns
Promise<Get2UsersResponse>
Promise resolving to the API response
Defined in
users/client.ts:2271getMe
▸ getMe(options?): Promise<Get2UsersMeResponse>
Get my User
Retrieves details of the authenticated user.
Parameters
| Name | Type | 
|---|---|
options | GetMeOptions | 
Returns
Promise<Get2UsersMeResponse>
Promise resolving to the API response
Defined in
users/client.ts:2331unblockDms
▸ unblockDms(id): Promise<UsersDMUnBlockCreateResponse>
Unblock DMs
Unblocks direct messages to or from a specific User by their ID for the authenticated user.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the target User that the authenticated user requesting to unblock dms for. | 
Returns
Promise<UsersDMUnBlockCreateResponse>
Promise resolving to the API response
Defined in
users/client.ts:2388getMuting
▸ getMuting(id, options?): Promise<Get2UsersIdMutingResponse>
Get muting
Retrieves a list of Users muted by the authenticated user.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the authenticated source User for whom to return results. | 
options | GetMutingOptions | - | 
Returns
Promise<Get2UsersIdMutingResponse>
Promise resolving to the API response
Defined in
users/client.ts:2426muteUser
▸ muteUser(id, options?): Promise<MuteUserMutationResponse>
Mute User
Causes the authenticated user to mute a specific User by their ID.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the authenticated source User that is requesting to mute the target User. | 
options | MuteUserOptions | - | 
Returns
Promise<MuteUserMutationResponse>
Promise resolving to the API response
Defined in
users/client.ts:2500getPosts
▸ getPosts(id, options?): Promise<Get2UsersIdTweetsResponse>
Get Posts
Retrieves a list of posts authored by a specific User by their ID.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the User to lookup. | 
options | GetPostsOptions | - | 
Returns
Promise<Get2UsersIdTweetsResponse>
Promise resolving to the API response
Defined in
users/client.ts:2548deleteBookmark
▸ deleteBookmark(id, tweetId): Promise<BookmarkMutationResponse>
Delete Bookmark
Removes a Post from the authenticated user’s Bookmarks by its ID.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the authenticated source User whose bookmark is to be removed. | 
tweetId | string | The ID of the Post that the source User is removing from bookmarks. | 
Returns
Promise<BookmarkMutationResponse>
Promise resolving to the API response
Defined in
users/client.ts:2674getByUsernames
▸ getByUsernames(usernames, options?): Promise<Get2UsersByResponse>
Get Users by usernames
Retrieves details of multiple Users by their usernames.
Parameters
| Name | Type | Description | 
|---|---|---|
usernames | any[] | A list of usernames, comma-separated. | 
options | GetByUsernamesOptions | - | 
Returns
Promise<Get2UsersByResponse>
Promise resolving to the API response
Defined in
users/client.ts:2717getByUsername
▸ getByUsername(username, options?): Promise<Get2UsersByUsernameUsernameResponse>
Get User by username
Retrieves details of a specific User by their username.
Parameters
| Name | Type | Description | 
|---|---|---|
username | string | A username. | 
options | GetByUsernameOptions | - | 
Returns
Promise<Get2UsersByUsernameUsernameResponse>
Promise resolving to the API response
Defined in
users/client.ts:2781getBookmarkFolders
▸ getBookmarkFolders(id, options?): Promise<BookmarkFoldersResponse>
Get Bookmark folders
Retrieves a list of Bookmark folders created by the authenticated user.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the authenticated source User for whom to return results. | 
options | GetBookmarkFoldersOptions | - | 
Returns
Promise<BookmarkFoldersResponse>
Promise resolving to the API response
Defined in
users/client.ts:2843search
▸ search(query, options?): Promise<Get2UsersSearchResponse>
Search Users
Retrieves a list of Users matching a search query.
Parameters
| Name | Type | Description | 
|---|---|---|
query | any | TThe the query string by which to query for users. | 
options | SearchOptions | - | 
Returns
Promise<Get2UsersSearchResponse>
Promise resolving to the API response
Defined in
users/client.ts:2899getTimeline
▸ getTimeline(id, options?): Promise<Get2UsersIdTimelinesReverseChronologicalResponse>
Get Timeline
Retrieves a reverse chronological list of Posts in the authenticated User’s Timeline.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the authenticated source User to list Reverse Chronological Timeline Posts of. | 
options | GetTimelineOptions | - | 
Returns
Promise<Get2UsersIdTimelinesReverseChronologicalResponse>
Promise resolving to the API response
Defined in
users/client.ts:2975getOwnedLists
▸ getOwnedLists(id, options?): Promise<Get2UsersIdOwnedListsResponse>
Get owned Lists
Retrieves a list of Lists owned by a specific User by their ID.
Parameters
| Name | Type | Description | 
|---|---|---|
id | string | The ID of the User to lookup. | 
options | GetOwnedListsOptions | - | 
Returns
Promise<Get2UsersIdOwnedListsResponse>
Promise resolving to the API response