As an internet user, you probably know Bitly as that link shortener used for social media. But as a developer, do you appreciate how the Bitly API helps organizations expand their business?

Bitly generates short, branded links that capture precise feedback on content and referrers. This data helps businesses of every size understand the complete picture of where visitors are coming from across every channel, and how often they return.

Underpinning this functionality is a powerful platform designed for creating and tracking customized links at scale.

Let’s take a developer's-eye tour of Bitly and see how it evolved from a simple link shortener into an enterprise-grade platform for managing links that get billions of clicks per month. You’ll get a glimpse of the Bitly API and learn what it means for developers who are integrating short links into customer communications.

What is Bitly?

Initially, Bitly was a service to provide short links for space-constrained social media platforms, alleviating problems of long, hard-to-share URLs. Bitly emerged as the first official Twitter URL shortener, and it also worked as a link archiver, helping people organize links to their favorite websites. But the platform soon evolved and expanded into a solution that can assist businesses to build their brands and acquire and connect with customers.

Due to the company's early presence on social media and to its steady evolution, Bitly short links are ubiquitous across the web: on Twitter, Facebook, SMS texts, media sites, and many more places. What's most evident about Bitly links is that they replace long, meaningless URLs with a simple, branded short link to help your messages, posts, and articles deliver more impact.

Companies understand their brands are priceless assets. In the social media era they're embracing URLs as part of their branding strategies. But building brand awareness takes time and requires the right marketing tools, which includes how they manage their URLs on the web. By using a custom domain to create branded short links, businesses can deliver a more coherent and trustworthy link experience.

A less evident but no less important feature is the ability to capture analytics based on link clicks and referrers. Your company can compile data based on the digital channels people arrived from right before they landed on your website. Leveraging the data captured by Bitly can reveal, for example, whether marketing campaigns are succeeding, which channels are working best, and what time of day produces more engagement with your social posts.

With an astonishing volume of 20 billion clicks every month, Bitly is the undisputed leader in link creation and reliability. This top position in link management stems from the robust, high-quality services it provides to companies who need to strengthen their marketing, customer service, and online sales initiatives.

Next-Level Links

Bitly’s API enables you to integrate custom link shortening with existing business systems, products, and services.

Here are some ways businesses have built success by making extensive use of Bitly’s API and developer tools to scale up their operations.

Short links are ubiquitous in SMS-based communication, where character count is limited. These links can be enhanced as custom links to individual recipients—which can be used for appointment reminders, password resets, and so on. SMS campaigns enable businesses to get in touch with customers and present a unique opportunity to use Bitly links for shortening and branding the links for text messages. Some brands use Bitly links for each campaign to measure effectiveness and improve targeting of customer engagement, device types, and geography.

Bitly short links let you create a branded, personalized invitation to a survey on every purchase receipt. Large organizations often find it hard to get individual reviews for each different survey source. Businesses solve this by generating unique Bitly-powered branded links to promote customer engagement and to know where the responses are coming from.

And what about tracking package delivery? Online merchants need to know the status of a shipment or see proof of delivery. Bitly automatically generates a unique short link connected to a tracking number via the Bitly API. Unique, personalized short links can incorporate the branding needs of both the seller and the shipper in the construction of the short link, while providing package tracking convenience for the shopper.

Over the years, Bitly built a link-management platform ready for enterprise-grade operations, on top of which businesses can create automated workflows. But what does this mean to the developer?

API Details

The Bitly API allows you to manage the creation, shortening, and tracking of links programmatically at scale.

The developer documentation will introduce you to the basics of the Bitly API, including tips, tricks, and different use cases. You can then learn how to integrate Bitly into your existing workflow, data platform, and social publishing tools.

With a modernRESTful API, Bitly follows standard REST conventions and uses a familiar OAuth2 authentication workflow, but also supports HTTP Basic Authentication to simplify command-line access. You can implement OAuth2 authentication so people can use your application, allowing end-users to manage and track shortened URLs.

The API provides endpoints for creating and managing links. Bitly links expand the link concept as a combination of "custom domain/customized back-half," for example, bitly.is/BetterLinks. Custom domains allow you to take control of your brand, promote your brand, and extend your brand, along with ensuring your audience knows they can trust your links.

Bitly offers a central place where you can organize and measure your links in many ways, including tags, groups, brands, teams, campaigns, and sales. The API gives developers endpoints to evaluate and visualize activity from different marketing channels across your organization.

Native mobile apps can also leverage the Bitly API endpoints. Bitly offers both the Bitly iOS SDK and the Bitly Android SDK to mobile developers.

Here's a simple shortening method that uses the Bitly Android SDK:

Bitly.shorten("http://theurlyouwishtoshorten.com", new Bitly.Callback() {
  	@Override
  	public void onResponse(Response response) {
  	// response provides a Response object which contains the
  	//shortened Bitly link
  	// response includes a status code
  	// Your custom logic goes here...
}

At some point, you’ll want to get some metrics about the links you’ve created. You can use your Android app to get the most-clicked Bitly links, ordered by the number of clicks, using the following code snippet:

URL url = new URL("https://api-ssl.bitly.com/v3/user/popular_links?access_token=ACCESS_TOKEN");
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
 
urlConnection.apply {
  	addRequestProperty("client_id", your client id)
	addRequestProperty("client_secret", your client secret)
    setRequestProperty("Authorization", "OAuth $token")
}
 
InputStream in = new BufferedInputStream(urlConnection.getInputStream());
result = inputStreamToString(in);

This program stores a JSON value to the result variable, like so:

{
  "data": {
  	"popular_links": [
  	{
  	  "clicks": 6150,
  	  "hash": "123456",
  	  "link": "http://bit.ly/123456"
  	},
  	{
  	  "clicks": 3647,
  	  "hash": "234567",
  	  "link": "http://bit.ly/234567"
  	},
  	...
  	],
  	"tz_offset": -4,
  	"unit": "day",
  	"units": -1
  },
  "status_code": 200,
  "status_txt": "OK"
}

Note that these code snippets assume Bitly is initialized and your user is already authenticated.

In addition to clicks from popular links, Bitly API endpoints allow you to obtain other metrics, including data grouped by time period, countries, pages, and domains.

The Bitly API features rate capacity options to handle tens of thousands of calls per hour. While rate limits exist, default limits are more than sufficient for most API usage. However, if your business requires a larger volume of API requests, you can always call the Bitly sales team to discuss solutions to bring your call rate to wherever you need it.

Start Sharing Branded Links Today

All the pieces are in place to automate the creation and tracking of custom branded links. Get started for free with the Bitly API, or subscribe to a plan to get a free custom domain, and start sharing branded links at scale.

For more information see: How to Leverage the Bitly API to Improve the Customer Experience or contact us to learn about our custom plans.

How to work with us

  • Contact us to set up a call.
  • We will analyze your needs and recommend a content contract solution.
  • Sign on with ContentLab.
  • We deliver topic-curated, deeply technical content to you.

To get started, complete the form to the right to schedule a call with us.

Send this to a friend