Skip to main content

Submodules

Module contents

This module provides access to the users endpoints of the X API and serves as the main entry point for all users-related functionality.

class xdk.users.UsersClient

Client for users operations

Parameters

Client

__init__

Parameters

Client

block_dms

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

Parameters

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

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

delete_bookmark

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

Parameters

Any
The ID of the authenticated source User whose bookmark is to be removed.
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

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

follow_user

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

Parameters

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

get_blocking

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

Parameters

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

Returns

IteratorGetBlockingResponse

get_bookmark_folders

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

Parameters

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

Returns

IteratorGetBookmarkFoldersResponse

get_bookmarks

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

Parameters

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

Returns

IteratorGetBookmarksResponse

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

Any
The ID of the authenticated source User for whom to return results.
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

Any
The ID of the User to lookup.
List or None
default:"None"
A comma separated list of User fields to display.
List or None
default:"None"
A comma separated list of fields to expand.
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

List
A list of User IDs, comma-separated. You can specify up to 100 IDs.
List or None
default:"None"
A comma separated list of User fields to display.
List or None
default:"None"
A comma separated list of fields to expand.
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

str
A username.
List or None
default:"None"
A comma separated list of User fields to display.
List or None
default:"None"
A comma separated list of fields to expand.
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

List
A list of usernames, comma-separated.
List or None
default:"None"
A comma separated list of User fields to display.
List or None
default:"None"
A comma separated list of fields to expand.
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

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

Returns

IteratorGetFollowedListsResponse

get_followers

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

Parameters

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

Returns

IteratorGetFollowersResponse

get_following

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

Parameters

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

Returns

IteratorGetFollowingResponse

get_liked_posts

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

Parameters

Any
The ID of the User to lookup.
int or None
default:"None"
The maximum number of results.
Any or None
default:"None"
This parameter is used to get the next ‘page’ of results.
List or None
default:"None"
A comma separated list of Tweet fields to display.
List or None
default:"None"
A comma separated list of fields to expand.
List or None
default:"None"
A comma separated list of Media fields to display.
List or None
default:"None"
A comma separated list of Poll fields to display.
List or None
default:"None"
A comma separated list of User fields to display.
List or None
default:"None"
A comma separated list of Place fields to display.

Returns

IteratorGetLikedPostsResponse

get_list_memberships

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

Parameters

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

Returns

IteratorGetListMembershipsResponse

get_me

Get my User Retrieves details of the authenticated user.

Parameters

List or None
default:"None"
A comma separated list of User fields to display.
List or None
default:"None"
A comma separated list of fields to expand.
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

Any
The ID of the User to lookup.
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.
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.
int or None
default:"None"
The maximum number of results.
Any or None
default:"None"
This parameter is used to get the next ‘page’ of results.
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.
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.
List or None
default:"None"
A comma separated list of Tweet fields to display.
List or None
default:"None"
A comma separated list of fields to expand.
List or None
default:"None"
A comma separated list of Media fields to display.
List or None
default:"None"
A comma separated list of Poll fields to display.
List or None
default:"None"
A comma separated list of User fields to display.
List or None
default:"None"
A comma separated list of Place fields to display.

Returns

IteratorGetMentionsResponse

get_muting

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

Parameters

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

Returns

IteratorGetMutingResponse

get_owned_lists

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

Parameters

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

Returns

IteratorGetOwnedListsResponse

get_pinned_lists

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

Parameters

Any
The ID of the authenticated source User for whom to return results.
List or None
default:"None"
A comma separated list of List fields to display.
List or None
default:"None"
A comma separated list of fields to expand.
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

Any
The ID of the User to lookup.
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.
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.
int or None
default:"None"
The maximum number of results.
Any or None
default:"None"
This parameter is used to get the next ‘page’ of results.
List or None
default:"None"
The set of entities to exclude (e.g. ‘replies’ or ‘retweets’).
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.
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.
List or None
default:"None"
A comma separated list of Tweet fields to display.
List or None
default:"None"
A comma separated list of fields to expand.
List or None
default:"None"
A comma separated list of Media fields to display.
List or None
default:"None"
A comma separated list of Poll fields to display.
List or None
default:"None"
A comma separated list of User fields to display.
List or None
default:"None"
A comma separated list of Place fields to display.

Returns

IteratorGetPostsResponse

get_reposts_of_me

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

Parameters

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

Returns

IteratorGetRepostsOfMeResponse

get_timeline

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

Parameters

Any
The ID of the authenticated source User to list Reverse Chronological Timeline Posts of.
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.
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.
int or None
default:"None"
The maximum number of results.
Any or None
default:"None"
This parameter is used to get the next ‘page’ of results.
List or None
default:"None"
The set of entities to exclude (e.g. ‘replies’ or ‘retweets’).
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.
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.
List or None
default:"None"
A comma separated list of Tweet fields to display.
List or None
default:"None"
A comma separated list of fields to expand.
List or None
default:"None"
A comma separated list of Media fields to display.
List or None
default:"None"
A comma separated list of Poll fields to display.
List or None
default:"None"
A comma separated list of User fields to display.
List or None
default:"None"
A comma separated list of Place fields to display.

Returns

IteratorGetTimelineResponse

like_post

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

Parameters

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

mute_user

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

Parameters

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

pin_list

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

Parameters

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

repost_post

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

Parameters

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

Parameters

Any
TThe the query string by which to query for users.
int or None
default:"None"
The maximum number of results.
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.
List or None
default:"None"
A comma separated list of User fields to display.
List or None
default:"None"
A comma separated list of fields to expand.
List or None
default:"None"
A comma separated list of Tweet fields to display.

Returns

IteratorSearchResponse

unblock_dms

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

Parameters

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

Any
The ID of the authenticated source User that will unfollow the List.
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

Any
The ID of the authenticated source User that is requesting to unfollow the target User.
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

Any
The ID of the authenticated source User that is requesting to unlike the Post.
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

Any
The ID of the authenticated source User that is requesting to unmute the target User.
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

Any
The ID of the authenticated source User for whom to return results.
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

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

Returns

UnrepostPostResponse - Response data