Using the Twitter API

The Twitter API can be used to programmatically retrieve and analyze data, as well as engage with the conversation on Twitter.

This API provides access to a variety of different resources including the following:

  • Tweets
  • Users
  • Direct Messages
  • Lists
  • Trends
  • Media
  • Places
     

The Twitter API currently consists of two supported versions, as well as different access tiers. We have listed these below to help you better understand which version and tiers are available, but would recommend using the newest versions (Twitter API v2) where available. Learn more about our new versioning strategy.
 

Version / tier Description
Twitter API v2: Early Access

We are providing Early Access to our new v2 endpoints, which include the following:

We are also introducing several new features with this new version, including the following:
Standard v1.1

The legacy standard endpoints provide access to the following resources on Twitter API v1.1.

  • Post and engage with Tweets
  • Retrieve timelines
  • Post and receive direct messages
  • Manage and pull public account information
  • Create and manage lists
  • Follow, search, and get users
  • Retrieve trends
     
Premium v1.1

Scaled access to Search Tweets and our Account Activity API, Including a free sandbox tier and multiple paid tiers.
 

Enterprise

Enterprise-level products that provide access to Twitter’s data, including Full Archive and 30 Day Search, PowerTrack, Historical PowerTrack, Decahose, Engagement API, and much more!
 

 

We will eventually release Twitter API v2 equivalents for most of the currently available endpoints. To learn more about Twitter API v2:  Early Access, visit one of the following resources:

Please stay informed to receive updates about our roadmap, and let us know what you'd like to see on our roadmap.

How to get access to the Twitter API

Step one: Apply and receive approval for a developer account

To make any request to the Twitter API, you must first apply for a developer account, and have your use case approved. Once approved, you can create a Project and connect an associated developer App which will provide you a set of credentials that you will use to authenticate all requests to the API. 


We require an approved use case, authentication and App authorization from Twitter users when making OAuth 1.0a User Context,  to protect the people that use Twitter. Before you apply, we strongly encourage you to understand our developer policy, and to review our list of restricted use cases. If your use case does not adhere to our policy, we will reject your application. 
 

 

Please note: We launched a new developer portal experience in July 2020. If you have an existing developer account, you can opt into this new portal experience and create a Project and App to access the Twitter API v2 endpoints and features.

For developers with Twitter Apps pre-dating July 2018, note that an approved developer account is required to utilize Twitter API v2 endpoints, as well as Twitter Developer Labs.  Once your developer account is approved, your Apps will be listed in the new developer portal under Standalone Apps.


Step two: Save your App's key and tokens and keep them secure

Within your developer App, you will be provided a set of API Keys (also known as Consumer Keys). You will also have the chance to generate a set of Access Tokens that can be used to make requests on behalf of your personal Twitter account, and a Bearer Token that can be used to authenticate endpoints that require OAuth 2.0 Bearer Token. As these keys and tokens do not expire unless regenerated, we suggest creating environment variables, or using a secure password manager.

Please note: Your keys and tokens will only display once in the developer portal, so it is important that you store these credentials in your password management system as soon as you generate them.

If you misplace or forget the keys and tokens, you will need to regenerate them, which creates new keys and tokens, and invalidates the old ones. This means that you will have to update any integrations that you may have set up with your prior credentials. Until January 2021, you can retrieve an App’s key and tokens through the developer portal.

Learn more about our authentication best practices

Step three: Set up your access

At this point in time, there are a few different access tiers across two different versions of Twitter API endpoints that require different provisioning and authentication methods. Please see the below table for more details on how to get access to the different tiers and versions:

 

Version or tier Provisioning method
Twitter API v2: Early Access

You must have an approved developer account, and have activated the new developer portal experience.

Access is available with active keys and tokens for a developer App that is attached to a Project created in the developer portal

 

Want to use an existing App instead?

You can add an existing App to your new Project. Keep in mind that you may only have one primary or production App per approved use case. See our Developer Policy for more information, including guidelines around additional apps for development or testing.

 

Standard v1.1

Access is available with active keys and tokens for any active developer App.

To create a new developer App, you must have an approved developer account.

Premium v1.1

Access is available with active keys and tokens for a developer App, set up for a dev environment for a premium subscription endpoint. The level of access is determined by the monthly subscription level tier.

To use premium, You must have an approved developer account.

Enterprise v1.1

Access is available with an approved enterprise data licensing contract and set up by a sales representative.  The level of access is determined by the contract and account terms. 

Apply for enterprise access

 

Step five: Make your first request

Once you have access, you’re ready to get started using the Twitter API! We have quick start guides for many of our endpoints, several useful tools and libraries, and the following tutorials that describe how to build solutions around different use cases:


Check out our full list of tutorials.

Next up...

Find an endpoint to start working with via our API reference index and review its docs. 

We also have a set of Twitter API tools and libraries that you can use to speed up your integration.

Was this document helpful?

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.