SDKs overview

Clearbit API offers a suite of Software Development Kits (SDKs) designed to simplify interaction with its data enrichment services. These SDKs abstract the underlying RESTful API calls, allowing developers to integrate Clearbit's functionalities—such as Person and Company enrichment, IP-to-company mapping (Reveal), and B2B contact prospecting (Prospector)—directly into their applications using familiar programming language syntax. The availability of SDKs for multiple languages aims to reduce development time and potential integration errors by handling authentication, request formatting, and response parsing.

The SDKs are generally structured to mirror the Clearbit API's core services, providing dedicated methods for each endpoint. For instance, developers can typically call a Clearbit.Person.find() method instead of constructing an HTTP GET request to api.clearbit.com/v2/people/find. This approach standardizes the integration process across different development environments and helps maintain consistency in how data is requested and consumed.

Official SDKs by language

Clearbit provides official SDKs for several programming languages, ensuring direct support and compatibility with their API. These SDKs are maintained by Clearbit and are the recommended method for integrating the API into applications. Each SDK typically includes comprehensive documentation and examples to assist developers in getting started quickly. The SDKs cover the main Clearbit products, including Person, Company, Reveal, and Prospector APIs. Detailed usage instructions and API specific methods can be found in the Clearbit API reference documentation.

The following table outlines the officially supported SDKs, their respective package names, common installation commands, and their general maturity status:

Language Package Name Installation Command Maturity
JavaScript clearbit npm install clearbit Stable
Ruby clearbit-ruby gem install clearbit-ruby Stable
Python clearbit pip install clearbit Stable
Node.js clearbit npm install clearbit Stable
PHP clearbit/clearbit-php composer require clearbit/clearbit-php Stable
Go github.com/clearbit/clearbit-go go get github.com/clearbit/clearbit-go Stable

Each SDK is designed to handle common API interaction patterns, such as authentication using an API key, error handling, and data serialization/deserialization. This allows developers to focus on integrating the data into their business logic rather than managing the complexities of HTTP requests and responses. For example, the Python SDK might automatically retry requests that fail due to transient network issues, a feature that would otherwise need to be implemented manually.

Installation

Installing Clearbit SDKs typically follows the standard package management practices for each respective programming language. Before installation, developers need a Clearbit API key, which can be obtained from the Clearbit developer dashboard. This key is essential for authenticating requests made through the SDKs.

JavaScript / Node.js

For JavaScript and Node.js environments, the SDK is available via npm. Open your terminal or command prompt and run:

npm install clearbit

After installation, you can require the library in your Node.js application or bundle it for browser-side use (though server-side integration is generally recommended for API key security).

Ruby

The Ruby SDK is distributed as a gem. To install it, execute the following command in your terminal:

gem install clearbit-ruby

Alternatively, you can add gem 'clearbit-ruby' to your Gemfile and run bundle install if you are using Bundler for dependency management in a Ruby project.

Python

For Python projects, the SDK can be installed using pip, Python's package installer:

pip install clearbit

It is often recommended to install Python packages within a Python virtual environment to manage project-specific dependencies without conflicts.

PHP

The PHP SDK is available through Composer, the dependency manager for PHP. Navigate to your project directory and run:

composer require clearbit/clearbit-php

This command will download the Clearbit PHP library and its dependencies into your project's vendor/ directory.

Go

For Go projects, the SDK can be fetched using the go get command:

go get github.com/clearbit/clearbit-go

This command will download the Clearbit Go package and its dependencies into your Go module cache, making it available for import in your Go source files.

After installing the chosen SDK, the next step involves configuring it with your Clearbit API key, typically by setting an environment variable or passing it directly during client initialization.

Quickstart example

This quickstart example demonstrates how to use the Clearbit Node.js SDK to enrich a person's data based on their email address. This process involves initializing the SDK with your API key and then calling the appropriate method to fetch data. The example assumes you have already installed the clearbit package using npm install clearbit.

const Clearbit = require('clearbit')('YOUR_API_KEY');

async function enrichPerson(email) {
  try {
    const person = await Clearbit.Person.find({
      email: email,
      stream: true // Use stream mode for real-time lookups
    });

    if (person) {
      console.log('Person found:');
      console.log(`Name: ${person.name.fullName}`);
      console.log(`Email: ${person.email}`);
      console.log(`Title: ${person.employment.title}`);
      console.log(`Company: ${person.employment.name}`);
      console.log(`LinkedIn: ${person.linkedin.handle}`);

      // Optionally, enrich company data based on the person's company domain
      if (person.employment.domain) {
        const company = await Clearbit.Company.find({
          domain: person.employment.domain
        });
        if (company) {
          console.log('\nCompany found:');
          console.log(`Company Name: ${company.name}`);
          console.log(`Company Sector: ${company.category.sector}`);
          console.log(`Company Employees: ${company.metrics.employeesRange}`);
        }
      }
    } else {
      console.log(`No person found for email: ${email}`);
    }
  } catch (error) {
    if (error.type === 'email_not_found') {
      console.log(`Email not found: ${email}`);
    } else {
      console.error('Error enriching person data:', error.message);
    }
  }
}

// Replace '[email protected]' with an email you want to enrich
enrichPerson('[email protected]');

In this example, YOUR_API_KEY should be replaced with your actual Clearbit API key. The stream: true parameter tells Clearbit to perform a real-time lookup, which is useful for interactive applications where immediate results are needed. The code then logs various attributes of the found person and, if available, their associated company, demonstrating a common workflow of enriching both individual and organizational data. Error handling is included to catch cases where an email is not found or other API errors occur.

Community libraries

While Clearbit provides a set of official SDKs, the developer community also contributes libraries and integrations that extend the API's reach or offer alternative implementations. These community-driven projects can sometimes fill gaps in language support, provide specialized functionalities, or integrate Clearbit with other platforms. However, it is important to note that community libraries are not officially supported or maintained by Clearbit, and their quality, security, and ongoing compatibility may vary.

Developers considering community libraries should evaluate them based on factors such as:

  • Active Maintenance: Is the library regularly updated to support the latest Clearbit API versions and security patches?
  • Community Support: Is there an active community or maintainer available to answer questions and address issues?
  • Documentation: Is the library well-documented with clear examples and usage instructions?
  • Licensing: What open-source license governs the library's use?
  • Security: Has the library undergone any security audits, especially if it handles sensitive data or API keys?

Examples of community contributions might include wrappers for languages not officially supported, integrations with specific CRM systems (e.g., Salesforce, which offers its own Lightning Web Components API), or tools that combine Clearbit data with other services. For instance, a community project might provide a serverless function template that uses Clearbit's API to enrich data as part of an AWS Lambda workflow. While specific community libraries are subject to change and may not have official endorsements, platforms like GitHub are common places to discover such projects by searching for 'Clearbit' and the desired programming language or integration. Always review the project's repository and issue tracker for signs of active development and community engagement before adopting a non-official solution.