Setup Your Environment
Contact [email protected] to obtain your API key. Keep your key secure - never commit it to version control.
Make Your First Request
Let’s enrich a GitHub user’s profile:
import requests
API_KEY = "your_api_key_here"
BASE_URL = "https://api.peoplecontext.com"
headers = {
"Authorization" : f "Bearer { API_KEY } " ,
"Content-Type" : "application/json"
}
# Enrich by GitHub username
payload = {
"github" : "torvalds" ,
"websets" : [ "github" ]
}
response = requests.post(
f " { BASE_URL } /v1/person/enrich" ,
headers = headers,
json = payload
)
data = response.json()
person = data.get( "person" , {})
github = person.get( "github" , {})
if github:
print ( f "Name: { github.get( 'full_name' ) } " )
print ( f "Username: { github.get( 'github_username' ) } " )
print ( f "Emails: { github.get( 'emails' ) } " )
print ( f "Followers: { github.get( 'followers' ) } " )
else :
print ( "No match found" )
Understanding the Response
A successful match returns the profile data within the person object:
{
"person" : {
"github" : {
"github_username" : "torvalds" ,
"full_name" : "Linus Torvalds" ,
"names" : [ "Linus Torvalds" ],
"emails" : [ "[email protected] " ],
"bio" : "Creator of Linux and Git" ,
"location" : "Portland, OR" ,
"company" : "@linuxfoundation" ,
"followers" : 180000 ,
"following" : 0 ,
"public_repos" : 6 ,
"repos" : [ ... ]
}
},
"websets_matched" : [ "github" ]
}
If no match is found:
{
"person" : {},
"websets_matched" : []
}
Enrich with LinkedIn Data
Access professional profiles with the LinkedIn webset:
# Enrich by LinkedIn username
payload = {
"linkedin_username" : "williamhgates" ,
"websets" : [ "linkedin" ]
}
response = requests.post(
f " { BASE_URL } /v1/person/enrich" ,
headers = headers,
json = payload
)
data = response.json()
if "linkedin" in data[ "person" ]:
linkedin = data[ "person" ][ "linkedin" ]
profile = linkedin.get( "profile" , {})
print ( f "Name: { profile.get( 'full_name' ) } " )
print ( f "Headline: { profile.get( 'headline' ) } " )
print ( f "Location: { profile.get( 'location' ) } " )
Enrich Company Data
Get comprehensive company information:
# Enrich by LinkedIn company slug
response = requests.post(
f " { BASE_URL } /v1/company/enrich" ,
headers = headers,
json = { "linkedin_slug" : "openai" }
)
data = response.json()
if data[ "matched" ]:
company = data[ "company" ]
profile = company[ "profile" ]
print ( f "Name: { profile[ 'name' ] } " )
print ( f "Industry: { profile[ 'industry' ] } " )
print ( f "Employees: { profile[ 'employees' ] } " )
print ( f "Location: { company[ 'headquarters' ][ 'city' ] } " )
Search by Email
You can also enrich profiles by email address across multiple websets:
payload = {
"email" : "[email protected] " ,
"websets" : [ "github" , "linkedin" ]
}
response = requests.post(
f " { BASE_URL } /v1/person/enrich" ,
headers = headers,
json = payload
)
# Finds GitHub and LinkedIn profiles associated with this email
You can provide multiple identifiers and websets. The API will try specific identifiers first, then fall back to email search across all requested websets if needed.
Next Steps