TwittrAPI
v1.2.0Read public Twitter/X data: tweets, profiles, followers, search.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
get_user_by_username Get user by username
Get an X (Twitter) user's profile by handle: name, bio, follower/following counts, verification, created date, and the numeric user ID (rest_id) needed by other tools.
| Parameter | Type | Description |
|---|---|---|
username * | string | X handle without the URL, e.g. "elonmusk" (a leading @ is fine). |
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
get_user_by_id Get user by ID
Get an X user's profile by numeric user ID (rest_id). Same data as get_user_by_username.
| Parameter | Type | Description |
|---|---|---|
userId * | string | Numeric X user ID (rest_id). |
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
username_to_id Username to user ID
Resolve an X handle to its numeric user ID. Cheaper and smaller than get_user_by_username when you only need the ID.
| Parameter | Type | Description |
|---|---|---|
username * | string | X handle without the URL, e.g. "elonmusk" (a leading @ is fine). |
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
users_by_ids Get users by IDs
Get profiles for up to 500 X users in one call, by numeric user ID.
| Parameter | Type | Description |
|---|---|---|
ids * | array | Numeric X user IDs, 1 to 500. |
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
get_user_tweets Get user tweets
Get a user's recent tweets (their profile timeline, without replies), newest first, including retweets and pinned tweet. Paginated.
| Parameter | Type | Description |
|---|---|---|
count | integer | How many tweets to request per page (default 20). X may return slightly more or fewer. |
cursor | string | Pagination cursor. Leave empty for the first page; pass the next_cursor from a previous result to get the next page. |
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
userId | string | Numeric X user ID (rest_id). Provide this or username. Using the ID is faster. |
username | string | X handle, used when you do not have the user ID. Provide this or userId. |
get_user_tweets_and_replies Get user tweets and replies
Get a user's tweets including their replies to others, newest first. Paginated.
| Parameter | Type | Description |
|---|---|---|
count | integer | How many tweets to request per page (default 20). X may return slightly more or fewer. |
cursor | string | Pagination cursor. Leave empty for the first page; pass the next_cursor from a previous result to get the next page. |
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
userId | string | Numeric X user ID (rest_id). Provide this or username. Using the ID is faster. |
username | string | X handle, used when you do not have the user ID. Provide this or userId. |
get_user_media Get user media
Get a user's tweets that contain photos or videos. Paginated.
| Parameter | Type | Description |
|---|---|---|
count | integer | How many tweets to request per page (default 20). X may return slightly more or fewer. |
cursor | string | Pagination cursor. Leave empty for the first page; pass the next_cursor from a previous result to get the next page. |
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
userId | string | Numeric X user ID (rest_id). Provide this or username. Using the ID is faster. |
username | string | X handle, used when you do not have the user ID. Provide this or userId. |
get_followers Get followers
Get accounts that follow a user, newest followers first. Paginated.
| Parameter | Type | Description |
|---|---|---|
count | integer | How many users to request per page (default 20). X may return slightly more or fewer. |
cursor | string | Pagination cursor. Leave empty for the first page; pass the next_cursor from a previous result to get the next page. |
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
userId | string | Numeric X user ID (rest_id). Provide this or username. Using the ID is faster. |
username | string | X handle, used when you do not have the user ID. Provide this or userId. |
get_following Get following
Get accounts a user follows. Paginated.
| Parameter | Type | Description |
|---|---|---|
count | integer | How many users to request per page (default 20). X may return slightly more or fewer. |
cursor | string | Pagination cursor. Leave empty for the first page; pass the next_cursor from a previous result to get the next page. |
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
userId | string | Numeric X user ID (rest_id). Provide this or username. Using the ID is faster. |
username | string | X handle, used when you do not have the user ID. Provide this or userId. |
get_verified_followers Get verified followers
Get a user's followers that have a verified (blue check) badge. Paginated.
| Parameter | Type | Description |
|---|---|---|
count | integer | How many users to request per page (default 20). X may return slightly more or fewer. |
cursor | string | Pagination cursor. Leave empty for the first page; pass the next_cursor from a previous result to get the next page. |
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
userId | string | Numeric X user ID (rest_id). Provide this or username. Using the ID is faster. |
username | string | X handle, used when you do not have the user ID. Provide this or userId. |
get_user_affiliates Get affiliates
Get the accounts affiliated with an organization, as in the Affiliates tab of its profile. Empty for accounts without affiliates. Paginated.
| Parameter | Type | Description |
|---|---|---|
count | integer | How many users to request per page (default 20). X may return slightly more or fewer. |
cursor | string | Pagination cursor. Leave empty for the first page; pass the next_cursor from a previous result to get the next page. |
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
userId | string | Numeric X user ID (rest_id). Provide this or username. Using the ID is faster. |
username | string | X handle, used when you do not have the user ID. Provide this or userId. |
get_friendships_batch Get relationships with many accounts
Check whether one account follows up to 50 others, and whether they follow it back, in one call. Returns raw JSON: one relationship per target, in order, plus errors for handles that could not be looked up.
| Parameter | Type | Description |
|---|---|---|
sourceUsername * | string | The account to compare with the others, e.g. "jack" (a leading @ is fine). |
targetUsernames * | array | Accounts to check, 1 to 50 X handles (a leading @ is fine). Billed as one call per handle. |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
get_user_about_batch Get "About this account" for many users
Get the "About this account" data (country the account is based in, username changes, verification) of up to 20 accounts in one call. Returns raw JSON: one entry per handle, in order, plus errors for handles that could not be looked up.
| Parameter | Type | Description |
|---|---|---|
usernames * | array | Accounts to look up, 1 to 20 X handles (a leading @ is fine). Billed as one call per handle. |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
search_tweets Search tweets
Search X like the search box. Supports X search operators in the query, e.g. from:user, to:user, "exact phrase", lang:en, since:2025-01-01, until:2025-02-01, min_faves:100, filter:media, -filter:replies. category Latest gives newest first; People returns accounts instead of tweets. Paginated.
| Parameter | Type | Description |
|---|---|---|
searchItem * | string | Search query, max 512 characters. May contain X search operators. |
category | string | Result tab: Top (default), Latest, People, Photos or Videos. |
count | integer | How many results to request per page (default 20). X may return slightly more or fewer. |
cursor | string | Pagination cursor. Leave empty for the first page; pass the next_cursor from a previous result to get the next page. |
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
get_tweet Get tweet
Get a tweet by ID with full text, author, media, engagement counts and the reply thread (conversation). Use cursor to load more replies.
| Parameter | Type | Description |
|---|---|---|
tweetId * | string | Numeric tweet ID, the number at the end of a tweet URL. |
cursor | string | Pagination cursor. Leave empty for the first page; pass the next_cursor from a previous result to get the next page. |
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
rankingMode | string | Sort order. Default Relevance. |
get_tweet_retweets Get tweet retweeters
Get the users who retweeted a tweet. Paginated.
| Parameter | Type | Description |
|---|---|---|
tweetId * | string | Numeric tweet ID. |
count | integer | How many users to request per page (default 20). X may return slightly more or fewer. |
cursor | string | Pagination cursor. Leave empty for the first page; pass the next_cursor from a previous result to get the next page. |
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
get_tweet_quotes Get tweet quotes
Get tweets that quote a given tweet. Paginated.
| Parameter | Type | Description |
|---|---|---|
tweetId * | string | Numeric tweet ID. |
count | integer | How many tweets to request per page (default 20). X may return slightly more or fewer. |
cursor | string | Pagination cursor. Leave empty for the first page; pass the next_cursor from a previous result to get the next page. |
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
get_tweet_replies Get tweet replies
Get only the replies to a tweet, without the tweet itself or the tweets above it. Paginated.
| Parameter | Type | Description |
|---|---|---|
tweetId * | string | Numeric tweet ID. |
cursor | string | Pagination cursor. Leave empty for the first page; pass the next_cursor from a previous result to get the next page. |
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
includePromotedContent | boolean | Include promoted replies (default false). |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
rankingMode | string | Sort order. Default Relevance. |
get_tweet_thread Get tweet thread
Get the author's own thread around a tweet in reading order: their tweets above it and their replies to themselves below it, up to the first reply by someone else.
| Parameter | Type | Description |
|---|---|---|
tweetId * | string | Numeric tweet ID. |
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
get_list_details Get list details
Get an X list's name, description, owner, and member/follower counts.
| Parameter | Type | Description |
|---|---|---|
listId * | string | Numeric list ID, from the list URL. |
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
get_list_tweets Get list tweets
Get the tweet timeline of an X list (tweets from its members), newest first. Paginated.
| Parameter | Type | Description |
|---|---|---|
listId * | string | Numeric list ID. |
count | integer | How many tweets to request per page (default 20). X may return slightly more or fewer. |
cursor | string | Pagination cursor. Leave empty for the first page; pass the next_cursor from a previous result to get the next page. |
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
get_list_members Get list members
Get the accounts that are members of an X list. Paginated.
| Parameter | Type | Description |
|---|---|---|
listId * | string | Numeric list ID. |
count | integer | How many users to request per page (default 20). X may return slightly more or fewer. |
cursor | string | Pagination cursor. Leave empty for the first page; pass the next_cursor from a previous result to get the next page. |
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
get_community Get community
Get an X Community's name, description, rules, member count and admins.
| Parameter | Type | Description |
|---|---|---|
communityId * | string | Numeric community ID. |
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
get_community_about Get community about page
Get the About page of an X Community: description, rules, creation date, moderators and a preview of members. Returns raw JSON.
| Parameter | Type | Description |
|---|---|---|
communityId * | string | Numeric community ID. |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
get_community_tweets Get community tweets
Get tweets posted in an X Community. Paginated.
| Parameter | Type | Description |
|---|---|---|
communityId * | string | Numeric community ID. |
count | integer | How many tweets to request per page (default 20). X may return slightly more or fewer. |
cursor | string | Pagination cursor. Leave empty for the first page; pass the next_cursor from a previous result to get the next page. |
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
search_communities Search communities
Search X Communities by keyword. Returns community IDs for get_community and get_community_tweets. Paginated.
| Parameter | Type | Description |
|---|---|---|
searchTerm * | string | Keyword to search for. |
count | integer | How many communities to request per page (default 20). X may return slightly more or fewer. |
cursor | string | Pagination cursor. Leave empty for the first page; pass the next_cursor from a previous result to get the next page. |
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
get_trends Get trends
Get trending topics for a location by WOEID (1 = worldwide, 23424977 = United States, 23424975 = United Kingdom). Use get_trend_locations to look up other WOEIDs.
| Parameter | Type | Description |
|---|---|---|
locationId * | string | Yahoo WOEID of the location, e.g. "1" for worldwide. |
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
get_trend_locations Get trend locations
List the locations (countries and cities) that have trends, with their WOEIDs for get_trends.
| Parameter | Type | Description |
|---|---|---|
format | string | Response format (default simple). simple: compact JSON with flat camelCase tweets and users, about 60% fewer tokens. raw: X's full GraphQL JSON, only needed for fields simple leaves out (cards, polls,… |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |
get_space Get Space
Get an X Space by ID: title, state, host and participants, and whether a replay is available. Returns raw JSON.
| Parameter | Type | Description |
|---|---|---|
spaceId * | string | Space ID, the letters and digits at the end of the Space URL (x.com/i/spaces/<spaceId>). |
max_chars | integer | Maximum characters of JSON to return (default 50000). Longer output is cut with a [TRUNCATED] marker. Lower it to save context, raise it if you need the full response. |