Skip to content
Talk to an Engineer Dashboard

Twitter (X)

Connect to Twitter (X). Post tweets, manage timelines, handle DMs, follow users, like content, manage lists, and upload media on behalf of your users.

Connect to Twitter (X). Post and manage tweets, read timelines, handle direct messages, manage followers, like and bookmark content, work with lists, upload media, and monitor Spaces — all on behalf of your users via OAuth 2.0 PKCE.

Twitter (X) logo

Supports authentication: OAuth 2.0

What you can build with this connector
Use caseTools involved
Automated social publishingtwitter_post_createtwitter_post_lookup (verify)
Audience growth agenttwitter_followers_gettwitter_user_followtwitter_user_lookup
Content monitoringtwitter_recent_searchtwitter_post_lookuptwitter_post_like
Thread composertwitter_post_create (with reply.in_reply_to_tweet_id chain)
DM outreach automationtwitter_followers_gettwitter_dm_send
List curation agenttwitter_recent_searchtwitter_list_createtwitter_list_member_add
Engagement trackertwitter_post_likers_get + twitter_post_retweeters_get → aggregate stats
Content bookmarkingtwitter_recent_searchtwitter_bookmark_add
Spaces discoverytwitter_spaces_searchtwitter_space_gettwitter_space_posts_get
Media-rich postingtwitter_media_uploadtwitter_post_create (with media.media_ids)

Key concepts:

  • Tweet IDs: All tweet operations use numeric string IDs (e.g., "1234567890123456789"). Fetch IDs from search or timeline results before updating or deleting.
  • User fields: By default, user objects return only id, name, and username. Use user.fields expansions to request profile_image_url, description, public_metrics, verified, and more.
  • Tweet fields: Request extra context with tweet.fields: author_id, created_at, public_metrics, entities, referenced_tweets.
  • Pagination: List endpoints return a next_token in meta. Pass it as pagination_token to retrieve the next page. Maximum results per page is 100 for most endpoints.
  • Rate limits: Twitter API v2 enforces per-endpoint rate limits. The free tier allows 1 500 tweet reads and 500 tweet writes per month. Monitor x-rate-limit-remaining response headers.
  • OAuth scopes: Each tool requires specific OAuth scopes. Ensure the connection was authorized with all required scopes before calling write operations.
  • Media uploads: Images under ~5 MB can use twitter_media_upload. For GIFs, videos, or larger files, use twitter_media_upload_large or the chunked flow (twitter_media_upload_inittwitter_media_upload_appendtwitter_media_upload_status_get).
  • Authenticated user ID: Many endpoints require the authenticated user’s own ID. Use twitter_user_me to retrieve it before calling those endpoints.

Register your Twitter app credentials with Scalekit so it can manage the OAuth 2.0 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 connection in Scalekit

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

      Search for Twitter and create a new connection in Scalekit Agent Auth

    • In the Configure Twitter Connection panel, copy the Redirect URI. It looks like https://<SCALEKIT_ENVIRONMENT_URL>/sso/v1/oauth/<CONNECTION_ID>/callback. You’ll paste this into Twitter in the next step.

      Copy the Redirect URI from the Configure Twitter Connection panel

  2. Create an app in the Twitter Developer Portal

    • Go to the Twitter Developer Portal and sign in.

    • Click + Add App (or + Create Project to group apps by environment).

      Twitter Developer Portal showing Projects and Apps with the Add App button

    • Select Production environment and give your app a name.

  3. Configure user authentication settings

    • In your app’s overview, find User authentication settings and click Set up.

      Twitter app User authentication settings panel

    • Set the following values:

      SettingValue
      App permissionsRead and Write — needed to post and manage content on behalf of users
      Type of AppWeb App, Automated App or Bot
      Callback URI / Redirect URLPaste the Redirect URI from Scalekit
      Website URLYour application’s public homepage
    • Click Save.

  4. Copy OAuth 2.0 credentials

    • In your app, navigate to Keys and tokens.

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

    • Copy the Client ID and Client Secret.

      Twitter app Keys and tokens page showing Client ID and Client Secret

  5. Add credentials in Scalekit

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

    • Enter your credentials:

      • Client ID — from the Twitter OAuth 2.0 section
      • Client Secret — copied in the previous step
      • Scopes — select the permissions your app needs:
        • tweet.read — read tweets and timelines
        • tweet.write — create, delete, and manage tweets
        • users.read — read user profile data
        • follows.read — read follower/following lists
        • follows.write — follow and unfollow users
        • like.read — read liked tweets
        • like.write — like and unlike tweets
        • bookmark.read — read bookmarked tweets
        • bookmark.write — add and remove bookmarks
        • list.read — read list membership and tweets
        • list.write — create, update, and delete lists
        • dm.read — read direct messages
        • dm.write — send direct messages
        • mute.read — read muted users
        • mute.write — mute and unmute users
        • block.read — read blocked users
        • block.write — block and unblock users
        • offline.access — obtain refresh tokens for long-lived access

      Scalekit Twitter connection with Client ID, Client Secret, and scopes configured

    • Click Save.

Connect a user’s Twitter account and make API calls on their behalf — Scalekit handles OAuth 2.0 PKCE and token management automatically.

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

Proxy API calls

import { ScalekitClient } from '@scalekit-sdk/node';
import 'dotenv/config';
const connectionName = 'twitter'; // connection name from Agent Auth → Connections
const identifier = 'user_123'; // your unique user identifier
// Get 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;
// Step 1: Generate an authorization link and redirect your user to it
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));
// Step 2: Make Twitter API v2 requests via the Scalekit proxy
// No token management needed — Scalekit handles refresh automatically
const me = await actions.request({
connectionName,
identifier,
path: '/2/users/me',
method: 'GET',
params: { 'user.fields': 'name,username,profile_image_url,description' },
});
console.log('Authenticated user:', me);
// Example: post a tweet
const tweet = await actions.request({
connectionName,
identifier,
path: '/2/tweets',
method: 'POST',
body: { text: 'Hello from Scalekit Agent Auth!' },
});
console.log('Posted tweet:', tweet);
// Example: search recent tweets
const search = await actions.request({
connectionName,
identifier,
path: '/2/tweets/search/recent',
method: 'GET',
params: { query: 'from:twitterdev', max_results: '10' },
});
console.log('Search results:', search);

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
user.fieldsstringNoComma-separated extra user fields: created_at, description, entities, location, pinned_tweet_id, profile_image_url, protected, public_metrics, url, verified
expansionsstringNoExpand related objects. Use pinned_tweet_id to include the pinned tweet object.
tweet.fieldsstringNoFields to return for expanded tweet objects.

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
idstringYesTwitter user ID (e.g., "783214").
user.fieldsstringNoComma-separated extra user fields.
expansionsstringNoExpand related objects (e.g., pinned_tweet_id).
tweet.fieldsstringNoFields for expanded tweet objects.

Fetches public profile information for a valid and existing Twitter user by their username. Results may be limited for protected profiles not followed by the authenticated user.

NameTypeRequiredDescription
usernamestringYesTwitter handle without the @ prefix (e.g., "twitter").
user.fieldsstringNoComma-separated extra user fields.
expansionsstringNoExpand related objects.
tweet.fieldsstringNoFields for expanded tweet objects.

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

NameTypeRequiredDescription
idsstringYesComma-separated list of user IDs (max 100).
user.fieldsstringNoComma-separated extra user fields.
expansionsstringNoExpand related objects.
tweet.fieldsstringNoFields for expanded tweet objects.

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

NameTypeRequiredDescription
usernamesstringYesComma-separated list of Twitter usernames (max 100, without @).
user.fieldsstringNoComma-separated extra user fields.
expansionsstringNoExpand related objects.
tweet.fieldsstringNoFields for expanded tweet objects.

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

NameTypeRequiredDescription
idstringYesThe tweet ID to retrieve.
tweet.fieldsstringNoComma-separated tweet fields: author_id, created_at, entities, public_metrics, referenced_tweets, reply_settings, source
expansionsstringNoExpand related objects: author_id, referenced_tweets.id, attachments.media_keys
user.fieldsstringNoFields for expanded author objects.
media.fieldsstringNoFields for expanded media objects: url, preview_image_url, alt_text

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

NameTypeRequiredDescription
idsstringYesComma-separated list of tweet IDs (max 100).
tweet.fieldsstringNoComma-separated tweet fields to include.
expansionsstringNoExpand related objects.
user.fieldsstringNoFields for expanded user objects.
media.fieldsstringNoFields for expanded media objects.

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
textstringNo*The text content of the tweet. Maximum 280 characters. Required unless providing card_uri, media.media_ids, poll.options, or quote_tweet_id.
reply.in_reply_to_tweet_idstringNoTweet ID to reply to. Creates a threaded reply.
quote_tweet_idstringNoTweet ID to quote-tweet.
reply_settingsstringNoWho can reply: mentionedUsers, following, or subscribers. Defaults to everyone.
media.media_idsarray<string>NoMedia IDs from the Twitter media upload API to attach.
poll.optionsarray<string>NoPoll option labels (2–4 options). Must be paired with poll.duration_minutes.
poll.duration_minutesintegerNoPoll duration in minutes (5–10080). Required when poll.options is set.
card_uristringNoCard URI for attaching a Twitter card.

*At least one of text, card_uri, media.media_ids, poll.options, or quote_tweet_id is required.

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

NameTypeRequiredDescription
idstringYesThe ID of the tweet to delete.

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
tweet_idstringYesThe ID of the tweet to retweet.

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

NameTypeRequiredDescription
tweet_idstringYesThe ID of the tweet to un-retweet.

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
tweet_idstringYesThe ID of the tweet to like.

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
tweet_idstringYesThe ID of the tweet to unlike.

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

NameTypeRequiredDescription
idstringYesThe tweet ID whose liking users to retrieve.
max_resultsintegerNoNumber of results (1–100). Defaults to 100.
pagination_tokenstringNoToken from a previous response to retrieve the next page.
user.fieldsstringNoExtra user fields to include.
expansionsstringNoExpand related objects.

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

NameTypeRequiredDescription
idstringYesThe tweet ID whose retweeters to retrieve.
max_resultsintegerNoNumber of results (1–100). Defaults to 100.
pagination_tokenstringNoToken from a previous response to retrieve the next page.
user.fieldsstringNoExtra user fields to include.
expansionsstringNoExpand related objects.

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

NameTypeRequiredDescription
idstringYesThe tweet ID whose retweets to retrieve.
max_resultsintegerNoNumber of results (1–100). Defaults to 100.
pagination_tokenstringNoToken from a previous response to retrieve the next page.
tweet.fieldsstringNoTweet fields to include.
expansionsstringNoExpand related objects.
user.fieldsstringNoFields for expanded user objects.

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

NameTypeRequiredDescription
idstringYesThe tweet ID whose quote tweets to retrieve.
max_resultsintegerNoNumber of results (1–100). Defaults to 10.
pagination_tokenstringNoToken from a previous response to retrieve the next page.
tweet.fieldsstringNoTweet fields to include.
expansionsstringNoExpand related objects.
user.fieldsstringNoFields for expanded user objects.

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
tweet_idsarray<string>YesList of tweet IDs to retrieve analytics for.
start_timestringYesStart of the time range. ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
end_timestringYesEnd of the time range. ISO 8601 format.

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).

NameTypeRequiredDescription
querystringYesSearch query using Twitter query syntax. Max 512 characters. Example: "from:twitter -is:retweet"
max_resultsintegerNoNumber of results per page (10–100). Defaults to 10.
pagination_tokenstringNoToken from a previous response to retrieve the next page.
start_timestringNoOldest UTC timestamp. ISO 8601 format.
end_timestringNoNewest UTC timestamp. ISO 8601 format.
since_idstringNoReturn tweets with IDs greater than this value (newer).
until_idstringNoReturn tweets with IDs less than this value (older).
tweet.fieldsstringNoComma-separated tweet fields to include.
expansionsstringNoExpand related objects: author_id, referenced_tweets.id
user.fieldsstringNoFields for expanded author objects.

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

NameTypeRequiredDescription
querystringYesSearch query using Twitter query syntax.
granularitystringNoTime granularity for aggregation: minute, hour, or day. Defaults to hour.
start_timestringNoOldest UTC timestamp. ISO 8601 format.
end_timestringNoNewest UTC timestamp. ISO 8601 format.
since_idstringNoCount tweets newer than this tweet ID.
until_idstringNoCount tweets older than this tweet ID.

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
querystringYesSearch query using Twitter query syntax. Max 1024 characters.
max_resultsintegerNoNumber of results per page (10–500). Defaults to 10.
next_tokenstringNoToken from a previous response to retrieve the next page.
start_timestringNoOldest UTC timestamp. ISO 8601 format. Cannot be used with since_id.
end_timestringNoNewest UTC timestamp. ISO 8601 format. Cannot be used with until_id.
since_idstringNoReturn tweets newer than this ID. Cannot be used with start_time.
until_idstringNoReturn tweets older than this ID. Cannot be used with end_time.
tweet.fieldsstringNoTweet fields to include.
expansionsstringNoExpand related objects.
user.fieldsstringNoFields for expanded user objects.

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
querystringYesSearch query using Twitter query syntax.
granularitystringNoTime granularity: minute, hour, or day. Defaults to hour.
start_timestringNoOldest UTC timestamp. ISO 8601 format.
end_timestringNoNewest UTC timestamp. ISO 8601 format.
since_idstringNoCount tweets newer than this ID.
until_idstringNoCount tweets older than this ID.
next_tokenstringNoToken for pagination.

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.

NameTypeRequiredDescription
idstringYesThe authenticated user’s own Twitter user ID.
max_resultsintegerNoNumber of tweets to return (1–100). Defaults to 100.
pagination_tokenstringNoToken from a previous response to retrieve the next page.
since_idstringNoReturn tweets newer than this tweet ID. Use for incremental polling.
until_idstringNoReturn tweets older than this tweet ID.
start_timestringNoOldest tweet creation time. ISO 8601 format.
end_timestringNoNewest tweet creation time. ISO 8601 format.
excludestringNoComma-separated types to exclude: retweets, replies.
tweet.fieldsstringNoTweet fields to include.
expansionsstringNoExpand related objects.
user.fieldsstringNoFields for expanded user objects.
media.fieldsstringNoFields for expanded media objects.

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

NameTypeRequiredDescription
idstringYesTwitter user ID whose liked tweets to retrieve.
max_resultsintegerNoNumber of results (1–100). Defaults to 100.
pagination_tokenstringNoToken from a previous response to retrieve the next page.
tweet.fieldsstringNoTweet fields to include.
expansionsstringNoExpand related objects.
user.fieldsstringNoFields for expanded user objects.

Retrieves a list of users who follow a specified public Twitter user ID. Requires follows.read scope.

NameTypeRequiredDescription
idstringYesTwitter user ID whose followers to retrieve.
max_resultsintegerNoNumber of results (1–1000). Defaults to 100.
pagination_tokenstringNoToken from a previous response to retrieve the next page.
user.fieldsstringNoExtra user fields to include.
expansionsstringNoExpand related objects.
tweet.fieldsstringNoFields for expanded pinned tweet objects.

Retrieves users followed by a specific Twitter user. Allows pagination and customization of returned user and tweet data fields via expansions. Requires follows.read scope.

NameTypeRequiredDescription
idstringYesTwitter user ID whose following list to retrieve.
max_resultsintegerNoNumber of results (1–1000). Defaults to 100.
pagination_tokenstringNoToken from a previous response to retrieve the next page.
user.fieldsstringNoExtra user fields to include.
expansionsstringNoExpand related objects.
tweet.fieldsstringNoFields for expanded pinned tweet objects.

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

NameTypeRequiredDescription
target_user_idstringYesThe Twitter user ID of the account to follow.

Allows the authenticated user to unfollow an existing Twitter user, removing the follow relationship. The source user ID is automatically determined from the authenticated session. Requires follows.write scope.

NameTypeRequiredDescription
target_user_idstringYesThe Twitter user ID of the account to unfollow.

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

NameTypeRequiredDescription
tweet_idstringYesThe ID 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. Requires bookmark.write scope.

NameTypeRequiredDescription
tweet_idstringYesThe ID of the tweet to remove from bookmarks.

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

NameTypeRequiredDescription
idstringYesThe authenticated user’s own Twitter user ID.
max_resultsintegerNoNumber of results (1–100). Defaults to 100.
pagination_tokenstringNoToken from a previous response to retrieve the next page.
tweet.fieldsstringNoTweet fields to include.
expansionsstringNoExpand related objects.
user.fieldsstringNoFields for expanded user objects.

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

NameTypeRequiredDescription
namestringYesThe name for the new list.
descriptionstringNoA brief description of the list.
privatebooleanNoSet to true to make the list private. Defaults to false (public).

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

NameTypeRequiredDescription
idstringYesThe list ID to update.
namestringNoNew name for the list.
descriptionstringNoNew description for the list.
privatebooleanNoUpdate the privacy setting of the list.

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

NameTypeRequiredDescription
idstringYesThe list ID to delete.

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. Requires list.read scope.

NameTypeRequiredDescription
idstringYesThe list ID to retrieve.
list.fieldsstringNoExtra list fields: created_at, follower_count, member_count, owner_id, private
expansionsstringNoExpand related objects (e.g., owner_id).
user.fieldsstringNoFields for expanded owner user objects.

Fetches the most recent Tweets posted by members of a specified Twitter List. Requires list.read and tweet.read scopes.

NameTypeRequiredDescription
idstringYesThe list ID whose timeline to retrieve.
max_resultsintegerNoNumber of tweets to return (1–100). Defaults to 100.
pagination_tokenstringNoToken from a previous response to retrieve the next page.
tweet.fieldsstringNoTweet fields to include.
expansionsstringNoExpand related objects.
user.fieldsstringNoFields for expanded author objects.
media.fieldsstringNoFields for expanded media objects.

Fetches members of a specific Twitter List, identified by its unique ID. Requires list.read scope.

NameTypeRequiredDescription
idstringYesThe list ID whose members to retrieve.
max_resultsintegerNoNumber of results (1–100). Defaults to 100.
pagination_tokenstringNoToken from a previous response to retrieve the next page.
user.fieldsstringNoExtra user fields to include.
expansionsstringNoExpand related objects.

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

NameTypeRequiredDescription
idstringYesThe list ID to add the member to.
user_idstringYesThe Twitter user ID to add as a member.

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. Requires list.write scope.

NameTypeRequiredDescription
idstringYesThe list ID to remove the member from.
user_idstringYesThe Twitter user ID to remove from the list.

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. Requires list.write scope.

NameTypeRequiredDescription
list_idstringYesThe list ID to follow.

Enables a user to unfollow a specific Twitter List, removing its tweets from their timeline and stopping related notifications. Reports following: false on success, even if the user was not initially following the list. Requires list.write scope.

NameTypeRequiredDescription
list_idstringYesThe list ID to unfollow.

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. Requires list.write scope.

NameTypeRequiredDescription
list_idstringYesThe list ID to pin.

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

NameTypeRequiredDescription
list_idstringYesThe list ID to unpin.

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. Requires list.read scope.

NameTypeRequiredDescription
idstringYesThe list ID whose followers to retrieve.
max_resultsintegerNoNumber of results (1–100). Defaults to 100.
pagination_tokenstringNoToken from a previous response to retrieve the next page.
user.fieldsstringNoExtra user fields to include.
expansionsstringNoExpand related objects.

Retrieves Lists created (owned) by a specific Twitter user — not Lists they follow or are subscribed to. Requires list.read scope.

NameTypeRequiredDescription
idstringYesTwitter user ID whose owned lists to retrieve.
max_resultsintegerNoNumber of results (1–100). Defaults to 100.
pagination_tokenstringNoToken from a previous response to retrieve the next page.
list.fieldsstringNoExtra list fields to include.
expansionsstringNoExpand related objects (e.g., owner_id).
user.fieldsstringNoFields for expanded owner user objects.

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

NameTypeRequiredDescription
idstringYesTwitter user ID whose followed lists to retrieve.
max_resultsintegerNoNumber of results (1–100). Defaults to 100.
pagination_tokenstringNoToken from a previous response to retrieve the next page.
list.fieldsstringNoExtra list fields to include.
expansionsstringNoExpand related objects.
user.fieldsstringNoFields for expanded owner user objects.

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

NameTypeRequiredDescription
idstringYesTwitter user ID whose list memberships to retrieve.
max_resultsintegerNoNumber of results (1–100). Defaults to 100.
pagination_tokenstringNoToken from a previous response to retrieve the next page.
list.fieldsstringNoExtra list fields to include.
expansionsstringNoExpand related objects.
user.fieldsstringNoFields for expanded user objects.

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

NameTypeRequiredDescription
idstringYesTwitter user ID whose pinned lists to retrieve.
list.fieldsstringNoExtra list fields to include.
expansionsstringNoExpand related objects.
user.fieldsstringNoFields for expanded owner user objects.

Sends a new Direct Message with text and/or media to a specified Twitter user. Creates a new DM and does not modify existing messages. Media must be pre-uploaded using a media upload tool. Requires dm.write scope.

NameTypeRequiredDescription
participant_idstringYesThe Twitter user ID of the DM recipient.
textstringNo*The text content of the direct message.
media_idstringNo*Media ID from a prior upload to attach to the message.

*At least one of text or media_id is required.

Sends a message with optional text and/or media attachments to a specified Twitter Direct Message conversation. Requires dm.write scope.

NameTypeRequiredDescription
dm_conversation_idstringYesThe DM conversation ID to send the message to.
textstringNo*The text content of the message.
media_idstringNo*Media ID from a prior upload to attach.

*At least one of text or media_id is required.

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

NameTypeRequiredDescription
max_resultsintegerNoNumber of events to return (1–100). Defaults to 100.
pagination_tokenstringNoToken from a previous response to retrieve the next page.
dm_event.fieldsstringNoExtra DM event fields: created_at, sender_id, text, attachments
expansionsstringNoExpand related objects: sender_id, attachments.media_keys
user.fieldsstringNoFields for expanded participant objects.
media.fieldsstringNoFields for expanded media objects.

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. Requires dm.read scope.

NameTypeRequiredDescription
participant_idstringYesThe Twitter user ID of the conversation participant.
max_resultsintegerNoNumber of events to return (1–100). Defaults to 100.
pagination_tokenstringNoToken from a previous response to retrieve the next page.
dm_event.fieldsstringNoExtra DM event fields to include.
expansionsstringNoExpand related objects.

Retrieves Direct Message (DM) events for a specific conversation ID. Useful for analyzing messages and participant activities. Requires dm.read scope.

NameTypeRequiredDescription
dm_conversation_idstringYesThe DM conversation ID to retrieve.
max_resultsintegerNoNumber of events to return (1–100). Defaults to 100.
pagination_tokenstringNoToken from a previous response to retrieve the next page.
dm_event.fieldsstringNoExtra DM event fields to include.
expansionsstringNoExpand related objects.

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

NameTypeRequiredDescription
event_idstringYesThe unique DM event ID to retrieve.
dm_event.fieldsstringNoExtra DM event fields to include.
expansionsstringNoExpand related objects.
user.fieldsstringNoFields for expanded user objects.
media.fieldsstringNoFields for expanded media objects.

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. Requires dm.write scope.

NameTypeRequiredDescription
event_idstringYesThe unique DM event ID to delete.

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. Requires dm.write scope.

NameTypeRequiredDescription
participant_idsarray<string>YesList of Twitter user IDs to include in the group DM (max 49 participants plus yourself).
textstringNo*The initial message text for the group conversation.
media_idstringNo*Media ID from a prior upload to attach to the initial message.

*At least one of text or media_id is required.

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. Requires mute.write scope.

NameTypeRequiredDescription
target_user_idstringYesThe Twitter user ID to mute.

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. Requires mute.write scope.

NameTypeRequiredDescription
target_user_idstringYesThe Twitter user ID to unmute.

Returns user objects muted by the X user identified by the id path parameter. Requires mute.read scope.

NameTypeRequiredDescription
idstringYesThe authenticated user’s own Twitter user ID.
max_resultsintegerNoNumber of results (1–1000). Defaults to 100.
pagination_tokenstringNoToken from a previous response to retrieve the next page.
user.fieldsstringNoExtra user fields to include.
expansionsstringNoExpand related objects.

Retrieves the authenticated user’s block list. The id parameter must be the authenticated user’s ID. Use twitter_user_me to obtain your user ID. Requires block.read scope.

NameTypeRequiredDescription
idstringYesThe authenticated user’s own Twitter user ID.
max_resultsintegerNoNumber of results (1–1000). Defaults to 100.
pagination_tokenstringNoToken from a previous response to retrieve the next page.
user.fieldsstringNoExtra user fields to include.
expansionsstringNoExpand related objects.

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
tweet_idstringYesThe ID of the reply tweet to hide or unhide.
hiddenbooleanYesSet to true to hide the reply, false to unhide it.

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
mediastringYesThe media file content as a binary string or URL.
media_typestringYesMIME type of the media (e.g., image/jpeg, image/png).
media_categorystringNoCategory for the media: tweet_image or dm_image.
alt_textstringNoAccessibility description for the image.

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_datastringYesBase64-encoded media content.
media_typestringYesMIME type of the media (e.g., image/jpeg).
media_categorystringNoCategory for the media: tweet_image or dm_image.
alt_textstringNoAccessibility description for the image.

Uploads media files to X/Twitter using the v2 media upload API. Supports images, GIFs, and videos via base64-encoded data. For very large files requiring chunked upload, use twitter_media_upload_inittwitter_media_upload_appendtwitter_media_upload_status_get.

NameTypeRequiredDescription
media_datastringYesBase64-encoded media content.
media_typestringYesMIME type of the media (e.g., video/mp4, image/gif).
media_categorystringYesCategory: tweet_gif, tweet_video, amplify_video, dm_gif, dm_video, tweet_image, or dm_image.
alt_textstringNoAccessibility description for the image.

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
total_bytesintegerYesTotal size of the media file in bytes.
media_typestringYesMIME type of the media to upload.
media_categorystringNoCategory for the media. Determines allowed media types.

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_idstringYesThe media_id returned by twitter_media_upload_init.
media_datastringYesBase64-encoded chunk of the media data.
segment_indexintegerYesZero-based index of this chunk in the upload sequence.

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_idstringYesThe media_id to check processing status for.

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

NameTypeRequiredDescription
idstringYesThe Space ID to retrieve.
space.fieldsstringNoExtra space fields: created_at, creator_id, ended_at, host_ids, lang, participant_count, scheduled_start, speaker_ids, started_at, state, subscriber_count, title, topic_ids
expansionsstringNoExpand related objects (e.g., creator_id, host_ids).
user.fieldsstringNoFields for expanded user objects.

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
idsstringYesComma-separated list of Space IDs (max 100).
space.fieldsstringNoExtra space fields to include.
expansionsstringNoExpand related objects.
user.fieldsstringNoFields for expanded user objects.

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

NameTypeRequiredDescription
querystringYesText query to search for Spaces.
statestringNoFilter by state: live, scheduled, or all. Defaults to live.
max_resultsintegerNoNumber of results (1–100). Defaults to 100.
space.fieldsstringNoExtra space fields to include.
expansionsstringNoExpand related objects.
user.fieldsstringNoFields for expanded user objects.

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

NameTypeRequiredDescription
user_idsstringYesComma-separated list of user IDs whose Spaces to retrieve (max 100).
space.fieldsstringNoExtra space fields to include.
expansionsstringNoExpand related objects.
user.fieldsstringNoFields for expanded user objects.

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
idstringYesThe Space ID whose associated tweets to retrieve.
max_resultsintegerNoNumber of results (1–100). Defaults to 100.
tweet.fieldsstringNoTweet fields to include.
expansionsstringNoExpand related objects.
user.fieldsstringNoFields for expanded user objects.

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

NameTypeRequiredDescription
idstringYesThe Space ID whose ticket buyers to retrieve.
user.fieldsstringNoExtra user fields to include.
expansionsstringNoExpand related objects.

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 of usage data to retrieve (1–90). Defaults to 7.

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

NameTypeRequiredDescription
backfill_minutesintegerNoNumber of minutes of backfill data to receive on reconnect (0–5).

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
typestringYesType of compliance job: tweets or users.
namestringNoDescriptive label for the job.
resumablebooleanNoWhether the upload supports resumable uploads.

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

NameTypeRequiredDescription
idstringYesThe compliance job ID to retrieve.

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

NameTypeRequiredDescription
typestringYesType of compliance jobs to retrieve: tweets or users.
statusstringNoFilter by job status: created, in_progress, failed, complete.

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_typestringYesThe activity event type to subscribe to.
user_idstringNoThe Twitter user ID to monitor for activity events.

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