DEV Community

Vinay Rajur for People Data Labs

Posted on

We made a free JS library to quickly access professional data on people and companies

What would you build with easy access to person and company data? What if you could instantly query a database for “all the companies in San Francisco using react” or “the GitHub profiles of senior software engineers at Google”?

Having the right data can sometimes make or break your project, and we often we rule out working on interesting projects simply because we don’t know how to get the data we need.

We wanted to create an easier way to get high-quality (and ethically-sourced) data - so we built an open-source library to do just that!

GitHub logo peopledatalabs / peopledatalabs-js

A universal JS client for the People Data Labs API

People Data Labs Logo

People Data Labs JS Library

A tiny, universal JS client for the People Data Labs API

peopledatalabs gzip size brotli size

Features:

  • Tiny <2KB size gzip
  • Works in Node.js and in Browser
  • Supports all People Data Labs API endpoints

Table of Contents

🔧 Installation

npm i peopledatalabs
Enter fullscreen mode Exit fullscreen mode

🚀 Usage

First, create the PDLJS client:

import PDLJS from 'peopledatalabs';

PDLJSClient = PDLJS({“apiKey”: “YOUR API KEY”})
Enter fullscreen mode Exit fullscreen mode

Then, send requests to any PDL API Endpoint:

Getting Person Data

// By Enrichment
PDLJSClient.person.enrichment({ phone: '4155688415' }).then((data) => {
  console.log(data);
}).catch((error) => {
  console.log(error);
});
// By Search (SQL)
const sqlQuery = "SELECT
Enter fullscreen mode Exit fullscreen mode

Features

This is a simple client library that supports over a dozen different endpoints for accessing the different datasets we’ve built1. Some of the key features are:

Totally minified

We know how much bloated npm packages can weigh down your project, so we kept it super lightweight with this library - less than 2KB compressed.

Framework agnostic

We wrote it using plain vanilla JS. This means you can easily integrate it into any of your javascript projects, whether you’re deploying to a server or running right in the browser.

Supports all our endpoints

This library supports every single one of our endpoints, so you can easily query the data you want, the way you want. Everything is just one function call away!

Getting Started

Getting set up is a breeze!

  1. Pull the package from the npm repository:
    npm i peopledatalabs

  2. Sign up for a free API key

And that’s it! Now just import the client and initialize it with your API key and you’re ready to go 🚀

import PDLJS from 'peopledatalabs';
const PDLJSClient = new PDLJS({ apiKey: "YOUR API KEY" });
Enter fullscreen mode Exit fullscreen mode

Examples

So what can you do, once you’re set up? Here’s a few quick examples:

Finding person-related information

Maybe you’re interested in data related to people? Here’s what that query from before would look like using our Person Search API:

// Find the github profiles for senior software engineers at Google
const sqlQuery = `
  SELECT * FROM person 
  WHERE job_company_website='google.com' 
  AND job_title='senior software engineer'
  AND github_url IS NOT NULL;`

PDLJSClient.person.search.sql({
  searchQuery: sqlQuery,
  size: 10
}).then((data) => {
  for (let record of data['data']) {
    console.log(record['github_url'])
  }
  console.log(`Total Number of Available Records: ${data['total']}`);
}).catch((error) => {
  console.log(error);
});
Enter fullscreen mode Exit fullscreen mode

Finding company-related information

Or if you’re interested in company data instead, you could use our Company Enrichment API to get full profiles on individual companies. For example, let’s look up Salesforce:

// Get the full profile for Salesforce
PDLJSClient.company.enrichment({ 
  website: 'salesforce.com' 
}).then((data) => {
  console.log(data);
}).catch((error) => {
  console.log(error);
});
Enter fullscreen mode Exit fullscreen mode

Using supporting endpoints

We’ve also got several auxiliary endpoints to help you with data cleaning and autocompletion. For example, you could use our Autocomplete API to build an interactive form (like the one below) by generating real-time suggestions for company names:

GIF of interactive form field displaying suggestions provided by the autocomplete api

// Autocomplete Suggestions for Company Names starting with "str"
PDLJSClient.autocomplete({ 
  field: "company", 
  text: "str" 
}).then((data) => {
  console.log(data);
}).catch((error) => {
  console.log(error);
});
Enter fullscreen mode Exit fullscreen mode

Documentation

If you’re interested in learning more, you can check out our GitHub repo for documentation, full working examples, and links to additional resources!

Wrapping Up

We hope you find this library useful, and we would love to see what you build. Of course nothing is ever perfect, so if you find a bug or if you have any suggestions or questions we are always happy to hear (pull requests welcome!)

So give it a spin, and let us know what you think!

- With ❤️ from the People Data Labs team

Who We Are

At PDL, we are in the business of building the world’s best datasets on business profiles and companies. We are an organization that believes the future of every business will be data-driven, and we want to make that happen through building the world’s most comprehensive and ethically-sourced B2B datasets.

We have a rapidly growing user base across numerous industries, ranging from recruiting to investment and competitive intelligence. We’re a fun-loving team and always looking for great talent to join!


  1. Curious about how we built our datasets? We put a fair bit of engineering behind it and we shared our process in this whitepaper - check it out! 

Top comments (0)