Skip to main content

Get Lead History

GET /leads/{id}/history

Returns the full conversation and activity history for a lead in chronological order. Merges WhatsApp messages, email messages, call transcripts, and system activity events into a unified timeline.

Path Parameters

ParameterTypeRequiredDescription
idstring (uuid)YesLead ID

Query Parameters

ParameterTypeDefaultDescription
channelstring(all)Comma-separated channel filter. Valid values: call, whatsapp, email
limitinteger50Max items to return (1–200)
offsetinteger0Pagination offset

Examples

# Full history
curl https://api.getnexor.ai/api/public/leads/550e8400-e29b-41d4-a716-446655440000/history \
-H "X-API-Key: nxr_live_your_api_key"

# Calls and WhatsApp only
curl "https://api.getnexor.ai/api/public/leads/550e8400-e29b-41d4-a716-446655440000/history?channel=call,whatsapp" \
-H "X-API-Key: nxr_live_your_api_key"

# Paginated
curl "https://api.getnexor.ai/api/public/leads/550e8400-e29b-41d4-a716-446655440000/history?limit=20&offset=40" \
-H "X-API-Key: nxr_live_your_api_key"

Responses

200 — History retrieved successfully

{
"success": true,
"lead": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"first_name": "John",
"last_name": "Doe",
"phone": "+1234567890",
"email": "john@example.com",
"source": "api",
"created_at": "2026-01-10T08:00:00Z"
},
"history": [
{
"type": "activity",
"channel": "system",
"activity_type": "workflow_assigned",
"title": "Assigned to Sales Outreach",
"description": "Lead enrolled via API",
"actor_type": "system",
"timestamp": "2026-01-10T08:00:00Z"
},
{
"type": "message",
"channel": "whatsapp",
"direction": "outbound",
"content": "Hi John, thanks for your interest!",
"message_type": "template",
"status": "delivered",
"timestamp": "2026-01-10T09:00:00Z"
},
{
"type": "message",
"channel": "whatsapp",
"direction": "inbound",
"content": "Yes, I'd like to learn more about pricing",
"message_type": "text",
"status": "read",
"timestamp": "2026-01-10T09:05:00Z"
},
{
"type": "call",
"channel": "call",
"duration_seconds": 185,
"call_status": "ended",
"summary": "Discussed pricing tiers and scheduled a demo for next week",
"recording_url": "https://storage.example.com/recordings/abc123.wav",
"sentiment": "positive",
"timestamp": "2026-01-10T14:00:00Z"
},
{
"type": "activity",
"channel": "call",
"activity_type": "status_changed",
"title": "Status changed to Qualified",
"description": "Lead qualified after discovery call",
"actor_type": "ai",
"timestamp": "2026-01-10T14:03:00Z"
}
],
"pagination": {
"limit": 50,
"offset": 0,
"has_more": false
}
}

History Entry Types

Each item in the history array has a type field that determines which fields are populated:

type: "message" — WhatsApp, email, or call messages

FieldTypeDescription
channelstringwhatsapp, call, or email
directionstringinbound or outbound
contentstringMessage text content
message_typestringtext, template, or media
statusstringsent, delivered, read, or failed

type: "call" — Call transcript summaries

FieldTypeDescription
duration_secondsintegerCall duration in seconds
call_statusstringCall outcome status
summarystringAI-generated call summary
recording_urlstringURL to the call recording
sentimentstringpositive, neutral, or negative

type: "activity" — System events

FieldTypeDescription
channelstringChannel that triggered the activity, or system
activity_typestringEvent type (e.g., status_changed, workflow_assigned)
titlestringHuman-readable event title
descriptionstringEvent description
actor_typestringuser, system, or ai

401 — Authentication error

See Authentication.

404 — Lead not found

{
"error": "Not found",
"message": "Lead not found or does not belong to your account"
}

500 — Internal server error