Standard v1.1 compared to X API v2
If you have been working with the standard v1.1 GET users/show and GET users/lookup, the goal of this guide is to help you understand the similarities and differences between the standard and X API v2 users lookup endpoints.- Similarities
- OAuth 1.0a User Context
- Users per request limits
- Differences
- Endpoint URLs
- App and Project requirements
- Response data format
- Request parameters
Similarities
OAuth 1.0a User Context authentication method The standard endpoint supports OAuth 1.0a User Context, while the new X API v2 users lookup endpoints supports both OAuth 1.0a User Context and App only. Therefore, if you were previously using one of the standard v1.1 users lookup endpoints, you can continue using the same authentication method if you migrate to the X API v2 version. Depending on your authentication library/package of choice, App only authentication is probably the easiest way to get started and can be set with a simple request header. To learn how to generate an App only Access Token, see this App only guide. Users per request limits The standard v1.1 GET users/lookup endpoint allows you to specify 100 users per request. This also goes for the GET /users and GET /users/by endpoints. To specify a full 100 users, you will need to pass the ids (GET /users) parameter or the username (GET /users/by) parameter as a query parameter, and include the list of user IDs/usernames in a comma-separated list.Differences
Endpoint URLs- Standard v1.1 endpoints:
- https://api.x.com/1.1/users/show (single-ID or username lookup)
- https://api.x.com/1.1/users/lookup (multi-ID or username lookup)
- X API v2 endpoint:
- https://api.x.com/2/users (multi-ID lookup)
- https://api.x.com/2/users/:id (single-ID lookup)
- https://api.x.com/2/users/by (multi-username lookup)
- https://api.x.com/2/users/by/username/:username (single-username lookup)
- At the JSON root level, the standard endpoints return Post objects in a statuses array, while X API v2 returns a data array.
- Instead of referring to Retweeted and Quoted “statuses”, X 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 Post object) and favourites (in user object), X API v2 uses the term like.
- X is adopting the convention that JSON values with no value (for example, null) are not written to the payload. Post and user attributes are only included if they have a non-null values.
- A conversation_id field
- Two new annotations fields, including context and entities
- Several new metrics fields
- A new reply_setting field, which shows you who can reply to a given Post
Standard | X API v2 |
user_id | ids |
screen_name | username |
Standard | Comment |
---|---|
include_entities | This parameter is used to remove the entities node from the Post payload. It has been replaced with the additive fields and expansions functionality. |