Google Adds API For URL Shortener and Link Analytics

Our API report for 2010 listed 25 URL Shorteners in our directory (there are now 28 URL shorteners). One of the better known link shrinkers in recent times,, has just given developers a New Years gift by providing an API. The Google URL Shortener API allows developers to integrate the service into their application and gives access to all operations like shortening and expanding URLs and giving access to your history and analytics.

Google's Ben D’Angelo announced the API at the Google code blog and developers can now integrate the service into their applications that need to send across short URLs for sharing content. By providing access to the analytics via the API, applications could even monitor the usage statistics and traffic patterns.

The API documentation page can get you started with the API. The API is REST based and JSON only. It is interesting to note that every request may include an API Key and an Auth Token. The URL Shortener has a very generous rate limit, joining the million daily queries club. You can get yourself an API Key via the API Console. The Auth Token is required when you perform the actions on behalf of a Google User. The Auth Token can be obtained typically via OAuth.

To get up and running with the API, visit the Getting Started section that takes you through the basic operations like shortening/expanding a URL, looking up short URL’s analytics and looking up a user’s history. An example POST request for shortening http://www.programmable.web is given below:


With the following JSON request : {“longURL”: “”}

If all goes well, , you get the following JSON response back:

"kind": "urlshortener#url",
"id": "",
"longUrl": "”

If you have already integrated an existing URL Shortener API into your application, this news might not be exciting but for developers looking to integrate one, this is an excellent and easy to use option out there, along with basic analytics data also available via the API.

One of the concerns around URL shorteners has been malicious content being camouflaged under a short URL. One of the enhancements that is likely to come in later versions of the API is to make the auto-detection of spam or malicious content more robust. It will be interesting to see how well it does that. The URL Shortener space has seen a lot of activity in the last year and these services are vying with each other to become the de facto service. Platforms like Twitter are employing their own shortening service to manage the links and control the analytics data. This space should see interesting times this year.

Be sure to read the next API article: Mapping Granddaddy Goes OpenStreetMap, No API Key Needed