FlexRate
FlexRate is a server-to-server Non-QM pricing engine that evaluates loan scenarios against live lender matrix data and returns ranked rate offers.
Users
Who consumes FlexRate (it has no end-user UI).
Product
How pricing works, end to end.
Engineering
Architecture, API reference, and tech debt.
What is FlexRate?
FlexRate is an internal pricing API that ingests daily rate sheets and eligibility matrices from a Non-QM lender, then exposes a single JSON endpoint to evaluate any borrower scenario against every applicable program.
Every call returns:
- Eligible offers — ranked best-price-first, each with a final price, note rate, and any LLPA adjustments applied
- Rejected programs — structured rejection reasons keyed by rule type so the consuming UI can surface meaningful guidance
Core Design Principles
Accuracy over convenience
Eligibility matrices are transcribed verbatim from published PDFs. No interpolation, no rounding. A single incorrect LTV cell could result in a borrower receiving a pricing indication that the lender will not honor.
Server-to-server only
The API is not a public endpoint. All calls require a shared bearer token (FLEXRATE_INTERNAL_TOKEN). There are no user-scoped credentials or OAuth flows — the token is rotated out-of-band and shared only with trusted server-side consumers.
Daily freshness
Rate sheets and matrices are re-ingested every morning via php artisan rates:daily. The pricing engine always reads from the most recently seeded rate sheet.
Fail loud, not silent
LLPA grids, rate ladders, and LTV matrices have no human review step between extraction and pricing — so the suite ships a coverage tripwire (LlpaRowCoverageTest) that fails CI the moment a new lender row would be priced as zero instead of its real value. Pricing drift surfaces as a failing test, not a wrong quote. See Architecture → Integrity & Test Gates.
What you can ask the API
| Endpoint | Purpose |
|---|---|
POST /api/pricer/quote | Evaluate a borrower scenario; returns ranked offers plus structured rejections. The main entry point. |
GET /api/pricer/programs | List active programs and their doc types on the most recent rate sheet. |
GET /api/programs | Full catalog including caps, eligibility rules, and PPP tables. |
GET /api/programs/{slug}/matrix | Per-program LTV matrix — every (FICO, loan amount, occupancy, purpose) cell. |
POST /api/auth/test | Verify the bearer token is configured correctly. |
Quick Start
curl -X POST https://api.example.com/api/pricer/quote \
-H "Authorization: Bearer <FLEXRATE_INTERNAL_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"term": 30,
"purpose": "purchase",
"credit_score": 740,
"purchase_price": 625000,
"loan_amount": 500000,
"state": "CA",
"occupancy": "investment",
"property_type": "sfr",
"dscr_ratio": 1.15
}'See POST /api/pricer/quote for the full payload reference.
Where to start reading
- Building a client? Start with POST /api/pricer/quote — every request shape, response shape, rejection key, and pricing cap is documented there.
- Onboarding to the codebase? Read Architecture end-to-end — it walks the daily extract → seed → evaluate → price chain with the actual class names you'll be touching.
- Debugging a quote? The program matrix endpoint returns the exact LTV row that would (or wouldn't) match a given borrower — the fastest way to explain a
no_ltv_matrix_cellrejection. - Tracking gaps? Tech Debt lists known shortcuts and their planned fixes, paired one-to-one with the per-task handoff docs under
tasks/.