Let’s say you’ve got nothing more than a CSV file of LinkedIn profiles for your prospects. With the /mobile-numbers/enrichendpoint, you can turn that single URL into a direct phone number you can use for outreach. The first function takes in a LinkedIn profile and returns the associated mobile number.
enrich-leads.py
import os, requests, csvAPI_KEY = os.getenv("LEADX_API_KEY")BASE_URL = "https://api.leadx.com/v1"headers = {"X-API-KEY": API_KEY, "Content-Type": "application/json"}# Inline CSV data for demonstration; adjust to import a CSVcsv_data = [ {"linkedin_url": "https://www.linkedin.com/in/john-doe"}, {"linkedin_url": "https://www.linkedin.com/in/jane-doe"}]output_csv = "sales_leads.csv"def get_mobile_number(linkedin_url): """Fetch mobile number using the /mobile-numbers/enrich endpoint.""" try: payload = {"linkedin_url": linkedin_url} response = requests.post(f"{BASE_URL}/mobile-numbers/enrich", headers=HEADERS, json=payload) response.raise_for_status() data = response.json() return data.get("mobile_number", "N/A") except requests.exceptions.RequestException as e: print(f"Error fetching mobile number for {linkedin_url}: {e}") return "Error"
2
Enrich Contact Data
Next, you’ll use the same LinkedIn URL to get details for the lead via the /contactsendpoint. You select certain fields that are available in the response, like their employment timeline, to help provide context for future interactions.
In this tutorial, you built a complete enrichment script that:
Authenticates with the LeadX API
Sends LinkedIn URLs to fetch mobile numbers and contact data
Writes all enriched results into a CSV file
This structure is flexible and you can easily adapt it to read input from a CSV file, enrich hundreds of profiles, or integrate directly into your CRM pipeline.