Build

Lender Search

Use Lev's lender search workflow to rank the most relevant lenders for a deal and turn those results into actionable next steps.

Updated March 2026

Overview

The lender search workflow is two-step:

  1. Trigger a search (POST) — initiates the AI matching process for a deal
  2. Get results (GET) — retrieves the ranked results once the search is complete

If a recent search already exists for the deal, the trigger endpoint returns cached results immediately.

Workflow Shape

Use lender search as a workflow, not just an endpoint:

  1. Read the deal and any available financial context.
  2. Trigger or reuse lender search for that deal.
  3. Summarize the ranked result set with the deal context that likely drove the ranking.
  4. Hand the shortlist to a human or the next workflow step, such as placement creation or term-sheet review.
POST/api/external/v2/deals/{deal_id}/actions/search-lenders

Trigger an AI-powered lender search for a deal

The request body should be an empty JSON object {}.

Response (200):

{
  "request_id": "...",
  "timestamp": "2026-03-20T15:30:45Z",
  "data": {
    "search_id": "abc123",
    "status": "completed",
    "deal_id": 101,
    "message": "Search completed with 25 results"
  }
}
StatusMeaning
completedResults are ready
pendingSearch is queued — poll the GET endpoint
runningSearch is actively processing — poll the GET endpoint
partialSome results are available but ranking is still in progress
failedSearch failed
unauthorized
Authentication requiredMissing or invalid Authorization header
not_found
Deal not foundThe deal_id doesn't exist or isn't accessible to the authenticated user

Get Results

GET/api/external/v2/deals/{deal_id}/build/lender-search

Get lender search results for a deal

Response (200):

{
  "request_id": "...",
  "timestamp": "2026-03-20T15:30:45Z",
  "data": {
    "search_id": "abc123",
    "status": "completed",
    "deal_id": 101,
    "results": [
      {
        "org_id": 500,
        "organization_name": "First National Bank",
        "ai_score": 92,
        "ai_rank_status": "completed",
        "ai_match_insights": "Strong fit based on asset type and geography",
        "is_connected_lender": true,
        "programs": [
          {
            "id": 10,
            "title": "CRE Bridge Lending",
            "loan_types": ["bridge"],
            "capital_source_type": "balance_sheet",
            "min_loan_amount": 1000000,
            "max_loan_amount": 50000000,
            "asset_types": ["multifamily", "office"],
            "states": ["NY", "NJ", "CT"]
          }
        ]
      }
    ],
    "pagination": {
      "total": 25,
      "limit": 50,
      "offset": 0,
      "has_more": false
    }
  }
}

Each result in the results array contains:

FieldTypeDescription
org_idinteger|nullOrganization ID
organization_namestring|nullLender name
ai_scoreinteger|nullAI match score
ai_rank_statusstring|nullAI ranking process status for this result (pending, running, completed, failed, partial)
ai_match_insightsstring|nullAI-generated match reasoning
is_connected_lenderboolean|nullWhether the lender is in your CRM
programsarray|nullMatching lending programs

Each program in the programs array contains:

FieldTypeDescription
idintegerProgram ID
titlestring|nullProgram name
loan_typesstring[]|nullSupported loan types
capital_source_typestring|nullCapital source type
min_loan_amountnumber|nullMinimum loan amount
max_loan_amountnumber|nullMaximum loan amount
asset_typesstring[]|nullSupported asset types
statesstring[]|nullGeographic coverage

Returns 404 if no search has been run for this deal.

unauthorized
Authentication requiredMissing or invalid Authorization header
not_found
Deal not foundThe deal_id doesn't exist or no search has been run for this deal

Implementation Notes

  • Trigger first, then poll with intention. Do not create aggressive retry loops.
  • Cache the latest search_id and status in your own workflow state when you are orchestrating multiple steps.
  • Treat lender search as recommendation input. Keep the final outreach and placement decisions reviewable by a human.
More in this section