Getting Started with the Twitter API

What is exactly is the Twitter API and what can it do for me?

An API or Application Programming Interface is, simply put, a set of tools and functions to access another system’s internal computer systems. An API can be used to perform tasks, do searches of the target system’s data or post data to their systems among other things. If you have followed one of those pop-ups that start off with “An application would like to connect to your Twitter account…” then you have used the Twitter API.

Twitter’s API provides everything from simple features such as the Tweet Button which can be placed on any website to the full suite of searches, follow/unfollow and timeline functionality that Twitter client’s like Hootsuite and TweetDeck use to access your Twitter account. All of these use the same API to instruct Twitter to do your bidding.

Twitter offers a handful of ways to connect to and use their API. Some require no authentication and require zero programming, like Twitter Web Intents. On the other end of the spectrum, if you want to write your own code to tweet, search and whatever else you can imagine with Twitter, there are options for you too… keep reading.


First, we need to register a new application with their development site at The application will tweet for the Twitter user that you use to signup for the development account. Be cautious here. Consider creating a new private Twitter account to play with as you are developing your application. You don’t want to be debugging your shiny new Twitter app in front of your 50,000 followers when it goes rogue and starts randomly retweeting your private @ParisHilton list… but that’s another story.

First off, you will need an a name for your application and a URL it will be installed on. The Application Name and Application Website that you submit will be displayed in your Twitter client under the tweet source (ie. web, Hootsuite, TweetDeck et al) and linked to the URL provided. These names are unique too, so don’t burn your company name on a test app.

Select Browser for Application Type.

Callback URL must be the website from which you will be executing your code. If you are creating an application to work with and tweet for @DomainsTweets then the Callback URL should be something at If your application will require authorization from other user’s Twitter accounts then they will be redirected back to this URL after they have authorized your app for access. If you attempt to execute your Twitter app from a domain other than the domain of this URL you’ll probably get an authorization error.

If you want your app to tweet, select the non-default Read / Write option under Default Access Type.

Once you complete and submit the form, your application will be assigned an API key and various other security keys for authentication. On the first page, copy and paste out API key (which is the same as Consumer key below it) and Consumer secret, you will need these to connect to the API.

On the right-hand menu, select My Access Token and the next page will list two more tokens you will need to connect: Access Token and Access Token Secret. Copy and paste these out for later as well.


The libraries section of the Twitter Developers site lists close to twenty languages and over sixty different public libraries that are available to connect to the Twitter API using your favorite web language such as PHP, Python, Ruby or Perl. It shouldn’t be too hard to find a library that works with your favorite scripting language.

Recommended articles