Twitter API v2
Twitter API v2 available endpoints
Fork copies the collection into your workspace, without the publisher's secrets, so you can add your own key and send requests. Star saves it to your starred APIs (Account › Marketplace) and helps others find it.
Overview
Twitter API v2 available endpoints
Endpoints 80
Bookmarks
- GETBookmarks by User
/2/users/:id/bookmarks?max_results=1&pagination_token=string&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheld&expansions=attachments.media_keys,attachments.poll_ids,author_id,edit_history_tweet_ids,entities.mentions.username,geo.place_id,in_reply_to_user_id,referenced_tweets.id,referenced_tweets.id.author_id&media.fields=alt_text,duration_ms,height,media_key,non_public_metrics,organic_metrics,preview_image_url,promoted_metrics,public_metrics,type,url,variants,width&poll.fields=duration_minutes,end_datetime,id,options,voting_status&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&place.fields=contained_within,country,country_code,full_name,geo,id,name,place_typeReturns Tweet objects that have been bookmarked by the requesting User - POSTAdd Tweet to Bookmarks
/2/users/:id/bookmarksAdds a Tweet (ID in the body) to the requesting User's (in the path) bookmarks - DELETERemove a bookmarked Tweet
/2/users/:id/bookmarks/:tweet_idRemoves a Tweet from the requesting User's bookmarked Tweets.
Compliance
- GETList Compliance Jobs
/2/compliance/jobs?type=tweets&status=created&compliance_job.fields=created_at,download_expires_at,download_url,id,name,resumable,status,type,upload_expires_at,upload_urlReturns recent Compliance Jobs for a given job type and optional job status - POSTCreate compliance job
/2/compliance/jobsCreates a compliance for the given job type - GETGet Compliance Job
/2/compliance/jobs/:id?compliance_job.fields=created_at,download_expires_at,download_url,id,name,resumable,status,type,upload_expires_at,upload_urlReturns a single Compliance Job by ID - GETTweets Compliance stream
/2/tweets/compliance/stream?backfill_minutes=0&partition=1&start_time=2021-02-01T18:40:40.000Z&end_time=2021-02-14T18:40:40.000ZStreams 100% of compliance data for Tweets - GETTweets Label stream
/2/tweets/label/stream?backfill_minutes=0&start_time=2021-02-01T18:40:40.000Z&end_time=2021-02-01T18:40:40.000ZStreams 100% of labeling events applied to Tweets - GETUsers Compliance stream
/2/users/compliance/stream?backfill_minutes=0&partition=1&start_time=2021-02-01T18:40:40.000Z&end_time=2021-02-01T18:40:40.000ZStreams 100% of compliance data for Users
Direct Messages
- POSTCreate a new DM Conversation
/2/dm_conversationsCreates a new DM Conversation. - GETGet DM Events for a DM Conversation
/2/dm_conversations/with/:participant_id/dm_events?max_results=100&pagination_token=string&event_types=MessageCreate,ParticipantsLeave&dm_event.fields=attachments,created_at,dm_conversation_id,event_type,id,participant_ids,referenced_tweets,sender_id,text&expansions=attachments.media_keys,participant_ids,referenced_tweets.id,sender_id&media.fields=alt_text,duration_ms,height,media_key,non_public_metrics,organic_metrics,preview_image_url,promoted_metrics,public_metrics,type,url,variants,width&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheldReturns DM Events for a DM Conversation - POSTSend a new message to a user
/2/dm_conversations/with/:participant_id/messagesCreates a new message for a DM Conversation with a participant user by ID - POSTSend a new message to a DM Conversation
/2/dm_conversations/:dm_conversation_id/messagesCreates a new message for a DM Conversation specified by DM Conversation ID - GETGet DM Events for a DM Conversation
/2/dm_conversations/:id/dm_events?max_results=100&pagination_token=string&event_types=MessageCreate,ParticipantsLeave&dm_event.fields=attachments,created_at,dm_conversation_id,event_type,id,participant_ids,referenced_tweets,sender_id,text&expansions=attachments.media_keys,participant_ids,referenced_tweets.id,sender_id&media.fields=alt_text,duration_ms,height,media_key,non_public_metrics,organic_metrics,preview_image_url,promoted_metrics,public_metrics,type,url,variants,width&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheldReturns DM Events for a DM Conversation - GETGet recent DM Events
/2/dm_events?max_results=100&pagination_token=string&event_types=MessageCreate,ParticipantsLeave&dm_event.fields=attachments,created_at,dm_conversation_id,event_type,id,participant_ids,referenced_tweets,sender_id,text&expansions=attachments.media_keys,participant_ids,referenced_tweets.id,sender_id&media.fields=alt_text,duration_ms,height,media_key,non_public_metrics,organic_metrics,preview_image_url,promoted_metrics,public_metrics,type,url,variants,width&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheldReturns recent DM Events across DM conversations
General
- GETReturns the OpenAPI Specification document.
/2/openapi.jsonFull OpenAPI Specification in JSON format. (See https://github.com/OAI/OpenAPI-Specification/blob/master/README.md)
Lists
- POSTCreate List
/2/listsCreates a new List. - GETList lookup by List ID.
/2/lists/:id?list.fields=created_at,description,follower_count,id,member_count,name,owner_id,private&expansions=owner_id&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheldReturns a List. - PUTUpdate List.
/2/lists/:idUpdate a List that you own. - DELETEDelete List
/2/lists/:idDelete a List that you own. - POSTAdd a List member
/2/lists/:id/membersCauses a User to become a member of a List. - DELETERemove a List member
/2/lists/:id/members/:user_idCauses a User to be removed from the members of a List. - GETGet User's Followed Lists
/2/users/:id/followed_lists?max_results=100&pagination_token=string&list.fields=created_at,description,follower_count,id,member_count,name,owner_id,private&expansions=owner_id&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheldReturns a User's followed Lists. - POSTFollow a List
/2/users/:id/followed_listsCauses a User to follow a List. - DELETEUnfollow a List
/2/users/:id/followed_lists/:list_idCauses a User to unfollow a List. - GETGet a User's List Memberships
/2/users/:id/list_memberships?max_results=100&pagination_token=string&list.fields=created_at,description,follower_count,id,member_count,name,owner_id,private&expansions=owner_id&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheldGet a User's List Memberships. - GETGet a User's Owned Lists.
/2/users/:id/owned_lists?max_results=100&pagination_token=string&list.fields=created_at,description,follower_count,id,member_count,name,owner_id,private&expansions=owner_id&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheldGet a User's Owned Lists. - GETGet a User's Pinned Lists
/2/users/:id/pinned_lists?list.fields=created_at,description,follower_count,id,member_count,name,owner_id,private&expansions=owner_id&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheldGet a User's Pinned Lists. - POSTPin a List
/2/users/:id/pinned_listsCauses a User to pin a List. - DELETEUnpin a List
/2/users/:id/pinned_lists/:list_idCauses a User to remove a pinned List.
Spaces
- GETSpace lookup up Space IDs
/2/spaces?ids=1SLjjRYNejbKM&space.fields=created_at,creator_id,ended_at,host_ids,id,invited_user_ids,is_ticketed,lang,participant_count,scheduled_start,speaker_ids,started_at,state,subscriber_count,title,topic_ids,updated_at&expansions=creator_id,host_ids,invited_user_ids,speaker_ids,topic_ids&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&topic.fields=description,id,nameReturns a variety of information about the Spaces specified by the requested IDs - GETSpace lookup by their creators
/2/spaces/by/creator_ids?user_ids=2244994945&space.fields=created_at,creator_id,ended_at,host_ids,id,invited_user_ids,is_ticketed,lang,participant_count,scheduled_start,speaker_ids,started_at,state,subscriber_count,title,topic_ids,updated_at&expansions=creator_id,host_ids,invited_user_ids,speaker_ids,topic_ids&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&topic.fields=description,id,nameReturns a variety of information about the Spaces created by the provided User IDs - GETSearch for Spaces
/2/spaces/search?query=crypto&state=all&max_results=100&space.fields=created_at,creator_id,ended_at,host_ids,id,invited_user_ids,is_ticketed,lang,participant_count,scheduled_start,speaker_ids,started_at,state,subscriber_count,title,topic_ids,updated_at&expansions=creator_id,host_ids,invited_user_ids,speaker_ids,topic_ids&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&topic.fields=description,id,nameReturns Spaces that match the provided query. - GETSpace lookup by Space ID
/2/spaces/:id?space.fields=created_at,creator_id,ended_at,host_ids,id,invited_user_ids,is_ticketed,lang,participant_count,scheduled_start,speaker_ids,started_at,state,subscriber_count,title,topic_ids,updated_at&expansions=creator_id,host_ids,invited_user_ids,speaker_ids,topic_ids&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&topic.fields=description,id,nameReturns a variety of information about the Space specified by the requested ID - GETRetrieve the list of Users who purchased a ticket to the given space
/2/spaces/:id/buyers?pagination_token=string&max_results=100&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&expansions=pinned_tweet_id&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheldRetrieves the list of Users who purchased a ticket to the given space - GETRetrieve Tweets from a Space.
/2/spaces/:id/tweets?max_results=25&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheld&expansions=attachments.media_keys,attachments.poll_ids,author_id,edit_history_tweet_ids,entities.mentions.username,geo.place_id,in_reply_to_user_id,referenced_tweets.id,referenced_tweets.id.author_id&media.fields=alt_text,duration_ms,height,media_key,non_public_metrics,organic_metrics,preview_image_url,promoted_metrics,public_metrics,type,url,variants,width&poll.fields=duration_minutes,end_datetime,id,options,voting_status&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&place.fields=contained_within,country,country_code,full_name,geo,id,name,place_typeRetrieves Tweets shared in the specified Space.
Tweets
- GETList Tweets timeline by List ID.
/2/lists/:id/tweets?max_results=100&pagination_token=string&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheld&expansions=attachments.media_keys,attachments.poll_ids,author_id,edit_history_tweet_ids,entities.mentions.username,geo.place_id,in_reply_to_user_id,referenced_tweets.id,referenced_tweets.id.author_id&media.fields=alt_text,duration_ms,height,media_key,non_public_metrics,organic_metrics,preview_image_url,promoted_metrics,public_metrics,type,url,variants,width&poll.fields=duration_minutes,end_datetime,id,options,voting_status&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&place.fields=contained_within,country,country_code,full_name,geo,id,name,place_typeReturns a list of Tweets associated with the provided List ID. - GETTweet lookup by Tweet IDs
/2/tweets?ids=1346889436626259968&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheld&expansions=attachments.media_keys,attachments.poll_ids,author_id,edit_history_tweet_ids,entities.mentions.username,geo.place_id,in_reply_to_user_id,referenced_tweets.id,referenced_tweets.id.author_id&media.fields=alt_text,duration_ms,height,media_key,non_public_metrics,organic_metrics,preview_image_url,promoted_metrics,public_metrics,type,url,variants,width&poll.fields=duration_minutes,end_datetime,id,options,voting_status&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&place.fields=contained_within,country,country_code,full_name,geo,id,name,place_typeReturns a variety of information about the Tweet specified by the requested ID. - POSTCreation of a Tweet
/2/tweetsCauses the User to create a Tweet under the authorized account. - GETFull archive search counts
/2/tweets/counts/all?query=(from:TwitterDev OR from:TwitterAPI) has:media -is:retweet&start_time=2024-01-01T00:00:00Z&end_time=2024-01-01T00:00:00Z&since_id=1346889436626259968&until_id=1346889436626259968&next_token=string&pagination_token=string&granularity=hour&search_count.fields=end,start,tweet_countReturns Tweet Counts that match a search query. - GETRecent search counts
/2/tweets/counts/recent?query=(from:TwitterDev OR from:TwitterAPI) has:media -is:retweet&start_time=2024-01-01T00:00:00Z&end_time=2024-01-01T00:00:00Z&since_id=1346889436626259968&until_id=1346889436626259968&next_token=string&pagination_token=string&granularity=hour&search_count.fields=end,start,tweet_countReturns Tweet Counts from the last 7 days that match a search query. - GETFirehose stream
/2/tweets/firehose/stream?backfill_minutes=0&partition=1&start_time=2021-02-14T18:40:40.000Z&end_time=2021-02-14T18:40:40.000Z&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheld&expansions=attachments.media_keys,attachments.poll_ids,author_id,edit_history_tweet_ids,entities.mentions.username,geo.place_id,in_reply_to_user_id,referenced_tweets.id,referenced_tweets.id.author_id&media.fields=alt_text,duration_ms,height,media_key,non_public_metrics,organic_metrics,preview_image_url,promoted_metrics,public_metrics,type,url,variants,width&poll.fields=duration_minutes,end_datetime,id,options,voting_status&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&place.fields=contained_within,country,country_code,full_name,geo,id,name,place_typeStreams 100% of public Tweets. - GETSample stream
/2/tweets/sample/stream?backfill_minutes=0&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheld&expansions=attachments.media_keys,attachments.poll_ids,author_id,edit_history_tweet_ids,entities.mentions.username,geo.place_id,in_reply_to_user_id,referenced_tweets.id,referenced_tweets.id.author_id&media.fields=alt_text,duration_ms,height,media_key,non_public_metrics,organic_metrics,preview_image_url,promoted_metrics,public_metrics,type,url,variants,width&poll.fields=duration_minutes,end_datetime,id,options,voting_status&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&place.fields=contained_within,country,country_code,full_name,geo,id,name,place_typeStreams a deterministic 1% of public Tweets. - GETSample 10% stream
/2/tweets/sample10/stream?backfill_minutes=0&partition=1&start_time=2021-02-14T18:40:40.000Z&end_time=2021-02-14T18:40:40.000Z&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheld&expansions=attachments.media_keys,attachments.poll_ids,author_id,edit_history_tweet_ids,entities.mentions.username,geo.place_id,in_reply_to_user_id,referenced_tweets.id,referenced_tweets.id.author_id&media.fields=alt_text,duration_ms,height,media_key,non_public_metrics,organic_metrics,preview_image_url,promoted_metrics,public_metrics,type,url,variants,width&poll.fields=duration_minutes,end_datetime,id,options,voting_status&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&place.fields=contained_within,country,country_code,full_name,geo,id,name,place_typeStreams a deterministic 10% of public Tweets. - GETFull-archive search
/2/tweets/search/all?query=(from:TwitterDev OR from:TwitterAPI) has:media -is:retweet&start_time=2024-01-01T00:00:00Z&end_time=2024-01-01T00:00:00Z&since_id=1346889436626259968&until_id=1346889436626259968&max_results=10&next_token=string&pagination_token=string&sort_order=recency&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheld&expansions=attachments.media_keys,attachments.poll_ids,author_id,edit_history_tweet_ids,entities.mentions.username,geo.place_id,in_reply_to_user_id,referenced_tweets.id,referenced_tweets.id.author_id&media.fields=alt_text,duration_ms,height,media_key,non_public_metrics,organic_metrics,preview_image_url,promoted_metrics,public_metrics,type,url,variants,width&poll.fields=duration_minutes,end_datetime,id,options,voting_status&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&place.fields=contained_within,country,country_code,full_name,geo,id,name,place_typeReturns Tweets that match a search query. - GETRecent search
/2/tweets/search/recent?query=(from:TwitterDev OR from:TwitterAPI) has:media -is:retweet&start_time=2024-01-01T00:00:00Z&end_time=2024-01-01T00:00:00Z&since_id=1346889436626259968&until_id=1346889436626259968&max_results=10&next_token=string&pagination_token=string&sort_order=recency&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheld&expansions=attachments.media_keys,attachments.poll_ids,author_id,edit_history_tweet_ids,entities.mentions.username,geo.place_id,in_reply_to_user_id,referenced_tweets.id,referenced_tweets.id.author_id&media.fields=alt_text,duration_ms,height,media_key,non_public_metrics,organic_metrics,preview_image_url,promoted_metrics,public_metrics,type,url,variants,width&poll.fields=duration_minutes,end_datetime,id,options,voting_status&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&place.fields=contained_within,country,country_code,full_name,geo,id,name,place_typeReturns Tweets from the last 7 days that match a search query. - GETFiltered stream
/2/tweets/search/stream?backfill_minutes=0&start_time=2021-02-01T18:40:40.000Z&end_time=2021-02-14T18:40:40.000Z&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheld&expansions=attachments.media_keys,attachments.poll_ids,author_id,edit_history_tweet_ids,entities.mentions.username,geo.place_id,in_reply_to_user_id,referenced_tweets.id,referenced_tweets.id.author_id&media.fields=alt_text,duration_ms,height,media_key,non_public_metrics,organic_metrics,preview_image_url,promoted_metrics,public_metrics,type,url,variants,width&poll.fields=duration_minutes,end_datetime,id,options,voting_status&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&place.fields=contained_within,country,country_code,full_name,geo,id,name,place_typeStreams Tweets matching the stream's active rule set. - GETRules lookup
/2/tweets/search/stream/rules?ids=120897978112909812&max_results=1000&pagination_token=stringReturns rules from a User's active rule set. Users can fetch all of their rules or a subset, specified by the provided rule ids. - POSTAdd/Delete rules
/2/tweets/search/stream/rules?dry_run=trueAdd or delete rules from a User's active rule set. Users can provide unique, optionally tagged rules to add. Users can delete their entire rule set or a… - GETTweet lookup by Tweet ID
/2/tweets/:id?tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheld&expansions=attachments.media_keys,attachments.poll_ids,author_id,edit_history_tweet_ids,entities.mentions.username,geo.place_id,in_reply_to_user_id,referenced_tweets.id,referenced_tweets.id.author_id&media.fields=alt_text,duration_ms,height,media_key,non_public_metrics,organic_metrics,preview_image_url,promoted_metrics,public_metrics,type,url,variants,width&poll.fields=duration_minutes,end_datetime,id,options,voting_status&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&place.fields=contained_within,country,country_code,full_name,geo,id,name,place_typeReturns a variety of information about the Tweet specified by the requested ID. - DELETETweet delete by Tweet ID
/2/tweets/:idDelete specified Tweet (in the path) by ID. - GETRetrieve Tweets that quote a Tweet.
/2/tweets/:id/quote_tweets?max_results=10&pagination_token=string&exclude=replies,retweets&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheld&expansions=attachments.media_keys,attachments.poll_ids,author_id,edit_history_tweet_ids,entities.mentions.username,geo.place_id,in_reply_to_user_id,referenced_tweets.id,referenced_tweets.id.author_id&media.fields=alt_text,duration_ms,height,media_key,non_public_metrics,organic_metrics,preview_image_url,promoted_metrics,public_metrics,type,url,variants,width&poll.fields=duration_minutes,end_datetime,id,options,voting_status&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&place.fields=contained_within,country,country_code,full_name,geo,id,name,place_typeReturns a variety of information about each Tweet that quotes the Tweet specified by the requested ID. - PUTHide replies
/2/tweets/:tweet_id/hiddenHides or unhides a reply to an owned conversation. - GETReturns Tweet objects liked by the provided User ID
/2/users/:id/liked_tweets?max_results=5&pagination_token=string&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheld&expansions=attachments.media_keys,attachments.poll_ids,author_id,edit_history_tweet_ids,entities.mentions.username,geo.place_id,in_reply_to_user_id,referenced_tweets.id,referenced_tweets.id.author_id&media.fields=alt_text,duration_ms,height,media_key,non_public_metrics,organic_metrics,preview_image_url,promoted_metrics,public_metrics,type,url,variants,width&poll.fields=duration_minutes,end_datetime,id,options,voting_status&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&place.fields=contained_within,country,country_code,full_name,geo,id,name,place_typeReturns a list of Tweets liked by the provided User ID - POSTCauses the User (in the path) to like the specified Tweet
/2/users/:id/likesCauses the User (in the path) to like the specified Tweet. The User in the path must match the User context authorizing the request. - DELETECauses the User (in the path) to unlike the specified Tweet
/2/users/:id/likes/:tweet_idCauses the User (in the path) to unlike the specified Tweet. The User must match the User context authorizing the request - GETUser mention timeline by User ID
/2/users/:id/mentions?since_id=1346889436626259968&until_id=1346889436626259968&max_results=5&pagination_token=string&start_time=2021-02-01T18:40:40.000Z&end_time=2021-02-14T18:40:40.000Z&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheld&expansions=attachments.media_keys,attachments.poll_ids,author_id,edit_history_tweet_ids,entities.mentions.username,geo.place_id,in_reply_to_user_id,referenced_tweets.id,referenced_tweets.id.author_id&media.fields=alt_text,duration_ms,height,media_key,non_public_metrics,organic_metrics,preview_image_url,promoted_metrics,public_metrics,type,url,variants,width&poll.fields=duration_minutes,end_datetime,id,options,voting_status&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&place.fields=contained_within,country,country_code,full_name,geo,id,name,place_typeReturns Tweet objects that mention username associated to the provided User ID - POSTCauses the User (in the path) to retweet the specified Tweet.
/2/users/:id/retweetsCauses the User (in the path) to retweet the specified Tweet. The User in the path must match the User context authorizing the request. - DELETECauses the User (in the path) to unretweet the specified Tweet
/2/users/:id/retweets/:source_tweet_idCauses the User (in the path) to unretweet the specified Tweet. The User must match the User context authorizing the request - GETUser home timeline by User ID
/2/users/:id/timelines/reverse_chronological?since_id=791775337160081409&until_id=1346889436626259968&max_results=1&pagination_token=string&exclude=replies,retweets&start_time=2021-02-01T18:40:40.000Z&end_time=2021-02-14T18:40:40.000Z&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheld&expansions=attachments.media_keys,attachments.poll_ids,author_id,edit_history_tweet_ids,entities.mentions.username,geo.place_id,in_reply_to_user_id,referenced_tweets.id,referenced_tweets.id.author_id&media.fields=alt_text,duration_ms,height,media_key,non_public_metrics,organic_metrics,preview_image_url,promoted_metrics,public_metrics,type,url,variants,width&poll.fields=duration_minutes,end_datetime,id,options,voting_status&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&place.fields=contained_within,country,country_code,full_name,geo,id,name,place_typeReturns Tweet objects that appears in the provided User ID's home timeline - GETUser Tweets timeline by User ID
/2/users/:id/tweets?since_id=791775337160081409&until_id=1346889436626259968&max_results=5&pagination_token=string&exclude=replies,retweets&start_time=2021-02-01T18:40:40.000Z&end_time=2021-02-14T18:40:40.000Z&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheld&expansions=attachments.media_keys,attachments.poll_ids,author_id,edit_history_tweet_ids,entities.mentions.username,geo.place_id,in_reply_to_user_id,referenced_tweets.id,referenced_tweets.id.author_id&media.fields=alt_text,duration_ms,height,media_key,non_public_metrics,organic_metrics,preview_image_url,promoted_metrics,public_metrics,type,url,variants,width&poll.fields=duration_minutes,end_datetime,id,options,voting_status&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&place.fields=contained_within,country,country_code,full_name,geo,id,name,place_typeReturns a list of Tweets authored by the provided User ID
Users
- GETReturns User objects that follow a List by the provided List ID
/2/lists/:id/followers?max_results=100&pagination_token=string&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&expansions=pinned_tweet_id&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheldReturns a list of Users that follow a List by the provided List ID - GETReturns User objects that are members of a List by the provided List ID.
/2/lists/:id/members?max_results=100&pagination_token=string&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&expansions=pinned_tweet_id&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheldReturns a list of Users that are members of a List by the provided List ID. - GETReturns User objects that have liked the provided Tweet ID
/2/tweets/:id/liking_users?max_results=100&pagination_token=string&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&expansions=pinned_tweet_id&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheldReturns a list of Users that have liked the provided Tweet ID - GETReturns User objects that have retweeted the provided Tweet ID
/2/tweets/:id/retweeted_by?max_results=100&pagination_token=string&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&expansions=pinned_tweet_id&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheldReturns a list of Users that have retweeted the provided Tweet ID - GETUser lookup by IDs
/2/users?ids=2244994945,6253282,12&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&expansions=pinned_tweet_id&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheldThis endpoint returns information about Users. Specify Users by their ID. - GETUser lookup by usernames
/2/users/by?usernames=TwitterDev,TwitterAPI&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&expansions=pinned_tweet_id&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheldThis endpoint returns information about Users. Specify Users by their username. - GETUser lookup by username
/2/users/by/username/:username?user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&expansions=pinned_tweet_id&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheldThis endpoint returns information about a User. Specify User by username. - GETUser lookup me
/2/users/me?user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&expansions=pinned_tweet_id&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheldThis endpoint returns information about the requesting User. - GETUser lookup by ID
/2/users/:id?user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&expansions=pinned_tweet_id&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheldThis endpoint returns information about a User. Specify User by ID. - GETReturns User objects that are blocked by provided User ID
/2/users/:id/blocking?max_results=1&pagination_token=string&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&expansions=pinned_tweet_id&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheldReturns a list of Users that are blocked by the provided User ID - POSTBlock User by User ID
/2/users/:id/blockingCauses the User (in the path) to block the target User. The User (in the path) must match the User context authorizing the request - GETFollowers by User ID
/2/users/:id/followers?max_results=1&pagination_token=string&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&expansions=pinned_tweet_id&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheldReturns a list of Users who are followers of the specified User ID. - GETFollowing by User ID
/2/users/:id/following?max_results=1&pagination_token=string&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&expansions=pinned_tweet_id&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheldReturns a list of Users that are being followed by the provided User ID - POSTFollow User
/2/users/:id/followingCauses the User(in the path) to follow, or “request to follow” for protected Users, the target User. The User(in the path) must match the User context… - GETReturns User objects that are muted by the provided User ID
/2/users/:id/muting?max_results=100&pagination_token=string&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&expansions=pinned_tweet_id&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheldReturns a list of Users that are muted by the provided User ID - POSTMute User by User ID.
/2/users/:id/mutingCauses the User (in the path) to mute the target User. The User (in the path) must match the User context authorizing the request. - DELETEUnblock User by User ID
/2/users/:source_user_id/blocking/:target_user_idCauses the source User to unblock the target User. The source User must match the User context authorizing the request - DELETEUnfollow User
/2/users/:source_user_id/following/:target_user_idCauses the source User to unfollow the target User. The source User must match the User context authorizing the request - DELETEUnmute User by User ID
/2/users/:source_user_id/muting/:target_user_idCauses the source User to unmute the target User. The source User must match the User context authorizing the request
API details
- Base URL
https://api.twitter.com- Authentication
- A bearer token in the Authorization header
OAuth 2.0 (authorization code flow) with 20 scopes
HTTP oauth authentication - Operations
- 80 operations on 67 pathsGET 51POST 16DELETE 11PUT 2
- Main resources
- Tweets 27Users 19Lists 14Compliance 6Direct Messages 6Spaces 6Bookmarks 3General 1
- Response formats
application/jsonapplication/problem+json- Description format
- OpenAPI 3.0.0, API version
2.61 - Links
- OpenAPI document · Terms of service · Support
- Listed from
- APIs.guru OpenAPI Directory (CC0-1.0)
Source updated
How to test the Twitter API v2 in Swastik Codes
- Open the APISelect “Fork & run in Swastik Codes” on this page. Sign in or create a free account if asked.
- Fork it into your workspaceChoose a workspace. You get your own copy of the Twitter API v2 collection, without the publisher's secrets.
- Add your credentialsThis API uses A bearer token in the Authorization header. Add yours in the collection's variables or an environment; the requests already reference it.
- Send a requestPick an endpoint, for example “Bookmarks by User” (GET /2/users/:id/bookmarks?max_results=1&pagination_token=string&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheld&expansions=attachments.media_keys,attachments.poll_ids,author_id,edit_history_tweet_ids,entities.mentions.username,geo.place_id,in_reply_to_user_id,referenced_tweets.id,referenced_tweets.id.author_id&media.fields=alt_text,duration_ms,height,media_key,non_public_metrics,organic_metrics,preview_image_url,promoted_metrics,public_metrics,type,url,variants,width&poll.fields=duration_minutes,end_datetime,id,options,voting_status&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld&place.fields=contained_within,country,country_code,full_name,geo,id,name,place_type), and press Send. Check the response, add tests and run the whole collection with the runner.
Frequently asked questions
What is the Twitter API v2?
Twitter API v2 available endpoints It is listed under Social and has 80 endpoints.
Who publishes the Twitter API v2?
It is listed from X (Twitter)'s public API description (an OpenAPI document), not published by X (Twitter) on Swastik Codes. Anyone who controls twitter.com can claim the profile by adding a DNS TXT record.
What is the base URL of the Twitter API v2?
Requests go to https://api.twitter.com. Endpoint paths are added to this base URL.
How do I authenticate with the Twitter API v2?
It accepts 3 methods: A bearer token in the Authorization header; OAuth 2.0 (authorization code flow) with 20 scopes; HTTP oauth authentication.
How many endpoints does the Twitter API v2 have?
80 operations on 67 paths (51 GET, 16 POST, 11 DELETE, 2 PUT). The largest groups are Tweets, Users, Lists, Compliance.
Is forking the Twitter API v2 free?
Yes. Forking copies the collection into your workspace for free. It has been starred 0 times and forked 0 times.