Registry / crm-productivity / clearbit

clearbit

JSON →
library0.1.7jsnpmunverified

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.

npm install clearbit
INSTALL
IMPORT
SIG · CLEARBIT
C
clearbit
crm-productivityjavascriptv0.1.7
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

clearbit
const clearbit = require('clearbit')(process.env.CLEARBIT_API_KEY);
import clearbit from 'clearbit';
The primary way to initialize the client in CommonJS. Direct ESM import is not supported.
Client
const Client = require('clearbit').Client;
import { Client } from 'clearbit';
Accesses the Client constructor directly for alternative initialization. CommonJS only.
Person
const { Person } = clearbit;
const Person = require('clearbit').Person;
API modules like Person, Company, etc., are accessed as properties of the initialized client instance, not directly from the package root.

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();
Debug
Known issues
breakingThis package (`clearbit@1.3.5`) is abandoned and has not been updated in over eight years. It is highly recommended to avoid using it in new projects due to potential security vulnerabilities from outdated dependencies, lack of bug fixes, and compatibility issues with modern Node.js runtimes.
fix
Consider migrating to Clearbit's newer API versions directly via an HTTP client or seeking alternative, actively maintained libraries if available. Clearbit's API documentation should be consulted for direct integration options.
affects: >=1.0.0
gotchaThe library is exclusively CommonJS (`require`) and does not support ES Modules (`import`) directly. Attempting to use `import` syntax will result in errors.
fix
Ensure your project is configured for CommonJS, or use a bundler that can transpile CommonJS to ESM if necessary. For modern Node.js, stick to `require()` or use a different library.
affects: >=1.0.0
gotchaError handling relies on custom error classes (e.g., `Person.QueuedError`, `Company.NotFoundError`) which might not behave as expected or integrate seamlessly with standard `try/catch` blocks without explicit `instanceof` checks. This pattern is common in older Promise libraries like Bluebird, which may differ from native Promises.
fix
Always use `instanceof` to catch specific Clearbit errors, as demonstrated in the quickstart. Be aware that the Promise implementation might not be fully compliant with modern Promise A+ specifications, which could lead to unexpected behavior in complex asynchronous flows.
affects: >=1.0.0
gotchaThe client is designed for synchronous API key initialization upon `require('clearbit')`, which can be problematic for dynamic API key management or serverless functions where environment variables might not be immediately available during module loading.
fix
Ensure `process.env.CLEARBIT_API_KEY` is set before the module is `require`d. For more dynamic scenarios, use `new Client({ key: 'api_key' })` after `const Client = require('clearbit').Client;` to instantiate with a runtime-provided key.
affects: >=1.0.0
Errors
Common errors & fixes
ReferenceError: require is not defined in ES module scope
Attempting to use `require()` in an ES Module context (`type: 'module'` in package.json or `.mjs` file).
fix
Change your file to a CommonJS context (e.g., `.js` file without `type: 'module'`) or use a bundler that transpiles CJS. This package is CJS-only.
Error: Missing Clearbit API Key
The API key was not provided during client initialization.
fix
Ensure `require('clearbit')('YOUR_API_KEY')` has a valid key string, or when using `new Client({ key: 'YOUR_API_KEY' })`, that the `key` property is set.
TypeError: clearbit(...) is not a function
You might be trying to call `clearbit()` after already initializing it once, or attempting to use `clearbit.Client` incorrectly.
fix
Ensure you are using `require('clearbit')(API_KEY)` for the initial factory function call, or `const Client = require('clearbit').Client; new Client({ key: API_KEY });` for the constructor.
UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().
Failure to catch rejections from the API calls, especially `QueuedError` or `NotFoundError` if not explicitly handled.
fix
Always attach a `.catch()` block to your Promise chains or use `try...catch` with `async/await` to handle all possible errors, including Clearbit's custom error types.
Upgrade
Version history
0.1.7latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
51 hits · last 30 days
node
44
OpenAI (training)
1
Resources
clearbit — npm install clearbit · libregistry