SDKs overview

Hunter provides official Software Development Kits (SDKs) to facilitate integration with its API, which offers functionalities for email finding, email verification, and domain searches. These SDKs are designed to abstract the underlying HTTP requests, handle authentication, and parse API responses, allowing developers to interact with Hunter's services using native language constructs rather than direct RESTful calls. The official SDKs support several popular programming languages, ensuring broad compatibility for various development environments.

Beyond the official offerings, a range of community-contributed libraries and wrappers exist. These often extend functionality or adapt the API for languages and frameworks not officially supported, offering additional flexibility for developers. While official SDKs are maintained directly by Hunter, community libraries may vary in their maintenance and support levels. Developers often consult the Hunter API documentation for the most current information and best practices when integrating with the service.

Official SDKs by language

Hunter offers specific SDKs for several programming languages, each designed to provide a native interface for its API endpoints. These SDKs simplify common tasks such as finding email addresses, verifying their validity, and performing domain-based searches for contact information. The following table provides an overview of the officially supported SDKs, including their respective package names and typical installation commands.

Language Package Manager / Name Installation Command Maturity
Python hunterio (PyPI) pip install hunterio Stable
Node.js hunter.io (npm) npm install hunter.io Stable
PHP hunterio/hunter-php (Composer) composer require hunterio/hunter-php Stable
Ruby hunterio-ruby (RubyGems) gem install hunterio-ruby Stable
Go go-hunter.io (Go Modules) go get github.com/hunterio/go-hunter.io Stable

Each SDK provides methods corresponding to the Hunter API's core functionalities, such as Email Finder, Email Verifier, and Domain Search. Developers can typically instantiate a client with their API key and then call specific methods to perform operations. For example, the Python SDK might have a method like finder.email_finder(domain='example.com') to locate emails associated with a given domain.

These SDKs manage the complexities of API communication, including constructing request URLs, setting headers, handling JSON serialization and deserialization, and managing error responses. This abstraction allows developers to focus on integrating the data into their applications rather than the mechanics of HTTP requests. The official Hunter API documentation portal provides detailed guides for each SDK, including method signatures and response formats.

Installation

Installing Hunter's official SDKs typically involves using the standard package manager for the respective programming language. Each SDK is published to its language's primary package repository, ensuring straightforward dependency management.

Python

To install the Python SDK, use pip, the Python package installer:

pip install hunterio

This command downloads the hunterio package from PyPI, along with any necessary dependencies, and makes it available for import in your Python projects. The Python Package Index (PyPI) is the official third-party software repository for Python, as described by Python's official documentation.

Node.js

For Node.js applications, install the hunter.io package using npm (Node Package Manager):

npm install hunter.io

This adds the SDK to your project's node_modules directory and updates your package.json file. npm is the default package manager for the JavaScript runtime environment Node.js.

PHP

PHP developers can install the hunterio/hunter-php library via Composer, the dependency manager for PHP:

composer require hunterio/hunter-php

Composer resolves and installs the required PHP packages into your project's vendor directory. More information on Composer usage can be found on the Composer official documentation site.

Ruby

The Ruby SDK, hunterio-ruby, is installed using RubyGems:

gem install hunterio-ruby

This command fetches the gem from RubyGems.org and installs it into your Ruby environment.

Go

For Go projects, use go get to retrieve the go-hunter.io module:

go get github.com/hunterio/go-hunter.io

This command downloads the module and adds it to your Go module cache, making it available for import. Go Modules are the official dependency management solution for Go.

Quickstart example

This example demonstrates how to use the Python SDK to perform an Email Finder query. Replace YOUR_API_KEY with your actual Hunter API key, which can be obtained from your Hunter API dashboard.

Python Email Finder Example

This Python snippet uses the email_finder method to locate likely email addresses for a given domain and first/last name combination.

from hunterio import Hunter

# Initialize the Hunter client with your API key
hunter = Hunter(api_key="YOUR_API_KEY")

try:
    # Perform an Email Finder query
    result = hunter.email_finder(
        domain="example.com",
        first_name="John",
        last_name="Doe"
    )

    if result and result.get('data'):
        data = result['data']
        print(f"Email: {data.get('email')}")
        print(f"Score: {data.get('score')}")
        print(f"Confidence: {data.get('confidence')}")
        print(f"Type: {data.get('type')}")
        print(f"Verification Status: {data.get('verification', {}).get('status')}")
    else:
        print("No email found for the given criteria.")

except Exception as e:
    print(f"An error occurred: {e}")

This example first imports the Hunter class, then creates an instance, passing the API key. It then calls the email_finder method with the specified parameters. The response, if successful, contains data such as the email address, confidence score, and verification status. Error handling is included to catch potential issues during the API call, which is a standard practice in API integrations to ensure application stability, as noted in general API client best practices from Google Developers.

Node.js Email Verifier Example

This Node.js example demonstrates how to use the SDK to verify an email address.

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

const hunter = new Hunter('YOUR_API_KEY');

hunter.emailVerifier.verify('[email protected]')
  .then(response => {
    const data = response.data;
    console.log(`Email: ${data.email}`);
    console.log(`Status: ${data.status}`);
    console.log(`Result: ${data.result}`);
    console.log(`Score: ${data.score}`);
    console.log(`Bounce: ${data.down_from_bounced_detector}`);
  })
  .catch(error => {
    console.error('Error verifying email:', error.message);
  });

This Node.js snippet initializes the Hunter client and then calls the emailVerifier.verify method. It then processes the response or catches any errors that occur during the verification process. The status and result fields provide key information on the email's validity.

Community libraries

While Hunter provides official SDKs, the broader developer community has also contributed various libraries and wrappers that extend or adapt Hunter's API functionality to other languages, frameworks, or specific use cases. These community-driven projects can offer alternative integration paths, though their maintenance and support levels may vary compared to official SDKs.

Some examples of community contributions might include:

  • Go wrappers: While an official Go SDK exists, community projects might offer alternative interfaces or specific integrations with popular Go web frameworks.
  • C#/.NET libraries: For developers working in the .NET ecosystem, community members might have created wrappers that align with C# idioms, providing a more native development experience.
  • Unofficial API clients: These could be simple HTTP clients tailored for the Hunter API in languages without an official SDK, enabling basic interaction without manual request construction.
  • Integrations with specific platforms: Some community libraries might focus on integrating Hunter's capabilities directly into CRM systems, marketing automation platforms, or other business tools that rely on custom code.

Developers considering community libraries should evaluate factors such as the project's activity, documentation quality, and the community support available. It is advisable to check the project's repository (e.g., GitHub) for recent updates, open issues, and contribution guidelines. The official Hunter API documentation is always the authoritative source for API specifications, regardless of whether an official or community library is used for integration.