Skip to main content

UsersClient

Class Bases: object Client for users operations

Constructors

__init__

Parameters

path.client
Client

block_dms

Block DMs Blocks direct messages to or from a specific User by their ID for the authenticated user.

Parameters

path.id
Any
The ID of the target User that the authenticated user requesting to block dms for.

Returns

BlockDmsResponse - Response data

create_bookmark

Create Bookmark Adds a post to the authenticated user’s bookmarks.

Parameters

path.id
Any
The ID of the authenticated source User for whom to add bookmarks.
body.body
CreateBookmarkRequest
Request body

delete_bookmark

Delete Bookmark Removes a Post from the authenticated user’s Bookmarks by its ID.

Parameters

path.id
Any
The ID of the authenticated source User whose bookmark is to be removed.
path.tweet_id
Any
The ID of the Post that the source User is removing from bookmarks.

Returns

DeleteBookmarkResponse - Response data

follow_list

Follow List Causes the authenticated user to follow a specific List by its ID.

Parameters

path.id
Any
The ID of the authenticated source User that will follow the List.
body.body
FollowListRequest
Request body

follow_user

Follow User Causes the authenticated user to follow a specific user by their ID.

Parameters

path.id
Any
The ID of the authenticated source User that is requesting to follow the target User.
body.body
FollowUserRequest
Request body

get_blocking

Get blocking Retrieves a list of Users blocked by the specified User ID.

Parameters

path.id
Any
The ID of the authenticated source User for whom to return results.
path.max_results
int or None
default:"None"
The maximum number of results.
path.pagination_token
Any or None
default:"None"
This parameter is used to get a specified ‘page’ of results.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.

Returns

GetBlockingResponse - Response data

get_bookmark_folders

Get Bookmark folders Retrieves a list of Bookmark folders created by the authenticated user.

Parameters

path.id
Any
The ID of the authenticated source User for whom to return results.
path.max_results
int or None
default:"None"
The maximum number of results.
path.pagination_token
Any or None
default:"None"
This parameter is used to get the next ‘page’ of results.

Returns

GetBookmarkFoldersResponse - Response data

get_bookmarks

Get Bookmarks Retrieves a list of Posts bookmarked by the authenticated user.

Parameters

path.id
Any
The ID of the authenticated source User for whom to return results.
path.max_results
int or None
default:"None"
The maximum number of results.
path.pagination_token
Any or None
default:"None"
This parameter is used to get the next ‘page’ of results.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.media_fields
List or None
default:"None"
A comma separated list of Media fields to display.
path.poll_fields
List or None
default:"None"
A comma separated list of Poll fields to display.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.place_fields
List or None
default:"None"
A comma separated list of Place fields to display.

Returns

GetBookmarksResponse - Response data

get_bookmarks_by_folder_id

Get Bookmarks by folder ID Retrieves Posts in a specific Bookmark folder by its ID for the authenticated user.

Parameters

path.id
Any
The ID of the authenticated source User for whom to return results.
path.folder_id
Any
The ID of the Bookmark Folder that the authenticated User is trying to fetch Posts for.

Returns

GetBookmarksByFolderIdResponse - Response data

get_by_id

Get User by ID Retrieves details of a specific User by their ID.

Parameters

path.id
Any
The ID of the User to lookup.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.

Returns

GetByIdResponse - Response data

get_by_ids

Get Users by IDs Retrieves details of multiple Users by their IDs.

Parameters

path.ids
List
A list of User IDs, comma-separated. You can specify up to 100 IDs.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.

Returns

GetByIdsResponse - Response data

get_by_username

Get User by username Retrieves details of a specific User by their username.

Parameters

path.username
str
A username.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.

Returns

GetByUsernameResponse - Response data

get_by_usernames

Get Users by usernames Retrieves details of multiple Users by their usernames.

Parameters

path.usernames
List
A list of usernames, comma-separated.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.

Returns

GetByUsernamesResponse - Response data

get_followed_lists

Get followed Lists Retrieves a list of Lists followed by a specific User by their ID.

Parameters

path.id
Any
The ID of the User to lookup.
path.max_results
int or None
default:"None"
The maximum number of results.
path.pagination_token
Any or None
default:"None"
This parameter is used to get a specified ‘page’ of results.
path.list_fields
List or None
default:"None"
A comma separated list of List fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.

Returns

GetFollowedListsResponse - Response data

get_followers

Get followers Retrieves a list of Users who follow a specific User by their ID.

Parameters

path.id
Any
The ID of the User to lookup.
path.max_results
int or None
default:"None"
The maximum number of results.
path.pagination_token
Any or None
default:"None"
This parameter is used to get a specified ‘page’ of results.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.

Returns

GetFollowersResponse - Response data

get_following

Get following Retrieves a list of Users followed by a specific User by their ID.

Parameters

path.id
Any
The ID of the User to lookup.
path.max_results
int or None
default:"None"
The maximum number of results.
path.pagination_token
Any or None
default:"None"
This parameter is used to get a specified ‘page’ of results.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.

Returns

GetFollowingResponse - Response data

get_liked_posts

Get liked Posts Retrieves a list of Posts liked by a specific User by their ID.

Parameters

path.id
Any
The ID of the User to lookup.
path.max_results
int or None
default:"None"
The maximum number of results.
path.pagination_token
Any or None
default:"None"
This parameter is used to get the next ‘page’ of results.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.media_fields
List or None
default:"None"
A comma separated list of Media fields to display.
path.poll_fields
List or None
default:"None"
A comma separated list of Poll fields to display.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.place_fields
List or None
default:"None"
A comma separated list of Place fields to display.

Returns

GetLikedPostsResponse - Response data

get_list_memberships

Get List memberships Retrieves a list of Lists that a specific User is a member of by their ID.

Parameters

path.id
Any
The ID of the User to lookup.
path.max_results
int or None
default:"None"
The maximum number of results.
path.pagination_token
Any or None
default:"None"
This parameter is used to get a specified ‘page’ of results.
path.list_fields
List or None
default:"None"
A comma separated list of List fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.

Returns

GetListMembershipsResponse - Response data

get_me

Get my User Retrieves details of the authenticated user.

Parameters

path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.

Returns

GetMeResponse - Response data

get_mentions

Get mentions Retrieves a list of Posts that mention a specific User by their ID.

Parameters

path.id
Any
The ID of the User to lookup.
path.since_id
Any or None
default:"None"
The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified.
path.until_id
Any or None
default:"None"
The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified.
path.max_results
int or None
default:"None"
The maximum number of results.
path.pagination_token
Any or None
default:"None"
This parameter is used to get the next ‘page’ of results.
path.start_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified.
path.end_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.media_fields
List or None
default:"None"
A comma separated list of Media fields to display.
path.poll_fields
List or None
default:"None"
A comma separated list of Poll fields to display.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.place_fields
List or None
default:"None"
A comma separated list of Place fields to display.

Returns

GetMentionsResponse - Response data

get_muting

Get muting Retrieves a list of Users muted by the authenticated user.

Parameters

path.id
Any
The ID of the authenticated source User for whom to return results.
path.max_results
int or None
default:"None"
The maximum number of results.
path.pagination_token
Any or None
default:"None"
This parameter is used to get the next ‘page’ of results.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.

Returns

GetMutingResponse - Response data

get_owned_lists

Get owned Lists Retrieves a list of Lists owned by a specific User by their ID.

Parameters

path.id
Any
The ID of the User to lookup.
path.max_results
int or None
default:"None"
The maximum number of results.
path.pagination_token
Any or None
default:"None"
This parameter is used to get a specified ‘page’ of results.
path.list_fields
List or None
default:"None"
A comma separated list of List fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.

Returns

GetOwnedListsResponse - Response data

get_pinned_lists

Get pinned Lists Retrieves a list of Lists pinned by the authenticated user.

Parameters

path.id
Any
The ID of the authenticated source User for whom to return results.
path.list_fields
List or None
default:"None"
A comma separated list of List fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.

Returns

GetPinnedListsResponse - Response data

get_posts

Get Posts Retrieves a list of posts authored by a specific User by their ID.

Parameters

path.id
Any
The ID of the User to lookup.
path.since_id
Any or None
default:"None"
The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified.
path.until_id
Any or None
default:"None"
The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified.
path.max_results
int or None
default:"None"
The maximum number of results.
path.pagination_token
Any or None
default:"None"
This parameter is used to get the next ‘page’ of results.
path.exclude
List or None
default:"None"
The set of entities to exclude (e.g. ‘replies’ or ‘retweets’).
path.start_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified.
path.end_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.media_fields
List or None
default:"None"
A comma separated list of Media fields to display.
path.poll_fields
List or None
default:"None"
A comma separated list of Poll fields to display.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.place_fields
List or None
default:"None"
A comma separated list of Place fields to display.

Returns

GetPostsResponse - Response data

get_reposts_of_me

Get Reposts of me Retrieves a list of Posts that repost content from the authenticated user.

Parameters

path.max_results
int or None
default:"None"
The maximum number of results.
path.pagination_token
Any or None
default:"None"
This parameter is used to get the next ‘page’ of results.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.media_fields
List or None
default:"None"
A comma separated list of Media fields to display.
path.poll_fields
List or None
default:"None"
A comma separated list of Poll fields to display.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.place_fields
List or None
default:"None"
A comma separated list of Place fields to display.

Returns

GetRepostsOfMeResponse - Response data

get_timeline

Get Timeline Retrieves a reverse chronological list of Posts in the authenticated User’s Timeline.

Parameters

path.id
Any
The ID of the authenticated source User to list Reverse Chronological Timeline Posts of.
path.since_id
Any or None
default:"None"
The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified.
path.until_id
Any or None
default:"None"
The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified.
path.max_results
int or None
default:"None"
The maximum number of results.
path.pagination_token
Any or None
default:"None"
This parameter is used to get the next ‘page’ of results.
path.exclude
List or None
default:"None"
The set of entities to exclude (e.g. ‘replies’ or ‘retweets’).
path.start_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified.
path.end_time
str or None
default:"None"
YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.media_fields
List or None
default:"None"
A comma separated list of Media fields to display.
path.poll_fields
List or None
default:"None"
A comma separated list of Poll fields to display.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.place_fields
List or None
default:"None"
A comma separated list of Place fields to display.

Returns

GetTimelineResponse - Response data

like_post

Like Post Causes the authenticated user to Like a specific Post by its ID.

Parameters

path.id
Any
The ID of the authenticated source User that is requesting to like the Post.
body.body
LikePostRequest
Request body

mute_user

Mute User Causes the authenticated user to mute a specific User by their ID.

Parameters

path.id
Any
The ID of the authenticated source User that is requesting to mute the target User.
body.body
MuteUserRequest
Request body

pin_list

Pin List Causes the authenticated user to pin a specific List by its ID.

Parameters

path.id
Any
The ID of the authenticated source User that will pin the List.
body.body
PinListRequest
Request body

repost_post

Repost Post Causes the authenticated user to repost a specific Post by its ID.

Parameters

path.id
Any
The ID of the authenticated source User that is requesting to repost the Post.
body.body
RepostPostRequest
Request body
Search Users Retrieves a list of Users matching a search query.

Parameters

path.query
Any
TThe the query string by which to query for users.
path.max_results
int or None
default:"None"
The maximum number of results.
path.next_token
Any or None
default:"None"
This parameter is used to get the next ‘page’ of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified.
path.user_fields
List or None
default:"None"
A comma separated list of User fields to display.
path.expansions
List or None
default:"None"
A comma separated list of fields to expand.
path.tweet_fields
List or None
default:"None"
A comma separated list of Tweet fields to display.

Returns

SearchResponse - Response data

unblock_dms

Unblock DMs Unblocks direct messages to or from a specific User by their ID for the authenticated user.

Parameters

path.id
Any
The ID of the target User that the authenticated user requesting to unblock dms for.

Returns

UnblockDmsResponse - Response data

unfollow_list

Unfollow List Causes the authenticated user to unfollow a specific List by its ID.

Parameters

path.id
Any
The ID of the authenticated source User that will unfollow the List.
path.list_id
Any
The ID of the List to unfollow.

Returns

UnfollowListResponse - Response data

unfollow_user

Unfollow User Causes the authenticated user to unfollow a specific user by their ID.

Parameters

path.source_user_id
Any
The ID of the authenticated source User that is requesting to unfollow the target User.
path.target_user_id
Any
The ID of the User that the source User is requesting to unfollow.

Returns

UnfollowUserResponse - Response data

unlike_post

Unlike Post Causes the authenticated user to Unlike a specific Post by its ID.

Parameters

path.id
Any
The ID of the authenticated source User that is requesting to unlike the Post.
path.tweet_id
Any
The ID of the Post that the User is requesting to unlike.

Returns

UnlikePostResponse - Response data

unmute_user

Unmute User Causes the authenticated user to unmute a specific user by their ID.

Parameters

path.source_user_id
Any
The ID of the authenticated source User that is requesting to unmute the target User.
path.target_user_id
Any
The ID of the User that the source User is requesting to unmute.

Returns

UnmuteUserResponse - Response data

unpin_list

Unpin List Causes the authenticated user to unpin a specific List by its ID.

Parameters

path.id
Any
The ID of the authenticated source User for whom to return results.
path.list_id
Any
The ID of the List to unpin.

Returns

UnpinListResponse - Response data

unrepost_post

Unrepost Post Causes the authenticated user to unrepost a specific Post by its ID.

Parameters

path.id
Any
The ID of the authenticated source User that is requesting to repost the Post.
path.source_tweet_id
Any
The ID of the Post that the User is requesting to unretweet.

Returns

UnrepostPostResponse - Response data