Documentation

Integrate with LendTrain via our Chat API or Claude Code plugin. No API key required.

Chat API

The Chat API powers the LendTrain AI Mortgage Advisor. Send a conversation history and receive a mortgage-aware assistant response with real-time pricing, compliance disclosures, and refinance analysis built in.

Endpoint
POST /api/chat
Content-Type
application/json
Authentication
None required
Rate Limit
20 requests per minute per IP

Request

Send the full conversation history as a messages array. Each message must have a role ("user" or "assistant") and content (string, 1–10,000 characters). Maximum 50 messages per request.

Request body
{
  "messages": [
    { "role": "user", "content": "I want to refinance my home in Georgia." },
    { "role": "assistant", "content": "Great! Let me help you explore..." },
    { "role": "user", "content": "My loan balance is $350,000 and the home is worth $500,000." }
  ]
}

Response

Returns the assistant reply as a single text content block.

Success response (200)
{
  "role": "assistant",
  "content": "Thanks for that info! A few more questions..."
}
Error response (4xx / 5xx)
{
  "error": "Each message must have a valid role (user/assistant) and non-empty content (max 10,000 chars)"
}

Example Conversation

fetch example
const response = await fetch("https://lendtrain.com/api/chat", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    messages: [
      {
        role: "user",
        content: "I'm in Georgia with a $350k balance on a $500k home, 740 credit score. What are my refi options?"
      }
    ]
  })
});

const data = await response.json();
console.log(data.content);
// The assistant responds with rate options, monthly savings, and breakeven analysis.

Status Codes

  • 200 — Success
  • 400 — Invalid request body or messages format
  • 403 — Origin not allowed
  • 413 — Request body too large (100 KB limit)
  • 429 — Rate limit exceeded
  • 502 — AI service error
  • 504 — Request timed out

Claude Code Plugin

Install the LendTrain plugin in Claude Code for a guided mortgage refinance workflow directly in your terminal. The plugin provides structured skills, compliance guardrails, and real-time pricing through a single command.

Installation

Install from marketplace
# In Claude Code, open the plugin marketplace and install "lendtrain"
# Or install manually by copying the lendtrain/ directory to your plugins folder

Usage

Run the refinance quote workflow
/refi-quote

The /refi-quote command walks you through collecting borrower details, calculating pricing, analyzing savings, and generating a compliant refinance recommendation.

Skills

The plugin bundles five specialized skills that the assistant uses automatically during the refinance workflow:

About Atlantic Home Mortgage

Company background, NMLS information, and contact details for Atlantic Home Mortgage Corporation.

Closing Costs

State-specific closing cost estimation with fee breakdowns for each licensed state.

Mortgage Compliance

Licensing data, required disclosures, and compliance language for all 10 licensed states.

Mortgage Loan Officer

Loan officer identity, workflow rules, recommendation scoring, and presentation guidelines.

Security Guardrails

Data handling policies, prohibited actions, and security boundaries for safe conversations.

What You Get

Whether you use the Chat API or the Claude Code plugin, every interaction includes:

Real-Time Pricing

Live rate quotes from institutional rate sheets, updated daily. Conventional, FHA, and VA loans supported.

State-Specific Closing Costs

Estimated closing costs tailored to each licensed state, including transfer taxes, title fees, and recording charges.

FHA & VA Detection

Automatic product-type identification with financed fee calculations: UFMIP for FHA, funding fee for VA.

Compliance Built In

NMLS disclosures, Equal Housing Opportunity language, and safe-harbor disclaimers included in every response.

Recommendation Scoring

A 1-10 score weighing monthly savings, breakeven period, rate improvement, goal alignment, and total interest savings.

Application Redirect

Qualified borrowers are directed to a secure loan application portal when the recommendation score warrants it.

Licensed States

The pricing engine and full plugin are available for properties in these 10 states:

AL
FL
GA
KY
NC
OR
SC
TN
TX
UT

Discovery Files

Machine-readable files for AI agent and developer discovery: