curl "https://server.smartlead.ai/api/v1/campaigns/123/leads/789/message-history?api_key=YOUR_KEY"
import requests
response = requests.get(
f"https://server.smartlead.ai/api/v1/campaigns/123/leads/789/message-history",
params={"api_key": "YOUR_API_KEY", "show_plain_text_response": True}
)
history = response.json()
for msg in history['messages']:
direction = "➡️ " if msg['direction'] == 'outbound' else "⬅️ "
print(f"{direction}{msg['subject']} - {msg['sent_at']}")
{
"messages": [
{
"id": "msg_1",
"subject": "Partnership Opportunity",
"direction": "outbound",
"sent_at": "2025-01-15T10:00:00Z",
"opened_at": "2025-01-15T10:30:00Z"
},
{
"id": "msg_2",
"subject": "Re: Partnership Opportunity",
"direction": "inbound",
"received_at": "2025-01-20T14:00:00Z"
}
]
}
Campaign Leads
Get Lead Message History
Retrieve complete email conversation history for a specific lead
GET
/
api
/
v1
/
campaigns
/
{campaign_id}
/
leads
/
{lead_id}
/
message-history
curl "https://server.smartlead.ai/api/v1/campaigns/123/leads/789/message-history?api_key=YOUR_KEY"
import requests
response = requests.get(
f"https://server.smartlead.ai/api/v1/campaigns/123/leads/789/message-history",
params={"api_key": "YOUR_API_KEY", "show_plain_text_response": True}
)
history = response.json()
for msg in history['messages']:
direction = "➡️ " if msg['direction'] == 'outbound' else "⬅️ "
print(f"{direction}{msg['subject']} - {msg['sent_at']}")
{
"messages": [
{
"id": "msg_1",
"subject": "Partnership Opportunity",
"direction": "outbound",
"sent_at": "2025-01-15T10:00:00Z",
"opened_at": "2025-01-15T10:30:00Z"
},
{
"id": "msg_2",
"subject": "Re: Partnership Opportunity",
"direction": "inbound",
"received_at": "2025-01-20T14:00:00Z"
}
]
}
View full email thread history with a lead. Essential for understanding conversation context and lead engagement.
Path Parameters
number
required
Campaign ID
number
required
Lead ID
Query Parameters
string
required
Your SmartLead API key
string
Filter messages after this timestamp (ISO 8601)
boolean
Include plain text version of emails
curl "https://server.smartlead.ai/api/v1/campaigns/123/leads/789/message-history?api_key=YOUR_KEY"
import requests
response = requests.get(
f"https://server.smartlead.ai/api/v1/campaigns/123/leads/789/message-history",
params={"api_key": "YOUR_API_KEY", "show_plain_text_response": True}
)
history = response.json()
for msg in history['messages']:
direction = "➡️ " if msg['direction'] == 'outbound' else "⬅️ "
print(f"{direction}{msg['subject']} - {msg['sent_at']}")
Response Example
{
"messages": [
{
"id": "msg_1",
"subject": "Partnership Opportunity",
"direction": "outbound",
"sent_at": "2025-01-15T10:00:00Z",
"opened_at": "2025-01-15T10:30:00Z"
},
{
"id": "msg_2",
"subject": "Re: Partnership Opportunity",
"direction": "inbound",
"received_at": "2025-01-20T14:00:00Z"
}
]
}
