Standard v1.1 timelines to X API v2 timelines
If you have been working with the v1.1 timelines endpoints (statuses/user_timeline and statuses/mentions_timeline), the goal of this guide is to help you understand the similarities and differences between the standard and X API v2 timelines endpoints so that you can migrate your current integration to the new version.- Similarities:
- Authentication:
- OAuth 1.0a User Context (reverse chronological home timeline, user Post timeline and user mentions timeline)
- OAuth 2.0 App-Only (user Post timeline)
- Historical Access limit: User timeline (user Post timeline) provides access to most recent 3200 Posts; mentions timeline (user mention timeline) provides access to most recent 800 mentions.
- Support for Post edit history and metadata
- Rate limits (user Post timeline)
- Refresh polling: Ability to retrieve new results since the since_id
- Traversing timelines by Post IDs
- Results specifications:
- Results order: Results returned in reverse chronological order
- Ability to exclude replies (user Post timeline only)
- Ability to exclude Retweets (user Post timeline only)
- Authentication:
- Differences
- New Authentication capability:
- OAuth 2.0 App-Only (user mention timeline)
- OAuth 2.0 Authorization Code Flow with PKCE (reverse chronological home timeline, user Post timeline and user mentions timeline)
- Access requirements: X API v2 App and Project requirements
- Rate limits (user mention timeline and reverse chronological home timeline)
- Additional pagination method
- Different max_results (count) per response
- Response data format
- Request parameters
- Customized data format based on request parameters, including v2 fields and expansions
- Additional available data: metrics, Post annotations, polls
- New Authentication capability:
Similarities
Authentication The v1.1 statuses/user_timeline and the X API v2 user Post timeline endpoint support both OAuth 1.0a User Context and OAuth 2.0 App-Only. Therefore, you can continue using the same authentication method and authorization tokens if you migrate to the X API v2 version. Historical Access The v1.1 statuses/user_timeline and the X API v2 user Post timeline endpoint both will return the most recent 3200 Posts, including Retweets The v1.1 statuses/mentions_timeline and the X API v2 user mention timeline endpoint can return the most recent 800 Posts. Support for Post edit history and metadata Both versions provide metadata that describes any edit history. Check out the filtered stream API References and the Edit Posts fundamentals page for more details. Rate Limits
Refresh polling using since_id
Both versions allow polling for recent results using the since_id.
Traversing timelines by Post IDs
Both endpoints have the capability to traverse through timelines using Post ID ‘timestamps’ based on the way Post IDs are constructed. The functionality is generally the same except for the following:
Response filtering parameters
Differences
Authentication **The v1.1 statuses/mentions_timeline endpoint only supports OAuth 1.0a User Context. The X API v2 user mention timeline endpoint supports both OAuth 1.0a User Context,OAuth 2.0 App-Only, and OAuth 2.0 Authorization Code with PKCE ** If you would like to take advantage of the ability to access private or promoted metrics using the X API v2 user Post timeline endpoint, you will need to use OAuth 1.0a User Context or OAuth 2.0 Authorization Code with PKCE, and pass the user access tokens related to the user who posted the Post for which you would like to access metrics. Endpoint URLs Note that the X API v2 timelines endpoints require a path parameter of :id for the user ID.- Standard v1.1 endpoints:
- X API v2 endpoint:
Request parameters
Response data format
X API v2 JSON format
X API v2 is introducing new JSON designs for the objects returned by the APIs, including Post and user objects. You can learn more about the X API v2 format, how to use fields and expansions by visiting our guide, and by reading through our broader data dictionary
- 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 favorites (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 value.
- fields: X API v2 endpoints enable you to select which fields are provided in your payload. For example, Post, user, Media, Place, and Poll objects all have a list of fields that can be returned (or not).
- expansions: Used to expand the complementary objects referenced in Post JSON payloads. For example, all Retweets and Replies reference other Posts. By setting expansions=referenced_tweets.id, these other Post objects are expanded according to the tweet.fields setting. Other objects such as users, polls, and media can be expanded.
- conversation_id
- Two new annotations fields, including context and entities
- Several new metrics fields
Code examples
User Posts timeline (v2)
cURL
User mentions timeline (v2)
cURL