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

Filtered stream

GET
/2/tweets/search/stream
Tweets
Streams Tweets matching the stream's active rule set.
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request GET 'https://api.twitter.com/2/tweets/search/stream'
Response Response Example
200 - Example 1
{
  "data": {
    "author_id": "2244994945",
    "created_at": "Wed Jan 06 18:40:40 +0000 2021",
    "id": "1346889436626259968",
    "text": "Learn how to use the user Tweet timeline and user mention timeline endpoints in the Twitter API v2 to explore Tweet\\u2026 https:\\/\\/t.co\\/56a0vZUx7i"
  },
  "includes": {
    "media": [
      {
        "height": 0,
        "media_key": "string",
        "width": 0,
        "alt_text": "string",
        "type": "photo",
        "url": "http://example.com"
      }
    ],
    "places": [
      {
        "contained_within": [
          "f7eb2fa2fea288b1"
        ],
        "country": "United States",
        "country_code": "US",
        "full_name": "Lakewood, CO",
        "geo": {
          "bbox": [
            -105.193475,
            39.60973,
            -105.053164,
            39.761974
          ],
          "geometry": {
            "coordinates": [
              -105.18816086351444,
              40.247749999999996
            ],
            "type": "Point"
          },
          "properties": {},
          "type": "Feature"
        },
        "id": "f7eb2fa2fea288b1",
        "name": "Lakewood",
        "place_type": "city"
      }
    ],
    "polls": [
      {
        "duration_minutes": 0,
        "end_datetime": "2019-08-24T14:15:22Z",
        "id": "1365059861688410112",
        "options": [
          {
            "label": "string",
            "position": 0,
            "votes": 0
          },
          {
            "label": "string",
            "position": 0,
            "votes": 0
          }
        ],
        "voting_status": "open"
      }
    ],
    "tweets": [
      {
        "author_id": "2244994945",
        "created_at": "Wed Jan 06 18:40:40 +0000 2021",
        "id": "1346889436626259968",
        "text": "Learn how to use the user Tweet timeline and user mention timeline endpoints in the Twitter API v2 to explore Tweet\\u2026 https:\\/\\/t.co\\/56a0vZUx7i"
      }
    ],
    "users": [
      {
        "created_at": "2013-12-14T04:35:55Z",
        "id": "2244994945",
        "name": "Twitter Dev",
        "protected": false,
        "username": "TwitterDev"
      }
    ]
  },
  "matching_rules": [
    {
      "id": "120897978112909812",
      "tag": "string"
    }
  ]
}

Request

Query Params
expansions
array[string]
optional
A comma separated list of fields to expand.
tweet.fields
array[string]
optional
A comma separated list of Tweet fields to display.
user.fields
array[string]
optional
A comma separated list of User fields to display.
media.fields
array[string]
optional
A comma separated list of Media fields to display.
place.fields
array[string]
optional
A comma separated list of Place fields to display.
poll.fields
array[string]
optional
A comma separated list of Poll fields to display.
backfill_minutes
integer 
optional
The number of minutes of backfill requested

Responses

🟢200The request was successful. Successful responses will return a stream of individual JSON Tweet payloads.
application/json
Body
FilteredStreamingTweet
optional
A tweet or error that can be returned by the streaming tweet API
One of
The values returned with a successful streamed tweet. Includes the user provided rules that the tweet matched.
data
object 
Tweet
required
Example:
{"author_id":"2244994945","created_at":"Wed Jan 06 18:40:40 +0000 2021","id":"1346889436626259968","text":"Learn how to use the user Tweet timeline and user mention timeline endpoints in the Twitter API v2 to explore Tweet\\u2026 https:\\/\\/t.co\\/56a0vZUx7i"}
includes
object 
Expansions
optional
matching_rules
array [object {2}] 
required
The list of rules which matched the tweet
🔴500500
Modified at 2022-09-10 21:25:17
Previous
Recent search
Next
Rules lookup
Built with