Manage follows: Standard v1.1 compared to Twitter API v2

If you have been working with the standard v1.1 POST friendships/create and POST friendships/destroy endpoints, the goal of this guide is to help you understand the similarities and differences between the standard and Twitter API v2 user lookup endpoints.

  • Similarities
    • OAuth 1.0a User Context
    • Users per request limits
  • Differences
    • Endpoint URLs
    • App and Project requirements
    • HTTP methods
    • Request parameters
    • New JSON format
       

Similarities

OAuth 1.0a User Context authentication method

Both the endpoint versions support OAuth 1.0a User Context. Therefore, if you were previously using one of the standard v1.1 manage follows endpoints, you can continue using the same authentication method if you migrate to the Twitter API v2 version. 

Users per request limits
The standard v1.1 endpoints allows you to return up to 5000 users per request. The new v2 endpoints allows you to return up to 1000 users per request. To return a full 1000 users, you will need to pass max_results=1000 as a query parameter; you can then pass the next_token returned in the response payload to the pagination_token query parameter in your next request.

 

Differences

Endpoint URLs

  • Standard v1.1 endpoints:
    • POST https://api.twitter.com/1.1/friendships/create.json
      (follow a user)
    • POST https://api.twitter.com/1.1/friendships/destroy.json
      (unfollow a user)
  • Twitter API v2 endpoint:
    • POST https://api.twitter.com/2/users/:source_user_id/following
      (follow a user)
    • DELETE https://api.twitter.com/2/users/:source_user_id/following/:target_user_id
      (unfollow a user) 

 

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.

Request parameters

The following standard v1.1 request parameters have equivalents in Twitter API v2:

Standard v1.1 Twitter API v2
user_id target_user_id
screen_name No equivalent

Please note that the Standard v1.1 parameters are passed as query parameters, whereas the Twitter API v2 parameters are passed as body parameters (for the POST endpoint) or path parameters (for the DELETE endpoint).

Also, source_id is not required when using the standard v1.1 endpoints since the access tokens passed with OAuth 1.0a User Context inferred which user was initiating the follow/unfollow. 
 

New JSON format

Twitter API v2 is introducing new JSON designs for the objects returned by the APIs, including Tweet and user objects.

  • At the JSON root level, the standard endpoints return user 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:

Was this document helpful?
Thank you

Thank you for the feedback. We’re really glad we could help!

Thank you for the feedback. How could we improve this document?
Thank you for the feedback. Your comments will help us improve our documents in the future.