Comparing Twitter API’s sample stream endpoints
The v2 sampled stream endpoint is replacing the v1.1 statuses/sample endpoint. If you have some code, apps, or tools that use an older version of the sample stream endpoint, and are considering migrating to the newer Twitter API v2 endpoint, then this set of guides is for you.
These guides will focus on the following areas:
- API request parameters - The Twitter API v2 endpoint introduces a new set of request parameters. While some parameters will be familiar, especially for those integrating with Labs, there are many important differences such as the introduction of the fields and expansions parameters.
- New JSON format - Twitter API v2 introduces a completely new JSON format. Any code that parses v1.1 standard, premium, and enterprise JSON payloads will need to be updated to work with the new formats.
- App and Project requirements - To access the Twitter API v2, you will need to use credentials from a developer App that is associated with a Project.
The following tables compare the various types of sampled stream endpoints:
|Description||Standard v1.1||Twitter API v2|
|Authentication||OAuth 1.0a User Context||OAuth 2.0 Bearer Token|
|HTTP methods supported||GET||GET|
|Default request rate limits||8 connection requests per minute||50 connection requests per 15 min|
|Maximum allowed connections||2||1|
|Recovery and redundancy features||None||
Standard product track:
Academic research product track using the basic access level:
|New JSON format||Standard v1.1 format||
Twitter API v2 format (determined by fields and expansions request parameters, not backward-compatible with v1.1 formats)
To learn more about how to migrate from the Standard v1.1 format to the Twitter API v2 format, please visit our data formats migration guide.
|Supports selecting which fields return in the payload||No, data format pre-determined||✔|
|Supports specifying the language of Tweets returned||✔|
|Supports the annotations field||✔|
|Supports requesting specific metrics||✔|
|Supports the conversation_id field||✔|
|Requires the use of credentials from a developer App associated with a project||✔|