Lead Recovery

Analyze a single lead and receive a Recovery Score with a recommended next action.

Endpoint

POST /api/v1/leads/recovery

This endpoint also accepts a { leads: [...] } body as a convenience, but for large jobs prefer the dedicated batch endpoint.

Request fields

FieldTypeDescription
status*enumPipeline stage: new, contacted, quote_requested, estimate_sent, proposal_sent, negotiating, no_response, closed_won, closed_lost, opted_out.
lead_age_days*integerDays since the lead was created. Must be >= 0.
industryenumhvac, plumbing, electrical, roofing, automotive, b2b_sales, generic. Defaults to generic.
lead_idstringYour identifier, echoed back on the response.
last_contact_daysintegerDays since last contact. Recent contact lifts the score.
contact_attemptsintegerPrior follow-up attempts. Few attempts help; excessive attempts hurt.
estimate_valuenumberEstimate or deal value in your currency. Higher value increases recovery priority.
sourcestringLead source, e.g. referral, website, google_ads, cold_email.
explicit_rejectionbooleanWhether the lead explicitly declined. Caps the score.
opted_outbooleanWhether the lead opted out of contact. Recommends archive.
previous_customerbooleanWhether this is an existing customer.
prior_engagementbooleanWhether the lead engaged previously.
repeat_servicebooleanRepeat-service opportunity (weighted by industry).
invalid_contactbooleanWhether contact info is invalid. Caps the score.
duplicatebooleanWhether the lead is a suspected duplicate.
closed_lost_reasonstringReason for a closed_lost status.
first_namestringUsed only to personalize the suggested message.

Example request

Request
POST /api/v1/leads/recovery
Authorization: Bearer stx_live_...
Content-Type: application/json

{
  "lead_id": "lead_123",
  "industry": "hvac",
  "status": "estimate_sent",
  "lead_age_days": 47,
  "last_contact_days": 31,
  "contact_attempts": 2,
  "estimate_value": 8500,
  "source": "website",
  "explicit_rejection": false
}

Example response

200 OK
{
  "request_id": "req_xxx",
  "lead_id": "lead_123",
  "recovery_score": 74,
  "priority": "high",
  "recommended_action": "follow_up",
  "recommended_channel": "sms",
  "recommended_timing": "today",
  "reason": "High-value estimate with no explicit rejection and limited recent follow-up.",
  "suggested_message": "Hi {{first_name}}, following up on the estimate we sent...",
  "confidence": 0.90,
  "factors": [
    { "factor": "estimate_value", "impact": "positive", "score_effect": 11 },
    { "factor": "status", "impact": "positive", "score_effect": 20 }
  ],
  "scoring_version": "1.0.0"
}