SkillAgentSearch skills...

Bitly

🗜 A Ruby wrapper for the bit.ly API

Install / Use

/learn @philnash/Bitly
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Bitly

A Ruby gem for using the version 4 Bitly API to shorten links, expand short links and view metrics across users, links and organizations.

Gem version Build status Maintainability Maintainability Rating Inline docs

Installation

Add this line to your application's Gemfile:

gem 'bitly'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install bitly

Usage

For a quick introduction, read this blog post on how to use the Bitly API in Ruby.

Authentication

All API endpoints require authentication with an OAuth token. You can get your own OAuth token from the Bitly console. Click on the account drop down menu, then Profile Settings then Generic Access Token. Fill in your password and you can generate an OAuth access token.

For other methods to generate access tokens for users via OAuth flows, see the Authentication documentation.

Once you have an access token you can use all the API methods.

Creating an API client

All API methods are available through the Bitly::API::Client. Initialise the client with the access token like so:

client = Bitly::API::Client.new(token: token)

You can then use the client to perform actions with the API

Shorten a link

With an authenticated client you can shorten a link like so:

bitlink = client.shorten(long_url: "http://example.com")
bitlink.link
# => http://bit.ly/2OUJim0

Expand a link

With an authorised you can expand any Bitlink.

bitlink = client.expand(bitlink: "bit.ly/2OUJim0")
bitlink.long_url
# => http://example.com

Available API Endpoints

This gem supports the following active v4 API endpoints for theBitly API.

Groups

Groups documentation

Organizations

Organizations documentation

Users

Users documentation

Bitlinks

Bitlinks documentation

QR codes

QR codes documentation

Custom Bitlinks

Campaigns

Related Skills

View on GitHub
GitHub Stars450
CategoryDevelopment
Updated16d ago
Forks137

Languages

Ruby

Security Score

100/100

Audited on Mar 22, 2026

No findings