Logo
Twitter API Documentation

Twitter API v2

Number of APIs: 40


This is a Qodex Collection for the Twitter API v2 endpoints.

Refer to the main Twitter API documentation for more details.

If you have an API-related question, you can also discuss in the developer community forum.

Installation

Quick install

Go to the Collection and click Run in Qodex.

Manual install

You can also download this Collection from a GitHub repo here: https://github.com/twitterdev/Qodex-twitter-api

Environment

This Collection includes a pre-configured Environment. You will need to set up the following variables in order to run each request (depending on the authentication type used by the request you are sending):

Name Description
consumer_key Your consumer key
consumer_secret Your consumer secret
access_token Your access token
token_secret Your access token secret
bearer_token Your bearer token


1. Tweet Lookup - Single Tweet Usercontext

GET https://api.twitter.com/2/tweets/:id

This endpoint returns details about the Tweet specified by the requested ID.

For full details, see the API reference for this endpoint.



2. Tweet Lookup - Multiple Tweets

GET https://api.twitter.com/2/tweets?ids=

This endpoint returns details about up to 100 Tweets specified by the requested IDs.

For full details, see the API reference for this endpoint.



3. User Lookup - User by ID

GET https://api.twitter.com/2/users/:id

This endpoint returns details about a user by ID.

For full details, see the API reference for this endpoint.



4. User Lookup - Users by ID

GET https://api.twitter.com/2/users?ids=

This endpoint returns details about up to 100 users by ID.

For full details, see the API reference for this endpoint.



5. User Lookup - User by Username

GET https://api.twitter.com/2/users/by/username/:username

This endpoint returns details about a user by username.

For full details, see the API reference for this endpoint.



6. User Lookup - Users by Username

GET https://api.twitter.com/2/users/by?usernames=

This endpoint returns details about up to 100 users specified by username.

For full details, see the API reference for this endpoint.



7. Follows - Followers of user ID

GET https://api.twitter.com/2/users/:id/followers

Returns a list of users who are followers of the specified user ID.

For full details, see the API reference for this endpoint.



8. Follows - Users a user ID is following

GET https://api.twitter.com/2/users/:id/following

Returns a list of users the specified user ID is following.

For full details, see the API reference for this endpoint.



9. Follows - Follow a user ID

POST https://api.twitter.com/2/users/:id/following

Allows a user ID to follow another user.

For full details, see the API reference for this endpoint.



10. Follows - Unfollow a user ID

DELETE https://api.twitter.com/2/users/:source_user_id/following/:target_user_id

Allows a user ID to unfollow another user.

For full details, see the API reference for this endpoint.



11. Blocks - Block a user ID

POST https://api.twitter.com/2/users/:id/blocking

Allows a user ID to block another user.

For full details, see the API reference for this endpoint.



12. Blocks - Blocks lookup

GET https://api.twitter.com/2/users/:id/blocking

Returns a list of users who are blocked by the specified user ID.

For full details, see the API reference for this endpoint.



13. Blocks - Unblock a user ID

DELETE https://api.twitter.com/2/users/:source_user_id/blocking/:target_user_id

Allows a user ID to unblock another user.

For full details, see the API reference for this endpoint.



14. Mutes - Mute a user ID

POST https://api.twitter.com/2/users/:id/muting

Allows a user ID to mute another user.

For full details, see the API reference for this endpoint.



15. Mutes - Unmute a user ID

DELETE https://api.twitter.com/2/users/:source_user_id/muting/:target_user_id

Allows a user ID to unmute another user.

For full details, see the API reference for this endpoint.



16. Likes - Like a Tweet

POST https://api.twitter.com/2/users/:id/likes

Allows an authenticated user to like a Tweet.

For full details, see the API reference for this endpoint.



17. Likes - Liked Tweets

GET https://api.twitter.com/2/users/:id/liked_tweets

Returns a list of Tweets that have been liked by a specified user ID.

For full details, see the API reference for this endpoint.



18. Likes - Liking users

GET https://api.twitter.com/2/tweets/:id/liking_users

Returns a list of users who have liked a specified Tweet ID.

For full details, see the API reference for this endpoint.



19. Likes - Unlike a Tweet

DELETE https://api.twitter.com/2/users/:id/likes/:tweet_id

Allows an authenticated user to unlike a Tweet.

For full details, see the API reference for this endpoint.



20. Retweets - Retweet a Tweet

POST https://api.twitter.com/2/users/:id/retweets

Allows an authenticated user to Retweet a Tweet.

For full details, see the API reference for this endpoint.



21. Retweets - Retweeted by

GET https://api.twitter.com/2/tweets/:id/retweeted_by

Returns a list of users who have liked a specified Tweet ID.

For full details, see the API reference for this endpoint.



22. Retweets - Undo a Retweet

DELETE https://api.twitter.com/2/users/:id/retweets/:source_tweet_id

Allows an authenticated user to unlike a Tweet.

For full details, see the API reference for this endpoint.



23. Timelines - User Tweet timeline by ID

GET https://api.twitter.com/2/users/:id/tweets

Returns the most recent Tweets composed by a single user specified by the requested user ID.

For full details, see the API reference for this endpoint.



24. Timelines - User mention timeline by ID

GET https://api.twitter.com/2/users/:id/mentions

Returns the most recent Tweets mentioning a single user specified by the requested user ID.

For full details, see the API reference for this endpoint.



25. Hide Replies - Unhide a reply

PUT https://api.twitter.com/2/tweets/:id/hidden

Provides the ability to unhide a reply to a Tweet.

For full details, see the API reference for this endpoint.



26. Search Tweets - Recent search

GET https://api.twitter.com/2/tweets/search/recent?query=

Search for public Tweets created in the last 7 days.

For full details, see the API reference for this endpoint.



27. Search Tweets - Full-archive search

GET https://api.twitter.com/2/tweets/search/all?query=

Search across the complete history of public Tweets matching a search query; since the first Tweet was created in March 2006.

For full details, see the API reference for this endpoint.

NOTE this endpoint requires access via the Academic Research product track



28. Tweet Counts - Recent Tweet counts

GET https://api.twitter.com/2/tweets/counts/recent?query=

Search for public Tweets created in the last 7 days.

For full details, see the API reference for this endpoint.



29. Tweet Counts - Full-archive Tweet counts

GET https://api.twitter.com/2/tweets/counts/all?query=

Search across the complete history of public Tweets matching a search query; since the first Tweet was created in March 2006.

For full details, see the API reference for this endpoint.

NOTE this endpoint requires access via the Academic Research product track



30. Filtered Stream - Delete Rules (by rule value)

POST https://api.twitter.com/2/tweets/search/stream/rules

Delete filter rules. To delete one or more rules, submit a delete object payload with an array of rule values to delete.



31. Filtered Stream - Retrieve Rules

GET https://api.twitter.com/2/tweets/search/stream/rules

Returns a list of filter rules currently active on the streaming endpoint.



32. Filtered Stream - Stream (see description)

GET https://api.twitter.com/2/tweets/search/stream

Streams Tweets in real-time based on a specific set of filter rules.

Please note streaming responses are currently not supported in Qodex. Use this to help form your request, then click on Code > cURL. Copy the cURL command and paste in terminal to view the response.



33. Sampled Stream - Stream (see description)

GET https://api.twitter.com/2/tweets/sample/stream

Stream, in real-time, roughly a 1% sample of all public Tweets.

Please note streaming responses are currently not supported in Qodex. Use this to help form your request, then click on Code > cURL. Copy the cURL command and paste in terminal to view the response.



34. Spaces-Spaces lookup - Spaces lookup by single ID

GET https://api.twitter.com/2/spaces/:id?space.fields=&expansions=&user.fields=

This endpoint returns information about a single Space with the specified ID.



35. Spaces-Spaces lookup - Spaces lookup by list of IDs

GET https://api.twitter.com/2/spaces?ids=&space.fields=&expansions=&user.fields=

This endpoint returns information about one or more Spaces with the specified comma-separated list of IDs. You can request up to 100 Spaces in a single request



36. Spaces-Spaces lookup - Lookup Spaces created by one or more users

GET https://api.twitter.com/2/spaces/by/creator_id?user_ids=&space.fields=&expansions=&user.fields=

This endpoint returns information about a user. Specify user by username.



37. Spaces-Search Spaces - Search Spaces by title

GET https://api.twitter.com/2/spaces/search?query=&state=live&space.fields=&expansions=&user.fields

This endpoint returns Spaces matching the specified keyword query.



38. Batch Compliance - Create a batch compliance job

POST https://api.twitter.com/2/compliance/jobs



39. Batch Compliance - Get all batch compliance jobs

GET https://api.twitter.com/2/compliance/jobs?type=tweets



40. Batch Compliance - Get a compliance job by ID

GET https://api.twitter.com/2/compliance/jobs/:id



ENDPOINTS