Online Domain Tools API

API that is currently implemented in Online Domain Tools is listed below. The list will be updated as we implement new features to our API. If you are in need of API that is not currently available, feel free to tell us about your needs through our support system.

Supported API (last update 7th November 2017):

  • Account API
  • Bulk Email Verifier API
  • Keyword Rank SERP Checker
  • Nmap Online Scanner API
  • Online Mail Server Blacklist Checker API
  • Online Website Link Checker API
  • Password Checker Online API
  • Whois Online API

Documentation

Detailed documentation of ODT API authentication mechanisms and all API calls is available in PDF: ODT API Specification

Code Samples

In order to make it easier for you to start with ODT API, we have created following examples in C# and PHP. In ODT API, clients use signed HTTPS POST requests to invoke API calls, server replies with JSON responses.

C# Code Sample

This sample shows how to send an authenticated API request and how to use this mechanism to call Whois Online API using synchronous and polling modes. Please read the ODT API Specification (download above) for more information about the API calling modes. Should you need any help with our API, feel free to contact our support.

using System;
using System.Text;
using System.Threading;
using System.Security.Cryptography;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Web;
using Newtonsoft.Json;

namespace ODT_API
{
  public class OdtApiPollResponse
  {
    public int success;
    public string resultUrl;
  }

  class OdtApi
  {
    private string key;
    private string secret;
    private HMACSHA512 hashMaker;

    public const string ApiUrl = "https://secured.online-domain-tools.com/api/user/{0}/";

    public OdtApi(string Key, string Secret)
    {
      key = Key;
      secret = Secret;
      hashMaker = new HMACSHA512(Encoding.ASCII.GetBytes(secret));
    }

    private static string ByteArrayToString(byte[] Bytes)
    {
      string hex = BitConverter.ToString(Bytes);
      return hex.Replace("-", "");
    }

    private string Sign(string Message)
    {
      byte[] bytes = Encoding.UTF8.GetBytes(Message);
      byte[] hash = hashMaker.ComputeHash(bytes);
      return ByteArrayToString(hash).ToLower();
    }

    public string SendRequest(string Action, NameValueCollection Params)
    {
      string responseData = null;
      try
      {
        string requestStr = string.Format(ApiUrl, Action);
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(requestStr);
        request.Method = "POST";

        string timeStr = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss"); 
        request.Headers["Key"] = key;
        request.Headers["Time"] = timeStr;

        string postData = "";
        foreach (string pKey in Params)
          postData += string.Format("{0}{1}={2}", postData.Length > 0 ? "&" : "", 
            HttpUtility.UrlEncode(pKey), HttpUtility.UrlEncode(Params[pKey]));

        string payloadToSign = string.Format(key + timeStr + postData);
        request.Headers["Sign"] = Sign(payloadToSign);

        byte[] postDataBytes = Encoding.UTF8.GetBytes(postData);
        request.ContentType = "application/x-www-form-urlencoded";
        request.ContentLength = postDataBytes.Length;
        Stream dataStream = request.GetRequestStream();
        dataStream.Write(postDataBytes, 0, postDataBytes.Length);

        HttpWebResponse response = (HttpWebResponse)request.GetResponse();

        StreamReader respStream = new StreamReader(response.GetResponseStream());
        responseData = respStream.ReadToEnd();
        respStream.Close();
      }
      catch (Exception e)
      {
        Console.WriteLine("SendRequest caused exception: {0}", e.ToString());
      }

      return responseData;
    }
  }


  class Program
  {
    static void Main(string[] args)
    {
      if (args.Length != 2)
      {
        Console.WriteLine("Usage: odt-api <API Key> <API Secret>");
        return;
      }


      OdtApi api = new OdtApi(args[0], args[1]);

      // Test authentication
      string result = api.SendRequest("account/authTest", new NameValueCollection());
      Console.WriteLine("Authentication test result:\n{0}\n", result);

      // Account information
      result = api.SendRequest("account/info", new NameValueCollection());
      Console.WriteLine("Account information result:\n{0}\n", result);

      // Synchronous Whois Query
      NameValueCollection whoisParamsSync = new NameValueCollection();
      whoisParamsSync.Add("query", "example.com");
      result = api.SendRequest("tool/whois/query", whoisParamsSync);
      Console.WriteLine("Synchronous Whois Query result:\n{0}\n", result);

      // Polling Whois Query
      NameValueCollection whoisParamsPoll = new NameValueCollection();
      whoisParamsPoll.Add("polling", "1");
      whoisParamsPoll.Add("query", "example.com");
      result = api.SendRequest("tool/whois/query", whoisParamsPoll);
      Console.WriteLine("Polling Whois Query result:\n{0}\n", result);

      try
      {
        OdtApiPollResponse plResp = JsonConvert.DeserializeObject<OdtApiPollResponse>(result);
        if (plResp.success == 1)
        {
          // Try to get Polling Whois Query result after 15 seconds
          Console.WriteLine("Waiting 15 seconds ...");
          Thread.Sleep(15000);

          HttpWebRequest request = (HttpWebRequest)WebRequest.Create(plResp.resultUrl);
          HttpWebResponse response = (HttpWebResponse)request.GetResponse();

          StreamReader respStream = new StreamReader(response.GetResponseStream());
          string responseData = respStream.ReadToEnd();
          Console.WriteLine("Polling query attempt result:\n{0}\n", responseData);
          respStream.Close();
        }
      }
      catch (Exception e)
      {
        Console.WriteLine("Polling query attempt caused exception: {0}", e.ToString());
      }
    }
  }
}

This C# sample program expects ODT API key and secret as its command line arguments. Here is a sample output of this program:

Authentication test result:
{"success":1}

Account information result:
{"success":1,"name":"My Account","owner":"myemail@mailinator.com","creditsWallet":154,"creditsDaily":0,"creditsDailyMax":22.2}

Synchronous Whois Query result:
{"success":1,"toolName":"Whois Online","status":{"value":"OK"},"headers":{"started":"2014-10-10 09:19:52 UTC","finished":"2014-10-10 09:19:53 UTC","generated":"2014-10-10 09:19:53 UTC"},"output":{"domain":"example.com","status":["registered"],"registered":true,"available":false,"created_on":"1992-01-01 00:00:00 +0100","expires_on":"2015-08-13 00:00:00 +0200","registrar":{"name":"RESERVED-INTERNET ASSIGNED NUMBERS AUTHORITY","url":"http://res-dom.iana.org"},"registrant_contact":{"organization":"Internet Assigned Numbers Authority"},"nameservers":[]},"rawOutput":["\nWhois Server Version 2.0\n\nDomain names in the .com and .net domains can now be registered\nwith many different competing registrars. Go to http://www.internic.net\nfor detailed information.\n\n   Server Name: EXAMPLE.COM.AU\n   Registrar: ENETICA PTY LTD\n   Whois Server: whois.enetica.com.au\n   Referral URL: http://www.enetica.com.au\n\n   Server Name: EXAMPLE.COM.FLORAMEIYUKWONG.COM\n   IP Address: 173.203.204.123\n   Registrar: GODADDY.COM, LLC\n   Whois Server: whois.godaddy.com\n   Referral URL: http://registrar.godaddy.com\n\n   Server Name: EXAMPLE.COM.RAFAELYALUFF.COM\n   IP Address: 173.203.204.123\n   Registrar: DOMAIN.COM, LLC\n   Whois Server: whois.domain.com\n   Referral URL: http://www.domain.com\n\n   Domain Name: EXAMPLE.COM\n   Registrar: RESERVED-INTERNET ASSIGNED NUMBERS AUTHORITY\n   Whois Server: whois.iana.org\n   Referral URL: http://res-dom.iana.org\n   Name Server: A.IANA-SERVERS.NET\n   Name Server: B.IANA-SERVERS.NET\n   Status: clientDeleteProhibited\n   Status: clientTransferProhibited\n   Status: clientUpdateProhibited\n   Updated Date: 14-aug-2014\n   Creation Date: 14-aug-1995\n   Expiration Date: 13-aug-2015\n\n&gt;&gt;&gt; Last update of whois database: Fri, 10 Oct 2014 09:09:46 GMT &lt;&lt;&lt;\n\nNOTICE: The expiration date displayed in this record is the date the \nregistrar's sponsorship of the domain name registration in the registry is \ncurrently set to expire. This date does not necessarily reflect the expiration \ndate of the domain name registrant's agreement with the sponsoring \nregistrar.  Users may consult the sponsoring registrar's Whois database to \nview the registrar's reported date of expiration for this registration.\n\nTERMS OF USE: You are not authorized to access or query our Whois \ndatabase through the use of electronic processes that are high-volume and \nautomated except as reasonably necessary to register domain names or \nmodify existing registrations; the Data in VeriSign Global Registry \nServices' (&quot;VeriSign&quot;) Whois database is provided by VeriSign for \ninformation purposes only, and to assist persons in obtaining information \nabout or related to a domain name registration record. VeriSign does not \nguarantee its accuracy. By submitting a Whois query, you agree to abide \nby the following terms of use: You agree that you may use this Data only \nfor lawful purposes and that under no circumstances will you use this Data \nto: (1) allow, enable, or otherwise support the transmission of mass \nunsolicited, commercial advertising or solicitations via e-mail, telephone, \nor facsimile; or (2) enable high volume, automated, electronic processes \nthat apply to VeriSign (or its computer systems). The compilation, \nrepackaging, dissemination or other use of this Data is expressly \nprohibited without the prior written consent of VeriSign. You agree not to \nuse electronic processes that are automated and high-volume to access or \nquery the Whois database except as reasonably necessary to register \ndomain names or modify existing registrations. VeriSign reserves the right \nto restrict your access to the Whois database in its sole discretion to ensure \noperational stability.  VeriSign may restrict or terminate your access to the \nWhois database for failure to abide by these terms of use. VeriSign \nreserves the right to modify these terms at any time. \n\nThe Registry database contains ONLY .COM, .NET, .EDU domains and\nRegistrars.\n\n","% IANA WHOIS server\n% for more information on IANA, visit http://www.iana.org\n% This query returned 1 object\n\ndomain:       EXAMPLE.COM\n\norganisation: Internet Assigned Numbers Authority\n\ncreated:      1992-01-01\nsource:       IANA\n\n\n"]}

Polling Whois Query result:
{"success":1,"resultUrl":"https://secured.online-domain-tools.com/api/user/tool/whois/result-url/9963bgjwZkP2l8rD"}

Waiting 15 seconds ...
Polling query attempt result:
{"success":1,"toolName":"Whois Online","status":{"value":"OK"},"headers":{"started":"2014-10-10 09:19:53 UTC","finished":"2014-10-10 09:19:53 UTC","generated":"2014-10-10 09:20:09 UTC"},"output":{"domain":"example.com","status":["registered"],"registered":true,"available":false,"created_on":"1992-01-01 00:00:00 +0100","expires_on":"2015-08-13 00:00:00 +0200","registrar":{"name":"RESERVED-INTERNET ASSIGNED NUMBERS AUTHORITY","url":"http://res-dom.iana.org"},"registrant_contact":{"organization":"Internet Assigned Numbers Authority"},"nameservers":[]},"rawOutput":["\nWhois Server Version 2.0\n\nDomain names in the .com and .net domains can now be registered\nwith many different competing registrars. Go to http://www.internic.net\nfor detailed information.\n\n   Server Name: EXAMPLE.COM.AU\n   Registrar: ENETICA PTY LTD\n   Whois Server: whois.enetica.com.au\n   Referral URL: http://www.enetica.com.au\n\n   Server Name: EXAMPLE.COM.FLORAMEIYUKWONG.COM\n   IP Address: 173.203.204.123\n   Registrar: GODADDY.COM, LLC\n   Whois Server: whois.godaddy.com\n   Referral URL: http://registrar.godaddy.com\n\n   Server Name: EXAMPLE.COM.RAFAELYALUFF.COM\n   IP Address: 173.203.204.123\n   Registrar: DOMAIN.COM, LLC\n   Whois Server: whois.domain.com\n   Referral URL: http://www.domain.com\n\n   Domain Name: EXAMPLE.COM\n   Registrar: RESERVED-INTERNET ASSIGNED NUMBERS AUTHORITY\n   Whois Server: whois.iana.org\n   Referral URL: http://res-dom.iana.org\n   Name Server: A.IANA-SERVERS.NET\n   Name Server: B.IANA-SERVERS.NET\n   Status: clientDeleteProhibited\n   Status: clientTransferProhibited\n   Status: clientUpdateProhibited\n   Updated Date: 14-aug-2014\n   Creation Date: 14-aug-1995\n   Expiration Date: 13-aug-2015\n\n&gt;&gt;&gt; Last update of whois database: Fri, 10 Oct 2014 09:09:46 GMT &lt;&lt;&lt;\n\nNOTICE: The expiration date displayed in this record is the date the \nregistrar's sponsorship of the domain name registration in the registry is \ncurrently set to expire. This date does not necessarily reflect the expiration \ndate of the domain name registrant's agreement with the sponsoring \nregistrar.  Users may consult the sponsoring registrar's Whois database to \nview the registrar's reported date of expiration for this registration.\n\nTERMS OF USE: You are not authorized to access or query our Whois \ndatabase through the use of electronic processes that are high-volume and \nautomated except as reasonably necessary to register domain names or \nmodify existing registrations; the Data in VeriSign Global Registry \nServices' (&quot;VeriSign&quot;) Whois database is provided by VeriSign for \ninformation purposes only, and to assist persons in obtaining information \nabout or related to a domain name registration record. VeriSign does not \nguarantee its accuracy. By submitting a Whois query, you agree to abide \nby the following terms of use: You agree that you may use this Data only \nfor lawful purposes and that under no circumstances will you use this Data \nto: (1) allow, enable, or otherwise support the transmission of mass \nunsolicited, commercial advertising or solicitations via e-mail, telephone, \nor facsimile; or (2) enable high volume, automated, electronic processes \nthat apply to VeriSign (or its computer systems). The compilation, \nrepackaging, dissemination or other use of this Data is expressly \nprohibited without the prior written consent of VeriSign. You agree not to \nuse electronic processes that are automated and high-volume to access or \nquery the Whois database except as reasonably necessary to register \ndomain names or modify existing registrations. VeriSign reserves the right \nto restrict your access to the Whois database in its sole discretion to ensure \noperational stability.  VeriSign may restrict or terminate your access to the \nWhois database for failure to abide by these terms of use. VeriSign \nreserves the right to modify these terms at any time. \n\nThe Registry database contains ONLY .COM, .NET, .EDU domains and\nRegistrars.\n\n","% IANA WHOIS server\n% for more information on IANA, visit http://www.iana.org\n% This query returned 1 object\n\ndomain:       EXAMPLE.COM\n\norganisation: Internet Assigned Numbers Authority\n\ncreated:      1992-01-01\nsource:       IANA\n\n\n"]}


PHP 5.3+ Code Sample

This PHP sample is very similar to the C# sample above.

<?php

/**
 * @param string $key
 * @param string $secret
 * @param string $action
 * @param array $postData
 * @return array
 */
function odtSendRequest($key, $secret, $action, array $postData)
{
    // generate POST data string
    $postFields = http_build_query($postData);
    $dateTime = new \DateTime('now', new \DateTimeZone('UTC'));
    $time = $dateTime->format('Y-m-d H:i:s');

    $message = $key . $time . $postFields;
    $signature = hash_hmac('sha512', $message, $secret);

    // generate extra headers
    $headers = array(
        'Sign: ' . $signature,
        'Time: ' . $time,
        'Key: ' . $key
        );

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    curl_setopt($ch, CURLOPT_URL, 
"https://secured.online-domain-tools.com/api/user/{$action}/");
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($ch, CURLOPT_TIMEOUT, 240);

    $data = curl_exec($ch);

    if ($data === false) {
        $error = curl_error($ch);
        $result = array(false, $error);
    } else {
        $result = array(true, $data);
    }
    curl_close($ch);

    return $result;
}

// Settings
$apiKey = 'FILLME';
$apiSecret = 'FILLME';

header('content-type: text/plain;');

// Test authentication
$result = odtSendRequest($apiKey, $apiSecret, "account/authTest", array());
echo "1) Authentication test result:\n" . var_export($result, true) . "\n\n";

// Account information
$result = odtSendRequest($apiKey, $apiSecret, "account/info", array());
echo "2) Account information result:\n" . var_export($result, true) . "\n\n";

// Synchronous Whois Query
$result = odtSendRequest($apiKey, $apiSecret, "tool/whois/query", 
    array("query" => "example.com"));
echo "3) Synchronous Whois Query result:\n" . var_export($result, true) . "\n\n";

// Polling Whois Query
list($isHttpRequestOk, $result) = odtSendRequest($apiKey, $apiSecret, "tool/whois/query", 
    array(
        "query" => "example.com",
        "polling" => 1
    ));
echo "4) Polling Whois Query result:\n" .
    var_export(array($isHttpRequestOk, $result), true) . 
    "\n\n";

if ($isHttpRequestOk) {
    $pollResponse = json_decode($result, true);

    if ($pollResponse['success'] == 1) {
        // Try to get Polling Whois Query result after 15 seconds
        echo "Waiting 15 seconds ...\n\n";
        sleep(15);

        $updateResponseString = file_get_contents($pollResponse['resultUrl']);

        if ($updateResponseString === false) {
            echo "Polling query failed." . "\n\n";
        } else {
            echo "Polling query attempt result:\n" . $updateResponseString . "\n\n";
        }
    } else {
        echo "Polling Whois Query result: " . var_export($pollResponse, true) . "\n\n";
    }
} else {
    $errorMessage = $result;
    echo " HTTP request failed with error: {$errorMessage}" . "\n\n";
}

PHP 5.3+ Email Verifier API Code Sample

Please visit ODT API – Bulk Email Verifier API Sample

PHP 5.3+ Whois API Bulk Lookup Sample

Please visit ODT API – Whois API Bulk Lookup Sample