Examples - Person Identify API
We've provided code samples in Python, cURL, 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.
Basic Usage
I would like to find the most strongly associated profiles for the name "Sean Thorne."
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 = {
"first_name": "sean",
"last_name": "thorne",
"company": "people data labs",
"pretty": True
}
# Pass the parameters object to the Person Identify API
response_data = CLIENT.person.identify(**PARAMS).json()
# Check for successful response
if json_response["status"] == 200:
# Create a list of matches
identities = response_data['matches']
# Print the matches in JSON format
print(identities)
print(f"Found {len(identities)} identities!")
else:
print("Identify unsuccessful. See error and try again.")
print("error:", json_response)
API_KEY="ENTER YOUR API KEY HERE"
curl -X GET -G \
"https://api.peopledatalabs.com/v5/person/identify"\
-H "X-Api-Key: ${API_KEY}" \
--data-urlencode 'first_name=sean'\
--data-urlencode 'last_name=thorne'\
--data-urlencode 'company="people data labs"'\
--data-urlencode 'pretty=True'
// 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
const params = {
first_name: "sean",
last_name: "thorne",
company: "people data labs",
pretty: true,
}
// Pass the parameters object to the Person Identify API
PDLJSClient.person.identify(params).then((data) => {
// Create a list of matches
var identities = data["matches"]
// Print the matches in JSON format
console.log(identities);
console.log(`Found ${identities.length} identities!`)
}).catch((error) => {
console.log("Identify unsuccessful. See error and try again.")
console.log(error);
});
# 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 = {
"first_name": "sean",
"last_name": "thorne",
"company": "people data labs",
"pretty": true
}
# Pass the parameters object to the Person Identify API
response = Peopledatalabs::Identify.person(params: PARAMS)
# Check for successful response
if json_response['status'] == 200
# Create a list of matches
identities = response['matches']
# Print the matches in JSON format
puts identities
puts "Found #{identities.length()} identities!"
end
else
puts "Identify unsuccessful. See error and try again."
puts "error: #{json_response}"
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
params := pdlmodel.IdentifyPersonParams {
BaseParams: pdlmodel.BaseParams {
Pretty: true,
},
PersonParams: pdlmodel.PersonParams {
FirstName: []string{"sean"},
LastName: []string{"thorne"},
Company: []string{"people data labs"},
},
}
// Pass the parameters object to the Person Identify API
response, err := client.Person.Identify(context.Background(), params)
// Check for successful response
if err == nil {
// Create a list of matches
identities := response.Matches
// Convert the matches to JSON
jsonResponse, jsonErr := json.Marshal(identities)
// Print the matches
if (jsonErr == nil) {
fmt.Println(string(jsonResponse))
}
fmt.Printf("Found %d identities!\n", len(identities))
} else {
fmt.Println("Identify unsuccessful. See error and try again.")
fmt.Println("error:", err)
}
}
import requests
# Set your API key
API_KEY = "YOUR API KEY"
# Set the Person Identify API URL
PDL_URL = "https://api.peopledatalabs.com/v5/person/identify"
# Create a parameters JSON object
PARAMS = {
"first_name": "sean",
"last_name": "thorne",
"company": "people data labs",
"pretty": True,
"api_key": API_KEY
}
# Pass the parameters object to the Person Identify API
json_response = requests.get(PDL_URL, params=PARAMS).json()
# Check for successful response
if json_response['status'] == 200:
# Create a list of matches
identities = json_response['matches']
# Print the matches in JSON format
print(identities)
print(f"Found {len(identities)} identities!")
else:
print("Identify unsuccessful. See error and try again.")
print("error:", json_response)
Associated LinkedIn Profiles
I would like to find the most strongly associated profiles for a particular LinkedIn account.
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": "linkedin.com/in/seanthorne",
"pretty": True
}
# Pass the parameters object to the Person Identify API
response_data = CLIENT.person.identify(**PARAMS).json()
# Check for successful response
if json_response["status"] == 200:
# Create a list of matches
identities = response_data['matches']
# Print the matches in JSON format
print(identities)
print(f"Found {len(identities)} identities!")
else:
print("Identify unsuccessful. See error and try again.")
print("error:", json_response)
API_KEY="ENTER YOUR API KEY HERE"
curl -X GET -G \
"https://api.peopledatalabs.com/v5/person/identify"\
-H "X-Api-Key: ${API_KEY}" \
--data-urlencode 'profile=linkedin.com/in/seanthorne'\
--data-urlencode 'pretty=True'
// 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
const params = {
profile: "linkedin.com/in/seanthorne",
pretty: true,
}
// Pass the parameters object to the Person Identify API
PDLJSClient.person.identify(params).then((data) => {
// Create a list of matches
var identities = data["matches"]
// Print the matches in JSON format
console.log(identities);
console.log(`Found ${identities.length} identities!`)
}).catch((error) => {
console.log("Identify unsuccessful. See error and try again.")
console.log(error);
});
# 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": "linkedin.com/in/seanthorne",
"pretty": true
}
# Pass the parameters object to the Person Identify API
response = Peopledatalabs::Identify.person(params: PARAMS)
# Check for successful response
if json_response['status'] == 200
# Create a list of matches
identities = response['matches']
# Print the matches in JSON format
puts identities
puts "Found #{identities.length()} identities!"
end
else
puts "Identify unsuccessful. See error and try again."
puts "error: #{json_response}"
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
params := pdlmodel.IdentifyPersonParams {
BaseParams: pdlmodel.BaseParams {
Pretty: true,
},
PersonParams: pdlmodel.PersonParams {
Profile: []string{"linkedin.com/in/seanthorne"},
},
}
// Pass the parameters object to the Person Identify API
response, err := client.Person.Identify(context.Background(), params)
// Check for successful response
if err == nil {
// Create a list of matches
identities := response.Matches
// Convert the matches to JSON
jsonResponse, jsonErr := json.Marshal(identities)
// Print the matches
if (jsonErr == nil) {
fmt.Println(string(jsonResponse))
}
fmt.Printf("Found %d identities!\n", len(identities))
} else {
fmt.Println("Identify unsuccessful. See error and try again.")
fmt.Println("error:", err)
}
}
import requests
# Set your API key
API_KEY = "YOUR API KEY"
# Set the Person Identify API URL
PDL_URL = "https://api.peopledatalabs.com/v5/person/identify"
# Create a parameters JSON object
PARAMS = {
"profile": "linkedin.com/in/seanthorne",
"pretty": True,
"api_key": API_KEY
}
# Pass the parameters object to the Person Identify API
json_response = requests.get(PDL_URL, params=PARAMS).json()
# Check for successful response
if json_response['status'] == 200:
# Create a list of matches
identities = json_response['matches']
# Print the matches in JSON format
print(identities)
print(f"Found {len(identities)} identities!")
else:
print("Identify unsuccessful. See error and try again.")
print("error:", json_response)
Updated about 2 months ago