Java wrapper for DomainTools API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

DomainToolsAPI Java Wrapper


The DomainToolsAPI Java Wrapper is a simple connector to access all webservices of

Getting started

To use the DomainTools API, you need to have a DomainTools Account. Create and account.


Download the jar and add it in your Library.


  1. Visit to know the list of available services.

Beware, certains services (like reverse-whois) don't need domains to work, but require parameters to work. (Example terms=Seattle).

Please read attentively how to use each services.

  1. When you need to use a DomainTools service :

  2. Add import com.domaintoolsapi.*;

Create a DomainTools object

DomainTools domainTools = new DomainTools("your_username", "your_key");

You can switch to the Free API


Create a DomainTools request (DTRequest)

To execute a request on DomainTools, you need to set the product which you want to use. Visit to know the list of available services.

Set a product with the method use

To set a product, call the method use with a String representation of the the product name

DTRequest dtRequest = domainTools.use("whois");

Set a domain with the method on

To set a domain, call the method on with a String representation of the domain name


Set a format

DomainTools can return responses in diffents formats :

  • JSON with toJSON()
  • XML with toXML()
  • A Java Object toObject()

Set parameters

Some products need parameters to be executed. To set parameters, call the method where. where can use String or Map argument. If you use a String argument, keep in my mind you must replace space character by %20


In this example, we limit to 10 the number of domain names's responses. We can also use a Map to declare some parameters :

Map<String, String> parameters = new HashMap<String, String>();
parameters.put("limit", "10");

You can use several time where to add multiples parameters :



HashMap<String, String> params = new HashMap<String, String>();
params.put("query", "domain%20tools");

Or use the character "&"


But you can't use multples arguments in a single method.

Reuse a request

If you want to reuse a request with different parameters, you can use resetParameters() to erase current parameters.


If you also want to erase product, domain and format, but not username and key, use clear().


Refresh your results

You can refresh your results by using the method refresh


Signed Authentication

The DomainToolsAPI Java Wrapper allows to use the HMAC (or hashed message authentication code) to protect the API Key.

To use HMAC, add signed(true) on your request.

Example :


We recommande to use this authentication scheme to protecting your API key.

Method chaining

The domaintoolsAPI Java Wrapper is a fluent API implemented by using method chaining. You can combine methods to specify return type, options, etc.:

Example :


This request use the reverse-whois services and add terms and mode parameters in signed mode and require a XML format.

Traversing an Object

You can traverse a response object by using the method "get". It returns the child node specified by the parameter name.

Example :

DTRequest dtRequest = domainTools.use("reverse-ip");
JsonNode jsonNode = dtRequest.getObject();
Iterator<JsonNode> it = jsonNode.get("response").get("ip_addresses").get("domain_names").getElements();

This example shows how to get all the domain names contains in the response.


See the file for details.


Copyright (C) 2011 by, DomaintoolsAPI PHP Wrapper is released under the MIT license.

See the file for details.