v1.0 • Lead Management
Retrieve a specific lead by ID
Retrieve complete information for a specific lead
GET ${baseUrl}/api/v1/leads/{leadId}leadIdThe unique identifier of the lead (required)
Returns the complete lead object with all metadata
{
"success": true,
"data": {
"id": "lead_1234567890abcdef",
"name": "John Doe",
"email": "john.doe@example.com",
"phone": "+1-555-123-4567",
"source": "website",
"status": "contacted",
"metadata": {
"utm_source": "google",
"utm_campaign": "spring_2024",
"interests": ["product_a", "product_b"],
"company": "Tech Corp",
"job_title": "Marketing Manager",
"last_interaction": "2024-01-16T14:30:00.000Z",
"notes": "Interested in premium package",
"follow_up_date": "2024-01-20"
},
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-16T14:30:00.000Z",
"workspaceId": "ws_your_workspace_id"
}
}The GET endpoint returns the complete lead object including all metadata fields, unlike the list endpoint which may only return essential fields for performance.
Simple implementations for retrieving a specific lead
curl -X GET "https://your-domain.com/api/v1/leads/lead_1234567890abcdef" \
-H "Authorization: Bearer sk-workspace_your_api_key"const getLead = async (leadId) => {
try {
const response = await fetch(`https://your-domain.com/api/v1/leads/${leadId}`, {
method: 'GET',
headers: {
'Authorization': 'Bearer sk-workspace_your_api_key',
'Content-Type': 'application/json'
}
});
if (!response.ok) {
if (response.status === 404) {
throw new Error('Lead not found');
}
throw new Error(`HTTP error! status: ${response.status}`);
}
const result = await response.json();
return result.data;
} catch (error) {
console.error('Error getting lead:', error);
throw error;
}
};
// Usage
const leadId = "lead_1234567890abcdef";
getLead(leadId);import requests
def get_lead(api_key: str, lead_id: str) -> dict:
"""
Retrieve a specific lead by ID.
Args:
api_key: Your API key
lead_id: The lead's unique identifier
Returns:
dict: The lead data
Raises:
requests.exceptions.HTTPError: If lead not found or other HTTP error
"""
url = f"https://your-domain.com/api/v1/leads/{lead_id}"
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
try:
response = requests.get(url, headers=headers)
if response.status_code == 404:
raise ValueError(f"Lead with ID '{lead_id}' not found")
response.raise_for_status()
result = response.json()
print(f"Retrieved lead: {result['data']['name']} ({result['data']['email']})")
return result['data']
except requests.exceptions.RequestException as e:
print(f"Error getting lead: {e}")
raise
# Usage
api_key = "sk-workspace_your_api_key"
lead_id = "lead_1234567890abcdef"
try:
lead = get_lead(api_key, lead_id)
print(f"Lead status: {lead['status']}")
print(f"Company: {lead['metadata'].get('company', 'N/A')}")
except ValueError as e:
print(f"Lead not found: {e}")
except Exception as e:
print(f"Error: {e}")Handle these common error cases
{
"success": false,
"error": "Lead not found",
"code": "LEAD_NOT_FOUND",
"details": {
"leadId": "lead_nonexistent123",
"message": "No lead found with this ID in your workspace"
}
}{
"success": false,
"error": "Invalid lead ID format",
"code": "INVALID_ID_FORMAT",
"details": {
"leadId": "invalid-id",
"expected": "lead_[alphanumeric string]",
"message": "Lead IDs must start with 'lead_' followed by alphanumeric characters"
}
}