Twitter API v2
  1. Tweets
Twitter API v2
  • General
    • Returns the open api spec document.
      GET
  • Spaces
    • Space lookup up Space IDs
      GET
    • Space lookup by their creators
      GET
    • Search for Spaces
      GET
    • Space lookup by Space ID
      GET
  • Tweets
    • Tweet lookup by Tweet IDs
      GET
    • Full archive search counts
      GET
    • Recent search counts
      GET
    • Sample stream
      GET
    • Full-archive search
      GET
    • Recent search
      GET
    • Filtered stream
      GET
    • Rules lookup
      GET
    • Add/Delete rules
      POST
    • Tweet lookup by Tweet ID
      GET
    • Hide replies
      PUT
    • Returns Tweet objects liked by the provided User ID
      GET
    • Causes the user (in the path) to like the specified tweet
      POST
    • Causes the user (in the path) to unlike the specified tweet
      DELETE
    • User mention timeline by User ID
      GET
    • Causes the user (in the path) to retweet the specified tweet
      POST
    • Causes the user (in the path) to unretweet the specified tweet
      DELETE
    • User Tweets timeline by User ID
      GET
  • Users
    • Returns user objects that have liked the provided Tweet ID
      GET
    • Returns user objects that have retweeted the provided Tweet ID
      GET
    • User lookup by IDs
      GET
    • User lookup by usernames
      GET
    • User lookup by username
      GET
    • User lookup by ID
      GET
    • Returns user objects that are blocked by provided user ID
      GET
    • Block User by User ID
      POST
    • Returns user objects that follow the provided user ID
      GET
    • Following by User ID
      GET
    • Follow User
      POST
    • Mute User by User ID
      POST
    • Unblock User by User ID
      DELETE
    • Unfollow User
      DELETE
    • Unmute User by User ID
      DELETE
  1. Tweets

Recent search counts

GET
/2/tweets/counts/recent
Tweets
Returns Tweet Counts from the last 7 days that match a search query.
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request GET 'https://api.twitter.com/2/tweets/counts/recent?query='
Response Response Example
200 - Example 1
{
  "data": [
    {
      "end": "2019-08-24T14:15:22Z",
      "start": "2019-08-24T14:15:22Z",
      "tweet_count": 0
    }
  ],
  "errors": [
    {
      "detail": "string",
      "title": "string",
      "status": 0,
      "type": "about:blank"
    }
  ],
  "meta": {
    "next_token": "string",
    "total_tweet_count": 0
  }
}

Request

Query Params
query
string 
required
One query/rule/filter for matching Tweets. Up to 2048 characters.
start_time
string 
optional
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 
optional
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 
optional
Returns results with a Tweet ID greater than (that is, more recent than) the specified ID.
until_id
string 
optional
Returns results with a Tweet ID less than (that is, older than) the specified ID.
next_token
string 
optional
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 
optional
The granularity for the search counts results.

Responses

🟢200Recent tweet counts response
application/json
Body
data
array[object (SearchCount) {3}] 
optional
>= 1 items
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[null (Problem) {17}] 
optional
>= 1 items
object 
GenericProblem
optional
A generic problem with no additional information beyond that provided by the HTTP status code.
object 
InvalidRequestProblem
optional
A problem that indicates this request is invalid.
object 
ClientForbiddenProblem
optional
A problem that indicates your client is forbidden from making this request.
object 
ResourceNotFoundProblem
optional
A problem that indicates that a given Tweet, User, etc. does not exist.
object 
ResourceUnavailableProblem
optional
A problem that indicates a particular Tweet, User, etc. is not available to you.
object 
ResourceUnauthorizedProblem
optional
A problem that indicates you are not allowed to see a particular Tweet, User, etc.
object 
FieldUnauthorizedProblem
optional
A problem that indicates that you are not allowed to see a particular field on a Tweet, User, etc.
object 
DisallowedResourceProblem
optional
A problem that indicates that the resource requested violates the precepts of this API.
object 
UnsupportedAuthenticationProblem
optional
A problem that indicates that the authentication used is not supported.
object 
UsageCapExceededProblem
optional
A problem that indicates that a usage cap has been exceeded.
object 
ConnectionExceptionProblem
optional
A problem that indicates something is wrong with the connection
object 
ClientDisconnectedProblem
optional
Your client has gone away.
object 
OperationalDisconnectProblem
optional
You have been disconnected for operational reasons.
object 
RulesCapProblem
optional
You have exceeded the maximum number of rules.
object 
InvalidRuleProblem
optional
The rule you have submitted is invalid.
object 
DuplicateRuleProblem
optional
The rule you have submitted is a duplicate.
object 
ConflictProblem
optional
You cannot create a new job if one is already in progress.
meta
object 
optional
next_token
string 
optional
This value is used to get the next 'page' of results by providing it to the next_token parameter.
total_tweet_count
integer <int32>
optional
Sum of search query count results
🔴500500
Modified at 2022-09-10 21:25:17
Previous
Full archive search counts
Next
Sample stream
Built with