client.users (UsersClient).
Methods
block_dms
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:BlockDmsResponse
create_bookmark
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).CreateBookmarkResponse
create_bookmark_folder
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).CreateBookmarkFolderResponse
delete_bookmark
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).DeleteBookmarkResponse
follow_list
POST /2/users/{id}/followed_lists
Follow List
Causes the authenticated user to follow a specific List by its ID.
Parameters
Returns:FollowListResponse
follow_user
POST /2/users/{id}/following
Follow User
Causes the authenticated user to follow a specific User by their ID.
Parameters
Returns:FollowUserResponse
get_affiliates
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:Iterator[GetAffiliatesResponse]
get_blocking
GET /2/users/{id}/blocking Paginated
Get Blocked Users
Returns the Users that the given User is blocking.
Parameters
Returns:Iterator[GetBlockingResponse]
get_bookmark_folders
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).Iterator[GetBookmarkFoldersResponse]
get_bookmarks
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).Iterator[GetBookmarksResponse]
get_bookmarks_by_folder_id
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).Iterator[GetBookmarksByFolderIdResponse]
get_by_id
GET /2/users/{id}
Get User by ID
Retrieves details of a specific User by their ID.
Parameters
Returns:GetByIdResponse
get_by_ids
GET /2/users
Get Users by IDs
Retrieves details of multiple Users by their IDs.
Parameters
Returns:GetByIdsResponse
get_by_username
GET /2/users/by/username/{username}
Get User by Username
Retrieves details of a specific User by their username.
Parameters
Returns:GetByUsernameResponse
get_by_usernames
GET /2/users/by
Get Users by Usernames
Retrieves details of multiple Users by their usernames.
Parameters
Returns:GetByUsernamesResponse
get_followed_lists
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:Iterator[GetFollowedListsResponse]
get_followers
GET /2/users/{id}/followers Paginated
Get Followers
Retrieves a list of Users who follow a specific User by their ID.
Parameters
Returns:Iterator[GetFollowersResponse]
get_following
GET /2/users/{id}/following Paginated
Get Following
Retrieves a list of Users followed by a specific User by their ID.
Parameters
Returns:Iterator[GetFollowingResponse]
get_liked_posts
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:Iterator[GetLikedPostsResponse]
get_list_memberships
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:Iterator[GetListMembershipsResponse]
get_me
GET /2/users/me
Get My User
Retrieves details of the authenticated user.
Parameters
Returns:GetMeResponse
get_me_followers
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:Iterator[GetMeFollowersResponse]
get_me_following
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:Iterator[GetMeFollowingResponse]
get_mentions
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:Iterator[GetMentionsResponse]
get_muting
GET /2/users/{id}/muting Paginated
Get Muting
Retrieves a list of Users muted by the authenticated user.
Parameters
Returns:Iterator[GetMutingResponse]
get_owned_lists
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:Iterator[GetOwnedListsResponse]
get_pinned_lists
GET /2/users/{id}/pinned_lists
Get Pinned Lists
Retrieves a list of Lists pinned by the authenticated user.
Parameters
Returns:GetPinnedListsResponse
get_posts
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:Iterator[GetPostsResponse]
get_public_key
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).GetPublicKeyResponse
get_public_keys
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:GetPublicKeysResponse
get_reposts_of_me
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:Iterator[GetRepostsOfMeResponse]
get_timeline
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:Iterator[GetTimelineResponse]
id_block
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:IdBlockResponse
id_unblock
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:IdUnblockResponse
like_post
POST /2/users/{id}/likes
Like Post
Causes the authenticated user to like a specific Post by its ID.
Parameters
Returns:LikePostResponse
mute_user
POST /2/users/{id}/muting
Mute User
Causes the authenticated user to mute a specific User by their ID.
Parameters
Returns:MuteUserResponse
pin_list
POST /2/users/{id}/pinned_lists
Pin List
Causes the authenticated user to pin a specific List by its ID.
Parameters
Returns:PinListResponse
repost_post
POST /2/users/{id}/retweets
Repost Post
Causes the authenticated user to repost a specific Post by its ID.
Parameters
Returns: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 _ ’ . - @ & ”
Iterator[SearchResponse]
unblock_dms
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:UnblockDmsResponse
unfollow_list
DELETE /2/users/{id}/followed_lists/{list_id}
Unfollow List
Causes the authenticated user to unfollow a List by its ID.
Parameters
Returns:UnfollowListResponse
unfollow_user
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:UnfollowUserResponse
unlike_post
DELETE /2/users/{id}/likes/{tweet_id}
Unlike Post
Causes the authenticated user to unlike a specific Post by its ID.
Parameters
Returns:UnlikePostResponse
unmute_user
DELETE /2/users/{source_user_id}/muting/{target_user_id}
Unmute User
Causes the authenticated user to unmute the target user.
Parameters
Returns:UnmuteUserResponse
unpin_list
DELETE /2/users/{id}/pinned_lists/{list_id}
Unpin List
Causes the authenticated user to unpin a List by its ID.
Parameters
Returns:UnpinListResponse
unrepost_post
DELETE /2/users/{id}/retweets/{source_tweet_id}
Unrepost Post
Causes the authenticated user to unrepost a specific Post by its ID.
Parameters
Returns:UnrepostPostResponse