Enrich Lead Notebook

Open In Colab This notebook shows how to use the Sixtyfour API to enrich a single lead. To get started, go to https://app.sixtyfour.ai and sign up to create an account and API key.

Prerequisites

Before you begin, make sure you have:
  1. A Sixtyfour API key (get it from the dashboard after signing up)
  2. Python 3.8+
  3. Packages: requests, python-dotenv (optional: httpx for async)

Set up

Create a .env file and load your API key in code.
import os
from dotenv import load_dotenv
import requests

load_dotenv()
SIXTYFOUR_API_KEY = os.getenv("SIXTYFOUR_API_KEY")
.env example:
SIXTYFOUR_API_KEY=your_api_key_here

Define the lead and fields to collect

Provide whatever initial information you have about the person in lead_info. Specify output fields in struct.
lead_info = {
    "name": "Saarth Shah",
    "title": "CEO & Co-Founder @ Sixtyfour AI",
    "company": "Sixtyfour AI",
    "location": "San Francisco",
    "linkedin": "https://www.linkedin.com/in/saarthshah"
}

struct = {
    "name": "The individual's full name",
    "email": "The individual's email address",
    "phone": "The individual's phone number",
    "company": "The company the individual is associated with",
    "title": "The individual's job title",
    "linkedin": "LinkedIn URL for the person",
    "website": "Company website URL",
    "location": "The individual's location and/or company location",
    "industry": "Industry the person operates in",
    "github_url": "url for their github profile",
    "github_notes": "Take detailed notes on their github profile."
}

research_plan = "Review LinkedIn, company website, and public profiles for contact info and role verification."

Enrich the lead (sync)

response = requests.post(
    "https://api.sixtyfour.ai/enrich-lead",
    headers={
        "x-api-key": SIXTYFOUR_API_KEY,
        "Content-Type": "application/json"
    }, 
    json={
        "lead_info": lead_info,
        "struct": struct,
        "research_plan": research_plan
    }
)

response.raise_for_status()
result = response.json()

notes = result.get("notes", "")
data = result.get("structured_data", {})
findings = result.get("findings", [])

data
Example keys you might see in data:
  • name, email, phone, company, title, linkedin, website, location, industry, github_url, github_notes

Enrich the lead (async)

Use the async endpoint for longer jobs and poll the task status.
import time

# Start async job
start_resp = requests.post(
    "https://api.sixtyfour.ai/enrich-lead-async",
    headers={
        "x-api-key": SIXTYFOUR_API_KEY,
        "Content-Type": "application/json"
    },
    json={
        "lead_info": lead_info,
        "struct": struct,
        "research_plan": research_plan
    }
)
start_resp.raise_for_status()
task_id = start_resp.json()["task_id"]

# Poll for completion
while True:
    status_resp = requests.get(
        f"https://api.sixtyfour.ai/job-status/{task_id}",
        headers={"x-api-key": SIXTYFOUR_API_KEY}
    )
    status = status_resp.json()
    if status["status"] == "completed":
        async_result = status["result"]
        break
    if status["status"] == "failed":
        raise RuntimeError(status.get("error", "Async job failed"))
    time.sleep(5)

Tips

  • Keep struct concise to improve speed and accuracy.
  • Provide as much high-confidence info as you have in lead_info (e.g., LinkedIn URL).
  • Respect API limits; batch async jobs for heavy usage.