Developer API
Ingest leads via REST or webhooks. AI qualifies and scores; you get a clear decision and optional technician matches.
Lead ingest (REST)
POST /api/lead
Submit a lead (e.g. from your CRM or form). The graph runs qualification and returns a decision (dispatch, nurture, or reject). When the decision is dispatch, the lead is persisted and appears on the technician dashboard.
// Request body (JSON)
{
"phone": "+15551234567",
"message": "Locked out, Honda Civic at 123 Main St",
"vehicleYear": "2020",
"vehicleMake": "Honda",
"vehicleModel": "Civic",
"jobType": "lockout",
"insurance": { "provider": "GEICO", "policyNumber": "XXX-XXX" }
}
// Response: full graph state including decision, lead, techniciansCORS is enabled for cross-origin requests (e.g. Twilio).
Qualification graph (low-level)
POST /api/graph/run
Invoke the lead qualification graph with a custom lead object and optional thread_id. Returns decision and state. When decision is dispatch, state is synced to Prisma for the dashboard. This endpoint is restricted to internal/admin callers.
// Request body
{ "lead": { "phone": "+1...", "message": "..." }, "thread_id": "optional-id" }
// Response: { decision, lead, technicians, ... }Twilio webhook
POST /api/twilio
Configure your Twilio number to send incoming SMS to this URL (form-encoded). We use From (phone) and Body (message), run the lead workflow, and reply with TwiML. Always returns 200 so Twilio does not retry.