Batch Analysis

Analyze many leads at once and get an aggregated pipeline summary alongside per-lead results.

Endpoint

POST /api/v1/leads/recovery/batch

Send a leads array of up to 1,000 entries. Each entry uses the same fields as the single Lead Recovery endpoint.

Example request

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

{
  "leads": [
    { "lead_id": "l_1", "industry": "roofing", "status": "estimate_sent", "lead_age_days": 28, "estimate_value": 12000 },
    { "lead_id": "l_2", "industry": "hvac", "status": "no_response", "lead_age_days": 190, "estimate_value": 5200 }
  ]
}

Example response

200 OK
{
  "request_id": "req_batch_xxx",
  "results": [
    { "lead_id": "l_1", "recovery_score": 88, "priority": "high", "recommended_action": "follow_up", "recommended_channel": "phone", "recommended_timing": "today", "confidence": 0.7, "factors": [] },
    { "lead_id": "l_2", "recovery_score": 34, "priority": "low", "recommended_action": "deprioritize", "recommended_channel": "email", "recommended_timing": "this_month", "confidence": 0.8, "factors": [] }
  ],
  "summary": {
    "total_leads": 2,
    "high_priority_count": 1,
    "medium_priority_count": 0,
    "low_priority_count": 1,
    "total_pipeline_value": 17200,
    "high_priority_pipeline_value": 12000,
    "processing_time_ms": 3
  }
}

Summary fields

  • total_leads — number of leads analyzed
  • high_priority_count / medium_priority_count / low_priority_count
  • total_pipeline_value — sum of all estimate_value
  • high_priority_pipeline_value — pipeline value of high-priority leads only
  • processing_time_ms — server-side processing time

Every lead in the batch counts toward your monthly leads analyzed quota. If the batch would exceed your remaining allowance, the whole request returns 429 and nothing is metered.