Skip to main content
Access Users endpoints via 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

String
required
id (path parameter).
Returns: Hash

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

String
required
The authenticated user’s numeric ID, not me: the id from Get My User (GET /2/users/me).
Hash
required
At least one of tweet_id, tweet_ids is required.
Returns: Hash

create_bookmark_folder

POST /2/users/{id}/bookmarks/folders Create Bookmark Folder Creates a new Bookmark folder for the authenticated user.

Parameters

String
required
The authenticated user’s numeric ID, not me: the id from Get My User (GET /2/users/me).
Hash
required
Request payload.
Returns: Hash

delete_bookmark

DELETE /2/users/{id}/bookmarks/{tweet_id} Delete Bookmark Removes a Post from the authenticated user’s Bookmarks by its ID.

Parameters

String
required
The authenticated user’s numeric ID, not me: the id from Get My User (GET /2/users/me).
String
required
tweet_id (path parameter).
Returns: Hash

follow_list

POST /2/users/{id}/followed_lists Follow List Causes the authenticated user to follow a specific List by its ID.

Parameters

String
required
id (path parameter).
Hash
required
Request payload.
Returns: Hash

follow_user

POST /2/users/{id}/following Follow User Causes the authenticated user to follow a specific User by their ID.

Parameters

String
required
id (path parameter).
Hash
required
Request payload.
Returns: Hash

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

String
required
id (path parameter).
Returns: Enumerator<Hash>

get_blocking

GET /2/users/{id}/blocking Paginated Get Blocked Users Returns the Users that the given User is blocking.

Parameters

String
required
id (path parameter).
Returns: Enumerator<Hash>

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

String
required
The authenticated user’s numeric ID, not me: the id from Get My User (GET /2/users/me).
Returns: Enumerator<Hash>

get_bookmarks

GET /2/users/{id}/bookmarks Paginated Get Bookmarks Retrieves a list of Posts bookmarked by the authenticated user.

Parameters

String
required
The authenticated user’s numeric ID, not me: the id from Get My User (GET /2/users/me).
Returns: Enumerator<Hash>

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

String
required
The authenticated user’s numeric ID, not me: the id from Get My User (GET /2/users/me).
String
required
folder_id (path parameter).
Returns: Enumerator<Hash>

get_by_id

GET /2/users/{id} Get User by ID Retrieves details of a specific User by their ID.

Parameters

String
required
id (path parameter).
Returns: Hash

get_by_ids

GET /2/users Get Users by IDs Retrieves details of multiple Users by their IDs.

Parameters

Array<String>
required
ids (query parameter).
Returns: Hash

get_by_username

GET /2/users/by/username/{username} Get User by Username Retrieves details of a specific User by their username.

Parameters

String
required
username (path parameter).
Returns: Hash

get_by_usernames

GET /2/users/by Get Users by Usernames Retrieves details of multiple Users by their usernames.

Parameters

Array<String>
required
usernames (query parameter).
Returns: Hash

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

String
required
id (path parameter).
Returns: Enumerator<Hash>

get_followers

GET /2/users/{id}/followers Paginated Get Followers Retrieves a list of Users who follow a specific User by their ID.

Parameters

String
required
id (path parameter).
Returns: Enumerator<Hash>

get_following

GET /2/users/{id}/following Paginated Get Following Retrieves a list of Users followed by a specific User by their ID.

Parameters

String
required
id (path parameter).
Returns: Enumerator<Hash>

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

String
required
id (path parameter).
Returns: Enumerator<Hash>

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

String
required
id (path parameter).
Returns: Enumerator<Hash>

get_me

GET /2/users/me Get My User Retrieves details of the authenticated user.

Parameters

Returns: Hash

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: Enumerator<Hash>

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: Enumerator<Hash>

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

String
required
id (path parameter).
Returns: Enumerator<Hash>

get_muting

GET /2/users/{id}/muting Paginated Get Muting Retrieves a list of Users muted by the authenticated user.

Parameters

String
required
id (path parameter).
Returns: Enumerator<Hash>

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

String
required
id (path parameter).
Returns: Enumerator<Hash>

get_pinned_lists

GET /2/users/{id}/pinned_lists Get Pinned Lists Retrieves a list of Lists pinned by the authenticated user.

Parameters

String
required
id (path parameter).
Returns: Hash

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

String
required
id (path parameter).
Returns: Enumerator<Hash>

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

String
required
Numeric user ID, not me. For your own keys, use the id from Get My User (GET /2/users/me).
Returns: Hash

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

Array<String>
required
Comma-separated numeric user IDs (1-100), not @usernames.
Returns: Hash

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: Enumerator<Hash>

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

String
required
id (path parameter).
Returns: Enumerator<Hash>

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

String
required
id (path parameter).
Hash
required
Request payload.
Returns: Hash

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

String
required
source_user_id (path parameter).
String
required
target_user_id (path parameter).
Returns: Hash

like_post

POST /2/users/{id}/likes Like Post Causes the authenticated user to like a specific Post by its ID.

Parameters

String
required
id (path parameter).
Hash
required
Request payload.
Returns: Hash

mute_user

POST /2/users/{id}/muting Mute User Causes the authenticated user to mute a specific User by their ID.

Parameters

String
required
id (path parameter).
Hash
required
Request payload.
Returns: Hash

pin_list

POST /2/users/{id}/pinned_lists Pin List Causes the authenticated user to pin a specific List by its ID.

Parameters

String
required
id (path parameter).
Hash
required
Request payload.
Returns: Hash

repost_post

POST /2/users/{id}/retweets Repost Post Causes the authenticated user to repost a specific Post by its ID.

Parameters

String
required
id (path parameter).
Hash
required
Request payload.
Returns: Hash
GET /2/users/search Paginated Search Users Retrieves a list of Users matching a search query.

Parameters

String
required
A name or @username (1-50 chars): letters and digits in any language, spaces, and _ ’ . - @ & ”
Returns: Enumerator<Hash>

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

String
required
id (path parameter).
Returns: Hash

unfollow_list

DELETE /2/users/{id}/followed_lists/{list_id} Unfollow List Causes the authenticated user to unfollow a List by its ID.

Parameters

String
required
id (path parameter).
String
required
list_id (path parameter).
Returns: Hash

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

String
required
source_user_id (path parameter).
String
required
target_user_id (path parameter).
Returns: Hash

unlike_post

DELETE /2/users/{id}/likes/{tweet_id} Unlike Post Causes the authenticated user to unlike a specific Post by its ID.

Parameters

String
required
id (path parameter).
String
required
tweet_id (path parameter).
Returns: Hash

unmute_user

DELETE /2/users/{source_user_id}/muting/{target_user_id} Unmute User Causes the authenticated user to unmute the target user.

Parameters

String
required
source_user_id (path parameter).
String
required
target_user_id (path parameter).
Returns: Hash

unpin_list

DELETE /2/users/{id}/pinned_lists/{list_id} Unpin List Causes the authenticated user to unpin a List by its ID.

Parameters

String
required
id (path parameter).
String
required
list_id (path parameter).
Returns: Hash

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

String
required
id (path parameter).
String
required
source_tweet_id (path parameter).
Returns: Hash