Skip to content
Talk to an Engineer Dashboard

Twitter (X)

Connect to Twitter (X). Read and write tweets, manage users, follows, bookmarks, spaces, and more using the Twitter API v2.

Connect to Twitter (X). Read and write tweets, manage users, follows, bookmarks, spaces, and more using the Twitter API v2.

Twitter (X) logo

Supports authentication: OAuth 2.0

Register your Twitter (X) app credentials with Scalekit so it can manage the OAuth 2.0 (PKCE) authentication flow and token lifecycle on your behalf. You’ll need a Client ID and Client Secret from the Twitter Developer Portal.

  1. Create a Twitter developer project and app

    • Go to the Twitter Developer Portal and sign in with your Twitter account.

      Twitter Developer Portal dashboard
    • Click + Create Project, give your project a meaningful name, select a use case, and add a description.

    • Create an app within the project. Give your app a name (e.g., Scalekit-Agent).

      Twitter create app form with app name field
  2. Configure user authentication settings

    • Inside your app, go to User authentication settings and click Set up.

    • Configure the following:

      • App permissions — select Read and write (or Read if your agent only reads data)
      • Type of App — select Web App, Automated App or Bot
      • Website URL — enter your application’s homepage URL
  3. Get the redirect URI from Scalekit

    • In Scalekit dashboard, go to Agent AuthCreate Connection. Search for Twitter and click Create.

      Searching for Twitter in Scalekit Create Connection
    • Copy the Redirect URI from the connection configuration panel. It looks like https://<SCALEKIT_ENVIRONMENT_URL>/sso/v1/oauth/<CONNECTION_ID>/callback.

      Configure Twitter Connection panel showing Redirect URI, Client ID, and Client Secret fields
  4. Add the callback URL in Twitter

    • Back in the Twitter Developer Portal, inside User authentication settings, paste the Scalekit Redirect URI into the Callback URI / Redirect URL field.

    • Click Save to apply the authentication settings.

      Twitter app User authentication settings with Scalekit callback URL configured
  5. Copy your client credentials

    • In the Twitter Developer Portal, go to Keys and tokens for your app.

    • Under OAuth 2.0 Client ID and Client Secret, click Generate (or Regenerate if credentials already exist).

    • Copy the Client ID and Client Secret immediately. The secret will not be shown again.

      Twitter app Keys and tokens page showing OAuth 2.0 Client ID and Client Secret
  6. Add credentials in Scalekit

    • In Scalekit dashboard, go to Agent AuthConnections and open the Twitter connection you created.

    • Enter your credentials:

      • Client ID — the Client ID from your Twitter app

      • Client Secret — the secret you generated in step 5

      • Scopes — select the scopes your agent needs. Common scopes:

        ScopeWhat it grants
        tweet.readRead tweets and timelines
        tweet.writePost, delete, and manage tweets
        users.readRead user profile information
        follows.readRead following and follower lists
        follows.writeFollow and unfollow users
        like.readRead liked tweets
        like.writeLike and unlike tweets
        bookmark.readRead bookmarked tweets
        bookmark.writeAdd and remove bookmarks
        offline.accessObtain refresh tokens for long-lived access
    • Click Save.

Connect a user’s Twitter (X) account and make API calls on their behalf — Scalekit handles OAuth 2.0 (PKCE), token storage, and refresh automatically.

You can interact with Twitter (X) in two ways — via direct proxy API calls or via Scalekit optimized tool calls. Scroll down to see the list of available Scalekit tools.

Proxy API calls

import { ScalekitClient } from '@scalekit-sdk/node';
import 'dotenv/config';
const connectionName = 'twitter'; // get your connection name from connection configurations
const identifier = 'user_123'; // your unique user identifier
// Get your credentials from app.scalekit.com → Developers → Settings → API Credentials
const scalekit = new ScalekitClient(
process.env.SCALEKIT_ENV_URL,
process.env.SCALEKIT_CLIENT_ID,
process.env.SCALEKIT_CLIENT_SECRET
);
const actions = scalekit.actions;
// Authenticate the user — send this link to your user
const { link } = await actions.getAuthorizationLink({
connectionName,
identifier,
});
console.log('Authorize Twitter:', link);
process.stdout.write('Press Enter after authorizing...');
await new Promise(r => process.stdin.once('data', r));
// Fetch the authenticated user's Twitter profile via Scalekit proxy
const user = await actions.request({
connectionName,
identifier,
path: '/2/users/me',
method: 'GET',
});
console.log(user);

Scalekit tools

Creates a subscription for an X activity event. Use when you need to monitor specific user activities like profile updates, follows, or spaces events.

NameTypeRequiredDescription
event_typesarray<string>YesList of event types to subscribe to, e.g. profile.updated, follows, spaces
user_idstringYesTwitter user ID to subscribe to activities for

Retrieves the authenticated user’s block list. The id parameter must be the authenticated user’s ID. Use Get Authenticated User action first to obtain your user ID.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idstringYesAuthenticated user’s Twitter ID — must match the authenticated user
max_resultsintegerNoMax results per page (1-1000)
pagination_tokenstringNoPagination token for next page
user_fieldsstringNoComma-separated user fields

Adds a specified, existing, and accessible Tweet to a user’s bookmarks. Success is indicated by the ‘bookmarked’ field in the response.

NameTypeRequiredDescription
idstringYesAuthenticated user’s Twitter ID
tweet_idstringYesID of the Tweet to bookmark

Removes a Tweet from the authenticated user’s bookmarks. The Tweet must have been previously bookmarked by the user for the action to have an effect.

NameTypeRequiredDescription
idstringYesAuthenticated user’s Twitter ID
tweet_idstringYesID of the bookmarked tweet to remove

Retrieves Tweets bookmarked by the authenticated user. The provided User ID must match the authenticated user’s ID.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idstringYesAuthenticated user’s Twitter ID
max_resultsintegerNoMax results per page (1-100)
pagination_tokenstringNoPagination token for next page
tweet_fieldsstringNoComma-separated tweet fields

Creates a new compliance job to check the status of Tweet or user IDs. Upload IDs as a plain text file (one ID per line) to the upload_url received in the response.

NameTypeRequiredDescription
resumablebooleanNoWhether the job should be resumable
typestringYesType of compliance job

Retrieves status, download/upload URLs, and other details for an existing Twitter compliance job specified by its unique ID.

NameTypeRequiredDescription
idstringYesCompliance job ID

Returns a list of recent compliance jobs, filtered by type (tweets or users) and optionally by status.

NameTypeRequiredDescription
statusstringNoFilter by job status
typestringYesType of compliance jobs to list

Fetches Direct Message (DM) events for a one-on-one conversation with a specified participant ID, ordered chronologically newest to oldest. Does not support group DMs.

NameTypeRequiredDescription
dm_event_fieldsstringNoComma-separated DM event fields
event_typesstringNoFilter by event types
expansionsstringNoComma-separated expansions
max_resultsintegerNoMax results per page (1-100)
pagination_tokenstringNoPagination token for next page
participant_idstringYesUser ID of the DM conversation participant

Retrieves Direct Message (DM) events for a specific conversation ID on Twitter. Useful for analyzing messages and participant activities.

NameTypeRequiredDescription
dm_conversation_idstringYesDM conversation ID
dm_event_fieldsstringNoComma-separated DM event fields
expansionsstringNoComma-separated expansions
max_resultsintegerNoMax results per page (1-100)
pagination_tokenstringNoPagination token for next page

Sends a message with optional text and/or media attachments (using pre-uploaded media_ids) to a specified Twitter Direct Message conversation.

NameTypeRequiredDescription
dm_conversation_idstringYesDM conversation ID to send the message to
media_idstringNoPre-uploaded media ID to attach
textstringNoMessage text

Permanently deletes a specific Twitter Direct Message (DM) event using its event_id, if the authenticated user sent it. This action is irreversible and does not delete entire conversations.

NameTypeRequiredDescription
event_idstringYesID of the DM event to delete
participant_idstringYesUser ID of the DM conversation participant

Fetches a specific Direct Message (DM) event by its unique ID. Allows optional expansion of related data like users or tweets.

NameTypeRequiredDescription
dm_event_fieldsstringNoComma-separated DM event fields
event_idstringYesDM event ID
expansionsstringNoComma-separated expansions

Returns recent Direct Message events for the authenticated user, such as new messages or changes in conversation participants.

NameTypeRequiredDescription
dm_event_fieldsstringNoComma-separated DM event fields
event_typesstringNoFilter by event types
expansionsstringNoComma-separated expansions
max_resultsintegerNoMax results per page (1-100)
pagination_tokenstringNoPagination token for next page

Creates a new group Direct Message (DM) conversation on Twitter. The conversation_type must be ‘Group’. Include participant_ids and an initial message with text and optional media attachments using media_id (not media_url). Media must be uploaded first.

NameTypeRequiredDescription
message_media_idsarray<string>NoMedia IDs to attach to initial message
message_textstringYesInitial message text
participant_idsarray<string>YesList of Twitter user IDs to include

Sends a new Direct Message with text and/or media (media_id for attachments must be pre-uploaded) to a specified Twitter user. Creates a new DM and does not modify existing messages.

NameTypeRequiredDescription
media_idstringNoPre-uploaded media ID to attach
participant_idstringYesTwitter user ID of the DM recipient
textstringNoMessage text

Retrieves a list of users who follow a specified public Twitter user ID.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idstringYesTwitter user ID to get followers for
max_resultsintegerNoMax results per page (1-1000)
pagination_tokenstringNoPagination token for next page
user_fieldsstringNoComma-separated user fields

Retrieves users followed by a specific Twitter user, allowing pagination and customization of returned user and tweet data fields via expansions.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idstringYesTwitter user ID
max_resultsintegerNoMax results per page (1-1000)
pagination_tokenstringNoPagination token for next page
user_fieldsstringNoComma-separated user fields

Searches the full archive of public Tweets from March 2006 onwards. Use start_time and end_time together for a defined time window. Requires Academic Research access.

NameTypeRequiredDescription
end_timestringNoISO 8601 end time
expansionsstringNoComma-separated expansions
max_resultsintegerNoMax results per page (10-500)
next_tokenstringNoNext page token
querystringYesSearch query using X search syntax
since_idstringNoMinimum tweet ID
start_timestringNoISO 8601 start time e.g. 2021-01-01T00:00:00Z
tweet_fieldsstringNoComma-separated tweet fields
until_idstringNoMaximum tweet ID
user_fieldsstringNoComma-separated user fields

Returns a count of Tweets from the full archive that match a specified query, aggregated by day, hour, or minute. start_time must be before end_time if both are provided. since_id/until_id cannot be used with start_time/end_time.

NameTypeRequiredDescription
end_timestringNoISO 8601 end time
granularitystringNoAggregation granularity
next_tokenstringNoNext page token
querystringYesSearch query
since_idstringNoMinimum tweet ID
start_timestringNoISO 8601 start time
until_idstringNoMaximum tweet ID

Creates a new, empty List on X (formerly Twitter). The provided name must be unique for the authenticated user. Accounts are added separately.

NameTypeRequiredDescription
descriptionstringNoDescription of the list
namestringYesUnique name for the new list
privatebooleanNoWhether the list should be private

Permanently deletes a specified Twitter List using its ID. The list must be owned by the authenticated user. This action is irreversible.

NameTypeRequiredDescription
list_idstringYesID of the Twitter List to delete

Allows the authenticated user to follow a specific Twitter List they are permitted to access, subscribing them to the list’s timeline. This does not automatically follow individual list members.

NameTypeRequiredDescription
idstringYesAuthenticated user’s Twitter ID
list_idstringYesID of the list to follow

Fetches a list of users who follow a specific Twitter List, identified by its ID. Ensure the authenticated user has access if the list is private.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idstringYesTwitter List ID
max_resultsintegerNoMax results per page (1-100)
pagination_tokenstringNoPagination token for next page
user_fieldsstringNoComma-separated user fields

Returns metadata for a specific Twitter List, identified by its ID. Does not return list members. Can expand the owner’s User object via the expansions parameter.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idstringYesTwitter List ID
list_fieldsstringNoComma-separated list fields
user_fieldsstringNoComma-separated user fields

Adds a user to a specified Twitter List. The list must be owned by the authenticated user.

NameTypeRequiredDescription
list_idstringYesID of the Twitter List
user_idstringYesID of the user to add

Removes a user from a Twitter List. The response is_member field will be false if removal was successful or the user was not a member. The updated list of members is not returned.

NameTypeRequiredDescription
idstringYesTwitter List ID
user_idstringYesID of the user to remove from the list

Fetches members of a specific Twitter List, identified by its unique ID.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idstringYesTwitter List ID
max_resultsintegerNoMax results per page (1-100)
pagination_tokenstringNoPagination token for next page
user_fieldsstringNoComma-separated user fields

Pins a specified List to the authenticated user’s profile. The List must exist, the user must have access rights, and the pin limit (typically 5 Lists) must not be exceeded.

NameTypeRequiredDescription
idstringYesAuthenticated user’s Twitter ID
list_idstringYesID of the list to pin

Fetches the most recent Tweets posted by members of a specified Twitter List.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idstringYesTwitter List ID
max_resultsintegerNoMax results per page (1-100)
pagination_tokenstringNoPagination token for next page
tweet_fieldsstringNoComma-separated tweet fields
user_fieldsstringNoComma-separated user fields

Enables a user to unfollow a specific Twitter List, which removes its tweets from their timeline and stops related notifications. Reports following: false on success, even if the user was not initially following the list.

NameTypeRequiredDescription
idstringYesAuthenticated user’s Twitter ID
list_idstringYesID of the list to unfollow

Unpins a List from the authenticated user’s profile. The user ID is automatically retrieved if not provided.

NameTypeRequiredDescription
idstringYesAuthenticated user’s Twitter ID
list_idstringYesID of the list to unpin

Updates an existing Twitter List’s name, description, or privacy status. Requires the List ID and at least one mutable property.

NameTypeRequiredDescription
descriptionstringNoNew description
idstringYesTwitter List ID to update
namestringNoNew name for the list
privatebooleanNoSet to true to make private, false for public

Uploads media (images only) to X/Twitter using the v2 API. Only supports images (tweet_image, dm_image) and subtitle files. For GIFs, videos, or any file larger than ~5 MB, use twitter_media_upload_large instead.

NameTypeRequiredDescription
mediastringYesBase64-encoded image data
media_categorystringNoMedia category for use context
media_typestringYesMIME type, e.g. image/jpeg or image/png

Appends a data chunk to an ongoing media upload session on X/Twitter. Use during chunked media uploads to append each segment of media data in sequence.

NameTypeRequiredDescription
media_datastringYesBase64-encoded chunk data
media_idstringYesMedia ID from the INIT step
segment_indexintegerYesZero-based index of the chunk segment

Uploads media to X/Twitter using base64-encoded data. Use when you have media content as a base64 string. Only supports images and subtitle files. For videos or GIFs, use twitter_media_upload_large.

NameTypeRequiredDescription
media_categorystringNoMedia category for use context
media_datastringYesBase64-encoded media data
media_typestringYesMIME type, e.g. image/jpeg

Initializes a media upload session for X/Twitter. Returns a media_id for subsequent APPEND and FINALIZE commands. Required for uploading large files or when using the chunked upload workflow.

NameTypeRequiredDescription
additional_ownersstringNoComma-separated user IDs to also own the media
media_categorystringNoMedia category for use context
media_typestringYesMIME type, e.g. video/mp4 or image/gif
total_bytesintegerYesTotal size of the media file in bytes

Uploads media files to X/Twitter. Automatically uses chunked upload for GIFs, videos, and images larger than 5 MB. Use for videos, GIFs, or any file larger than 5 MB.

NameTypeRequiredDescription
additional_ownersstringNoComma-separated user IDs to also own the media
media_categorystringNoMedia category for use context
media_datastringYesBase64-encoded media file data
media_typestringYesMIME type, e.g. video/mp4 or image/gif
total_bytesintegerYesTotal size of the file in bytes

Gets the status of a media upload for X/Twitter. Use to check the processing status of uploaded media, especially for videos and GIFs. Only needed if the FINALIZE command returned processing_info.

NameTypeRequiredDescription
media_idstringYesMedia ID from the upload INIT step

Returns user objects muted by the X user identified by the id path parameter.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idstringYesTwitter user ID
max_resultsintegerNoMax results per page (1-1000)
pagination_tokenstringNoPagination token for next page
user_fieldsstringNoComma-separated user fields

Fetches the OpenAPI specification (JSON) for Twitter’s API v2. Used to programmatically understand the API’s structure for developing client libraries or tools.

Retrieves analytics data for specified Posts within a defined time range. Returns engagement metrics, impressions, and other analytics. Requires OAuth 2.0 with tweet.read and users.read scopes.

NameTypeRequiredDescription
end_timestringYesISO 8601 end time
start_timestringYesISO 8601 start time
tweet_idsstringYesComma-separated list of Tweet IDs

Creates a Tweet on Twitter. The text field is required unless card_uri, media_media_ids, poll_options, or quote_tweet_id is provided. Supports media, polls, geo, and reply targeting.

NameTypeRequiredDescription
geo_place_idstringNoPlace ID for geo tag
media_media_idsarray<string>NoMedia IDs to attach
poll_duration_minutesintegerNoDuration of poll in minutes
poll_optionsarray<string>NoUp to 4 poll options
quote_tweet_idstringNoID of the tweet to quote
reply_in_reply_to_tweet_idstringNoID of the tweet to reply to
textstringNoText content of the tweet

Irreversibly deletes a specific Tweet by its ID. The Tweet may persist in third-party caches after deletion.

NameTypeRequiredDescription
idstringYesID of the Tweet to delete

Allows the authenticated user to like a specific, accessible Tweet. The authenticated user’s ID is automatically determined from the OAuth token — you only need to provide the tweet_id.

NameTypeRequiredDescription
idstringYesAuthenticated user’s Twitter ID
tweet_idstringYesID of the Tweet to like

Retrieves users who have liked the Post (Tweet) identified by the provided ID.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idstringYesTweet ID
max_resultsintegerNoMax results per page (1-100)
pagination_tokenstringNoPagination token for next page
user_fieldsstringNoComma-separated user fields

Fetches comprehensive details for a single Tweet by its unique ID, provided the Tweet exists and is accessible.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idstringYesTweet ID
media_fieldsstringNoComma-separated media fields
tweet_fieldsstringNoComma-separated tweet fields
user_fieldsstringNoComma-separated user fields

Retrieves Tweets that quote a specified Tweet. Requires a valid Tweet ID.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idstringYesTweet ID
max_resultsintegerNoMax results per page (1-100)
pagination_tokenstringNoPagination token for next page
tweet_fieldsstringNoComma-separated tweet fields

Retweets a Tweet for the authenticated user. The user ID is automatically fetched from the authenticated session — you only need to provide the tweet_id.

NameTypeRequiredDescription
idstringYesAuthenticated user’s Twitter ID
tweet_idstringYesID of the Tweet to retweet

Retrieves users who publicly retweeted a specified public Post ID, excluding Quote Tweets and retweets from private accounts.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idstringYesTweet ID
max_resultsintegerNoMax results per page (1-100)
pagination_tokenstringNoPagination token for next page
user_fieldsstringNoComma-separated user fields

Retrieves Tweets that Retweeted a specified public or authenticated-user-accessible Tweet ID. Optionally customize the response with fields and expansions.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idstringYesTweet ID
max_resultsintegerNoMax results per page (1-100)
pagination_tokenstringNoPagination token for next page
tweet_fieldsstringNoComma-separated tweet fields

Allows an authenticated user to remove their like from a specific post. The action is idempotent and completes successfully even if the post was not liked.

NameTypeRequiredDescription
idstringYesAuthenticated user’s Twitter ID
tweet_idstringYesID of the Tweet to unlike

Removes a user’s retweet of a specified Post, if the user had previously retweeted it.

NameTypeRequiredDescription
idstringYesAuthenticated user’s Twitter ID
source_tweet_idstringYesID of the Tweet to unretweet

Retrieves detailed information for one or more Posts (Tweets) identified by their unique IDs. Allows selection of specific fields and expansions.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idsstringYesComma-separated list of Tweet IDs (up to 100)
media_fieldsstringNoComma-separated media fields
tweet_fieldsstringNoComma-separated tweet fields
user_fieldsstringNoComma-separated user fields

Searches Tweets from the last 7 days matching a query using X’s search syntax. Ideal for real-time analysis, trend monitoring, or retrieving posts from specific users (e.g., from:username). Note: impression_count returns 0 for other users’ tweets — use retweet_count, like_count, or quote_count for engagement filtering instead.

NameTypeRequiredDescription
end_timestringNoISO 8601 end time
expansionsstringNoComma-separated expansions
max_resultsintegerNoMax results per page (10-100)
media_fieldsstringNoComma-separated media fields
next_tokenstringNoNext page token
querystringYesSearch query using X search syntax, e.g. from:username -is:retweet
since_idstringNoMinimum tweet ID
start_timestringNoISO 8601 start time
tweet_fieldsstringNoComma-separated tweet fields
until_idstringNoMaximum tweet ID
user_fieldsstringNoComma-separated user fields

Retrieves the count of Tweets matching a specified search query within the last 7 days, aggregated by ‘minute’, ‘hour’, or ‘day’.

NameTypeRequiredDescription
end_timestringNoISO 8601 end time
granularitystringNoAggregation granularity
querystringYesSearch query
since_idstringNoMinimum tweet ID
start_timestringNoISO 8601 start time
until_idstringNoMaximum tweet ID

Hides or unhides an existing reply Tweet. Allows the authenticated user to hide or unhide a reply to a conversation they own. You can only hide replies to posts you authored. Requires tweet.moderate.write OAuth scope.

NameTypeRequiredDescription
hiddenbooleanYestrue to hide, false to unhide
tweet_idstringYesID of the reply tweet to hide or unhide

Retrieves details for a Twitter Space by its ID, allowing for customization and expansion of related data.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idstringYesTwitter Space ID
space_fieldsstringNoComma-separated space fields
user_fieldsstringNoComma-separated user fields

Retrieves Tweets that were shared/posted during a Twitter Space broadcast. Returns Tweets that participants explicitly shared during the Space session, NOT audio transcripts. Most Spaces have zero associated Tweets — empty results are normal.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idstringYesTwitter Space ID
max_resultsintegerNoMax results per page (1-100)
tweet_fieldsstringNoComma-separated tweet fields

Retrieves a list of users who purchased tickets for a specific, valid, and ticketed Twitter Space.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idstringYesTwitter Space ID
user_fieldsstringNoComma-separated user fields

Retrieves Twitter Spaces created by a list of specified User IDs, with options to customize returned data fields.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
space_fieldsstringNoComma-separated space fields
user_fieldsstringNoComma-separated user fields
user_idsstringYesComma-separated list of user IDs to get spaces for

Fetches detailed information for one or more Twitter Spaces (live, scheduled, or ended) by their unique IDs. At least one Space ID must be provided.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idsstringYesComma-separated list of Space IDs
space_fieldsstringNoComma-separated space fields
user_fieldsstringNoComma-separated user fields

Searches for Twitter Spaces by a textual query. Optionally filter by state (live, scheduled, all) to discover audio conversations.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
max_resultsintegerNoMax results per page (1-100)
querystringYesText to search for in Space titles
space_fieldsstringNoComma-separated space fields
statestringNoFilter by space state

Stream real-time Tweet label events (apply/remove). Requires Enterprise access and App-Only OAuth 2.0 auth. Returns PublicTweetNotice or PublicTweetUnviewable events. 403 errors indicate missing Enterprise access or wrong auth type.

NameTypeRequiredDescription
backfill_minutesintegerNoMinutes of backfill to stream on reconnect (0-5)
expansionsstringNoComma-separated expansions
tweet_fieldsstringNoComma-separated tweet fields

Fetches Tweet usage statistics for a Project (e.g., consumption, caps, daily breakdowns for Project and Client Apps) to monitor API limits. Data can be retrieved for 1 to 90 days.

NameTypeRequiredDescription
daysintegerNoNumber of days to retrieve usage data for, default 7
usage_fieldsstringNoComma-separated usage fields to include

Allows an authenticated user to follow another user. Results in a pending request if the target user’s tweets are protected.

NameTypeRequiredDescription
idstringYesAuthenticated user’s Twitter ID
target_user_idstringYesID of the user to follow

Returns metadata (not Tweets) for lists a specific Twitter user follows. Optionally includes expanded owner details.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idstringYesTwitter user ID
list_fieldsstringNoComma-separated list fields
max_resultsintegerNoMax results per page (1-100)
pagination_tokenstringNoPagination token for next page
user_fieldsstringNoComma-separated user fields

Retrieves Tweets liked by a specified Twitter user, provided their liked tweets are public or accessible.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idstringYesTwitter user ID
max_resultsintegerNoMax results per page (5-100)
pagination_tokenstringNoPagination token for next page
tweet_fieldsstringNoComma-separated tweet fields
user_fieldsstringNoComma-separated user fields

Retrieves all Twitter Lists a specified user is a member of, including public Lists and private Lists the authenticated user is authorized to view.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idstringYesTwitter user ID
list_fieldsstringNoComma-separated list fields
max_resultsintegerNoMax results per page (1-100)
pagination_tokenstringNoPagination token for next page
user_fieldsstringNoComma-separated user fields

Retrieves detailed public information for a Twitter user by their ID. Optionally expand related data (e.g., pinned tweets) and specify particular user or tweet fields to return.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idstringYesTwitter user ID
tweet_fieldsstringNoComma-separated tweet fields
user_fieldsstringNoComma-separated user fields

Fetches public profile information for a valid and existing Twitter user by their username. Optionally expands related data like pinned Tweets. Results may be limited for protected profiles not followed by the authenticated user.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
tweet_fieldsstringNoComma-separated tweet fields
user_fieldsstringNoComma-separated user fields
usernamestringYesTwitter username without the @ symbol, e.g. elonmusk

Returns profile information for the currently authenticated X user. Use this to get the authenticated user’s ID before calling endpoints that require it.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
tweet_fieldsstringNoComma-separated tweet fields
user_fieldsstringNoComma-separated user fields to return, e.g. created_at,description,public_metrics

Mutes a target user on behalf of an authenticated user, preventing the target’s Tweets and Retweets from appearing in the authenticated user’s home timeline without notifying the target.

NameTypeRequiredDescription
idstringYesAuthenticated user’s Twitter ID
target_user_idstringYesID of the user to mute

Retrieves Lists created (owned) by a specific Twitter user, not Lists they follow or are subscribed to.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idstringYesTwitter user ID
list_fieldsstringNoComma-separated list fields
max_resultsintegerNoMax results per page (1-100)
pagination_tokenstringNoPagination token for next page
user_fieldsstringNoComma-separated user fields

Retrieves the Lists a specific, existing Twitter user has pinned to their profile to highlight them.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idstringYesTwitter user ID
list_fieldsstringNoComma-separated list fields
user_fieldsstringNoComma-separated user fields

Retrieves the home timeline (reverse chronological feed) for the authenticated Twitter user. Returns tweets from accounts the user follows and the user’s own tweets. CRITICAL: The id parameter MUST be the authenticated user’s own numeric Twitter user ID. Use twitter_user_me to get your ID first. Cannot fetch another user’s home timeline.

NameTypeRequiredDescription
excludestringNoComma-separated types to exclude: retweets,replies
expansionsstringNoComma-separated expansions
idstringYesAuthenticated user’s own numeric Twitter ID — must be your own ID
max_resultsintegerNoMax results per page (1-100)
pagination_tokenstringNoPagination token for next page
tweet_fieldsstringNoComma-separated tweet fields
user_fieldsstringNoComma-separated user fields

Allows the authenticated user to unfollow an existing Twitter user, which removes the follow relationship. The source user ID is automatically determined from the authenticated session.

NameTypeRequiredDescription
idstringYesAuthenticated user’s Twitter ID
target_user_idstringYesID of the user to unfollow

Unmutes a target user for the authenticated user, allowing them to see Tweets and notifications from the target user again. The source_user_id is automatically populated from the authenticated user’s credentials.

NameTypeRequiredDescription
idstringYesAuthenticated user’s Twitter ID
target_user_idstringYesID of the user to unmute

Retrieves detailed information for specified X (formerly Twitter) user IDs. Optionally customize returned fields and expand related entities like pinned tweets.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
idsstringYesComma-separated list of Twitter user IDs (up to 100)
tweet_fieldsstringNoComma-separated tweet fields
user_fieldsstringNoComma-separated user fields

Retrieves detailed information for 1 to 100 Twitter users by their usernames (each 1-15 alphanumeric characters/underscores). Allows customizable user/tweet fields and expansion of related data like pinned tweets.

NameTypeRequiredDescription
expansionsstringNoComma-separated expansions
tweet_fieldsstringNoComma-separated tweet fields
user_fieldsstringNoComma-separated user fields
usernamesstringYesComma-separated list of Twitter usernames without @ symbols (up to 100)