Skip to main content
GET
/
2
/
tweets
/
counts
/
all
Get count of all Posts
curl --request GET \
  --url https://api.x.com/2/tweets/counts/all \
  --header 'Authorization: Bearer <token>'
{
  "data": [
    {
      "end": "2023-11-07T05:31:56Z",
      "start": "2023-11-07T05:31:56Z",
      "tweet_count": 123
    }
  ],
  "errors": [
    {
      "title": "<string>",
      "type": "<string>",
      "detail": "<string>",
      "status": 123
    }
  ],
  "meta": {
    "newest_id": "<string>",
    "next_token": "<string>",
    "oldest_id": "<string>",
    "total_tweet_count": 123
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

query
string
required

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

Required string length: 1 - 4096
Example:

"(from:TwitterDev OR from:TwitterAPI) has:media -is:retweet"

start_time
string<date-time>

YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp (from most recent 7 days) from which the Posts 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 Posts 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 Post ID greater than (that is, more recent than) the specified ID. Unique identifier of this Tweet. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers.

Example:

"1346889436626259968"

until_id
string

Returns results with a Post ID less than (that is, older than) the specified ID. Unique identifier of this Tweet. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers.

Example:

"1346889436626259968"

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. A base36 pagination token.

Minimum string length: 1
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. A base36 pagination token.

Minimum string length: 1
granularity
enum<string>
default:hour

The granularity for the search counts results.

Available options:
minute,
hour,
day
search_count.fields
enum<string>[]

A comma separated list of SearchCount fields to display. The fields available for a SearchCount object.

Minimum array length: 1
Available options:
end,
start,
tweet_count
Example:
["end", "start", "tweet_count"]

Response

The request has succeeded.

data
object[]
Minimum array length: 1
errors
object[]
Minimum array length: 1
meta
object