Recent search counts

GET /2/tweets/counts/recent

Returns Tweet Counts from the last 7 days that match a search query.

Query parameters

  • query string Required

    One query/rule/filter for matching Tweets. Refer to https:\/\/t.co\/rulelength to identify the max query length

  • start_time string(date-time)

    YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp (from most recent 7 days) from which the Tweets will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute).

  • end_time string(date-time)

    YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Tweets will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute).

  • since_id string

    Returns results with a Tweet ID greater than (that is, more recent than) the specified ID.

  • until_id string

    Returns results with a Tweet ID less than (that is, older than) the specified ID.

  • next_token string

    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, and should not be modified.

  • pagination_token string

    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, and should not be modified.

  • granularity string

    The granularity for the search counts results.

    Values are minute, hour, or day. Default value is hour.

Responses

  • 200

    Recent tweet counts response

    Hide response attributes Show response attributes object
    • data array[object]

      Represent a Search Count Result

      At least 1 element.

      Hide data attributes Show data attributes array[object]
      • end string(date-time) Required

        The end time of the bucket

      • start string(date-time) Required

        The start time of the bucket

      • tweet_count integer Required

        The count for the bucket

    • errors array[object]

      An HTTP Problem Details object, as defined in IETF RFC 7807 (https://tools.ietf.org/html/rfc7807).

      At least 1 element.

      Hide errors attributes Show errors attributes array[object]
      • type string Required
      • title string Required
      • detail string
      • status integer
    • meta object
      Hide meta attributes Show meta attributes object
      • next_token string

        This value is used to get the next 'page' of results by providing it to the next_token parameter.

      • total_tweet_count integer(int32)

        Sum of search query count results

  • default

    The request has failed.

    Hide response attributes Show response attributes object
    • code integer(int32) Required
    • message string Required
GET /2/tweets/counts/recent
curl \
 -X GET https://api.twitter.com/2/tweets/counts/recent?query=%28from%3ATwitterDev+OR+from%3ATwitterAPI%29+has%3Amedia+-is%3Aretweet \
 -H "Authorization: Bearer $ACCESS_TOKEN"
Response examples (200)
{
  "data": [
    {
      "end": "2023-05-04T09:42:00+00:00",
      "start": "2023-05-04T09:42:00+00:00",
      "tweet_count": 42
    }
  ],
  "errors": [
    {
      "type": "string",
      "title": "string",
      "detail": "string",
      "status": 42
    }
  ],
  "meta": {
    "next_token": "string",
    "total_tweet_count": 42
  }
}
Response examples (200)
{
  "data": [
    {
      "end": "2025-05-04T09:42:00Z",
      "start": "2025-05-04T09:42:00Z",
      "tweet_count": 42
    }
  ],
  "errors": [
    {
      "type": "string",
      "title": "string",
      "detail": "string",
      "status": 42
    }
  ],
  "meta": {
    "next_token": "string",
    "total_tweet_count": 42
  }
}
Response examples (default)
{
  "code": 42,
  "message": "string"
}
Response examples (default)
{
  "code": 42,
  "message": "string"
}