curl --request POST \
--url https://api.buena.ai/api/v2/enrich \
--header 'Content-Type: <content-type>' \
--header 'x-api-key: <x-api-key>' \
--data '{
"leads": [
{}
],
"enrichmentOptions": {
"includePersonalInfo": true,
"includeCompanyInfo": true,
"includeSocialProfiles": true,
"includeContactInfo": true
}
}'
{
"success": true,
"data": {
"enriched": [
{
"input": {
"email": "john@techcorp.com",
"firstName": "John",
"lastName": "Doe"
},
"enrichedData": {
"firstName": "John",
"lastName": "Doe",
"email": "john@techcorp.com",
"alternativeEmails": ["j.doe@techcorp.com"],
"phone": "+1-555-123-4567",
"linkedinUrl": "https://linkedin.com/in/johndoe",
"company": "Tech Corp",
"title": "Senior Software Engineer",
"location": "San Francisco, CA",
"experience": "8 years",
"skills": ["JavaScript", "React", "Node.js", "Python", "AWS"],
"bio": "Experienced software engineer specializing in full-stack development and cloud architecture.",
"companyInfo": {
"name": "Tech Corp",
"website": "https://techcorp.com",
"industry": "Technology",
"size": "100-500",
"description": "Leading provider of enterprise software solutions.",
"founded": "2010",
"headquarters": "San Francisco, CA"
},
"socialProfiles": {
"twitter": "https://twitter.com/johndoe",
"github": "https://github.com/johndoe"
}
},
"confidence": 0.95,
"sources": ["apollo", "clearbit", "hunter"]
}
],
"failed": [],
"creditsUsed": 1,
"remainingCredits": 99
}
}
Enrich lead data with additional information from multiple premium sources
curl --request POST \
--url https://api.buena.ai/api/v2/enrich \
--header 'Content-Type: <content-type>' \
--header 'x-api-key: <x-api-key>' \
--data '{
"leads": [
{}
],
"enrichmentOptions": {
"includePersonalInfo": true,
"includeCompanyInfo": true,
"includeSocialProfiles": true,
"includeContactInfo": true
}
}'
{
"success": true,
"data": {
"enriched": [
{
"input": {
"email": "john@techcorp.com",
"firstName": "John",
"lastName": "Doe"
},
"enrichedData": {
"firstName": "John",
"lastName": "Doe",
"email": "john@techcorp.com",
"alternativeEmails": ["j.doe@techcorp.com"],
"phone": "+1-555-123-4567",
"linkedinUrl": "https://linkedin.com/in/johndoe",
"company": "Tech Corp",
"title": "Senior Software Engineer",
"location": "San Francisco, CA",
"experience": "8 years",
"skills": ["JavaScript", "React", "Node.js", "Python", "AWS"],
"bio": "Experienced software engineer specializing in full-stack development and cloud architecture.",
"companyInfo": {
"name": "Tech Corp",
"website": "https://techcorp.com",
"industry": "Technology",
"size": "100-500",
"description": "Leading provider of enterprise software solutions.",
"founded": "2010",
"headquarters": "San Francisco, CA"
},
"socialProfiles": {
"twitter": "https://twitter.com/johndoe",
"github": "https://github.com/johndoe"
}
},
"confidence": 0.95,
"sources": ["apollo", "clearbit", "hunter"]
}
],
"failed": [],
"creditsUsed": 1,
"remainingCredits": 99
}
}
leads:enrich
permission. Each enrichment request consumes
credits from your account.leads:enrich
permissionapplication/json
Show Enrichment Options
Email-based Enrichment
{
"email": "john@techcorp.com",
"firstName": "John", // Optional but helpful
"lastName": "Doe", // Optional but helpful
"company": "Tech Corp" // Optional but helpful
}
LinkedIn URL-based
{
"linkedinUrl": "https://linkedin.com/in/johndoe"
}
Name + Company
{
"firstName": "John",
"lastName": "Doe",
"company": "Tech Corp"
}
curl -X POST "https://api.buena.ai/api/v2/enrich" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"leads": [
{
"email": "john@techcorp.com",
"firstName": "John",
"lastName": "Doe"
}
],
"enrichmentOptions": {
"includePersonalInfo": true,
"includeCompanyInfo": true,
"includeContactInfo": true
}
}'
curl -X POST "https://api.buena.ai/api/v2/enrich" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"leads": [
{
"email": "john@techcorp.com"
},
{
"linkedinUrl": "https://linkedin.com/in/janedoe"
},
{
"firstName": "Bob",
"lastName": "Smith",
"company": "Startup Inc"
}
]
}'
true
for successful requestsShow Data Object
Show Enriched Lead Object
Show Enriched Data Fields
{
"success": true,
"data": {
"enriched": [
{
"input": {
"email": "john@techcorp.com",
"firstName": "John",
"lastName": "Doe"
},
"enrichedData": {
"firstName": "John",
"lastName": "Doe",
"email": "john@techcorp.com",
"alternativeEmails": ["j.doe@techcorp.com"],
"phone": "+1-555-123-4567",
"linkedinUrl": "https://linkedin.com/in/johndoe",
"company": "Tech Corp",
"title": "Senior Software Engineer",
"location": "San Francisco, CA",
"experience": "8 years",
"skills": ["JavaScript", "React", "Node.js", "Python", "AWS"],
"bio": "Experienced software engineer specializing in full-stack development and cloud architecture.",
"companyInfo": {
"name": "Tech Corp",
"website": "https://techcorp.com",
"industry": "Technology",
"size": "100-500",
"description": "Leading provider of enterprise software solutions.",
"founded": "2010",
"headquarters": "San Francisco, CA"
},
"socialProfiles": {
"twitter": "https://twitter.com/johndoe",
"github": "https://github.com/johndoe"
}
},
"confidence": 0.95,
"sources": ["apollo", "clearbit", "hunter"]
}
],
"failed": [],
"creditsUsed": 1,
"remainingCredits": 99
}
}
async function enrichCRMContacts() {
// Get contacts from your CRM that need enrichment
const contacts = await getCRMContacts({ needsEnrichment: true });
// Prepare leads for enrichment
const leadsToEnrich = contacts.map((contact) => ({
email: contact.email,
firstName: contact.firstName,
lastName: contact.lastName,
company: contact.company,
}));
// Batch enrichment (max 50 per request)
const batchSize = 50;
const enrichedLeads = [];
for (let i = 0; i < leadsToEnrich.length; i += batchSize) {
const batch = leadsToEnrich.slice(i, i + batchSize);
const response = await fetch("https://api.buena.ai/api/v2/enrich", {
method: "POST",
headers: {
"x-api-key": process.env.BUENA_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
leads: batch,
enrichmentOptions: {
includePersonalInfo: true,
includeCompanyInfo: true,
includeContactInfo: true,
},
}),
});
const data = await response.json();
enrichedLeads.push(...data.data.enriched);
console.log(
`Enriched batch ${Math.floor(i / batchSize) + 1}: ${
data.data.enriched.length
} leads`
);
// Rate limiting
await new Promise((resolve) => setTimeout(resolve, 1000));
}
// Update CRM with enriched data
for (const enriched of enrichedLeads) {
await updateCRMContact(enriched.input.email, enriched.enrichedData);
}
return enrichedLeads;
}
import requests
def enrich_and_score_leads(leads):
"""Enrich leads and calculate quality scores"""
response = requests.post(
'https://api.buena.ai/api/v2/enrich',
headers={
'x-api-key': os.getenv('BUENA_API_KEY'),
'Content-Type': 'application/json'
},
json={
'leads': leads,
'enrichmentOptions': {
'includePersonalInfo': True,
'includeCompanyInfo': True
}
}
)
data = response.json()
scored_leads = []
for enriched in data['data']['enriched']:
lead_data = enriched['enrichedData']
score = calculate_lead_score(lead_data)
scored_leads.append({
**lead_data,
'score': score,
'confidence': enriched['confidence']
})
return sorted(scored_leads, key=lambda x: x['score'], reverse=True)
def calculate_lead_score(lead_data):
"""Calculate lead quality score based on enriched data"""
score = 0
# Company size scoring
company_size = lead_data.get('companyInfo', {}).get('size', '')
size_scores = {
'1000+': 10,
'500-1000': 8,
'100-500': 6,
'50-100': 4,
'10-50': 2
}
score += size_scores.get(company_size, 0)
# Title scoring
title = lead_data.get('title', '').lower()
senior_titles = ['ceo', 'cto', 'vp', 'director', 'head', 'senior', 'lead']
if any(t in title for t in senior_titles):
score += 5
# Technology fit scoring
skills = lead_data.get('skills', [])
target_skills = ['python', 'javascript', 'aws', 'machine learning', 'api']
skill_matches = sum(1 for skill in skills if any(target in skill.lower() for target in target_skills))
score += skill_matches * 2
# Contact info completeness
if lead_data.get('phone'):
score += 2
if lead_data.get('linkedinUrl'):
score += 2
return min(score, 25) # Cap at 25
# Example usage
leads_to_enrich = [
{'email': 'john@techcorp.com'},
{'email': 'jane@startup.io'},
{'linkedinUrl': 'https://linkedin.com/in/bobsmith'}
]
scored_leads = enrich_and_score_leads(leads_to_enrich)
print("Top scoring leads:")
for lead in scored_leads[:5]:
print(f"{lead['firstName']} {lead['lastName']} ({lead['company']}) - Score: {lead['score']}")
// Real-time enrichment as users fill out forms
class FormEnrichment {
constructor(apiKey) {
this.apiKey = apiKey;
this.cache = new Map();
this.enrichmentTimeout = null;
}
async onEmailChange(email) {
// Debounce enrichment requests
clearTimeout(this.enrichmentTimeout);
this.enrichmentTimeout = setTimeout(async () => {
try {
const enrichedData = await this.enrichLead({ email });
if (enrichedData) {
this.autofillForm(enrichedData);
}
} catch (error) {
console.log("Enrichment failed:", error.message);
}
}, 1000);
}
async enrichLead(leadData) {
const cacheKey = JSON.stringify(leadData);
if (this.cache.has(cacheKey)) {
return this.cache.get(cacheKey);
}
const response = await fetch("https://api.buena.ai/api/v2/enrich", {
method: "POST",
headers: {
"x-api-key": this.apiKey,
"Content-Type": "application/json",
},
body: JSON.stringify({
leads: [leadData],
enrichmentOptions: {
includePersonalInfo: true,
includeCompanyInfo: true,
},
}),
});
const data = await response.json();
const enriched = data.data.enriched[0];
if (enriched) {
this.cache.set(cacheKey, enriched.enrichedData);
return enriched.enrichedData;
}
return null;
}
autofillForm(enrichedData) {
// Auto-fill form fields with enriched data
const fieldMap = {
firstName: enrichedData.firstName,
lastName: enrichedData.lastName,
company: enrichedData.company,
title: enrichedData.title,
phone: enrichedData.phone,
linkedinUrl: enrichedData.linkedinUrl,
};
Object.entries(fieldMap).forEach(([fieldName, value]) => {
const field = document.querySelector(`[name="${fieldName}"]`);
if (field && !field.value && value) {
field.value = value;
field.dispatchEvent(new Event("change"));
}
});
// Show enrichment success indicator
this.showEnrichmentSuccess(enrichedData);
}
showEnrichmentSuccess(data) {
const notification = document.createElement("div");
notification.className = "enrichment-success";
notification.innerHTML = `
<div>✅ Auto-filled with data from ${data.company}</div>
<small>Found additional details for ${data.firstName} ${data.lastName}</small>
`;
document.body.appendChild(notification);
setTimeout(() => notification.remove(), 3000);
}
}
// Usage
const enricher = new FormEnrichment("your-api-key");
document.querySelector("#email").addEventListener("blur", (e) => {
enricher.onEmailChange(e.target.value);
});
Contact Data Sources
Social Media Sources
Company Data Sources
{
"error": true,
"code": "ENRICHMENT_CREDITS_EXHAUSTED",
"message": "Insufficient enrichment credits",
"version": "2.0",
"timestamp": "2024-01-20T15:30:00Z",
"details": {
"remaining": 0,
"required": 5,
"upgradeUrl": "https://app.buena.ai/billing"
}
}
{
"error": true,
"code": "VALIDATION_ERROR",
"message": "Invalid lead data for enrichment",
"version": "2.0",
"timestamp": "2024-01-20T15:30:00Z",
"details": {
"errors": [
{
"index": 0,
"message": "At least one identifier (email, LinkedIn URL, or name + company) is required"
}
]
}
}
{
"error": true,
"code": "RATE_LIMIT_EXCEEDED",
"message": "Enrichment rate limit exceeded",
"version": "2.0",
"timestamp": "2024-01-20T15:30:00Z",
"retryAfter": 60,
"details": {
"limit": "100 enrichments per hour",
"resetTime": "2024-01-20T16:30:00Z"
}
}
Optimize Credit Usage
// Only enrich high-value leads
const shouldEnrich = (lead) => {
return lead.source === 'referral' ||
lead.company.includes('Enterprise') ||
lead.title.includes('Director');
};
const leadsToEnrich = allLeads.filter(shouldEnrich);
Batch Processing
// Process in batches of 50
const batchSize = 50;
for (let i = 0; i < leads.length; i += batchSize) {
const batch = leads.slice(i, i + batchSize);
await enrichBatch(batch);
// Rate limiting between batches
await new Promise(resolve => setTimeout(resolve, 1000));
}
Cache Results
const enrichmentCache = new Map();
function getCacheKey(lead) {
return lead.email || lead.linkedinUrl || `${lead.firstName}-${lead.lastName}-${lead.company}`;
}
async function enrichWithCache(lead) {
const key = getCacheKey(lead);
if (enrichmentCache.has(key)) {
return enrichmentCache.get(key);
}
const enriched = await enrichLead(lead);
enrichmentCache.set(key, enriched);
return enriched;
}