SDKs overview

Hunter.io offers a suite of Software Development Kits (SDKs) and libraries designed to simplify programmatic interaction with its API. These tools encapsulate the underlying RESTful API calls, handling HTTP requests, authentication, and JSON response parsing, which allows developers to integrate email verification, email finding, and domain search functionalities into their applications with less boilerplate code. The API itself uses predictable, resource-oriented URLs, accepts form-encoded request bodies, and returns JSON-encoded responses, consistent with common web API design patterns W3C POWDER Description Resources. Authentication for all API requests is managed via API keys Hunter.io API authentication guide.

The availability of official SDKs for several prominent programming languages, alongside community-contributed libraries, aims to provide flexibility for a diverse developer ecosystem. These SDKs are maintained to reflect the current API version and features, ensuring compatibility and access to Hunter.io's core products Hunter.io API documentation.

Official SDKs by language

Hunter.io maintains official SDKs for several popular programming languages. These libraries are developed and supported by Hunter.io to ensure full compatibility with their API and provide a consistent developer experience across different environments. Each SDK is designed to abstract the complexities of direct HTTP requests and JSON parsing, allowing developers to interact with the API using native language constructs.

Language Package Name Installation Command Maturity
Python hunter pip install hunter Official, Actively Maintained
Node.js hunter.io npm install hunter.io Official, Actively Maintained
PHP hunterio/hunter-php composer require hunterio/hunter-php Official, Actively Maintained
Ruby hunter_io gem install hunter_io Official, Actively Maintained
Go github.com/hunterio/hunter-go go get github.com/hunterio/hunter-go Official, Actively Maintained

Installation

Installing Hunter.io SDKs typically involves using the package manager specific to the programming language. The following subsections provide general instructions for the officially supported languages. For the most up-to-date and specific instructions, developers should always refer to the official Hunter.io API documentation Hunter.io documentation portal.

Python Installation

The Python SDK can be installed using pip, the standard package installer for Python PyPI pip documentation:

pip install hunter

Node.js Installation

For Node.js projects, the SDK is available via npm, the default package manager for Node.js npm install command reference:

npm install hunter.io

PHP Installation

PHP projects typically use Composer for dependency management Composer official documentation. The Hunter.io PHP library can be added as follows:

composer require hunterio/hunter-php

Ruby Installation

Ruby projects manage dependencies with Bundler and RubyGems RubyGems guide. To install the Hunter.io Ruby gem:

gem install hunter_io

Alternatively, add it to your Gemfile:

gem 'hunter_io'

Then run bundle install.

Go Installation

Go modules are used for dependency management in Go projects Go modules documentation. To add the Hunter.io Go library:

go get github.com/hunterio/hunter-go

Quickstart example

The following examples demonstrate common API calls using the official SDKs. These snippets illustrate how to perform an email verification and an email search, which are core functionalities of the Hunter.io API. Developers will need to replace 'YOUR_API_KEY' with their actual Hunter.io API key, obtainable from their Hunter.io account dashboard Hunter.io API key instructions.

Python Quickstart

import hunter

hunter.api_key = 'YOUR_API_KEY'

# Email verification
email_to_verify = '[email protected]'
verification_result = hunter.verify(email=email_to_verify)
print(f"Verification of {email_to_verify}: {verification_result.status}")

# Email finder
domain_to_search = 'example.com'
first_name = 'John'
last_name = 'Doe'
email_finder_result = hunter.email_finder(domain=domain_to_search, first_name=first_name, last_name=last_name)
if email_finder_result.email:
    print(f"Found email for {first_name} {last_name} at {domain_to_search}: {email_finder_result.email}")
else:
    print(f"No email found for {first_name} {last_name} at {domain_to_search}")

Node.js Quickstart

const Hunter = require('hunter.io');
const hunter = new Hunter('YOUR_API_KEY');

// Email verification
hunter.verify('[email protected]')
  .then(response => {
    console.log(`Verification of [email protected]: ${response.data.status}`);
  })
  .catch(error => console.error('Verification error:', error.message));

// Email finder
hunter.emailFinder({ domain: 'example.com', first_name: 'John', last_name: 'Doe' })
  .then(response => {
    if (response.data.email) {
      console.log(`Found email for John Doe at example.com: ${response.data.email}`);
    } else {
      console.log('No email found for John Doe at example.com');
    }
  })
  .catch(error => console.error('Email finder error:', error.message));

PHP Quickstart

<?php
require 'vendor/autoload.php';

use Hunterio\Hunterio;

$hunter = new Hunterio('YOUR_API_KEY');

// Email verification
try {
    $verificationResult = $hunter->verify('[email protected]');
    echo "Verification of [email protected]: " . $verificationResult->data->status . "\n";
} catch (Exception $e) {
    echo "Verification error: " . $e->getMessage() . "\n";
}

// Email finder
try {
    $emailFinderResult = $hunter->emailFinder(['domain' => 'example.com', 'first_name' => 'John', 'last_name' => 'Doe']);
    if (isset($emailFinderResult->data->email)) {
        echo "Found email for John Doe at example.com: " . $emailFinderResult->data->email . "\n";
    } else {
        echo "No email found for John Doe at example.com\n";
    }
} catch (Exception $e) {
    echo "Email finder error: " . $e->getMessage() . "\n";
}
?>

Ruby Quickstart

require 'hunter_io'

Hunterio.api_key = 'YOUR_API_KEY'

# Email verification
begin
  verification_result = Hunterio.verify(email: '[email protected]')
  puts "Verification of [email protected]: #{verification_result.data.status}"
rescue Hunterio::Error => e
  puts "Verification error: #{e.message}"
end

# Email finder
begin
  email_finder_result = Hunterio.email_finder(domain: 'example.com', first_name: 'John', last_name: 'Doe')
  if email_finder_result.data.email
    puts "Found email for John Doe at example.com: #{email_finder_result.data.email}"
  else
    puts "No email found for John Doe at example.com"
  end
rescue Hunterio::Error => e
  puts "Email finder error: #{e.message}"
end

Go Quickstart

package main

import (
	"fmt"
	"log"
	"github.com/hunterio/hunter-go"
)

func main() {
	hunterClient := hunter.NewClient("YOUR_API_KEY")

	// Email verification
	verifyResult, err := hunterClient.Verify("[email protected]")
	if err != nil {
		log.Fatalf("Email verification error: %v", err)
	}
	fmt.Printf("Verification of [email protected]: %s\n", verifyResult.Data.Status)

	// Email finder
	finderResult, err := hunterClient.EmailFinder("example.com", "John", "Doe")
	if err != nil {
		log.Fatalf("Email finder error: %v", err)
	}
	if finderResult.Data.Email != "" {
		fmt.Printf("Found email for John Doe at example.com: %s\n", finderResult.Data.Email)
	} else {
		fmt.Println("No email found for John Doe at example.com")
	}
}

Community libraries

While Hunter.io provides official SDKs for major programming languages, the developer community often contributes additional libraries or wrappers for other languages, frameworks, or specific use cases. These community-driven projects can offer alternative integration methods or extend functionality beyond the official offerings. It is important for developers to evaluate the maintenance status, documentation, and community support for any third-party library before integrating it into production systems, as they may not be officially supported or updated by Hunter.io.

Developers looking for community libraries can typically find them on platforms like GitHub or language-specific package repositories by searching for "Hunter.io API" or "Hunter.io client" along with the desired language or framework. The official Hunter.io documentation and developer forums may also list or link to notable community contributions Hunter.io developer resources.