Stream (see description)
GET https://api.twitter.com/2/tweets/sample/stream
Stream, in real-time, roughly a 1% sample of all public Tweets.
Please note streaming responses are currently not supported in Qodex. Use this to help form your request, then click on Code > cURL. Copy the cURL command and paste in terminal to view the response.
Sign up for the Twitter API
Request Params
| Key | Datatype | Required | Description |
| tweet.fields
| null | | Comma-separated list of fields for the Tweet object.
Allowed values: attachments,author_id,context_annotations,conversation_id,created_at,entities,geo,id,in_reply_to_user_id,lang,possibly_sensitive,public_metrics,referenced_tweets,reply_settings,source,text,withheld,edit_history_tweet_ids,edit_controls
Default values:
id,text,edit_history_tweet_ids |
| expansions
| null | | Comma-separated list of fields to expand. Expansions enable requests to expand an ID into a full object in the includes response object.
Allowed values: attachments.poll_ids,attachments.media_keys,author_id,geo.place_id,in_reply_to_user_id,referenced_tweets.id,entities.mentions.username,referenced_tweets.id.author_id,edit_history_tweet_ids
Default values: none |
| media.fields
| null | | Comma-separated list of fields for the media object. Expansion required.
Allowed values: duration_ms,height,media_key,preview_image_url,public_metrics,type,url,width
Default values:
media_key,type |
| poll.fields
| null | | Comma-separated list of fields for the poll object. Expansion required.
Allowed values: duration_minutes,end_datetime,id,options,voting_status
Default values:
id,options |
| place.fields
| null | | Comma-separated list of fields for the place object. Expansion required.
Allowed values: contained_within,country,country_code,full_name,geo,id,name,place_type
Default values:
id,full_name |
| user.fields
| null | | Comma-separated list of fields for the user object. Expansion required.
Allowed values: created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,withheld
Default values:
id,name,username |
| backfill_minutes
| null | | Provide a whole number between 1 and 5.
This parameter enables the recovery of up to five minutes worth of data that may have been missed during a disconnection.
The backfilled Tweets will automatically flow through a reconnected stream, with older Tweets generally being delivered before any newly matching Tweets. This feature will deliver all Tweets that matched your rules and were published during the timeframe selected, meaning that if you were disconnected for 90 seconds, and you requested two minutes of backfill, you will receive 30 seconds worth of duplicate Tweets. Due to this, you should make sure your system is tolerant of duplicate data.
This feature is currently only available to the academic research product track. |
HEADERS
| Key | Datatype | Required | Description |
RESPONSES
status: ``