Twitter/X Users API
Endpoints related to retrieving, managing relationships of Users
Endpoints related to retrieving, managing relationships of Users
openapi: 3.0.0
info:
description: X API v2 available endpoints
version: '2.166'
title: X API v2 Account Activity Users API
termsOfService: https://developer.x.com/en/developer-terms/agreement-and-policy.html
contact:
name: X Developers
url: https://developer.x.com/
license:
name: X Developer Agreement and Policy
url: https://developer.x.com/en/developer-terms/agreement-and-policy.html
servers:
- description: X API
url: https://api.x.com
tags:
- name: Users
description: Endpoints related to retrieving, managing relationships of Users
externalDocs:
description: Find out more
url: https://developer.twitter.com/en/docs/twitter-api/users/lookup
paths:
/2/lists/{id}/followers:
get:
security:
- BearerToken: []
- OAuth2UserToken:
- list.read
- tweet.read
- users.read
- UserToken: []
tags:
- Users
summary: Get List followers
description: Retrieves a list of Users who follow a specific List by its ID.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/users/follows/api-reference/get-users-id-followers
operationId: getListsFollowers
parameters:
- name: id
in: path
description: The ID of the List.
required: true
schema:
$ref: '#/components/schemas/ListId'
style: simple
- name: max_results
in: query
description: The maximum number of results.
required: false
schema:
type: integer
minimum: 1
maximum: 100
format: int32
default: 100
style: form
- name: pagination_token
in: query
description: This parameter is used to get a specified 'page' of results.
required: false
schema:
$ref: '#/components/schemas/PaginationTokenLong'
style: form
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/UserExpansionsParameter'
- $ref: '#/components/parameters/TweetFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Get2ListsIdFollowersResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/lists/{id}/members:
get:
security:
- BearerToken: []
- OAuth2UserToken:
- list.read
- tweet.read
- users.read
- UserToken: []
tags:
- Users
summary: Get List members
description: Retrieves a list of Users who are members of a specific List by its ID.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/lists/list-members/api-reference/get-users-id-list_memberships
operationId: getListsMembers
parameters:
- name: id
in: path
description: The ID of the List.
required: true
schema:
$ref: '#/components/schemas/ListId'
style: simple
- name: max_results
in: query
description: The maximum number of results.
required: false
schema:
type: integer
minimum: 1
maximum: 100
format: int32
default: 100
style: form
- name: pagination_token
in: query
description: This parameter is used to get a specified 'page' of results.
required: false
schema:
$ref: '#/components/schemas/PaginationTokenLong'
style: form
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/UserExpansionsParameter'
- $ref: '#/components/parameters/TweetFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Get2ListsIdMembersResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/tweets/{id}/liking_users:
get:
security:
- OAuth2UserToken:
- like.read
- tweet.read
- users.read
- UserToken: []
tags:
- Users
summary: Get Liking Users
description: Retrieves a list of Users who liked a specific Post by its ID.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/tweets/likes/api-reference/get-tweets-id-liking_users
operationId: getPostsLikingUsers
parameters:
- name: id
in: path
description: A single Post ID.
required: true
schema:
$ref: '#/components/schemas/TweetId'
style: simple
- name: max_results
in: query
description: The maximum number of results.
required: false
schema:
type: integer
minimum: 1
maximum: 100
format: int32
default: 100
style: form
- name: pagination_token
in: query
description: This parameter is used to get the next 'page' of results.
required: false
schema:
$ref: '#/components/schemas/PaginationToken36'
style: form
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/UserExpansionsParameter'
- $ref: '#/components/parameters/TweetFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Get2TweetsIdLikingUsersResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/tweets/{id}/retweeted_by:
get:
security:
- BearerToken: []
- OAuth2UserToken:
- tweet.read
- users.read
- UserToken: []
tags:
- Users
summary: Get Reposted by
description: Retrieves a list of Users who reposted a specific Post by its ID.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/tweets/retweets/api-reference/get-tweets-id-retweeted_by
operationId: getPostsRepostedBy
parameters:
- name: id
in: path
description: A single Post ID.
required: true
schema:
$ref: '#/components/schemas/TweetId'
style: simple
- name: max_results
in: query
description: The maximum number of results.
required: false
schema:
type: integer
minimum: 1
maximum: 100
format: int32
default: 100
style: form
- name: pagination_token
in: query
description: This parameter is used to get the next 'page' of results.
required: false
schema:
$ref: '#/components/schemas/PaginationToken36'
style: form
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/UserExpansionsParameter'
- $ref: '#/components/parameters/TweetFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Get2TweetsIdRetweetedByResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/users:
get:
security:
- BearerToken: []
- OAuth2UserToken:
- tweet.read
- users.read
- UserToken: []
tags:
- Users
summary: Get Users by IDs
description: Retrieves details of multiple Users by their IDs.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/users/lookup/api-reference/get-users
operationId: getUsersByIds
parameters:
- name: ids
in: query
description: A list of User IDs, comma-separated. You can specify up to 100 IDs.
required: true
example: 2244994945,6253282,12
schema:
type: array
minItems: 1
maxItems: 100
items:
$ref: '#/components/schemas/UserId'
explode: false
style: form
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/UserExpansionsParameter'
- $ref: '#/components/parameters/TweetFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Get2UsersResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/users/by:
get:
security:
- BearerToken: []
- OAuth2UserToken:
- tweet.read
- users.read
- UserToken: []
tags:
- Users
summary: Get Users by usernames
description: Retrieves details of multiple Users by their usernames.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/users/lookup/api-reference/get-users-by
operationId: getUsersByUsernames
parameters:
- name: usernames
in: query
description: A list of usernames, comma-separated.
required: true
schema:
type: array
minItems: 1
maxItems: 100
items:
type: string
description: The X handle (screen name) of this User.
pattern: ^[A-Za-z0-9_]{1,15}$
example: TwitterDev,TwitterAPI
explode: false
style: form
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/UserExpansionsParameter'
- $ref: '#/components/parameters/TweetFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Get2UsersByResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/users/by/username/{username}:
get:
security:
- BearerToken: []
- OAuth2UserToken:
- tweet.read
- users.read
- UserToken: []
tags:
- Users
summary: Get User by username
description: Retrieves details of a specific User by their username.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/users/lookup/api-reference/get-users-by-username-username
operationId: getUsersByUsername
parameters:
- name: username
in: path
description: A username.
required: true
example: TwitterDev
schema:
type: string
pattern: ^[A-Za-z0-9_]{1,15}$
style: simple
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/UserExpansionsParameter'
- $ref: '#/components/parameters/TweetFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Get2UsersByUsernameUsernameResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/users/me:
get:
security:
- OAuth2UserToken:
- tweet.read
- users.read
- UserToken: []
tags:
- Users
summary: Get my User
description: Retrieves details of the authenticated user.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/users/lookup/api-reference/get-users-me
operationId: getUsersMe
parameters:
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/UserExpansionsParameter'
- $ref: '#/components/parameters/TweetFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Get2UsersMeResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/users/public_keys:
get:
security:
- OAuth2UserToken:
- dm.read
- tweet.read
- users.read
- UserToken: []
tags:
- Users
summary: Get public keys for multiple users
description: Returns the public keys and Juicebox configuration for the specified users.
externalDocs:
url: https://developer.x.com/
operationId: getUsersPublicKeys
parameters:
- name: ids
in: query
description: A list of User IDs, comma-separated. You can specify up to 100 IDs.
required: true
example: 2244994945,6253282,12
schema:
type: array
minItems: 1
maxItems: 100
items:
$ref: '#/components/schemas/UserId'
explode: false
style: form
- $ref: '#/components/parameters/PublicKeyFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Get2UsersPublicKeysResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/users/reposts_of_me:
get:
security:
- OAuth2UserToken:
- timeline.read
- tweet.read
- UserToken: []
tags:
- Users
summary: Get Reposts of me
description: Retrieves a list of Posts that repost content from the authenticated user.
externalDocs:
url: https://docs.x.com/x-api/posts/retweets/quickstart/retweets-of-me#retweets-of-me
operationId: getUsersRepostsOfMe
parameters:
- name: max_results
in: query
description: The maximum number of results.
required: false
schema:
type: integer
minimum: 1
maximum: 100
format: int32
default: 100
style: form
- name: pagination_token
in: query
description: This parameter is used to get the next 'page' of results.
required: false
schema:
$ref: '#/components/schemas/PaginationToken36'
style: form
- $ref: '#/components/parameters/TweetFieldsParameter'
- $ref: '#/components/parameters/TweetExpansionsParameter'
- $ref: '#/components/parameters/MediaFieldsParameter'
- $ref: '#/components/parameters/PollFieldsParameter'
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/PlaceFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Get2UsersRepostsOfMeResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/users/search:
get:
security:
- OAuth2UserToken:
- tweet.read
- users.read
- UserToken: []
tags:
- Users
summary: Search Users
description: Retrieves a list of Users matching a search query.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/users/lookup/api-reference/get-users-search
operationId: searchUsers
parameters:
- name: query
in: query
description: TThe the query string by which to query for users.
required: true
example: someXUser
schema:
$ref: '#/components/schemas/UserSearchQueryVnext'
style: form
- name: max_results
in: query
description: The maximum number of results.
required: false
schema:
type: integer
minimum: 1
maximum: 1000
format: int32
default: 100
style: form
- name: next_token
in: query
description: 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.
required: false
schema:
$ref: '#/components/schemas/PaginationToken36'
style: form
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/UserExpansionsParameter'
- $ref: '#/components/parameters/TweetFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Get2UsersSearchResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/users/{id}:
get:
security:
- BearerToken: []
- OAuth2UserToken:
- tweet.read
- users.read
- UserToken: []
tags:
- Users
summary: Get User by ID
description: Retrieves details of a specific User by their ID.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/users/lookup/api-reference/get-users-id
operationId: getUsersById
parameters:
- name: id
in: path
description: The ID of the User to lookup.
required: true
example: '2244994945'
schema:
$ref: '#/components/schemas/UserId'
style: simple
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/UserExpansionsParameter'
- $ref: '#/components/parameters/TweetFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Get2UsersIdResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/users/{id}/affiliates:
get:
security:
- BearerToken: []
- OAuth2UserToken:
- tweet.read
- users.read
- UserToken: []
tags:
- Users
summary: Get affiliates
description: Retrieves a list of Users who are affiliated with a specific organization User by their ID.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/users/affiliates/api-reference/get-users-id-affiliates
operationId: getUsersAffiliates
parameters:
- name: id
in: path
description: The ID of the User to lookup.
required: true
example: '2244994945'
schema:
$ref: '#/components/schemas/UserId'
style: simple
- name: max_results
in: query
description: The maximum number of results.
required: false
schema:
type: integer
minimum: 1
maximum: 1000
format: int32
style: form
- name: pagination_token
in: query
description: This parameter is used to get a specified 'page' of results.
required: false
schema:
$ref: '#/components/schemas/PaginationTokenLong'
style: form
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/UserExpansionsParameter'
- $ref: '#/components/parameters/TweetFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Get2UsersIdAffiliatesResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/users/{id}/blocking:
get:
security:
- OAuth2UserToken:
- block.read
- tweet.read
- users.read
- UserToken: []
tags:
- Users
summary: Get blocking
description: Retrieves a list of Users blocked by the specified User ID.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/users/blocks/api-reference/get-users-blocking
operationId: getUsersBlocking
parameters:
- name: id
in: path
description: The ID of the authenticated source User for whom to return results.
required: true
schema:
$ref: '#/components/schemas/UserIdMatchesAuthenticatedUser'
style: simple
- name: max_results
in: query
description: The maximum number of results.
required: false
schema:
type: integer
minimum: 1
maximum: 1000
format: int32
style: form
- name: pagination_token
in: query
description: This parameter is used to get a specified 'page' of results.
required: false
schema:
$ref: '#/components/schemas/PaginationToken32'
style: form
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/UserExpansionsParameter'
- $ref: '#/components/parameters/TweetFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Get2UsersIdBlockingResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/users/{id}/bookmarks:
get:
security:
- OAuth2UserToken:
- bookmark.read
- tweet.read
- users.read
tags:
- Users
summary: Get Bookmarks
description: Retrieves a list of Posts bookmarked by the authenticated user.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/tweets/bookmarks/api-reference/get-users-id-bookmarks
operationId: getUsersBookmarks
parameters:
- name: id
in: path
description: The ID of the authenticated source User for whom to return results.
required: true
schema:
$ref: '#/components/schemas/UserIdMatchesAuthenticatedUser'
style: simple
- name: max_results
in: query
description: The maximum number of results.
required: false
schema:
type: integer
minimum: 1
maximum: 100
format: int32
style: form
- name: pagination_token
in: query
description: This parameter is used to get the next 'page' of results.
required: false
schema:
$ref: '#/components/schemas/PaginationToken36'
style: form
- $ref: '#/components/parameters/TweetFieldsParameter'
- $ref: '#/components/parameters/TweetExpansionsParameter'
- $ref: '#/components/parameters/MediaFieldsParameter'
- $ref: '#/components/parameters/PollFieldsParameter'
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/PlaceFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Get2UsersIdBookmarksResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
post:
security:
- OAuth2UserToken:
- bookmark.write
- tweet.read
- users.read
tags:
- Users
summary: Create Bookmark
description: Adds a post to the authenticated user’s bookmarks.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/tweets/bookmarks/api-reference/post-users-id-bookmarks
operationId: createUsersBookmark
parameters:
- name: id
in: path
description: The ID of the authenticated source User for whom to add bookmarks.
required: true
schema:
$ref: '#/components/schemas/UserIdMatchesAuthenticatedUser'
style: simple
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/BookmarkAddRequest'
required: true
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/BookmarkMutationResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/users/{id}/bookmarks/folders:
get:
security:
- OAuth2UserToken:
- bookmark.read
- users.read
tags:
- Users
summary: Get Bookmark folders
description: Retrieves a list of Bookmark folders created by the authenticated user.
externalDocs:
url: https://developer.x.com
operationId: getUsersBookmarkFolders
parameters:
- name: id
in: path
description: The ID of the authenticated source User for whom to return results.
required: true
schema:
$ref: '#/components/schemas/UserIdMatchesAuthenticatedUser'
style: simple
- name: max_results
in: query
description: The maximum number of results.
required: false
schema:
type: integer
minimum: 1
maximum: 100
format: int32
style: form
- name: pagination_token
in: query
description: This parameter is used to get the next 'page' of results.
required: false
schema:
$ref: '#/components/schemas/PaginationToken36'
style: form
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/BookmarkFoldersResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/users/{id}/bookmarks/folders/{folder_id}:
get:
security:
- OAuth2UserToken:
- bookmark.read
- tweet.read
- users.read
tags:
- Users
summary: Get Bookmarks by folder ID
description: Retrieves Posts in a specific Bookmark folder by its ID for the authenticated user.
externalDocs:
url: https://developer.x.com
operationId: getUsersBookmarksByFolderId
parameters:
- name: id
in: path
description: The ID of the authenticated source User for whom to return results.
required: true
schema:
$ref: '#/components/schemas/UserIdMatchesAuthenticatedUser'
style: simple
- name: folder_id
in: path
description: The ID of the Bookmark Folder that the authenticated User is trying to fetch Posts for.
required: true
schema:
$ref: '#/components/schemas/BookmarkFolderId'
style: simple
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/BookmarkFolderPostsResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/2/users/{id}/bookmarks/{tweet_id}:
delete:
security:
- OAuth2UserToken:
- bookmark.write
- tweet.read
- users.read
tags:
- Users
summary: Delete Bookmark
description: Removes a Post from the authenticated user’s Bookmarks by its ID.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/tweets/bookmarks/api-reference/delete-users-id-bookmarks-tweet_id
operationId: deleteUsersBookmark
parameters:
- name: id
in: path
description: The ID of the authenticated source User whose bookmark is to be removed.
required: true
schema:
$ref: '#/components/schemas/UserIdMatchesAuthenticatedUser'
style: simple
- name: tweet_id
in: path
description: The ID of the Post that the source User is removing from bookmarks.
required: true
schema:
$ref: '#/components/schemas/TweetId'
style: simple
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/BookmarkMutationResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/
# --- truncated at 32 KB (152 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/twitter-x/refs/heads/main/openapi/twitter-x-users-api-openapi.yml