Created: 2012-03-26 01:52
Updated: 2018-08-11 03:40
License: mit



Ruby client for Amazon Alexa APIs.

These include Alexa Top Sites and Alexa Web Information Service.

HTTP transport thanks to Net::HTTP, with a little help from addressable.

XML parsing courtesy of Nokogiri.

Thorough test coverage provided by MiniTest::Spec.

Deprecation Notice

AWS introduced IAM credentials support for accessing AWIS and Alexa Top Sites. They deprecated the use of root account credentials and will stop working on January 31, 2018.

This gem doesn't support using IAM credentials and we're no longer maintaining this gem.

If you're up for the challenge and very keen to keep this up to date, we're looking for someone willing to maintain.


# with bundler
echo 'gem "ralexa"' >> Gemfile

# or just the gem
gem install ralexa

Usage Examples

# grab a Ralexa::Session instance to hold your credentials.
session = Ralexa.session("aws_access_key_id", "aws_secret_access_key")

# all countries
countries = session.top_sites.list_countries
p countries.map(&:name)

# global top 250 sites
global = session.top_sites.global(250)

# per-country top sites
first_by_country = {}
countries.each do |c|
  first_by_country[c.name] = session.top_sites.country(c.code, 1).first.url

# individual country lookup
puts "Top Ten Australian Sites"
session.top_sites.country("AU", 10).each do |s|
  puts "#{s.url} (#{s.page_views} pageviews)"

# url info for an individual site
puts "Url info of Flippa.com"
puts session.url_info.get("http://flippa.com")

puts "bam!"


Service Action ResponseGroup Supported
Alexa Top Sites TopSites Global Yes
Country Yes
ListCountries Yes
Alexa Web Information Services UrlInfo Get Yes
TrafficHistory * Send a pull request!
CategoryBrowse * Send a pull request!
CategoryListings * Send a pull request!
SitesLinkingIn * Send a pull request!


  1. Fork it
  2. Create your feature branch (git checkout -b some-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin some-new-feature)
  5. Create new Pull Request


(c) 2012 Flippa, The MIT License.

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more