Open In Colab
View on GitHub
This notebook is your guide to using the Sixtyfour API enrich-lead. The enrich_lead endpoint allows you to perform deep research on an individual—be it a prospect, candidate, or contact. Enrich-Lead recursively reads through every link and with this knowledge it can answer questions like: What is this individual an expert in? How many publications do they have? Are they a fashion reseller? Do they have experience with M&A transactions? Etc. Anything that you can think of is fair game for our API. Please give it a go, and let us know how we can help!
Tip: You can change the person in the parameters at the top. It can be anyone with a digital presence. For best results, include at least: name and company, or a direct identifier like email or linkedin.

Prerequisites & Secrets

Get your SixtyFour API key

Follow these steps to create and copy your API key 1) Sign in Go to https://app.sixtyfour.ai/login and log in or sign up. 2) Enter an organization name once you’ve signed up and click Create Organization. 3) You’ll land on the dashboard/usage page with $25 in credits. In the left sidebar, open Keys → click Create new key → name it → Create key → copy the key value.

If you’re in Google Colab

  1. Click the 🔑 (Secrets) icon in the left sidebar.
  2. Add a secret named SIXTYFOUR_API_KEY and paste your key.
  3. Make sure the notebook can access the secret.
# --- Parameters (you can change these) ---
# Only name+company/university OR linkedin is needed
# You can also give the agent more context following the structure below
LEAD_NAME = "Saarth Shah"
LEAD_COMPANY = "Sixtyfour AI"
LEAD_EMAIL = None
LEAD_LINKEDIN = None
import os, json, time, csv, io
from datetime import datetime
from typing import Dict, Any, List, Optional

import requests
import pandas as pd

API_KEY = os.getenv("SIXTYFOUR_API_KEY", "")  # fallback if already set locally
try:
    from google.colab import userdata
    secret_val = userdata.get("SIXTYFOUR_API_KEY")  # raises if not granted or not created
    if secret_val:  # avoid overwriting with empty
        os.environ["SIXTYFOUR_API_KEY"] = secret_val
        API_KEY = secret_val
except Exception:
    # Not in Colab or secret not available; rely on existing env var
    pass

BASE_URL = "https://api.sixtyfour.ai"
SYNC_ENDPOINT = f"{BASE_URL}/enrich-lead"
ASYNC_ENDPOINT = f"{BASE_URL}/enrich-lead-async"
STATUS_ENDPOINT = f"{BASE_URL}/job-status"
TIMEOUT_S = 600  # We reuse these endpoints and TIMEOUT_S throughout the notebook.

print("✅ Setup complete (key detected, endpoints ready).")
Output:
✅ Setup complete (key detected, endpoints ready).

Enrich_Lead Request

For most queries, enrich_lead is the perfect tool. You send a request and get a complete profile back with a single call. The request requires two main components in its body:
  • lead_info: The initial data you have on the person. The more context you provide, the more focused and correct the research will be.
  • struct: Here is where you can request the niche pieces of information you’d like. The first part “name” is the field you want filled. The second part following the ”:” is the description given to the agent to help fulfill your exact request.
lead_info = {
    "name": LEAD_NAME,
    "company": LEAD_COMPANY,
    "email": LEAD_EMAIL,
    "linkedin": LEAD_LINKEDIN,
}

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."

payload = {
    "lead_info": lead_info,
    "struct": struct,
    "research_plan": research_plan,
}

response = requests.post(
    SYNC_ENDPOINT,
    headers={"x-api-key": API_KEY, "Content-Type": "application/json"},
    json=payload,
    timeout=TIMEOUT_S,
)

if response.ok:
    result = response.json()
    print("✅ Success! Keys:", list(result.keys()))
    print("\n" + "="*50)
    print("STRUCTURED DATA:")
    print("="*50)
    structured_data = result.get("structured_data", {})
    for key, value in structured_data.items():
        print(f"{key}: {value}")
else:
    print("❌ Request failed:", response.status_code, response.text[:800])
Output:
✅ Success! Keys: ['notes', 'structured_data', 'findings']

==================================================
STRUCTURED DATA:
==================================================
name: Saarth Shah
email: saarth@sixtyfour.ai
phone: Not found
company: Sixtyfour AI
title: CEO & Co-Founder
linkedin: https://www.linkedin.com/in/saarthshah
website: https://sixtyfour.ai
location: San Francisco, CA
industry: AI/Technology
github_url: https://github.com/saarthshah
github_notes: Active GitHub profile with multiple repositories focused on AI and data processing tools.

Enrich_Lead Request (Async)

For longer jobs, use the async endpoint and poll for completion.
# Start async job
start_resp = requests.post(
    ASYNC_ENDPOINT,
    headers={"x-api-key": API_KEY, "Content-Type": "application/json"},
    json=payload,
    timeout=30,
)
start_resp.raise_for_status()
task_id = start_resp.json()["task_id"]
print(f"🔄 Started async job: {task_id}")

# Poll for completion
while True:
    status_resp = requests.get(
        f"{STATUS_ENDPOINT}/{task_id}",
        headers={"x-api-key": API_KEY}
    )
    status = status_resp.json()
    
    if status["status"] == "completed":
        async_result = status["result"]
        print("✅ Async job completed!")
        break
    elif status["status"] == "failed":
        raise RuntimeError(status.get("error", "Async job failed"))
    else:
        print(f"⏳ Status: {status['status']}")
        time.sleep(5)

# Display results
print("\nAsync Results:")
print("="*50)
async_structured_data = async_result.get("structured_data", {})
for key, value in async_structured_data.items():
    print(f"{key}: {value}")
Output:
🔄 Started async job: abc123def456
⏳ Status: processing
⏳ Status: processing
✅ Async job completed!

Async Results:
==================================================
name: Saarth Shah
email: saarth@sixtyfour.ai
phone: Not found
company: Sixtyfour AI
title: CEO & Co-Founder
linkedin: https://www.linkedin.com/in/saarthshah
website: https://sixtyfour.ai
location: San Francisco, CA
industry: AI/Technology
github_url: https://github.com/saarthshah
github_notes: Active GitHub profile with multiple repositories focused on AI and data processing tools.

Tips

  • Rate limit: 500 requests per minute per API key
  • Don’t be vague — “Saarth” vs “Saarth Shah, CEO at Sixtyfour AI”
  • Provide context — More details = better results
If a request fails: make sure you provide either email, linkedin, or (name AND company).
If fields are missing, request fewer first or add more context to lead_info. For large workloads, prefer async or the concurrent batch.
Next steps: try a different struct, point the CSV output to your CRM, or move this into an automated script.
This notebook stays simple on purpose: small cells, clear comments, and the same pattern repeated so anyone can follow.