Setting up API in Twitter


Before you start

To connect to Twitter from R, you need to have a Twitter account. You can create it here
You need to note down your username and password

Create a Twitter account at
Now go to and sign in with your username and password

There you will need to set up your developer’s access: click on “Apply for a developer account”

Twitter Apps

Select a Twitter username for which you are setting up your developer’s access

On the next screen select the option that better suit your needs, for our tutorial, we will be using option 2 “I am requesting access for my own personal use”

Now you need to specify your application name and your country

You will need to specify the case for your access (“Academic research” for me), write a 300 word description of your intended use and your relation to government entity

For example, like this

Now, you click submit and you will need to wait till Twitter approves your access

Once your access is approved, your Developer account will look like this

and you can set up your Twitter app now by clicking on “Create an app”

Enter the details for your application:

Click on “Create a new App”

Go to the “Keys and Access Tokens” tab and click on “Create my access token”

You need to write down (copy and paste!) the details of your access:

  • API key
  • API secret
  • Token
  • Token secret

and now you can go back to R and connect from R!

Leave a Reply

Your email address will not be published. Required fields are marked *