node package manager


A API library for Node.JS

node-bitly - Bitly API for nodejs

This module provides calls to the Bitly API for Nodejs. For more information on the API request and responses visit the Bitly API docs

From version 4.0 of this library, the callback in methods have been removed and the library only provides promises for each method response. The library has also been re-written in ES2015/ES6. The transpiled version is only distributed via NPM, or can be created the command npm run compile if you fork the source. Finally support is no longer provided for node < 0.12.

To install via NPM type the following: npm install bitly

You can also install via git by cloning: git clone /path/to/bitly

This library uses the API provided by bitly and requires an OAuth token to use. To get your access token, visit (under Generic Access Token)

See for format of returned objects from the API

// For ES2015/ES6 
import Bitly from 'bitly';
let bitly = new Bitly('<YOUR ACCESS TOKEN>');
bitly.shorten('', (response) => {
}, (error) => {
// For ES5 
var Bitly = require('bitly');
var bitly = new Bitly('<YOUR ACCESS TOKEN>');
  .then(function(response) {
    var short_url =
    // Do something with data 
  }, function(error) {
    throw error;

To run tests type npm test. For coverage type npm run coverage Features

This module is limited to the following API methods:

  • shorten
  • expand
  • clicks / clicks_by_minute / clicks_by_day
  • referrers
  • countries
  • bitly_pro_domain
  • lookup
  • info
  • history
  • link_edit