import requests
import time
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.sixtyfour.ai"
headers = {
"x-api-key": API_KEY,
"Content-Type": "application/json"
}
# 1. Start the search
start_response = requests.post(
f"{BASE_URL}/search/start-deep-search",
headers=headers,
json={
"query": "VP of Engineering at Series B SaaS startups in New York",
"mode": "people",
"max_results": 500
}
)
start_response.raise_for_status()
task_id = start_response.json()["task_id"]
print(f"Search started: {task_id}")
# 2. Poll until complete
while True:
status_response = requests.get(
f"{BASE_URL}/search/status/{task_id}",
headers=headers
)
status_response.raise_for_status()
status_data = status_response.json()
print(f"Status: {status_data['status']} — {status_data.get('progress_message', '')}")
if status_data["status"] == "completed":
resource_handle_id = status_data["resource_handle_id"]
break
elif status_data["status"] == "failed":
raise RuntimeError(f"Search failed: {status_data.get('error')}")
time.sleep(10)
# 3. Get signed download URL
download_response = requests.get(
f"{BASE_URL}/search/download",
headers=headers,
params={"resource_handle_id": resource_handle_id}
)
download_response.raise_for_status()
download_url = download_response.json()["url"]
print(f"Download URL: {download_url}")