Skip to main content
Client for users operations This client provides methods for interacting with the users endpoints of the X API. It handles authentication, request formatting, and response parsing for all users related operations.

Constructors

constructor

• new UsersClient(client): UsersClient Creates a new users client instance

Parameters

Returns

UsersClient

Defined in

users/client.ts:1234

Methods

getByUsernames

▸ getByUsernames(usernames, options): Promise<Response> Get Users by usernames Retrieves details of multiple Users by their usernames.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:1279 ▸ getByUsernames(usernames, options?): Promise<Get2UsersByResponse>

Parameters

Returns

Promise<Get2UsersByResponse>

Defined in

users/client.ts:1292

getRepostsOfMe

▸ getRepostsOfMe(options): Promise<Response> Get Reposts of me Retrieves a list of Posts that repost content from the authenticated user.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:1471 ▸ getRepostsOfMe(options?): Promise<Get2UsersRepostsOfMeResponse>

Parameters

Returns

Promise<Get2UsersRepostsOfMeResponse>

Defined in

users/client.ts:1480

unlikePost

▸ unlikePost(id, tweetId, options): Promise<Response> Unlike Post Causes the authenticated user to Unlike a specific Post by its ID.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:1741 ▸ unlikePost(id, tweetId): Promise<UsersLikesDeleteResponse>

Parameters

Returns

Promise<UsersLikesDeleteResponse>

Defined in

users/client.ts:1758

getBookmarks

▸ getBookmarks(id, options): Promise<Response> Get Bookmarks Retrieves a list of Posts bookmarked by the authenticated user.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:1861 ▸ getBookmarks(id, options?): Promise<Get2UsersIdBookmarksResponse>

Parameters

Returns

Promise<Get2UsersIdBookmarksResponse>

Defined in

users/client.ts:1874

createBookmark

▸ createBookmark(id, body, options): Promise<Response> Create Bookmark Adds a post to the authenticated user’s bookmarks.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:2139 ▸ createBookmark(id, body): Promise<BookmarkMutationResponse>

Parameters

Returns

Promise<BookmarkMutationResponse>

Defined in

users/client.ts:2154

getFollowers

▸ getFollowers(id, options): Promise<Response> Get followers Retrieves a list of Users who follow a specific User by their ID.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:2245 ▸ getFollowers(id, options?): Promise<Get2UsersIdFollowersResponse>

Parameters

Returns

Promise<Get2UsersIdFollowersResponse>

Defined in

users/client.ts:2258

unpinList

▸ unpinList(id, listId, options): Promise<Response> Unpin List Causes the authenticated user to unpin a specific List by its ID.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:2474 ▸ unpinList(id, listId): Promise<ListUnpinResponse>

Parameters

Returns

Promise<ListUnpinResponse>

Defined in

users/client.ts:2491

getById

▸ getById(id, options): Promise<Response> Get User by ID Retrieves details of a specific User by their ID.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:2594 ▸ getById(id, options?): Promise<Get2UsersIdResponse>

Parameters

Returns

Promise<Get2UsersIdResponse>

Defined in

users/client.ts:2607

getMentions

▸ getMentions(id, options): Promise<Response> Get mentions Retrieves a list of Posts that mention a specific User by their ID.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:2781 ▸ getMentions(id, options?): Promise<Get2UsersIdMentionsResponse>

Parameters

Returns

Promise<Get2UsersIdMentionsResponse>

Defined in

users/client.ts:2794

unrepostPost

▸ unrepostPost(id, sourceTweetId, options): Promise<Response> Unrepost Post Causes the authenticated user to unrepost a specific Post by its ID.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:3149 ▸ unrepostPost(id, sourceTweetId): Promise<UsersRetweetsDeleteResponse>

Parameters

Returns

Promise<UsersRetweetsDeleteResponse>

Defined in

users/client.ts:3166

deleteBookmark

▸ deleteBookmark(id, tweetId, options): Promise<Response> Delete Bookmark Removes a Post from the authenticated user’s Bookmarks by its ID.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:3273 ▸ deleteBookmark(id, tweetId): Promise<BookmarkMutationResponse>

Parameters

Returns

Promise<BookmarkMutationResponse>

Defined in

users/client.ts:3290

unfollowList

▸ unfollowList(id, listId, options): Promise<Response> Unfollow List Causes the authenticated user to unfollow a specific List by its ID.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:3391 ▸ unfollowList(id, listId): Promise<ListFollowedResponse>

Parameters

Returns

Promise<ListFollowedResponse>

Defined in

users/client.ts:3408

unmuteUser

▸ unmuteUser(sourceUserId, targetUserId, options): Promise<Response> Unmute User Causes the authenticated user to unmute a specific user by their ID.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:3515 ▸ unmuteUser(sourceUserId, targetUserId): Promise<MuteUserMutationResponse>

Parameters

Returns

Promise<MuteUserMutationResponse>

Defined in

users/client.ts:3532

getMe

▸ getMe(options): Promise<Response> Get my User Retrieves details of the authenticated user.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:3631 ▸ getMe(options?): Promise<Get2UsersMeResponse>

Parameters

Returns

Promise<Get2UsersMeResponse>

Defined in

users/client.ts:3640

getMuting

▸ getMuting(id, options): Promise<Response> Get muting Retrieves a list of Users muted by the authenticated user.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:3796 ▸ getMuting(id, options?): Promise<Get2UsersIdMutingResponse>

Parameters

Returns

Promise<Get2UsersIdMutingResponse>

Defined in

users/client.ts:3809

muteUser

▸ muteUser(id, options): Promise<Response> Mute User Causes the authenticated user to mute a specific User by their ID.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:4015 ▸ muteUser(id, options?): Promise<MuteUserMutationResponse>

Parameters

Returns

Promise<MuteUserMutationResponse>

Defined in

users/client.ts:4028
▸ search(query, options): Promise<Response> Search Users Retrieves a list of Users matching a search query.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:4136 ▸ search(query, options?): Promise<Get2UsersSearchResponse>

Parameters

Returns

Promise<Get2UsersSearchResponse>

Defined in

users/client.ts:4149

getBlocking

▸ getBlocking(id, options): Promise<Response> Get blocking Retrieves a list of Users blocked by the specified User ID.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:4362 ▸ getBlocking(id, options?): Promise<Get2UsersIdBlockingResponse>

Parameters

Returns

Promise<Get2UsersIdBlockingResponse>

Defined in

users/client.ts:4375

getByIds

▸ getByIds(ids, options): Promise<Response> Get Users by IDs Retrieves details of multiple Users by their IDs.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:4581 ▸ getByIds(ids, options?): Promise<Get2UsersResponse>

Parameters

Returns

Promise<Get2UsersResponse>

Defined in

users/client.ts:4594

getFollowing

▸ getFollowing(id, options): Promise<Response> Get following Retrieves a list of Users followed by a specific User by their ID.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:4777 ▸ getFollowing(id, options?): Promise<Get2UsersIdFollowingResponse>

Parameters

Returns

Promise<Get2UsersIdFollowingResponse>

Defined in

users/client.ts:4790

followUser

▸ followUser(id, options): Promise<Response> Follow User Causes the authenticated user to follow a specific user by their ID.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:5002 ▸ followUser(id, options?): Promise<UsersFollowingCreateResponse>

Parameters

Returns

Promise<UsersFollowingCreateResponse>

Defined in

users/client.ts:5015

likePost

▸ likePost(id, options): Promise<Response> Like Post Causes the authenticated user to Like a specific Post by its ID.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:5123 ▸ likePost(id, options?): Promise<UsersLikesCreateResponse>

Parameters

Returns

Promise<UsersLikesCreateResponse>

Defined in

users/client.ts:5136

getLikedPosts

▸ getLikedPosts(id, options): Promise<Response> Get liked Posts Retrieves a list of Posts liked by a specific User by their ID.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:5244 ▸ getLikedPosts(id, options?): Promise<Get2UsersIdLikedTweetsResponse>

Parameters

Returns

Promise<Get2UsersIdLikedTweetsResponse>

Defined in

users/client.ts:5257

getPosts

▸ getPosts(id, options): Promise<Response> Get Posts Retrieves a list of posts authored by a specific User by their ID.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:5526 ▸ getPosts(id, options?): Promise<Get2UsersIdTweetsResponse>

Parameters

Returns

Promise<Get2UsersIdTweetsResponse>

Defined in

users/client.ts:5539

blockDms

▸ blockDms(id, options): Promise<Response> Block DMs Blocks direct messages to or from a specific User by their ID for the authenticated user.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:5909 ▸ blockDms(id): Promise<UsersDMBlockCreateResponse>

Parameters

Returns

Promise<UsersDMBlockCreateResponse>

Defined in

users/client.ts:5922

getListMemberships

▸ getListMemberships(id, options): Promise<Response> Get List memberships Retrieves a list of Lists that a specific User is a member of by their ID.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:6013 ▸ getListMemberships(id, options?): Promise<Get2UsersIdListMembershipsResponse>

Parameters

Returns

Promise<Get2UsersIdListMembershipsResponse>

Defined in

users/client.ts:6026

getPinnedLists

▸ getPinnedLists(id, options): Promise<Response> Get pinned Lists Retrieves a list of Lists pinned by the authenticated user.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:6238 ▸ getPinnedLists(id, options?): Promise<Get2UsersIdPinnedListsResponse>

Parameters

Returns

Promise<Get2UsersIdPinnedListsResponse>

Defined in

users/client.ts:6251

pinList

▸ pinList(id, body, options): Promise<Response> Pin List Causes the authenticated user to pin a specific List by its ID.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:6421 ▸ pinList(id, body): Promise<ListPinnedResponse>

Parameters

Returns

Promise<ListPinnedResponse>

Defined in

users/client.ts:6436

getByUsername

▸ getByUsername(username, options): Promise<Response> Get User by username Retrieves details of a specific User by their username.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:6533 ▸ getByUsername(username, options?): Promise<Get2UsersByUsernameUsernameResponse>

Parameters

Returns

Promise<Get2UsersByUsernameUsernameResponse>

Defined in

users/client.ts:6546

unfollowUser

▸ unfollowUser(sourceUserId, targetUserId, options): Promise<Response> Unfollow User Causes the authenticated user to unfollow a specific user by their ID.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:6724 ▸ unfollowUser(sourceUserId, targetUserId): Promise<UsersFollowingDeleteResponse>

Parameters

Returns

Promise<UsersFollowingDeleteResponse>

Defined in

users/client.ts:6741

getTimeline

▸ getTimeline(id, options): Promise<Response> Get Timeline Retrieves a reverse chronological list of Posts in the authenticated User’s Timeline.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:6844 ▸ getTimeline(id, options?): Promise<Get2UsersIdTimelinesReverseChronologicalResponse>

Parameters

Returns

Promise<Get2UsersIdTimelinesReverseChronologicalResponse>

Defined in

users/client.ts:6857

getFollowedLists

▸ getFollowedLists(id, options): Promise<Response> Get followed Lists Retrieves a list of Lists followed by a specific User by their ID.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:7221 ▸ getFollowedLists(id, options?): Promise<Get2UsersIdFollowedListsResponse>

Parameters

Returns

Promise<Get2UsersIdFollowedListsResponse>

Defined in

users/client.ts:7234

followList

▸ followList(id, options): Promise<Response> Follow List Causes the authenticated user to follow a specific List by its ID.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:7446 ▸ followList(id, options?): Promise<ListFollowedResponse>

Parameters

Returns

Promise<ListFollowedResponse>

Defined in

users/client.ts:7459

unblockDms

▸ unblockDms(id, options): Promise<Response> Unblock DMs Unblocks direct messages to or from a specific User by their ID for the authenticated user.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:7567 ▸ unblockDms(id): Promise<UsersDMUnBlockCreateResponse>

Parameters

Returns

Promise<UsersDMUnBlockCreateResponse>

Defined in

users/client.ts:7580

repostPost

▸ repostPost(id, options): Promise<Response> Repost Post Causes the authenticated user to repost a specific Post by its ID.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:7671 ▸ repostPost(id, options?): Promise<UsersRetweetsCreateResponse>

Parameters

Returns

Promise<UsersRetweetsCreateResponse>

Defined in

users/client.ts:7684

getBookmarkFolders

▸ getBookmarkFolders(id, options): Promise<Response> Get Bookmark folders Retrieves a list of Bookmark folders created by the authenticated user.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:7792 ▸ getBookmarkFolders(id, options?): Promise<BookmarkFoldersResponse>

Parameters

Returns

Promise<BookmarkFoldersResponse>

Defined in

users/client.ts:7805

getOwnedLists

▸ getOwnedLists(id, options): Promise<Response> Get owned Lists Retrieves a list of Lists owned by a specific User by their ID.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:7944 ▸ getOwnedLists(id, options?): Promise<Get2UsersIdOwnedListsResponse>

Parameters

Returns

Promise<Get2UsersIdOwnedListsResponse>

Defined in

users/client.ts:7957

getBookmarksByFolderId

▸ getBookmarksByFolderId(id, folderId, options): Promise<Response> Get Bookmarks by folder ID Retrieves Posts in a specific Bookmark folder by its ID for the authenticated user.

Parameters

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

users/client.ts:8173 ▸ getBookmarksByFolderId(id, folderId): Promise<BookmarkFolderPostsResponse>

Parameters

Returns

Promise<BookmarkFolderPostsResponse>

Defined in

users/client.ts:8190