Standard v1.1 compared to Twitter API v2
If you have been working with the standard v1.1 GET statuses/show and GET statuses/lookup, the goal of this guide is to help you understand the similarities and differences between the standard and Twitter API v2 Tweet lookup endpoints.
- OAuth 1.0a User Context
- Tweets per request limits
- Endpoint URLs
- App and Project requirements
- Request parameters
- New JSON format
OAuth 1.0a User Context authentication method
The standard endpoint supports OAuth 1.0a User Context, while the new Twitter API v2 Tweet lookup endpoint supports both OAuth 1.0a User Context and OAuth 2.0 Bearer Token. Therefore, if you were previously using one of the standard v1.1 Tweet lookup endpoints, you can continue using the same authentication method if you migrate to the Twitter API v2 version.
Depending on your authentication library/package of choice, Bearer Token authentication is probably the easiest way to get started and can be set with a simple request header. To learn how to generate a Bearer Token, see this OAuth 2.0 Bearer Token guide.
Tweets per request limits
The v1.1 GET statuses/lookup endpoint allows you to specify 100 Tweets per request. This also goes for the GET /tweets endpoint. To specify a full 100 Tweets, you will need to pass the ids parameter as a query parameter rather than a path parameter, and include the list of Tweet IDs in a comma-separated list.
- Standard v1.1 endpoints:
- Twitter API v2 endpoint:
App and Project requirements
The Twitter API v2 endpoints require that you use credentials from a developer App that is associated to a Project when authenticating your requests. All Twitter API v1.1 endpoints can use credentials from standalone Apps or Apps associated with a project.
The following standard v1.1 request parameters have equivalents in Twitter API v2:
|Standard||Twitter API v2|
One of the biggest differences between standard v1.1 and Twitter API v2 endpoint versions is how you select which fields return in your payload. For the standard endpoints, there are several parameters that you could use to identify which fields or sets of fields would return in the payload, while the Twitter API v2 version simplifies these different parameters into fields and expansions.
There are also a set of standard Tweet lookup request parameters not supported in Twitter API v2:
|tweet_mode||This parameter enables developers to request a series of different extended fields that had been introduced in the years since statuses/show and statuses/lookup were introduced. It has been replaced with the fields and expansions functionality.|
|trim_user||This parameter is used to reduce the number of fields that deliver in the user object that comes alongside each Tweet. It has been replaced with the additive fields and expansions functionality.
To request user information alongside your requested Tweet, you will need to use a combination of the author_id expansion and the user.fields parameter with a set of specified user fields.
|include_my_retweet||This parameter includes the ID of the source Tweet for those specified Tweets that were Retweeted by the authenticating user.|
|include_entities||This parameter is used to remove the entities node from the Tweet payload. It has been replaced with the additive fields and expansions functionality.|
|include_ext_alt_text||This parameter adds an additional ext_alt_text field in the media entity if that media has alt text attached to it.
|include_card_uri||This parameters adds a card_uri attribute when there is an ads card attached.
This parameter would return the Tweet ID and nullified fields for unavailable Tweets.
In v2, we return the Tweet ID and a detailed error message for unavailable Tweets.
New JSON format
- At the JSON root level, the standard endpoints return Tweet objects in a statuses array, while Twitter API v2 returns a data array.
- Instead of referring to Retweeted and Quoted "statuses", Twitter API v2 JSON refers to Retweeted and Quoted Tweets. Many legacy and deprecated fields, such as contributors and user.translator_type are being removed.
- Instead of using both favorites (in Tweet object) and favourites (in user object), Twitter API v2 uses the term like.
- Twitter is adopting the convention that JSON values with no value (for example, null) are not written to the payload. Tweet and user attributes are only included if they have a non-null values.
In addition to the changes that we made to our new JSON format, we also introduced a new set of fields to the Tweet object including the following: