X Users API
Endpoints related to retrieving, managing relationships of Users — 42 operation(s) in the X-published contract.
Endpoints related to retrieving, managing relationships of Users — 42 operation(s) in the X-published contract.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/x-users-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: X Users API
version: '1.0'
description: 'Operations tagged Users across 2 of this provider''s published API definitions: x-api-v2-openapi.json, x-openapi.yml. Each path carries the servers of the definition it was published in.'
servers:
- description: X API
url: https://api.x.com
- url: https://api.x.com/2
description: X API v2 production server
tags:
- name: Users
description: Endpoints related to retrieving, managing relationships of Users
externalDocs:
description: Find out more
url: https://docs.x.com/x-api/users/introduction
paths:
/2/users:
get:
security:
- OAuth2UserToken:
- tweet.read
- users.read
- UserToken: []
- BearerToken: []
tags:
- Users
summary: Get Users by IDs
operationId: getUsersByIds
parameters:
- name: ids
in: query
required: true
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/PostFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/GetUsersByIdsResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
servers:
- description: X API
url: https://api.x.com
/2/users/by:
get:
security:
- OAuth2UserToken:
- users.read
- tweet.read
- UserToken: []
- BearerToken: []
tags:
- Users
summary: Get Users by Usernames
operationId: getUsersByUsernames
parameters:
- name: usernames
in: query
required: true
schema:
type: array
minItems: 1
maxItems: 100
items:
type: string
pattern: ^[A-Za-z0-9_]{1,15}$
explode: false
style: form
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/UserExpansionsParameter'
- $ref: '#/components/parameters/PostFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/GetUsersByUsernamesResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
servers:
- description: X API
url: https://api.x.com
/2/users/by/username/{username}:
get:
security:
- OAuth2UserToken:
- tweet.read
- users.read
- UserToken: []
- BearerToken: []
tags:
- Users
summary: Get Users by Username
operationId: getUsersByUsername
parameters:
- name: username
in: path
required: true
schema:
type: string
pattern: ^[A-Za-z0-9_]{1,15}$
style: simple
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/UserExpansionsParameter'
- $ref: '#/components/parameters/PostFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/GetUsersByUsernameResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
servers:
- description: X API
url: https://api.x.com
/2/users/me:
get:
security:
- OAuth2UserToken:
- users.read
- tweet.read
- UserToken: []
tags:
- Users
summary: Get Users Me
operationId: getUsersMe
parameters:
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/UserExpansionsParameter'
- $ref: '#/components/parameters/PostFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/GetUsersMeResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
servers:
- description: X API
url: https://api.x.com
/2/users/public_keys:
get:
security:
- OAuth2UserToken:
- tweet.read
- dm.read
- users.read
- UserToken: []
tags:
- Users
summary: Get public keys
description: Returns registered public keys for X Chat encryption for the specified users.
externalDocs:
url: https://developer.x.com/
operationId: getUsersPublicKeys
parameters:
- name: ids
in: query
required: true
schema:
type: array
minItems: 1
maxItems: 100
items:
$ref: '#/components/schemas/PublicKeyId'
explode: false
style: form
- $ref: '#/components/parameters/PublicKeyFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/GetUsersPublicKeysResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
servers:
- description: X API
url: https://api.x.com
/2/users/reposts_of_me:
get:
security:
- OAuth2UserToken:
- timeline.read
- tweet.read
- UserToken: []
tags:
- Users
summary: Get Users Reposts of Me
operationId: getUsersRepostsOfMe
parameters:
- name: max_results
in: query
required: false
schema:
type: integer
minimum: 1
maximum: 100
format: int32
default: 100
style: form
- name: pagination_token
in: query
description: A base32hex-encoded pagination token.
required: false
schema:
type: string
minLength: 1
style: form
- $ref: '#/components/parameters/PostFieldsParameter'
- $ref: '#/components/parameters/PostExpansionsParameter'
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/MediaFieldsParameter'
- $ref: '#/components/parameters/PollFieldsParameter'
- $ref: '#/components/parameters/PlaceFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/GetUsersRepostsOfMeResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
servers:
- description: X API
url: https://api.x.com
/2/users/search:
get:
security:
- OAuth2UserToken:
- users.read
- tweet.read
- UserToken: []
tags:
- Users
summary: Search Users
operationId: searchUsers
parameters:
- name: query
in: query
required: true
schema:
type: string
pattern: ^[A-Za-z0-9_' ]{1,50}$
style: form
- name: max_results
in: query
required: false
schema:
type: integer
minimum: 1
maximum: 1000
format: int32
default: 100
style: form
- name: next_token
in: query
required: false
schema:
type: string
minLength: 1
style: form
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/UserExpansionsParameter'
- $ref: '#/components/parameters/PostFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/SearchUsersResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
servers:
- description: X API
url: https://api.x.com
/2/users/{id}:
get:
security:
- OAuth2UserToken:
- users.read
- tweet.read
- UserToken: []
- BearerToken: []
tags:
- Users
summary: Get Users by ID
operationId: getUsersById
parameters:
- name: id
in: path
required: true
schema:
$ref: '#/components/schemas/UserId'
style: simple
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/UserExpansionsParameter'
- $ref: '#/components/parameters/PostFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/GetUsersByIdResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
servers:
- description: X API
url: https://api.x.com
/2/users/{id}/affiliates:
get:
security:
- OAuth2UserToken:
- users.read
- tweet.read
- UserToken: []
- BearerToken: []
tags:
- Users
summary: Get Users Affiliates
operationId: getUsersAffiliates
parameters:
- name: id
in: path
required: true
schema:
$ref: '#/components/schemas/UserId'
style: simple
- name: max_results
in: query
required: false
schema:
type: integer
minimum: 1
maximum: 1000
format: int32
style: form
- name: pagination_token
in: query
description: A 64-bit signed integer.
required: false
schema:
type: string
style: form
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/UserExpansionsParameter'
- $ref: '#/components/parameters/PostFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/GetUsersAffiliatesResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
servers:
- description: X API
url: https://api.x.com
/2/users/{id}/blocking:
get:
security:
- OAuth2UserToken:
- block.read
- users.read
- tweet.read
- UserToken: []
tags:
- Users
summary: Get Users Blocking
operationId: getUsersBlocking
parameters:
- name: id
in: path
required: true
schema:
$ref: '#/components/schemas/UserId'
style: simple
- name: max_results
in: query
required: false
schema:
type: integer
minimum: 1
maximum: 1000
format: int32
style: form
- name: pagination_token
in: query
required: false
schema:
type: string
minLength: 16
style: form
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/UserExpansionsParameter'
- $ref: '#/components/parameters/PostFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/GetUsersBlockingResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
servers:
- description: X API
url: https://api.x.com
/2/users/{id}/bookmarks:
get:
security:
- OAuth2UserToken:
- bookmark.read
- tweet.read
- users.read
- UserToken: []
tags:
- Users
summary: Get Users Bookmarks
operationId: getUsersBookmarks
parameters:
- name: id
in: path
required: true
schema:
$ref: '#/components/schemas/UserId'
style: simple
- name: max_results
in: query
required: false
schema:
type: integer
minimum: 1
maximum: 100
format: int32
style: form
- name: pagination_token
in: query
description: A base32hex-encoded pagination token.
required: false
schema:
type: string
minLength: 1
style: form
- $ref: '#/components/parameters/PostFieldsParameter'
- $ref: '#/components/parameters/PostExpansionsParameter'
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/MediaFieldsParameter'
- $ref: '#/components/parameters/PollFieldsParameter'
- $ref: '#/components/parameters/PlaceFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/GetUsersBookmarksResponse'
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:
- users.read
- bookmark.write
- tweet.read
tags:
- Users
summary: Create Users Bookmark
operationId: createUsersBookmark
parameters:
- name: id
in: path
required: true
schema:
$ref: '#/components/schemas/UserId'
style: simple
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateUsersBookmarkRequest'
required: true
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/CreateUsersBookmarkResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
servers:
- description: X API
url: https://api.x.com
/2/users/{id}/bookmarks/folders:
get:
security:
- OAuth2UserToken:
- users.read
- bookmark.read
- UserToken: []
tags:
- Users
summary: Get Users Bookmark Folders
operationId: getUsersBookmarkFolders
parameters:
- name: id
in: path
required: true
schema:
$ref: '#/components/schemas/UserId'
style: simple
- name: max_results
in: query
required: false
schema:
type: integer
minimum: 1
maximum: 100
format: int32
style: form
- name: pagination_token
in: query
description: A base32hex-encoded pagination token.
required: false
schema:
type: string
minLength: 1
style: form
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/GetUsersBookmarkFoldersResponse'
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:
- users.read
- bookmark.write
tags:
- Users
summary: Create Bookmark Folder
description: Creates a new Bookmark folder for the authenticated user.
operationId: createUsersBookmarkFolder
parameters:
- name: id
in: path
required: true
schema:
$ref: '#/components/schemas/UserId'
style: simple
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateUsersBookmarkFolderRequest'
required: true
responses:
'201':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/CreateUsersBookmarkFolderResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
servers:
- description: X API
url: https://api.x.com
/2/users/{id}/bookmarks/folders/{folder_id}:
get:
security:
- OAuth2UserToken:
- users.read
- tweet.read
- bookmark.read
- UserToken: []
tags:
- Users
summary: Get Users Bookmarks by Folder ID
operationId: getUsersBookmarksByFolderId
parameters:
- name: id
in: path
required: true
schema:
$ref: '#/components/schemas/UserId'
style: simple
- name: folder_id
in: path
required: true
schema:
type: string
pattern: ^[0-9]{1,19}$
style: simple
- name: max_results
in: query
required: false
schema:
type: integer
minimum: 1
maximum: 100
format: int32
style: form
- name: pagination_token
in: query
description: A base32hex-encoded pagination token.
required: false
schema:
type: string
style: form
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/GetUsersBookmarksByFolderIdResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
servers:
- description: X API
url: https://api.x.com
/2/users/{id}/bookmarks/{tweet_id}:
delete:
security:
- OAuth2UserToken:
- users.read
- tweet.read
- bookmark.write
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
required: true
schema:
$ref: '#/components/schemas/UserId'
style: simple
- name: tweet_id
in: path
required: true
schema:
$ref: '#/components/schemas/PostId'
style: simple
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/DeleteUsersBookmarkResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
servers:
- description: X API
url: https://api.x.com
/2/users/{id}/dm/block:
post:
security:
- OAuth2UserToken:
- tweet.read
- dm.write
- users.read
- UserToken: []
tags:
- Users
summary: Block Users Dms
operationId: blockUsersDms
parameters:
- name: id
in: path
required: true
schema:
$ref: '#/components/schemas/UserId'
style: simple
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/BlockUsersDmsResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
servers:
- description: X API
url: https://api.x.com
/2/users/{id}/dm/unblock:
post:
security:
- OAuth2UserToken:
- dm.write
- users.read
- tweet.read
- UserToken: []
tags:
- Users
summary: Unblock Users Dms
operationId: unblockUsersDms
parameters:
- name: id
in: path
required: true
schema:
$ref: '#/components/schemas/UserId'
style: simple
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/UnblockUsersDmsResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
servers:
- description: X API
url: https://api.x.com
/2/users/{id}/followed_lists:
get:
security:
- OAuth2UserToken:
- list.read
- tweet.read
- users.read
- UserToken: []
- BearerToken: []
tags:
- Users
summary: Get Users Followed Lists
operationId: getUsersFollowedLists
parameters:
- name: id
in: path
required: true
schema:
$ref: '#/components/schemas/UserId'
style: simple
- name: max_results
in: query
required: false
schema:
type: integer
minimum: 1
maximum: 100
format: int32
default: 100
style: form
- name: pagination_token
in: query
description: A 64-bit signed integer.
required: false
schema:
type: string
style: form
- $ref: '#/components/parameters/ListFieldsParameter'
- $ref: '#/components/parameters/ListExpansionsParameter'
- $ref: '#/components/parameters/UserFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/GetUsersFollowedListsResponse'
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:
- tweet.read
- list.write
- users.read
- UserToken: []
tags:
- Users
summary: Follow List
operationId: followList
parameters:
- name: id
in: path
required: true
schema:
$ref: '#/components/schemas/UserId'
style: simple
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/FollowListRequest'
required: true
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/FollowListResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
servers:
- description: X API
url: https://api.x.com
/2/users/{id}/followed_lists/{list_id}:
delete:
security:
- OAuth2UserToken:
- tweet.read
- list.write
- users.read
- UserToken: []
tags:
- Users
summary: Unfollow a List
description: Causes the authenticated user to unfollow a List by its ID.
externalDocs:
url: https://developer.twitter.com/en/docs/twitter-api/lists/list-follows/api-reference/delete-users-id-followed-lists-list_id
operationId: unfollowList
parameters:
- name: id
in: path
required: true
schema:
$ref: '#/components/schemas/UserId'
style: simple
- name: list_id
in: path
required: true
schema:
$ref: '#/components/schemas/ListId'
style: simple
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/UnfollowListResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
servers:
- description: X API
url: https://api.x.com
/2/users/{id}/followers:
get:
security:
- OAuth2UserToken:
- users.read
- tweet.read
- follows.read
- UserToken: []
- BearerToken: []
tags:
- Users
summary: Get Users Followers
operationId: getUsersFollowers
parameters:
- name: id
in: path
required: true
schema:
$ref: '#/components/schemas/UserId'
style: simple
- name: max_results
in: query
required: false
schema:
type: integer
minimum: 1
maximum: 1000
format: int32
style: form
- name: pagination_token
in: query
description: A base32hex-encoded pagination token.
required: false
schema:
type: string
minLength: 16
style: form
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/UserExpansionsParameter'
- $ref: '#/components/parameters/PostFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/GetUsersFollowersResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
servers:
- description: X API
url: https://api.x.com
/2/users/{id}/following:
get:
security:
- OAuth2UserToken:
- tweet.read
- follows.read
- users.read
- UserToken: []
- BearerToken: []
tags:
- Users
summary: Get Users Following
operationId: getUsersFollowing
parameters:
- name: id
in: path
required: true
schema:
$ref: '#/components/schemas/UserId'
style: simple
- name: max_results
in: query
required: false
schema:
type: integer
minimum: 1
maximum: 1000
format: int32
style: form
- name: pagination_token
in: query
description: A base32hex-encoded pagination token.
required: false
schema:
type: string
minLength: 16
style: form
- $ref: '#/components/parameters/UserFieldsParameter'
- $ref: '#/components/parameters/UserExpansionsParameter'
- $ref: '#/components/parameters/PostFieldsParameter'
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/GetUsersFollowingResponse'
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:
- users.read
- follows.write
- tweet.read
- UserToken: []
tags:
- Users
summary: Follow User
operationId: followUser
parameters:
- name: id
in: path
required: true
schema:
$ref: '#/components/schemas/UserId'
style: simple
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/FollowUserRequest'
required: true
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/FollowUserResponse'
default:
de
# --- truncated at 32 KB (146 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/x/refs/heads/main/openapi/x-users-api-openapi.yml