Clearbit Node.js Client

1.3.5 · abandoned · verified Tue Apr 21

The `clearbit` Node.js client (`clearbit-node`) provides an interface for interacting with various Clearbit business intelligence APIs, including Enrichment, Discovery, and Watchlist. It allows developers to programmatically look up person and company data by email or domain, and perform prospector searches. The library, last updated with version `1.3.5` eight years ago, primarily uses CommonJS modules and a Promise-based API for handling asynchronous operations and specific Clearbit API errors like `QueuedError` and `NotFoundError`. Due to its age and lack of maintenance, it does not natively support modern JavaScript features like ESM and may have unmaintained dependencies, making it potentially unsuitable for new projects or environments requiring up-to-date security patches. No new releases are expected.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates initializing the Clearbit client using an API key from environment variables, and performing basic lookups for a person by email and a company by domain, including specific error handling for Clearbit's `QueuedError` and `NotFoundError`.

const clearbit = require('clearbit')(process.env.CLEARBIT_API_KEY ?? '');

if (!process.env.CLEARBIT_API_KEY) {
  console.error('ERROR: CLEARBIT_API_KEY environment variable is not set.');
  process.exit(1);
}

const Person = clearbit.Person;
const Company = clearbit.Company;

async function lookupData() {
  try {
    console.log('--- Looking up Person ---');
    const person = await Person.find({ email: 'alex@clearbit.com' });
    console.log('Person Name:', person.name.fullName);
    console.log('Person Title:', person.employment.title);
  } catch (err) {
    if (err instanceof Person.QueuedError) {
      console.log('Person lookup queued:', err.message);
    } else if (err instanceof Person.NotFoundError) {
      console.log('Person not found:', err.message);
    } else {
      console.error('Error looking up person:', err.message);
    }
  }

  try {
    console.log('\n--- Looking up Company ---');
    const company = await Company.find({ domain: 'clearbit.com' });
    console.log('Company Name:', company.name);
    console.log('Company Sector:', company.category.sector);
  } catch (err) {
    if (err instanceof Company.QueuedError) {
      console.log('Company lookup queued:', err.message);
    } else if (err instanceof Company.NotFoundError) {
      console.log('Company not found:', err.message);
    } else {
      console.error('Error looking up company:', err.message);
    }
  }
}

lookupData();

view raw JSON →