Twitter Tweet Counts Timeline (V2) - Data API Endpoint

Tweet Counts Timeline (V2) by query, bearer token, pagination token, granularity, time range (ending time), time range (starting time) and recent or all.


Download Twitter Tweet Counts Timeline (V2) data from the Official Twitter API | 👥  Contributors: steve 🚩  Report

✏️ Inputs

Query query Required

Search query to run on Twitter, see the Twitter Query Builder for examples on how to search and check out the Quick Start Guide.

E.g. #beer
Bearer Token access_token Required

Your Twitter app’s Bearer Token for collecting data with. If you don’t have one, see How to Get a Twitter API Key Without Approval or check out Twitter’s docs on Bearer Tokens for more information.

If you get the error client-not-enrolled, then make sure you’re not using a standalone app and try creating a new application with the Add App button under a project and NOT under the standalone section.

Pagination Token pagination_token Optional

Used for pagination. Provide the next_token you see in a response here to get the next page of results.

Granularity granularity Optional

Set this to minute, hour or day to change how the counts are returned.

E.g. hour
Time Range (Ending Time) end_time Optional

End time range of the Tweets to fetch. This is exclusive, e.g. 2021-01-01T00:00:01Z will exclude the first second of 2021. Format is in YYYY-MM-DDTHH:mm:ssZ.

E.g. 2021-01-01T00:00:01Z
Time Range (Starting Time) start_time Optional

The starting timestamp of Tweets to return in the query. This is inclusive, so 2020-01-01T00:00:00 will include the first second of the new year.

E.g. 2020-01-01T00:00:00Z
Recent or All recent_or_all Default recent

Leave this as the default recent to search for Tweets published in the last 7 days. Change this to all to access the Twitter API V2 Full Archive Search (only available to users on the Academic Research product track).

📝 Notes

Twitter API V2 for getting the number of Tweets matching a query in the past 7 days or from the entire archive (requires academic track approval for the full archive). See the Twitter API V2 Tweet Counts Endpoint for more information.

This will not only return the total number of Tweets, but show the Tweets per hour / day / etc… to help spot trends!

Posted by steve on Sept. 30, 2022, 6:30 a.m. 🚩  Report

⚡️ Endpoint

GET https://api.twitter.com/2/tweets/counts/{{recent_or_all}}?query={{query}}&next_token={{pagination_token}}&end_time={{end_time}}&start_time={{start_time}}&granularity={{ granularity }}

Body

None

Headers

Authorization
Bearer {{access_token}}