client.users() (UsersClient).
Methods
blockDms
POST /2/users/{id}/dm/block
Block DMs
Blocks direct messages to or from a specific User by their ID for the authenticated user.
Parameters
Returns:Schemas.BlockUsersDmsResponse
createBookmark
POST /2/users/{id}/bookmarks
Create Bookmark
Adds one or more Posts to the authenticated user’s Bookmarks. Supply tweet_id for a single Post, or tweet_ids (at most 25) to bookmark several in one request. Optional folder_id applies to every Post in the request. Billing and rate limits still apply per HTTP request.
Parameters
The authenticated user’s numeric ID, not
me: the id from Get My User (GET /2/users/me).JsonNode
createBookmarkFolder
POST /2/users/{id}/bookmarks/folders
Create Bookmark Folder
Creates a new Bookmark folder for the authenticated user.
Parameters
The authenticated user’s numeric ID, not
me: the id from Get My User (GET /2/users/me).Schemas.CreateUsersBookmarkFolderResponse
deleteBookmark
DELETE /2/users/{id}/bookmarks/{tweet_id}
Delete Bookmark
Removes a Post from the authenticated user’s Bookmarks by its ID.
Parameters
The authenticated user’s numeric ID, not
me: the id from Get My User (GET /2/users/me).Schemas.DeleteUsersBookmarkResponse
followList
POST /2/users/{id}/followed_lists
Follow List
Causes the authenticated user to follow a specific List by its ID.
Parameters
Returns:Schemas.FollowListResponse
followUser
POST /2/users/{id}/following
Follow User
Causes the authenticated user to follow a specific User by their ID.
Parameters
Returns:Schemas.FollowUserResponse
getAffiliates
GET /2/users/{id}/affiliates Paginated
Get Affiliates
Retrieves a list of Users who are affiliated with a specific organization User by their ID.
Parameters
Returns:Schemas.GetUsersAffiliatesResponse (use getAffiliatesPages(...) for automatic Paginator<...> iteration)
getBlocking
GET /2/users/{id}/blocking Paginated
Get Blocked Users
Returns the Users that the given User is blocking.
Parameters
Returns:Schemas.GetUsersBlockingResponse (use getBlockingPages(...) for automatic Paginator<...> iteration)
getBookmarkFolders
GET /2/users/{id}/bookmarks/folders Paginated
Get Bookmark Folders
Retrieves a list of Bookmark folders created by the authenticated user.
Parameters
The authenticated user’s numeric ID, not
me: the id from Get My User (GET /2/users/me).Schemas.GetUsersBookmarkFoldersResponse (use getBookmarkFoldersPages(...) for automatic Paginator<...> iteration)
getBookmarks
GET /2/users/{id}/bookmarks Paginated
Get Bookmarks
Retrieves a list of Posts bookmarked by the authenticated user.
Parameters
The authenticated user’s numeric ID, not
me: the id from Get My User (GET /2/users/me).Schemas.GetUsersBookmarksResponse (use getBookmarksPages(...) for automatic Paginator<...> iteration)
getBookmarksByFolderId
GET /2/users/{id}/bookmarks/folders/{folder_id} Paginated
Get Bookmarks by Folder ID
Retrieves Posts in a specific Bookmark folder by its ID for the authenticated user.
Parameters
The authenticated user’s numeric ID, not
me: the id from Get My User (GET /2/users/me).Schemas.GetUsersBookmarksByFolderIdResponse (use getBookmarksByFolderIdPages(...) for automatic Paginator<...> iteration)
getById
GET /2/users/{id}
Get User by ID
Retrieves details of a specific User by their ID.
Parameters
Returns:Schemas.GetUsersByIdResponse
getByIds
GET /2/users
Get Users by IDs
Retrieves details of multiple Users by their IDs.
Parameters
Returns:Schemas.GetUsersByIdsResponse
getByUsername
GET /2/users/by/username/{username}
Get User by Username
Retrieves details of a specific User by their username.
Parameters
Returns:Schemas.GetUsersByUsernameResponse
getByUsernames
GET /2/users/by
Get Users by Usernames
Retrieves details of multiple Users by their usernames.
Parameters
Returns:Schemas.GetUsersByUsernamesResponse
getFollowedLists
GET /2/users/{id}/followed_lists Paginated
Get Followed Lists
Retrieves a list of Lists followed by a specific User by their ID.
Parameters
Returns:Schemas.GetUsersFollowedListsResponse (use getFollowedListsPages(...) for automatic Paginator<...> iteration)
getFollowers
GET /2/users/{id}/followers Paginated
Get Followers
Retrieves a list of Users who follow a specific User by their ID.
Parameters
Returns:Schemas.GetUsersFollowersResponse (use getFollowersPages(...) for automatic Paginator<...> iteration)
getFollowing
GET /2/users/{id}/following Paginated
Get Following
Retrieves a list of Users followed by a specific User by their ID.
Parameters
Returns:Schemas.GetUsersFollowingResponse (use getFollowingPages(...) for automatic Paginator<...> iteration)
getLikedPosts
GET /2/users/{id}/liked_tweets Paginated
Get Liked Posts
Retrieves a list of Posts liked by a specific User by their ID.
Parameters
Returns:Schemas.GetUsersLikedPostsResponse (use getLikedPostsPages(...) for automatic Paginator<...> iteration)
getListMemberships
GET /2/users/{id}/list_memberships Paginated
Get List Memberships
Retrieves a list of Lists that a specific User is a member of by their ID.
Parameters
Returns:Schemas.GetUsersListMembershipsResponse (use getListMembershipsPages(...) for automatic Paginator<...> iteration)
getMe
GET /2/users/me
Get My User
Retrieves details of the authenticated user.
Parameters
Returns:Schemas.GetUsersMeResponse
getMeFollowers
GET /2/users/me/followers Paginated
Get the Authenticated User’s Followers
Returns the Users who follow the authenticated user. Same results as GET /2/users/{id}/followers with your own user ID, without looking it up.
Parameters
Returns:Schemas.GetUsersMeFollowersResponse (use getMeFollowersPages(...) for automatic Paginator<...> iteration)
getMeFollowing
GET /2/users/me/following Paginated
Get the Users the Authenticated User Follows
Returns the Users the authenticated user follows. Same results as GET /2/users/{id}/following with your own user ID, without looking it up.
Parameters
Returns:Schemas.GetUsersMeFollowingResponse (use getMeFollowingPages(...) for automatic Paginator<...> iteration)
getMentions
GET /2/users/{id}/mentions Paginated
Get Mentions
Retrieves a list of Posts that mention a specific User by their ID.
When both are provided, start_time must be earlier than end_time. When both are provided, since_id must be less than until_id.
Parameters
Returns:Schemas.GetUsersMentionsResponse (use getMentionsPages(...) for automatic Paginator<...> iteration)
getMuting
GET /2/users/{id}/muting Paginated
Get Muting
Retrieves a list of Users muted by the authenticated user.
Parameters
Returns:Schemas.GetUsersMutingResponse (use getMutingPages(...) for automatic Paginator<...> iteration)
getOwnedLists
GET /2/users/{id}/owned_lists Paginated
Get Owned Lists
Retrieves a list of Lists owned by a specific User by their ID.
Parameters
Returns:Schemas.GetUsersOwnedListsResponse (use getOwnedListsPages(...) for automatic Paginator<...> iteration)
getPinnedLists
GET /2/users/{id}/pinned_lists
Get Pinned Lists
Retrieves a list of Lists pinned by the authenticated user.
Parameters
Returns:Schemas.GetUsersPinnedListsResponse
getPosts
GET /2/users/{id}/tweets Paginated
Get Posts
Retrieves a list of Posts authored by a specific User by their ID.
When both are provided, start_time must be earlier than end_time. When both are provided, since_id must be less than until_id.
Parameters
Returns:Schemas.GetUsersPostsResponse (use getPostsPages(...) for automatic Paginator<...> iteration)
getPublicKey
GET /2/users/{id}/public_keys
Get User Public Keys
Returns a user’s registered public keys for X Chat encryption.
Every key field is returned by default, so public_key.fields can be left out. It takes public_key, signing_public_key, identity_public_key_signature, public_key_version and juicebox_config.
Parameters
Numeric user ID, not
me. For your own keys, use the id from Get My User (GET /2/users/me).Schemas.GetUsersPublicKeyResponse
getPublicKeys
GET /2/users/public_keys
Get Public Keys for Multiple Users
Returns the public keys that up to 100 users registered for X Chat encryption, looked up by numeric user ID. Each key carries the user_id of the user it belongs to.
Every key field is returned by default, so public_key.fields can be left out. It takes public_key, signing_public_key, identity_public_key_signature, public_key_version, juicebox_config and user_id.
Parameters
Returns:Schemas.GetUsersPublicKeysResponse
getRepostsOfMe
GET /2/users/reposts_of_me Paginated
Get Reposts of Me
Retrieves a list of Posts that repost content from the authenticated user.
Parameters
Returns:Schemas.GetUsersRepostsOfMeResponse (use getRepostsOfMePages(...) for automatic Paginator<...> iteration)
getTimeline
GET /2/users/{id}/timelines/reverse_chronological Paginated
Get Timeline
Retrieves a reverse chronological list of Posts in the authenticated user’s Timeline.
When both are provided, start_time must be earlier than end_time. When both are provided, since_id must be less than until_id.
Parameters
Returns:Schemas.GetUsersTimelineResponse (use getTimelinePages(...) for automatic Paginator<...> iteration)
idBlock
POST /2/users/{id}/blocking
Block User
Causes the source User to block the target User. A block also removes any follow between the two Users, in both directions, and unblocking does not restore it. Each call blocks one account: block only accounts the authenticated User named or approved, because finding or reviewing accounts is not approval to block them.
Parameters
Returns:Schemas.UsersIdBlockResponse
idUnblock
DELETE /2/users/{source_user_id}/blocking/{target_user_id}
Unblock User
Causes the source User to unblock the target User. Unblocking does not restore any follow the block removed, so blocking and then unblocking a follower removes them as a follower: do that only for followers the authenticated User approved removing.
Parameters
Returns:Schemas.UsersIdUnblockResponse
likePost
POST /2/users/{id}/likes
Like Post
Causes the authenticated user to like a specific Post by its ID.
Parameters
Returns:Schemas.LikePostResponse
muteUser
POST /2/users/{id}/muting
Mute User
Causes the authenticated user to mute a specific User by their ID.
Parameters
Returns:Schemas.MuteUserResponse
pinList
POST /2/users/{id}/pinned_lists
Pin List
Causes the authenticated user to pin a specific List by its ID.
Parameters
Returns:Schemas.PinListResponse
repostPost
POST /2/users/{id}/retweets
Repost Post
Causes the authenticated user to repost a specific Post by its ID.
Parameters
Returns:Schemas.RepostPostResponse
search
GET /2/users/search Paginated
Search Users
Retrieves a list of Users matching a search query.
Parameters
A name or @username (1-50 chars): letters and digits in any language, spaces, and _ ’ . - @ & ”
Schemas.SearchUsersResponse (use searchPages(...) for automatic Paginator<...> iteration)
unblockDms
POST /2/users/{id}/dm/unblock
Unblock DMs
Unblocks direct messages to or from a specific User by their ID for the authenticated user.
Parameters
Returns:Schemas.UnblockUsersDmsResponse
unfollowList
DELETE /2/users/{id}/followed_lists/{list_id}
Unfollow List
Causes the authenticated user to unfollow a List by its ID.
Parameters
Returns:Schemas.UnfollowListResponse
unfollowUser
DELETE /2/users/{source_user_id}/following/{target_user_id}
Unfollow User
Causes the authenticated user to unfollow a specific user by their ID.
Parameters
Returns:Schemas.UnfollowUserResponse
unlikePost
DELETE /2/users/{id}/likes/{tweet_id}
Unlike Post
Causes the authenticated user to unlike a specific Post by its ID.
Parameters
Returns:Schemas.UnlikePostResponse
unmuteUser
DELETE /2/users/{source_user_id}/muting/{target_user_id}
Unmute User
Causes the authenticated user to unmute the target user.
Parameters
Returns:Schemas.UnmuteUserResponse
unpinList
DELETE /2/users/{id}/pinned_lists/{list_id}
Unpin List
Causes the authenticated user to unpin a List by its ID.
Parameters
Returns:Schemas.UnpinListResponse
unrepostPost
DELETE /2/users/{id}/retweets/{source_tweet_id}
Unrepost Post
Causes the authenticated user to unrepost a specific Post by its ID.
Parameters
Returns:Schemas.UnrepostPostResponse