Introduction

Introduction

The API is designed to enrich information on a single person.

The API is organized around REST and uses HTTP response codes to indicate API errors. All API responses, including errors, are returned in JSON.

Endpoints

The API resides at api.peopledatalabs.com. All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication (an API key) will also fail.

https://api.peopledatalabs.com

The v5/person/enrich API can be used to enrich data on a person:

import requests

API_KEY = # YOUR API KEY

pdl_url = "https://api.peopledatalabs.com/v5/person/enrich"

params = {
    "api_key": API_KEY,
    "profile": ["linkedin.com/in/seanthorne"]
}

json_response = requests.get(pdl_url,  params=params).json()

###
curl -X GET \
  'https://api.peopledatalabs.com/v5/person/enrich?api_key=xxxx&profile=linkedin.com/in/seanthorne'

We also provide a 'v5/person/bulk' endpoint which allows you to enrich 1-100 persons in a single request (recommended for high volume usage):

import requests

API_KEY = # YOUR API KEY

pdl_url = "https://api.peopledatalabs.com/v5/person/bulk"

headers = {
      'X-Api-Key': API_KEY,
    'Content-Type': 'application/json'
}

data = '{"requests": [{"params": {"profile": ["linkedin.com/in/seanthorne"]}}]}'

response = requests.post(pdl_url, headers=headers, data=data)
curl -X POST "https://api.peopledatalabs.com/v5/person/bulk" -H 'X-Api-Key: xxxx' 'Content-Type: application/json' -d'
{
    "requests": [
        {
            "params": {
                "profile": ["linkedin.com/in/seanthorne"]
            }
        }
    ]
}

We provide a v5/person/search endpoint which allows you to write queries (in Elasticsearch or SQL format) against our dataset and return any profiles that match that query.

import requests, json

API_KEY = # YOUR API KEY

PDL_URL = "https://api.peopledatalabs.com/v5/person/search"

H = {
  'Content-Type': "application/json",
  'X-api-key': API_KEY
}

ES_QUERY = {
  'query': {
    'bool': {
        'must': [
            {'term': {'location_country': "mexico"}},
            {'term': {'job_title_role': "health"}},
            {'exists': {'field': "phone_numbers"}}
      ]
    }
  }
}

P = {
  'query': json.dumps(ES_QUERY),
  'size': 10,
  'pretty': True
}

response = requests.get(
  PDL_URL,
  headers=H,
  params=P
).json()

if response["status"] == 200:
  data = response['data']
  with open("my_pdl_search.jsonl", "w") as out:
    for record in data:
      out.write(json.dumps(record) + "\n")
  print(f"successfully grabbed {len(data)} records from pdl")
  print(f"{response['total']} total pdl records exist matching this query")
import requests, json

API_KEY = # YOUR API KEY

PDL_URL = "https://api.peopledatalabs.com/v5/person/search"

H = {
  'Content-Type': "application/json",
  'X-api-key': API_KEY
}

SQL_QUERY = \
"""
  SELECT * FROM person
  WHERE location_country='mexico'
  AND job_title_role='health'
  AND phone_numbers IS NOT NULL;
 """

P = {
  'sql': SQL_QUERY,
  'size': 10,
  'pretty': True
}

response = requests.get(
  PDL_URL,
  headers=H,
  params=P
).json()

if response["status"] == 200:
  data = response['data']
  with open("my_pdl_search.jsonl", "w") as out:
    for record in data:
      out.write(json.dumps(record) + "\n")
  print(f"successfully grabbed {len(data)} records from pdl")
  print(f"{response['total']} total pdl records exist matching this query")
# Elasticsearch
curl -X GET 'https://api.peopledatalabs.com/v5/person/search' \
-H 'X-Api-Key: xxxx' \
--data-raw '{
  "size": 10,
  "query": {
    "bool": {
      "must": [
        {"term": {"location_country": "mexico"}},
        {"term": {"job_title_role": "health"}},
        {"exists": {"field": "phone_numbers"}}
      ]
    }
  }
}'

# SQL
curl -X GET \
  'https://api.peopledatalabs.com/v5/person/search' \
  -H 'X-Api-Key: xxxx' \
  --data-raw '{
    "size": 10,
    "sql": "SELECT * FROM person WHERE location_country='\''mexico'\'' AND job_title_role='\''health'\'' AND phone_numbers IS NOT NULL;"
}'

Similar to the Person Enrichment API, we provide a Company Enrichment API as well for querying more information on individual companies.

import requests

API_KEY = # ENTER YOUR API KEY

url = "https://api.peopledatalabs.com/v5/company/enrich"

querystring = {"website":"google.com"}

headers = {
    'accept': "application/json",
    'content-type': "application/json",
    'x-api-key': API_KEY
    }

response = requests.request("GET", url, headers=headers, params=querystring)

print(response.text)
curl -X GET -G \
  'https://api.peopledatalabs.com/v5/company/enrich'\
  -H 'X-Api-Key: xxxx'\
  --data-urlencode 'website=google.com'

Identical to the Person Search API, we provide a Company Search API that allows you to write queries to retrieve records on all companies matching the query criteria.

import requests, json
API_KEY = # YOUR API KEY

PDL_URL = "https://api.peopledatalabs.com/v5/company/search"

H = {
  'Content-Type': "application/json",
  'X-api-key': API_KEY
}

ES_QUERY = {
  "query": {
    "bool": {
      "must": [
        {"term": {"website": "google.com"}},
      ]
    }
  }
}

P = {
  'query': json.dumps(ES_QUERY),
  'size': 10,
  'pretty': True
}

response = requests.get(
  PDL_URL,
  headers=H,
  params=P
).json()

if response["status"] == 200:
  data = response['data']
  with open("my_pdl_search.jsonl", "w") as out:
    for record in data:
      out.write(json.dumps(record) + "\n")
  print(f"successfully grabbed {len(data)} records from pdl")
  print(f"{response['total']} total pdl records exist matching this query")
else:
  print("NOTE. The carrier pigeons lost motivation in flight. See error and try again.")
  print("Error:", response)
import requests, json

API_KEY = # YOUR API KEY

PDL_URL = "https://api.peopledatalabs.com/v5/company/search"

H = {
  'Content-Type': "application/json",
  'X-api-key': API_KEY
}

SQL_QUERY = \
"""
  SELECT * FROM company
  WHERE website='google.com';
 """

P = {
  'sql': SQL_QUERY,
  'size': 10,
  'pretty': True
}

response = requests.get(
  PDL_URL,
  headers=H,
  params=P
).json()

if response["status"] == 200:
  data = response['data']
  with open("my_pdl_search.jsonl", "w") as out:
    for record in data:
      out.write(json.dumps(record) + "\n")
  print(f"successfully grabbed {len(data)} records from pdl")
  print(f"{response['total']} total pdl records exist matching this query")
else:
  print("NOTE. The carrier pigeons lost motivation in flight. See error and try again.")
  print("error:", response)
# Elasticsearch
curl -X GET 'https://api.peopledatalabs.com/v5/company/search' \
-H 'X-Api-Key: xxxx' \
--data-raw '{
  "size": 10,
  "query": {
    "bool": {
      "must": [
        {"term": {"website": "google.com"}},
      ]
    }
  }
}'

# SQL
curl -X GET \
  'https://api.peopledatalabs.com/v5/company/search' \
  -H 'X-Api-Key: xxxx' \
  --data-raw '{
    "size": 10,
    "sql": "SELECT * FROM company WHERE website='\''google.com'\'';"
}'

We provide several Cleaner API's that can be used to standardize raw data fields for company, school and location names based on our own internal standardization criteria.

Use the Company Cleaner API to standardize company names

import requests

API_KEY = # ENTER YOUR API KEY

url = "https://api.peopledatalabs.com/v5/company/clean"

querystring = {"website":"peopledatalabs.com"}

headers = {
    'accept': "application/json",
    'content-type': "application/json",
    'x-api-key': API_KEY
    }

response = requests.request("GET", url, headers=headers, params=querystring)

print(response.text)

Use the School Cleaner API to standardize school names

import requests

API_KEY = # ENTER YOUR API KEY

url = "https://api.peopledatalabs.com/v5/school/clean"

querystring = {"profile":"linkedin.com/school/ucla"}

headers = {
    'accept': "application/json",
    'content-type': "application/json",
    'x-api-key': API_KEY
    }

response = requests.request("GET", url, headers=headers, params=querystring)

print(response.text)

Use the Location Cleaner API to standardize location names

import requests

API_KEY = # ENTER YOUR API KEY

url = "https://api.peopledatalabs.com/v5/location/clean"

querystring = {"location":"239 NW 13th Ave, Portland, Oregon 97209, US"}

headers = {
    'accept': "application/json",
    'content-type': "application/json",
    'x-api-key': API_KEY
    }

response = requests.request("GET", url, headers=headers, params=querystring)

print(response.text)

Did this page help you?