Bulk Person Enrichment API
Overview
The Bulk Enrichment API provides a way to enrich multiple profiles using the Person Enrichment API in one request.
Bulk Enrichment vs Person Search
The Bulk Enrichment API is NOT the same as the Person Search API.
The Bulk Enrichment API is the same as calling the Person Enrichment API multiple times.
Use the Bulk Enrichment API when you want to get detailed profiles for a set of people you already know (such as getting the work history of each person in a list of job candidate emails). Use the Person Search API to find an undetermined number of people that match your search criteria (such as finding possible job candidates based on their work history).
Request Format
The endpoint for the bulk enrichment api is POST https://api.peopledatalabs.com/v5/person/bulk
.
You can enrich up to 100 persons in a single request.
The request body must contain an array called requests
with 1-100 individual request objects, each containing a params
object for each request's parameters.
Field Name | Description | Type |
---|---|---|
requests | All requests to make in the bulk enrichment. | Array [Object] |
params | The parameters for a single enrichment call. | Object |
{
"requests": [
{
"params": {
...
}
},
{
"params": {
...
}
},
...
]
}
See Input Parameters - Person Enrichment API for details on the supported Enrichment API parameters.
Response Format
Bulk Enrichment responses are a JSON Array of objects with the following fields:
Field Name | Description | Type |
---|---|---|
data | The person response object. | Object |
status | The HTTP status code. | Integer |
likelihood | The likelihood score. | Integer |
metadata | Any metadata that the user included in the request. [OPTIONAL] | Object |
Note: Metadata is on a per-request basis, and generally you should use it to connect requests to responses within a call. See this section for more information.
[
{"status": 200, "likelihood": 10, "data": ...},
{"status": 200, "likelihood": 10, "data": ...}
]
The order the objects appear in the response list is the same as the order of the params
in the input requests
array.
Each response contains an individual status code that shows whether the enrichment for that particular request was successful (200
) or not. See Errors for a detailed breakdown on all possible status codes.
We will deduct the number of remaining Enrichment credits in your account by the number of 200
status responses in a Bulk Enrichment request as though you made each request individually.
Example
import json
# See https://github.com/peopledatalabs/peopledatalabs-python
from peopledatalabs import PDLPY
# Create a client, specifying your API key
CLIENT = PDLPY(
api_key="YOUR API KEY",
)
# Create an array of parameters JSON objects
DATA = {
"required": "profiles",
"include_if_matched": "True",
"requests": [
{
"params": {
"profile": ["linkedin.com/in/seanthorne"]
}
},
{
"params": {
"profile": ["linkedin.com/in/randrewn"]
}
}
]
}
# Pass the bulk parameters object to the Bulk Person Enrichment API
json_responses = CLIENT.person.bulk(**DATA).json()
# Iterate through the array of API responses
for response in json_responses:
# Check for successful response
if response['status'] == 200:
record = response['data']
# Print selected fields
print(
record['work_email'],
record['full_name'],
record['job_title'],
record['job_company_name']
)
print(f"Successfully enriched profile with PDL data.")
# Save enrichment data to JSON file
with open(f"my_pdl_enrichment.{record['linkedin_username']}.jsonl", "w") as out:
out.write(json.dumps(record) + "\n")
else:
print("Enrichment unsuccessful. See error and try again.")
print("error:", response)
curl -X POST "https://api.peopledatalabs.com/v5/person/bulk" \
-H 'Content-Type: application/json' \
-H 'X-Api-Key: XXX' \
-d ' {
"requests": [
{
"params": {
"profile": ["linkedin.com/in/seanthorne"],
"location": ["SF Bay Area"],
"name": ["Sean F. Thorne"]
}
},
{
"params": {
"profile": ["https://www.linkedin.com/in/haydenconrad/"],
"first_name": "Hayden",
"last_name": "Conrad"
}
}
]
}'
// See https://github.com/peopledatalabs/peopledatalabs-js
import PDLJS from 'peopledatalabs';
import fs from 'fs';
// Create a client, specifying your API key
const PDLJSClient = new PDLJS({ apiKey: "YOUR API KEY" });
// Create an array of parameters JSON objects
const records = {
requests: [
{
params: {
profile: ['linkedin.com/in/seanthorne']
}
},
{
params: {
profile: ['linkedin.com/in/randrewn']
}
}
]
};
// Pass the parameters object to the Bulk Person Enrichment API
PDLJSClient.person.bulk(records).then((data) => {
var record
// Iterate through the array of API responses
for (let response in data) {
// Check for successful response
if (data[response].status == 200) {
record = data[response].data
// Print selected fields
console.log(
record["work_email"],
record["full_name"],
record["job_title"],
record["job_company_name"],
)
console.log("Successfully enriched profile with PDL data.")
// Save enrichment data to JSON file
fs.writeFile(`my_pdl_enrichment.${record["linkedin_username"]}.jsonl`, Buffer.from(JSON.stringify(record)), (err) => {
if (err) throw err;
});
}
else {
console.log("Enrichment unsuccessful. See error and try again.")
console.log(data[response]);
}
}
}).catch((error) => {
console.log("Enrichment unsuccessful. See error and try again.")
console.log(error);
});
require 'json'
# See https://github.com/peopledatalabs/peopledatalabs-ruby
require 'peopledatalabs'
# Set your API key
Peopledatalabs.api_key = 'YOUR API KEY'
# Create an array of parameters JSON objects
DATA = {
"requests": [
{
"params": {
"profile": ["linkedin.com/in/seanthorne"]
}
},
{
"params": {
"profile": ["linkedin.com/in/randrewn"]
}
}
]
}
# Pass the bulk parameters object to the Bulk Person Enrichment API
json_response = Peopledatalabs::Bulk.person(params: DATA)
items = json_response['items']
# Iterate through the array of API responses
items.each do |response|
# Check for successful response
if response['status'] == 200
record = response['data']
# Print selected fields
puts \
"#{record['work_email']} \
#{record['full_name']} \
#{record['job_title']} \
#{record['job_company_name']}"
puts "Successfully enriched profile with PDL data."
# Save enrichment data to JSON file
File.open("my_pdl_enrichment.#{record['linkedin_username']}.jsonl", "w") do |out|
out.write(JSON.dump(record) + "\n")
end
else
puts "Enrichment unsuccessful. See error and try again."
puts "error: #{json_response}"
end
end
package main
import (
"fmt"
"os"
"encoding/json"
"context"
)
// See https://github.com/peopledatalabs/peopledatalabs-go
import (
pdl "github.com/peopledatalabs/peopledatalabs-go"
pdlmodel "github.com/peopledatalabs/peopledatalabs-go/model"
)
func main() {
// Set your API key
apiKey := "YOUR API KEY"
// Set API key as environmental variable
// apiKey := os.Getenv("API_KEY")
// Create a client, specifying your API key
client := pdl.New(apiKey)
// Create an array of parameters JSON objects
params := pdlmodel.BulkEnrichPersonParams {
Requests: []pdlmodel.BulkEnrichSinglePersonParams {
{
Params: pdlmodel.PersonParams {
Profile: []string{"linkedin.com/in/seanthorne"},
},
},
{
Params: pdlmodel.PersonParams {
Profile: []string{"linkedin.com/in/randrewn"},
},
},
},
}
// Pass the parameters object to the Bulk Person Enrichment API
responses, err := client.Person.BulkEnrich(context.Background(), params)
// Iterate through the array of API responses
for _, response := range responses {
// Check for successful response
if err == nil {
// Convert the API response to JSON
jsonResponse, jsonErr := json.Marshal(response.Data)
if jsonErr == nil {
var record map[string]interface{}
json.Unmarshal(jsonResponse, &record)
// Print selected fields
fmt.Println(
record["work_email"],
record["full_name"],
record["job_title"],
record["job_company_name"])
fmt.Println("Successfully enriched profile with PDL data.")
// Save enrichment data to JSON file
out, outErr := os.Create(fmt.Sprintf("my_pdl_enrichment.%s.jsonl", record["linkedin_username"]))
defer out.Close()
if outErr == nil {
out.WriteString(string(jsonResponse) + "\n")
}
out.Sync()
}
} else {
fmt.Println("Enrichment unsuccessful. See error and try again.")
fmt.Println("error:", err)
}
}
}
import requests
import json
# Set your API key
API_KEY = "YOUR API KEY"
# Pass your API key in header
HEADERS = {
'X-Api-Key': API_KEY,
'Content-Type': 'application/json',
}
# Create an array of parameters JSON objects
DATA = {
"requests": [
{
"params": {
"profile": ["linkedin.com/in/seanthorne"]
}
},
{
"params": {
"profile": ["linkedin.com/in/randrewn"]
}
}
]
}
# Pass the bulk parameters object to the Bulk Person Enrichment API using POST method
json_responses = requests.post(
'https://api.peopledatalabs.com/v5/person/bulk',
headers=HEADERS,
json=DATA
).json()
# Iterate through the array of API responses
for response in json_responses:
# Check for successful response
if response["status"] == 200:
record = response['data']
# Print selected fields
print(
record['work_email'],
record['full_name'],
record['job_title'],
record['job_company_name']
)
print(f"Successfully enriched profile with PDL data.")
# Save enrichment data to JSON file
with open(f"my_pdl_enrichment.{record['linkedin_username']}.jsonl", "w") as out:
out.write(json.dumps(record) + "\n")
else:
print("Enrichment unsuccessful. See error and try again.")
print("error:", response)
Tracking Responses
The API always returns response objects in the same order as they were defined in the requests
array. You can also add an optional metadata
object to each request, containing any information specific to that request. If you define metadata
in a request object, the API will return it unchanged in that request's corresponding response object:
import json
# See https://github.com/peopledatalabs/peopledatalabs-python
from peopledatalabs import PDLPY
# Create a client, specifying your API key
CLIENT = PDLPY(
api_key="YOUR API KEY",
)
# Create an array of parameters JSON objects
DATA = {
"required": "profiles",
"include_if_matched": "True",
"requests": [
{
# Include metadata object
"metadata": {
"user_id": "123"
},
"params": {
"profile": ["linkedin.com/in/seanthorne"],
"location": ["SF Bay Area"],
"name": ["Sean F. Thorne"]
}
},
{
# Include metadata object
"metadata": {
"user_id": "345"
},
"params": {
"profile": ["https://www.linkedin.com/in/haydenconrad/"],
"first_name": "Hayden",
"last_name": "Conrad"
}
}
]
}
# Pass the bulk parameters object to the Bulk Person Enrichment API
json_response = CLIENT.person.bulk(**DATA).json()
# Print the API response
print(json.dumps(json_response))
curl -X POST "https://api.peopledatalabs.com/v5/person/bulk" \
-H 'Content-Type: application/json' \
-H 'X-Api-Key: XXX' \
-d ' {
"requests": [
{
"metadata": {
"user_id": "123"
},
"params": {
"profile": ["linkedin.com/in/seanthorne"],
"location": ["SF Bay Area"],
"name": ["Sean F. Thorne"]
}
},
{
"metadata": {
"user_id": "345"
},
"params": {
"profile": ["https://www.linkedin.com/in/haydenconrad/"],
"first_name": "Hayden",
"last_name": "Conrad"
}
}
]
}'
// See https://github.com/peopledatalabs/peopledatalabs-js
import PDLJS from 'peopledatalabs';
// Create a client, specifying your API key
const PDLJSClient = new PDLJS({ apiKey: "YOUR API KEY" });
// Create an array of parameters JSON objects
const records = {
requests: [
{
// Include metadata object
metadata: {
user_id: "123"
},
params: {
profile: ['linkedin.com/in/seanthorne'],
location: "SF Bay Area",
name: "Sean F Thorne"
}
},
{
// Include metadata object
metadata: {
user_id: "345"
},
params: {
profile: ["https://www.linkedin.com/in/haydenconrad/"],
first_name: "Hayden",
last_name: "Conrad"
}
}
]
};
// Pass the parameters object to the Bulk Person Enrichment API
PDLJSClient.person.bulk(records).then((data) => {
// Print the API response
console.log(data);
}).catch((error) => {
console.log(error);
});
require 'json'
# See https://github.com/peopledatalabs/peopledatalabs-ruby
require 'peopledatalabs'
# Set your API key
Peopledatalabs.api_key = 'YOUR API KEY'
# Create an array of parameters JSON objects
DATA = {
"requests": [
{
# Include metadata object
"metadata": {
"user_id": "123"
},
"params": {
"profile": ["linkedin.com/in/seanthorne"],
"location": ["SF Bay Area"],
"name": ["Sean F. Thorne"]
}
},
{
# Include metadata object
"metadata": {
"user_id": "345"
},
"params": {
"profile": ["https://www.linkedin.com/in/haydenconrad/"],
"first_name": "Hayden",
"last_name": "Conrad"
}
}
]
}
# Pass the bulk parameters object to the Bulk Person Enrichment API
json_response = Peopledatalabs::Bulk.person(params: DATA)
# Print the API response
puts JSON.dump(json_response)
package main
import (
"fmt"
"encoding/json"
"context"
)
// See https://github.com/peopledatalabs/peopledatalabs-go
import (
pdl "github.com/peopledatalabs/peopledatalabs-go"
pdlmodel "github.com/peopledatalabs/peopledatalabs-go/model"
)
func main() {
// Set your API key
apiKey := "YOUR API KEY"
// Set API key as environmental variable
// apiKey := os.Getenv("API_KEY")
// Create a client, specifying your API key
client := pdl.New(apiKey)
// Create an array of parameters JSON objects
params := pdlmodel.BulkEnrichPersonParams {
Requests: []pdlmodel.BulkEnrichSinglePersonParams {
{
// Include metadata object
Metadata: map[string]string {
"user_id": "123",
},
Params: pdlmodel.PersonParams {
Profile: []string{"linkedin.com/in/seanthorne"},
Location: []string{"SF Bay Area"},
Name: []string{"Sean F. Thorne"},
},
},
{
// Include metadata object
Metadata: map[string]string {
"user_id": "345",
},
Params: pdlmodel.PersonParams {
Profile: []string{"https://www.linkedin.com/in/haydenconrad/"},
FirstName: []string{"Hayden"},
LastName: []string{"Conrad"},
},
},
},
}
// Pass the parameters object to the Bulk Person Enrichment API
response, err := client.Person.BulkEnrich(context.Background(), params)
// Check for successful response
if err == nil {
// Convert the API response to JSON
data, jsonErr := json.Marshal(response)
// Print the API response
if (jsonErr == nil) {
fmt.Println(string(data))
}
}
}
import requests
import json
# Pass your API key in header
HEADERS = {
'Content-Type': 'application/json',
'X-api-key': 'YOUR API KEY'
}
# Create an array of parameters JSON objects
DATA = {
"requests": [
{
# Include metadata object
"metadata": {
"user_id": "123"
},
"params": {
"profile": ["linkedin.com/in/seanthorne"],
"location": ["SF Bay Area"],
"name": ["Sean F. Thorne"]
}
},
{
# Include metadata object
"metadata": {
"user_id": "345"
},
"params": {
"profile": ["https://www.linkedin.com/in/haydenconrad/"],
"first_name": "Hayden",
"last_name": "Conrad"
}
}
]
}
# Pass the bulk parameters object to the Bulk Person Enrichment API
json_response = requests.post(
'https://api.peopledatalabs.com/v5/person/bulk',
headers=HEADERS,
json=DATA
).json()
# Print the API response
print(json.dumps(json_response))
[
{"metadata": {"user_id": "123"}, "status": 200, "likelihood": 10, "data": ...},
{"metadata": {"user_id": "345"}, "status": 200, "likelihood": 10, "data": ...}
]
Global Filtering and Formatting
You can define any of the response filtering or formatting parameters documented in the Input Parameters - Person Enrichment API page globally for all request objects.
Any response filtering and formatting parameters that you define within in an individual params
object will override those defined in the global request body.
import json
# See https://github.com/peopledatalabs/peopledatalabs-python
from peopledatalabs import PDLPY
# Create a client, specifying your API key
CLIENT = PDLPY(
api_key="YOUR API KEY",
)
# Create an array of parameters JSON objects
DATA = {
# Set global filter
"required": "emails AND profiles",
"requests": [
{
"params": {
"profile": ["linkedin.com/in/seanthorne"],
"location": ["SF Bay Area"],
"name": ["Sean F. Thorne"]
}
},
{
"params": {
"profile": ["https://www.linkedin.com/in/haydenconrad/"],
"first_name": "Hayden",
"last_name": "Conrad"
}
}
]
}
# Pass the bulk parameters object to the Bulk Person Enrichment API
json_response = CLIENT.person.bulk(**DATA).json()
# Print the API response
print(json.dumps(json_response))
curl -X POST "https://api.peopledatalabs.com/v5/person/bulk" \
-H 'Content-Type: application/json' \
-H 'X-Api-Key: XXX' \
-d ' {
"required": "emails AND profiles",
"requests": [
{
"params": {
"profile": ["linkedin.com/in/seanthorne"],
"location": ["SF Bay Area"],
"name": ["Sean F. Thorne"]
}
},
{
"params": {
"profile": ["https://www.linkedin.com/in/haydenconrad/"],
"first_name": "Hayden",
"last_name": "Conrad"
}
}
]
}'
// See https://github.com/peopledatalabs/peopledatalabs-js
import PDLJS from 'peopledatalabs';
// Create a client, specifying your API key
const PDLJSClient = new PDLJS({ apiKey: "YOUR API KEY" });
// Create an array of parameters JSON objects
const records = {
// Set global filter
required: "emails AND profiles",
requests: [
{
params: {
profile: ['linkedin.com/in/seanthorne'],
location: "SF Bay Area",
name: "Sean F Thorne"
}
},
{
params: {
profile: ["https://www.linkedin.com/in/haydenconrad/"],
first_name: "Hayden",
last_name: "Conrad"
}
}
]
};
// Pass the parameters object to the Bulk Person Enrichment API
PDLJSClient.person.bulk(records).then((data) => {
// Print the API response
console.log(data);
}).catch((error) => {
console.log(error);
});
require 'json'
# See https://github.com/peopledatalabs/peopledatalabs-ruby
require 'peopledatalabs'
# Set your API key
Peopledatalabs.api_key = 'YOUR API KEY'
# Create an array of parameters JSON objects
DATA = {
# Set global filter
"required": "emails AND profiles",
"requests": [
{
"params": {
"profile": ["linkedin.com/in/seanthorne"],
"location": ["SF Bay Area"],
"name": ["Sean F. Thorne"]
}
},
{
"params": {
"profile": ["https://www.linkedin.com/in/haydenconrad/"],
"first_name": "Hayden",
"last_name": "Conrad"
}
}
]
}
# Pass the bulk parameters object to the Bulk Person Enrichment API
json_response = Peopledatalabs::Bulk.person(params: DATA)
# Print the API response
puts JSON.dump(json_response)
package main
import (
"fmt"
"encoding/json"
"context"
)
// See https://github.com/peopledatalabs/peopledatalabs-go
import (
pdl "github.com/peopledatalabs/peopledatalabs-go"
pdlmodel "github.com/peopledatalabs/peopledatalabs-go/model"
)
func main() {
// Set your API key
apiKey := "YOUR API KEY"
// Set API key as environmental variable
// apiKey := os.Getenv("API_KEY")
// Create a client, specifying your API key
client := pdl.New(apiKey)
// Create an array of parameters JSON objects
params := pdlmodel.BulkEnrichPersonParams {
// Set global filter
Required: "emails AND profiles",
Requests: []pdlmodel.BulkEnrichSinglePersonParams {
{
Params: pdlmodel.PersonParams {
Profile: []string{"linkedin.com/in/seanthorne"},
Location: []string{"SF Bay Area"},
Name: []string{"Sean F. Thorne"},
},
},
{
Params: pdlmodel.PersonParams {
Profile: []string{"https://www.linkedin.com/in/haydenconrad/"},
FirstName: []string{"Hayden"},
LastName: []string{"Conrad"},
},
},
},
}
// Pass the parameters object to the Bulk Person Enrichment API
response, err := client.Person.BulkEnrich(context.Background(), params)
// Check for successful response
if err == nil {
// Convert the API response to JSON
data, jsonErr := json.Marshal(response)
// Print the API response
if (jsonErr == nil) {
fmt.Println(string(data))
}
}
}
import requests
import json
# Pass your API key in header
HEADERS = {
'Content-Type': 'application/json',
'X-api-key': 'YOUR API KEY'
}
# Create an array of parameters JSON objects
DATA = {
# Set global filter
"required": "emails AND profiles",
"requests": [
{
"params": {
"profile": ["linkedin.com/in/seanthorne"],
"location": ["SF Bay Area"],
"name": ["Sean F. Thorne"]
}
},
{
"params": {
"profile": ["https://www.linkedin.com/in/haydenconrad/"],
"first_name": "Hayden",
"last_name": "Conrad"
}
}
]
}
# Pass the bulk parameters object to the Bulk Person Enrichment API
json_response = requests.post(
'https://api.peopledatalabs.com/v5/person/bulk',
headers=HEADERS,
json=DATA
).json()
# Print the API response
print(json.dumps(json_response))
Malformed, Unauthenticated, or Throttled Requests
Any malformed, unauthenticated, or throttled requests will return errors in the same format as documented in the Errors page.
import json
# See https://github.com/peopledatalabs/peopledatalabs-python
from peopledatalabs import PDLPY
# Create a client, specifying your API key
CLIENT = PDLPY(
api_key="YOUR API KEY",
)
# Create a parameters JSON object without a requests array
DATA = {"required": "names"}
# Catch exception when passing the parameters object to the Bulk Person Enrichment API
try:
json_response = CLIENT.person.bulk(**DATA).json()
except Exception as err:
print(err);
curl -X POST "https://api.peopledatalabs.com/v5/person/bulk" \
-H 'Content-Type: application/json' \
-H 'X-Api-Key: XXX' \
-d ' {
"required": "names"
}'
// See https://github.com/peopledatalabs/peopledatalabs-js
import PDLJS from 'peopledatalabs';
// Create a client, specifying your API key
const PDLJSClient = new PDLJS({ apiKey: "YOUR API KEY" });
// Create a parameters JSON object without a requests array
const records = {
required: "names"
};
// Catch exception when passing the parameters object to the Bulk Person Enrichment API
PDLJSClient.person.bulk(records).then((data) => {
console.log(data);
}).catch((error) => {
console.log(error);
});
require 'json'
# See https://github.com/peopledatalabs/peopledatalabs-ruby
require 'peopledatalabs'
# Set your API key
Peopledatalabs.api_key = 'YOUR API KEY'
# Create a parameters JSON object without a requests array
DATA = {"required": "names"}
# Pass the parameters object to the Bulk Person Enrichment API
json_response = Peopledatalabs::Bulk.person(params: DATA)
# Check for error
if json_response['status'] != 200
puts json_response['error']['message']
end
package main
import (
"fmt"
"encoding/json"
"context"
)
// See https://github.com/peopledatalabs/peopledatalabs-go
import (
pdl "github.com/peopledatalabs/peopledatalabs-go"
pdlmodel "github.com/peopledatalabs/peopledatalabs-go/model"
)
func main() {
// Set your API key
apiKey := "YOUR API KEY"
// Set API key as environmental variable
// apiKey := os.Getenv("API_KEY")
// Create a client, specifying your API key
client := pdl.New(apiKey)
// Create a parameters JSON object without a requests array
data := pdlmodel.BulkEnrichPersonParams {
Required: "names",
}
// Pass the parameters object to the Bulk Person Enrichment API
response, err := client.Person.BulkEnrich(context.Background(), data)
// Check for error
if err == nil {
fmt.Println(response)
} else {
message, jsonErr := json.Marshal(err)
if jsonErr == nil {
fmt.Println(string(message))
}
}
}
import requests
import json
# Pass your API key in header
HEADERS = {
'Content-Type': 'application/json',
'X-api-key': 'YOUR API KEY'
}
# Create a parameters JSON object without a requests array
DATA = {"required": "names"}
# Pass the parameters object to the Bulk Person Enrichment API
response = requests.post(
'https://api.peopledatalabs.com/v5/person/bulk',
headers=HEADERS,
json=DATA
)
# Print error
print(response.text)
{
"status": 400,
"error": {
"type": "invalid_request_error",
"message": "Request object must contain `requests` field"
}
}
Updated about 2 months ago