PlaybooksEnrich a Lead with LinkedIn
Enrich a batch of leads
Build company records for a list of lead domains.
Loop over a list of email domains and build enriched company records ready to push to your CRM. Leads whose lookup fails are skipped.
import json
import os
import time
import requests
API_KEY = os.environ["PILOTERR_API_KEY"]
leads = [
{"email": "alice@stripe.com", "domain": "stripe.com"},
{"email": "bob@notion.so", "domain": "notion.so"},
{"email": "carol@figma.com", "domain": "figma.com"},
]
enriched = []
for lead in leads:
r = requests.get("https://api.piloterr.com/v2/linkedin/company/info",
headers={"x-api-key": API_KEY}, params={"domain": lead["domain"]})
if r.status_code == 200:
c = r.json()
enriched.append({"email": lead["email"], "domain": lead["domain"],
"company": c.get("company_name"), "industry": c.get("industry"),
"employees": c.get("staff_count"),
"hq_country": (c.get("headquarter") or {}).get("country"),
"linkedin_url": c.get("company_url")})
else:
print(f"Skipped {lead['domain']}: {r.status_code} {r.text}")
time.sleep(0.5)
with open("enriched_leads.json", "w") as f:
json.dump(enriched, f, indent=2)
print(f"Enriched {len(enriched)} leads → enriched_leads.json")