Examples - Person Identify API
Code examples and walkthroughs using the 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.
See a Bug? Want To See a Specific Example?
Feel free to use the
Suggest Edits
button in the top right-hand corner of this page to point out any bugs or to request any specific code examples for this API that you'd like to see here.
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()
# Create a list of matches
identities = response_data['matches']
# Print the matches in JSON format
print(identities)
print(f"Found {len(identities)} identities!")
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 = {
name: "sean thorne",
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(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)
# Create a list of matches
identities = response['matches']
# Print the matches in JSON format
puts identities
puts "Found #{identities.length()} identities!"
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))
}
}
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 = {
"name": "sean thorne",
"pretty": True,
"api_key": API_KEY
}
# Pass the parameters object to the Person Identify API
response_data = requests.request("GET", PDL_URL, params=PARAMS).json()
# Create a list of matches
identities = response_data['matches']
# Print the matches in JSON format
print(identities)
print(f"Found {len(identities)} identities!")
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()
# Create a list of matches
matches = response_data['matches']
# Print the matches in JSON format
print(matches)
print(f"Found {len(matches)} matches!")
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(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)
# Create a list of matches
matches = response['matches']
# Print the matches in JSON format
puts matches
puts "Found #{matches.length()} matches!"
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
matches := response.Matches
// Convert the matches to JSON
jsonResponse, jsonErr := json.Marshal(matches)
// Print the matches
if (jsonErr == nil) {
fmt.Println(string(jsonResponse))
}
fmt.Printf("Found %d matches!\n", len(matches))
}
}
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
response_data = requests.request("GET", PDL_URL, params=PARAMS).json()
# Create a list of matches
identities = response_data['matches']
# Print the matches in JSON format
print(identities)
print(f"Found {len(identities)} identities!")
Updated 8 months ago