Skip to content

CUFinder/cufinder-ts

Repository files navigation

CUFinder Typescript SDK

License: MIT npm version

A Typescript SDK for the CUFinder API that provides access to all company and person enrichment services.

Table of Contents

Installation

npm i @cufinder/cufinder-ts

or

yarn add @cufinder/cufinder-ts

or

pnpm add @cufinder/cufinder-ts

Usage

import { Cufinder } from '@cufinder/cufinder-ts';

// Initialize the client
const client = new Cufinder('your-api-key-here');

// Initialize with more options
const client = new Cufinder('your-api-key-here', { timeout: 60000 });

API Reference

This SDK covers all 20 Cufinder API (v2) endpoints:

CUF - Company Name to Domain

Returns the official website URL of a company based on its name.

const result = await client.cuf('cufinder', 'US');
console.log(result);

LCUF - LinkedIn Company URL Finder

Finds the official LinkedIn company profile URL from a company name.

const result = await client.lcuf('cufinder');
console.log(result);

DTC - Domain to Company Name

Retrieves the registered company name associated with a given website domain.

const result = await client.dtc('cufinder.io');
console.log(result);

DTE - Company Email Finder

Returns up to five general or role-based business email addresses for a company.

const result = await client.dte('cufinder.io');
console.log(result);

NTP - Company Phone Finder

Returns up to two verified phone numbers for a company.

const result = await client.ntp('apple');
console.log(result);

REL - Reverse Email Lookup

Enriches an email address with detailed person and company information.

const result = await client.rel('iain.mckenzie@stripe.com');
console.log(result);

FCL - Company Lookalikes Finder

Provides a list of similar companies based on an input company's profile.

const result = await client.fcl('apple');
console.log(result);

ELF - Company Fundraising

Returns detailed funding information about a company.

const result = await client.elf('cufinder');
console.log(result);

CAR - Company Revenue Finder

Estimates a company's annual revenue based on name.

const result = await client.car('apple');
console.log(result);

FCC - Company Subsidiaries Finder

Identifies known subsidiaries of a parent company.

const result = await client.fcc('amazon');
console.log(result);

FTS - Company Tech Stack Finder

Detects the technologies a company uses.

const result = await client.fts('cufinder');
console.log(result);

EPP - LinkedIn Profile Enrichment

Takes a LinkedIn profile URL and returns enriched person and company data.

const result = await client.epp('linkedin.com/in/iain-mckenzie');
console.log(result);

FWE - LinkedIn Profile Email Finder

Extracts a verified business email address from a LinkedIn profile URL.

const result = await client.fwe('linkedin.com/in/iain-mckenzie');
console.log(result);

TEP - Person Enrichment

Returns enriched person data based on full name and company name.

const result = await client.tep('iain mckenzie', 'stripe');
console.log(result);

ENC - Company Enrichment

Provides a complete company profile from a company name.

const result = await client.enc('cufinder');
console.log(result);

CEC - Company Employee Count

Returns an estimated number of employees for a company.

const result = await client.cec('cufinder');
console.log(result);

CLO - Company Locations

Returns the known physical office locations of a company.

const result = await client.clo('apple');
console.log(result);

CSE - Company Search

Search for companies by keyword, partial name, industry, location, or other filters.

const result = await client.cse({
  name: 'cufinder',
  country: 'germany',
  state: 'hamburg',
  city: 'hamburg'
});
console.log(result);

PSE - Person Search

Search for people by name, company, job title, location, or other filters.

const result = await client.pse({
  full_name: 'iain mckenzie',
  company_name: 'stripe'
});
console.log(result);

LBS - Local Business Search (Google Maps Search API)

Search for local businesses by location, industry, or name.

const result = await client.lbs({
  country: 'united states',
  state: 'california',
  page: 1
});
console.log(result);

BCD - B2B Customers Finder

Returns company's careers page

const result = await client.bcd('stripe.com');
console.log(result);

CCP - Company Career Page Finder

Returns is company SaaS or not

const result = await client.ccp('stripe.com');
console.log(result);

ISC - Company Saas Checker

Returns is company SaaS or not

const result = await client.isc('stripe.com')
console.log(result.is_saas);

CBC - Company B2B or B2C Checker

Returns company's business type

const result = await client.cbc('stripe.com')
console.log(result.business_type);

CSC - Company Mission Statement

Returns company's mission statement

const result = await client.csc('stripe.com')
console.log(result.mission_statement);

CSN - Company Snapshot

Returns company's snapshot information

const result = await client.csn('stripe.com')
console.log(result.company_snapshot);

NAO - Phone Number Normalizer

Returns normalized phone

const result = await client.nao('+18006676389')
console.log(result.phone); // +1 800 667 6389

NAA - Address Normalizer

Returns normalized address

const result = await client.naa('1095 avenue of the Americas, 6th Avenue ny 10036')
console.log(result.address); // 1095 AVENUE OF THE AMERICAS 6TH AVENUE NY 10036

Error Handling

The SDK provides comprehensive error handling with custom error types:

import {
  CufinderError,
  AuthenticationError,
  CreditLimitError,
  NotFoundError,
  PayloadError,
  RateLimitError,
  ServerError,
  NetworkError
} from '@cufinder/cufinder-ts';

try {
  const result = await client.cuf('cufinder', 'US');
} catch (error) {
  if (error instanceof AuthenticationError) {
    // 401 - Invalid API key
    console.log('Authentication failed:', error.message);
  } else if (error instanceof CreditLimitError) {
    // 400 - Not enough credit
    console.log('Not enough credit:', error.message);
  } else if (error instanceof NotFoundError) {
    // 404 - Not found result
    console.log('Not found result:', error.message);
  } else if (error instanceof PayloadError) {
    // 422 - Error in the payload
    console.log('Payload error:', error.message, error.details);
  } else if (error instanceof RateLimitError) {
    // 429 - Rate limit exceeded
    console.log('Rate limit exceeded. Retry after:', error.details?.retryAfter);
  } else if (error instanceof ServerError) {
    // 500, 501, ... - Server errors
    console.log('Server error:', error.message, 'Status:', error.statusCode);
  } else if (error instanceof NetworkError) {
    console.log('Network error:', error.message);
  } else {
    console.log('Unknown error:', error.message);
  }
}

Types

The SDK exports comprehensive TypeScript types:

import type {
  // Request types
  CseParams,
  PseParams,
  LbsParams,

  // Response types
  BaseResponse,
  ApiResponse,

  // Model types
  Company,
  Person,
  LookalikeCompany,
  FundraisingInfo,
  CompanyLocation,
  TepPerson,
  CloCompanyLocation
  CompanySearchResult,
  PersonSearchResult,
  LocalBusinessResult,

  // Configuration
  CufinderClientConfig,

  // Error types
  CufinderError,
  AuthenticationError,
  CreditLimitError,
  NotFoundError,
  PayloadError,
  RateLimitError,
  ServerError,
  NetworkError
} from '@cufinder/cufinder-ts';

Support

For support, please open an issue on the GitHub repository.

About

Typescript SDK for the CUFinder API.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors