countAll abstract method

Future<TwitterResponse<List<TweetCountData>, TweetCountMeta>> countAll({
  1. required String query,
  2. String? nextToken,
  3. DateTime? startTime,
  4. DateTime? endTime,
  5. String? sinceTweetId,
  6. String? untilTweetId,
  7. TweetCountGranularity? granularity,
  8. ForwardPaging<List<TweetCountData>, TweetCountMeta>? paging,

This endpoint is only available to those users who have been approved for Academic Research access.

The full-archive Tweet counts endpoint returns the count of Tweets that match your query from the complete history of public Tweets; since the first Tweet was created March 26, 2006.

The value returned when the paging callback is specified is the first object obtained that started the paging process. The value obtained in the paging process is passed to the paging callback function as a PagingEvent object.


  • query: One query for matching Tweets. You can learn how to build this query by reading a build a query guide. You can use all available operators and can make queries up to 1,024 characters long.

  • nextToken: This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, assuming that your request contains more than 31 days-worth of results, and should not be modified. You can learn more by visiting our page on pagination.

  • startTime: YYYY-MM-DDTHH:mm:ssZ (ISO 8601/RFC 3339). The oldest UTC timestamp from which the Tweets will be provided. Timestamp is in second granularity and is inclusive (for example, 12:00:01 includes the first second of the minute). By default, a request will return Tweets from up to 30 days ago if you do not include this parameter.

  • endTime: YYYY-MM-DDTHH:mm:ssZ (ISO 8601/RFC 3339). Used with startTime. The newest, most recent UTC timestamp to which the Tweets will be provided. Timestamp is in second granularity and is exclusive (for example, 12:00:01 excludes the first second of the minute). If used without startTime, Tweets from 30 days before endTime will be returned by default. If not specified, endTime will default to now - 30 seconds.

  • sinceTweetId: Returns results with a Tweet ID greater than (that is, more recent than) the specified ID. The ID specified is exclusive and responses will not include it. If included with the same request as a startTime parameter, only sinceTweetId will be used.

  • untilTweetId: Returns results with a Tweet ID less than (that is, older than) the specified ID. Used with sinceTweetId. The ID specified is exclusive and responses will not include it.

  • granularity: This is the granularity that you want the time series count data to be grouped by. You can request minute, hour, or day granularity. The default granularity, if not specified is hour.

  • paging: If this callback function is specified, paging is performed continuously until certain conditions are met. This paging function is uni-directional, only forward, and allows for safe paging. The response and other metadata obtained when paging is performed is passed to the callback function as PagingEvent object. So you can get the result of paging from PagingEvent object. Also, the direction and continuity of paging can be controlled by returning PaginationControl object in the paging callback function. Please use to continue paging and move forward. And be sure to return PaginationControl.stop() to terminate paging on arbitrary conditions, otherwise paging continues until the next page runs out.

Endpoint Url

Authentication Methods

  • OAuth 2.0 App-only

Rate Limits

  • App rate limit (OAuth 2.0 App Access Token): 300 requests per 15-minute window shared among all users of your app



Future<TwitterResponse<List<TweetCountData>, TweetCountMeta>> countAll({
  required String query,
  String? nextToken,
  DateTime? startTime,
  DateTime? endTime,
  String? sinceTweetId,
  String? untilTweetId,
  TweetCountGranularity? granularity,
  ForwardPaging<List<TweetCountData>, TweetCountMeta>? paging,