RoboWhois - Ruby Client

This is the official Ruby client for RoboWhois API.

RoboWhois is a web service that provides an API suite to access WHOIS records and domain related information with a unified, consistent interface.

Using RoboWhois API you can:

  • check domain availability for any supported TLD
  • lookup WHOIS information for a domain and retrieve the WHOIS record
  • access WHOIS data using a consistent, well-structured, HTTP-based interface
  • retrieve WHOIS details parsed as convenient JSON structure

Visit RoboWhois site and documentation to learn more about the service.


The best way to install this library is via RubyGems.

$ gem install robowhois

You might need administrator privileges on your system to install the gem.


All the examples below assume you installed the gem and required it via RubyGems. You also need a RoboWhois account and a valid API key.

require 'robowhois'

Please refer to the RoboWhois API Documentation for the list of all available API methods and response attributes.

Account information

client = => 'YOUR_API_KEY')
 = client.

puts ['email']
# => your email
puts ['credits_limit']
# => available credits

Original WHOIS record

client = => 'YOUR_API_KEY')
response = client.whois('')

puts response
# => The record String

Parsed WHOIS record

client = => 'YOUR_API_KEY')
response = client.whois_properties('')

# The record date
puts response['daystamp']

# The record registrant
if contact = response['properties']['registrant_contacts']
  puts contact['id']
  puts contact['name']
  puts contact['organization']
  puts "Registrant details not available."

# The record nameservers
response['properties']['nameservers'].each do |nameserver|
  puts nameserver['name']
  puts nameserver['ipv4']
  puts nameserver['ipv6']

Response Object

You can access the last response object using the last_response method.

client = => 'YOUR_API_KEY')
 = client.

response = client.last_response
# => 200
# => { ... }


In case of failure, the API call raises a RoboWhois::APIError exception.

client = => 'YOUR_API_KEY')

  response = client.whois_properties('')
rescue => error
  puts error.code
  # => "R04"
  # => "WhoisServerOnlyWeb"
  puts error.status
  # => 400

Error codes are explained in the API Errors documentation page.


See the file for details.


Copyright (c) 2012 RoboDomain Inc. Copyright (c) 2012-2014 Aetrion LLC.

This is Free Software distributed under the MIT license.