JavaScript SDK

Getting started with the People Data Labs JavaScript Helper Library, which is an open-source SDK that lets you write JavaScript code to make HTTP requests to our APIs

The People Data Labs JavaScript Helper Library

The People Data Labs JavaScript Helper Library makes it easy to interact with our APIs from your JavaScript application. You can find the most recent version of the library on npm.

How To Install the Library

This library is available as an npm package, and you can install it like this:

npm i -S peopledatalabs
yarn add peopledatalabs

Using the Library

Make sure that you sign up for a free PDL API key if you don't already have one.

// See https://github.com/peopledatalabs/peopledatalabs-js
import PDLJS from 'peopledatalabs';

// Create a client, specifying your API key
const PDLClient = new PDLJS({ apiKey: YOUR_API_KEY });

// Chaining Implementation
PDLClient.person.enrichment({ profile: 'linkedin.com/in/seanthorne' }).then((response) => {
  // Print the API response in JSON format
  console.log(response?.data);
}).catch((error) => {
  console.log(error);
});

// Async/Await Implementation
try {
  const getPersonRecord = async () => {
    const response = await PDLClient.person.enrichment({ profile: 'linkedin.com/in/seanthorne' });
    // Print the API response in JSON format
    console.log(response?.data);
  }
  
  getPersonRecord();
} catch (error) {
  console.log(error);
}

TypeScript Support

The People Data Labs JavaScript Helper Library ships with TypeScript types. You can use these to gain the benefits of using TypeScript without having to write your own types.

More Information, Pull Requests, Feature Suggestions and Bug Reports

We've open-sourced the library, which is available on GitHub. Go there to view more information. You can also submit pull requests, feature suggestions and bug reports.