Examples - Person Enrichment API
Examples
When specifying query parameters within a URL, you should separate them with an ampersand (&
). When specifying query parameters within a JSON object, you should use lists for the request parameters.
We've provided code samples in cURL, Python, Ruby, Go and JavaScript. If you aren't comfortable working in any of these languages, feel free to use this handy tool to convert code from cURL to the language of your choice.
We want your feedback!
Do you see a bug? Is there an example you'd like to see that's not listed here?
Head over to the public roadmap and submit a bug ticket or a feature request and receive automatic notifications as your bug is resolved or your request is implemented.
The following examples match a field (or a set of fields) to a person record:
LinkedIn URL
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
PARAMS = {
"profile": ["http://linkedin.com/in/seanthorne"],
"min_likelihood": 6
}
# Pass the parameters object to the Person Enrichment API
json_response = CLIENT.person.enrichment(**PARAMS).json()
# Check for successful response
if json_response["status"] == 200:
record = json_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("my_pdl_enrichment.jsonl", "w") as out:
out.write(json.dumps(record) + "\n")
else:
print("Enrichment unsuccessful. See error and try again.")
print("error:", json_response)
curl -X GET -G \
'https://api.peopledatalabs.com/v5/person/enrich'\
-H 'X-Api-Key: xxxx' \
--data-urlencode 'min_likelihood=6'\
--data-urlencode 'profile=http://linkedin.com/in/seanthorne'
// 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 a parameters JSON object
const params = {
profile: "http://linkedin.com/in/seanthorne",
min_likelihood: 6
}
// Pass the parameters object to the Person Enrichment API
PDLJSClient.person.enrichment(params).then((data) => {
var record = data.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.jsonl", Buffer.from(JSON.stringify(record)), (err) => {
if (err) throw err;
});
}).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 a parameters JSON object
PARAMS = {
"profile": ["http://linkedin.com/in/seanthorne"],
"min_likelihood": 6
}
# Pass the parameters object to the Person Enrichment API
json_response = Peopledatalabs::Enrichment.person(params: PARAMS)
# Check for successful response
if json_response['status'] == 200
record = json_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.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
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 a parameters JSON object
params := pdlmodel.EnrichPersonParams {
PersonParams: pdlmodel.PersonParams {
Profile: []string{"linkedin.com/in/seanthorne"},
},
AdditionalParams: pdlmodel.AdditionalParams {
MinLikelihood: 6,
},
}
// Pass the parameters object to the Person Enrichment API
response, err := client.Person.Enrich(context.Background(), params)
// 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("my_pdl_enrichment.jsonl")
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, json
# Set your API key
API_KEY = "YOUR API KEY"
# Set the Person Enrichment API URL
PDL_URL = "https://api.peopledatalabs.com/v5/person/enrich"
# Create a parameters JSON object
PARAMS = {
"api_key": API_KEY,
"profile": ["http://linkedin.com/in/seanthorne"],
"min_likelihood": 6
}
# Pass the parameters object to the Person Enrichment API
json_response = requests.get(PDL_URL, params=PARAMS).json()
# Check for successful response
if json_response["status"] == 200:
record = json_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("my_pdl_enrichment.jsonl", "w") as out:
out.write(json.dumps(record) + "\n")
else:
print("Enrichment unsuccessful. See error and try again.")
print("error:", json_response)
Email
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
PARAMS = {
"email": ["[email protected]"]
}
# Pass the parameters object to the Person Enrichment API
json_response = CLIENT.person.enrichment(**PARAMS).json()
# Check for successful response
if json_response["status"] == 200:
record = json_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("my_pdl_enrichment.jsonl", "w") as out:
out.write(json.dumps(record) + "\n")
else:
print("Enrichment unsuccessful. See error and try again.")
print("error:", json_response)
curl -X GET -G \
'https://api.peopledatalabs.com/v5/person/enrich' \
-H 'X-Api-Key: xxxx' \
--data-urlencode '[email protected]'
// 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 a parameters JSON object
const params = {
email: "[email protected]"
}
// Pass the parameters object to the Person Enrichment API
PDLJSClient.person.enrichment(params).then((data) => {
var record = data.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.jsonl", Buffer.from(JSON.stringify(record)), (err) => {
if (err) throw err;
});
}).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 a parameters JSON object
PARAMS = {
"email": ["[email protected]"]
}
# Pass the parameters object to the Person Enrichment API
json_response = Peopledatalabs::Enrichment.person(params: PARAMS)
# Check for successful response
if json_response['status'] == 200
record = json_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.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
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 a parameters JSON object
params := pdlmodel.EnrichPersonParams {
PersonParams: pdlmodel.PersonParams {
Email: []string{"[email protected]"},
},
}
// Pass the parameters object to the Person Enrichment API
response, err := client.Person.Enrich(context.Background(), params)
// 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("my_pdl_enrichment.jsonl")
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, json
# Set your API key
API_KEY = "YOUR API KEY"
# Set the Person Enrichment API URL
PDL_URL = "https://api.peopledatalabs.com/v5/person/enrich"
# Create a parameters JSON object
PARAMS = {
"api_key": API_KEY,
"email": ["[email protected]"]
}
# Pass the parameters object to the Person Enrichment API
json_response = requests.get(PDL_URL, params=PARAMS).json()
# Check for successful response
if json_response["status"] == 200:
record = json_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("my_pdl_enrichment.jsonl", "w") as out:
out.write(json.dumps(record) + "\n")
else:
print("Enrichment unsuccessful. See error and try again.")
print("error:", json_response)
Email Hash
Note: you can use MD5 or SHA-256 hashes.
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
PARAMS = {
"email_hash": ["e206e6cd7fa5f9499fd6d2d943dcf7d9c1469bad351061483f5ce7181663b8d4"]
}
# Pass the parameters object to the Person Enrichment API
json_response = CLIENT.person.enrichment(**PARAMS).json()
# Check for successful response
if json_response["status"] == 200:
record = json_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("my_pdl_enrichment.jsonl", "w") as out:
out.write(json.dumps(record) + "\n")
else:
print("Enrichment unsuccessful. See error and try again.")
print("error:", json_response)
curl -X GET -G \
'https://api.peopledatalabs.com/v5/person/enrich' \
-H 'X-Api-Key: xxxx' \
--data-urlencode 'email_hash=e206e6cd7fa5f9499fd6d2d943dcf7d9c1469bad351061483f5ce7181663b8d4'
// 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 a parameters JSON object
const params = {
email_hash: "e206e6cd7fa5f9499fd6d2d943dcf7d9c1469bad351061483f5ce7181663b8d4"
}
// Pass the parameters object to the Person Enrichment API
PDLJSClient.person.enrichment(params).then((data) => {
var record = data.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.jsonl", Buffer.from(JSON.stringify(record)), (err) => {
if (err) throw err;
});
}).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 a parameters JSON object
PARAMS = {
"email_hash": ["e206e6cd7fa5f9499fd6d2d943dcf7d9c1469bad351061483f5ce7181663b8d4"]
}
# Pass the parameters object to the Person Enrichment API
json_response = Peopledatalabs::Enrichment.person(params: PARAMS)
# Check for successful response
if json_response['status'] == 200
record = json_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.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
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 a parameters JSON object
params := pdlmodel.EnrichPersonParams {
PersonParams: pdlmodel.PersonParams {
EmailHash: []string{"e206e6cd7fa5f9499fd6d2d943dcf7d9c1469bad351061483f5ce7181663b8d4"},
},
}
// Pass the parameters object to the Person Enrichment API
response, err := client.Person.Enrich(context.Background(), params)
// 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("my_pdl_enrichment.jsonl")
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, json
# Set your API key
API_KEY = "YOUR API KEY"
# Set the Person Enrichment API URL
PDL_URL = "https://api.peopledatalabs.com/v5/person/enrich"
# Create a parameters JSON object
PARAMS = {
"api_key": API_KEY,
"email_hash": ["e206e6cd7fa5f9499fd6d2d943dcf7d9c1469bad351061483f5ce7181663b8d4"]
}
# Pass the parameters object to the Person Enrichment API
json_response = requests.get(PDL_URL, params=PARAMS).json()
# Check for successful response
if json_response["status"] == 200:
record = json_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("my_pdl_enrichment.jsonl", "w") as out:
out.write(json.dumps(record) + "\n")
else:
print("Enrichment unsuccessful. See error and try again.")
print("error:", json_response)
Email and Company
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
PARAMS = {
"company": ["Hallspot", "People Data Labs"],
"email": ["[email protected]"]
}
# Pass the parameters object to the Person Enrichment API
json_response = CLIENT.person.enrichment(**PARAMS).json()
# Check for successful response
if json_response["status"] == 200:
record = json_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("my_pdl_enrichment.jsonl", "w") as out:
out.write(json.dumps(record) + "\n")
else:
print("Enrichment unsuccessful. See error and try again.")
print("error:", json_response)
curl -X GET -G \
'https://api.peopledatalabs.com/v5/person/enrich'\
-H 'X-Api-Key: xxxx' \
--data-urlencode 'company=People Data Labs'\
--data-urlencode 'company=Hallspot'\
--data-urlencode '[email protected]'
// 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 a parameters JSON object
const params = {
company: "Hallspot",
company: "People Data Labs",
email: "[email protected]"
}
// Pass the parameters object to the Person Enrichment API
PDLJSClient.person.enrichment(params).then((data) => {
var record = data.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.jsonl", Buffer.from(JSON.stringify(record)), (err) => {
if (err) throw err;
});
}).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 a parameters JSON object
PARAMS = {
"company": ["Hallspot", "People Data Labs"],
"email": ["[email protected]"]
}
# Pass the parameters object to the Person Enrichment API
json_response = Peopledatalabs::Enrichment.person(params: PARAMS)
# Check for successful response
if json_response['status'] == 200
record = json_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.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
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 a parameters JSON object
params := pdlmodel.EnrichPersonParams {
PersonParams: pdlmodel.PersonParams {
Company: []string{"Hallspot", "People Data Labs"},
Email: []string{"[email protected]"},
},
}
// Pass the parameters object to the Person Enrichment API
response, err := client.Person.Enrich(context.Background(), params)
// 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("my_pdl_enrichment.jsonl")
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, json
# Set your API key
API_KEY = "YOUR API KEY"
# Set the Person Enrichment API URL
PDL_URL = "https://api.peopledatalabs.com/v5/person/enrich"
# Create a parameters JSON object
PARAMS = {
"api_key": API_KEY,
"company": ["Hallspot", "People Data Labs"],
"email": ["[email protected]"]
}
# Pass the parameters object to the Person Enrichment API
json_response = requests.get(PDL_URL, params=PARAMS).json()
# Check for successful response
if json_response["status"] == 200:
record = json_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("my_pdl_enrichment.jsonl", "w") as out:
out.write(json.dumps(record) + "\n")
else:
print("Enrichment unsuccessful. See error and try again.")
print("error:", json_response)
Name and Company and School
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
PARAMS = {
"company": ["TalentIQ Technologies"],
"first_name": ["Sean"],
"last_name": ["Thorne"],
"school": ["University of Oregon"]
}
# Pass the parameters object to the Person Enrichment API
json_response = CLIENT.person.enrichment(**PARAMS).json()
# Check for successful response
if json_response["status"] == 200:
record = json_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("my_pdl_enrichment.jsonl", "w") as out:
out.write(json.dumps(record) + "\n")
else:
print("Enrichment unsuccessful. See error and try again.")
print("error:", json_response)
curl -X GET -G \
'https://api.peopledatalabs.com/v5/person/enrich' \
-H 'X-Api-Key: xxxx' \
--data-urlencode 'company=TalentIQ Technologies' \
--data-urlencode 'first_name=Sean' \
--data-urlencode 'last_name=Thorne' \
--data-urlencode 'school=University of Oregon'
// 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 a parameters JSON object
const params = {
company: "TalentIQ Technologies",
first_name: "Sean",
last_name: "Thorne",
school: "University of Oregon"
}
// Pass the parameters object to the Person Enrichment API
PDLJSClient.person.enrichment(params).then((data) => {
var record = data.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.jsonl", Buffer.from(JSON.stringify(record)), (err) => {
if (err) throw err;
});
}).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 a parameters JSON object
PARAMS = {
"company": ["TalentIQ Technologies"],
"first_name": ["Sean"],
"last_name": ["Thorne"],
"school": ["University of Oregon"]
}
# Pass the parameters object to the Person Enrichment API
json_response = Peopledatalabs::Enrichment.person(params: PARAMS)
# Check for successful response
if json_response['status'] == 200
record = json_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.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
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 a parameters JSON object
params := pdlmodel.EnrichPersonParams {
PersonParams: pdlmodel.PersonParams {
Company: []string{"TalentIQ Technologies"},
FirstName: []string{"Sean"},
LastName: []string{"Thorne"},
School: []string{"University of Oregon"},
},
}
// Pass the parameters object to the Person Enrichment API
response, err := client.Person.Enrich(context.Background(), params)
// 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("my_pdl_enrichment.jsonl")
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, json
# Set your API key
API_KEY = "YOUR API KEY"
# Set the Person Enrichment API URL
PDL_URL = "https://api.peopledatalabs.com/v5/person/enrich"
# Create a parameters JSON object
PARAMS = {
"api_key": API_KEY,
"company": ["TalentIQ Technologies"],
"first_name": ["Sean"],
"last_name": ["Thorne"],
"school": ["University of Oregon"]
}
# Pass the parameters object to the Person Enrichment API
json_response = requests.get(PDL_URL, params=PARAMS).json()
# Check for successful response
if json_response["status"] == 200:
record = json_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("my_pdl_enrichment.jsonl", "w") as out:
out.write(json.dumps(record) + "\n")
else:
print("Enrichment unsuccessful. See error and try again.")
print("error:", json_response)
Name and Location and Twitter and Phone
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
PARAMS = {
"name": ["Sean Thorne"],
"location": ["SF Bay Area"],
"profile": ["www.twitter.com/seanthorne5"],
"phone": ["+15555091234"]
}
# Pass the parameters object to the Person Enrichment API
json_response = CLIENT.person.enrichment(**PARAMS).json()
# Check for successful response
if json_response["status"] == 200:
record = json_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("my_pdl_enrichment.jsonl", "w") as out:
out.write(json.dumps(record) + "\n")
else:
print("Enrichment unsuccessful. See error and try again.")
print("error:", json_response)
curl -X GET -G \
'https://api.peopledatalabs.com/v5/person/enrich' \
-H 'X-Api-Key: xxxx' \
--data-urlencode 'name=Sean Thorne' \
--data-urlencode 'location=SF Bay Area' \
--data-urlencode 'profile=www.twitter.com/seanthorne5' \
--data-urlencode 'phone=+15555091234'
// 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 a parameters JSON object
const params = {
name: "Sean Thorne",
location: "SF Bay Area",
profile: "www.twitter.com/seanthorne5",
phone: "+15555091234"
}
// Pass the parameters object to the Person Enrichment API
PDLJSClient.person.enrichment(params).then((data) => {
var record = data.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.jsonl", Buffer.from(JSON.stringify(record)), (err) => {
if (err) throw err;
});
}).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 a parameters JSON object
PARAMS = {
"name": ["Sean Thorne"],
"location": ["SF Bay Area"],
"profile": ["www.twitter.com/seanthorne5"],
"phone": ["+15555091234"]
}
# Pass the parameters object to the Person Enrichment API
json_response = Peopledatalabs::Enrichment.person(params: PARAMS)
# Check for successful response
if json_response['status'] == 200
record = json_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.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
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 a parameters JSON object
params := pdlmodel.EnrichPersonParams {
PersonParams: pdlmodel.PersonParams {
Name: []string{"Sean Thorne"},
Location: []string{"SF Bay Area"},
Profile: []string{"www.twitter.com/seanthorne5"},
Phone: []string{"+15555091234"},
},
}
// Pass the parameters object to the Person Enrichment API
response, err := client.Person.Enrich(context.Background(), params)
// 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("my_pdl_enrichment.jsonl")
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, json
# Set your API key
API_KEY = "YOUR API KEY"
# Set the Person Enrichment API URL
PDL_URL = "https://api.peopledatalabs.com/v5/person/enrich"
# Create a parameters JSON object
PARAMS = {
"api_key": API_KEY,
"name": ["Sean Thorne"],
"location": ["SF Bay Area"],
"profile": ["www.twitter.com/seanthorne5"],
"phone": ["+15555091234"]
}
# Pass the parameters object to the Person Enrichment API
json_response = requests.get(PDL_URL, params=PARAMS).json()
# Check for successful response
if json_response["status"] == 200:
record = json_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("my_pdl_enrichment.jsonl", "w") as out:
out.write(json.dumps(record) + "\n")
else:
print("Enrichment unsuccessful. See error and try again.")
print("error:", json_response)
Multiple Values for the Same Parameter
Most query parameters can take multiple values. To do so, append the parameter with values as many times as needed. The only parameters that cannot exist multiple times are locality
, region
, country
and street_address
, as these are linearly related and multiple inputs would make it impossible to match. To match multiple locations, use the location
parameter.
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
PARAMS = {
"name": ["Sean Thorne"],
"profile": ["www.twitter.com/seanthorne5", "linkedin.com/in/seanthorne"]
}
# Pass the parameters object to the Person Enrichment API
json_response = CLIENT.person.enrichment(**PARAMS).json()
# Check for successful response
if json_response["status"] == 200:
record = json_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("my_pdl_enrichment.jsonl", "w") as out:
out.write(json.dumps(record) + "\n")
else:
print("Enrichment unsuccessful. See error and try again.")
print("error:", json_response)
curl -X GET -G \
'https://api.peopledatalabs.com/v5/person/enrich' \
-H 'X-Api-Key: xxxx' \
--data-urlencode 'name=Sean Thorne' \
--data-urlencode 'profile=www.twitter.com/seanthorne5' \
--data-urlencode 'profile=linkedin.com/in/seanthorne'
// 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 a parameters JSON object
const params = {
name: "Sean Thorne",
profile: "www.twitter.com/seanthorne5",
profile: "linkedin.com/in/seanthorne"
}
// Pass the parameters object to the Person Enrichment API
PDLJSClient.person.enrichment(params).then((data) => {
var record = data.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.jsonl", Buffer.from(JSON.stringify(record)), (err) => {
if (err) throw err;
});
}).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 a parameters JSON object
PARAMS = {
"name": ["Sean Thorne"],
"profile": ["www.twitter.com/seanthorne5", "linkedin.com/in/seanthorne"]
}
# Pass the parameters object to the Person Enrichment API
json_response = Peopledatalabs::Enrichment.person(params: PARAMS)
# Check for successful response
if json_response['status'] == 200
record = json_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.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
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 a parameters JSON object
params := pdlmodel.EnrichPersonParams {
PersonParams: pdlmodel.PersonParams {
Name: []string{"Sean Thorne"},
Profile: []string{"www.twitter.com/seanthorne5", "linkedin.com/in/seanthorne"},
},
}
// Pass the parameters object to the Person Enrichment API
response, err := client.Person.Enrich(context.Background(), params)
// 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("my_pdl_enrichment.jsonl")
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, json
# Set your API key
API_KEY = "YOUR API KEY"
# Set the Person Enrichment API URL
PDL_URL = "https://api.peopledatalabs.com/v5/person/enrich"
# Create a parameters JSON object
PARAMS = {
"api_key": API_KEY,
"name": ["Sean Thorne"],
"profile": ["www.twitter.com/seanthorne5", "linkedin.com/in/seanthorne"]
}
# Pass the parameters object to the Person Enrichment API
json_response = requests.get(PDL_URL, params=PARAMS).json()
# Check for successful response
if json_response["status"] == 200:
record = json_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("my_pdl_enrichment.jsonl", "w") as out:
out.write(json.dumps(record) + "\n")
else:
print("Enrichment unsuccessful. See error and try again.")
print("error:", json_response)
Using POST Requests
"I want to use POST requests instead of GET requests so that I can make queries with a lot of parameters."
Difference Between GET and POST Requests
See this article for a comparison of the differences between GET and POST requests. The biggest difference is that POST requests don't have any limits on the amount of data that you can pass in the request.
import requests, json
# Set your API key
API_KEY = "YOUR API KEY"
# Set the Person Enrichment API URL
PDL_URL = "https://api.peopledatalabs.com/v5/person/enrich"
# Create a parameters JSON object
PAYLOAD = {
"api_key": API_KEY,
"name": ["Sean Thorne"],
"profile": ["www.twitter.com/seanthorne5", "linkedin.com/in/seanthorne"]
}
# Pass the parameters object to the Person Enrichment API
json_response = requests.post(PDL_URL, json=PAYLOAD).json()
# Check for successful response
if json_response["status"] == 200:
record = json_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("my_pdl_enrichment.jsonl", "w") as out:
out.write(json.dumps(record) + "\n")
else:
print("Enrichment unsuccessful. See error and try again.")
print("error:", json_response)
curl -X POST "https://api.peopledatalabs.com/v5/person/enrich" \
-H "Content-Type: application/json" \
-d '{
"api_key": "YOUR API KEY",
"name": ["Sean Thorne"],
"profile": ["www.twitter.com/seanthorne5", "linkedin.com/in/seanthorne"]
}'
Updated 3 months ago