API cookbook
Two-stage eligibility — pre-flight then price
Use Stage 1 as a UX gate, then run the full ladder against survivors. Cuts perceived latency dramatically.
intermediateTypeScript
The /v1/pricing/eligibility endpoint is fast (sub-50ms warm) and returns the eligible/ineligible split. Use it on every form change so the LO sees survivors update live. Then run /v1/pricing/mode with BEST_EX only when the LO is ready to commit.
async function handleFormChange(input: LoanInput) {
const elig = await api.eligibility(input);
setEligible(elig.eligible);
setIneligible(elig.ineligible);
// The LO sees real-time survivor list as they type. No pricing yet.
}
async function handleGetQuotes(input: LoanInput) {
// Now fire the full ladder. The engine internally runs Stage 1 again
// for safety, but the survivor set is the same — no extra work.
const quotes = await api.pricing(input, "BEST_EX");
setQuotes(quotes);
}