API & Integration Docs

Embed a branded calculator on your site, capture leads, or integrate via REST API.

v1.0.0 Base URL: https://homebuyercalc.com/v1

Embed Widget

Add the HomeBuyerCalc calculator to your website with a single code snippet. The widget is fully responsive and renders with your custom branding (logo, colors, CTA text) configured in the Branding dashboard.

Option 1: iframe (Recommended)

Drop-in embed. Works with any CMS, WordPress, Squarespace, Webflow, or static HTML site.

HTML
<iframe
  src="https://homebuyercalc.com/embed/your-partner-slug"
  width="100%"
  height="800"
  frameborder="0"
  style="border:0; border-radius:8px;"
  allow="clipboard-write"
></iframe>

Option 2: JavaScript Snippet

Dynamic embed with auto-resizing. The script creates the iframe and adjusts height to match content.

HTML + JS
<div id="homebuyercalc-widget"></div>
<script
  src="https://homebuyercalc.com/widget.js"
  data-slug="your-partner-slug"
  data-container="homebuyercalc-widget"
></script>

Widget Attributes

AttributeDefaultDescription
data-slugRequiredYour partner slug (found in Settings)
data-containerRequiredID of the HTML element to render into
data-theme"dark""dark" or "light" — matches your site theme
data-height"800"Initial iframe height in pixels

WordPress Example

Paste this into a Custom HTML block in the WordPress editor.

WordPress — Custom HTML Block
<div style="max-width:720px; margin:0 auto;">
  <iframe
    src="https://homebuyercalc.com/embed/your-partner-slug"
    width="100%"
    height="800"
    frameborder="0"
    style="border:0; border-radius:8px;"
    allow="clipboard-write"
  ></iframe>
</div>

Works in any page builder (Elementor, Divi, Beaver Builder) that supports HTML blocks.

Webflow / Squarespace

  1. Add an Embed or Code Block component to your page
  2. Paste the iframe code above (replace your-partner-slug with your slug)
  3. Adjust the max-width wrapper to match your page layout
  4. Publish — the calculator renders with your branding automatically

White-Label Setup

Run a fully branded affordability calculator under your own identity. Buyers see your logo, your colors, and your CTA — HomeBuyerCalc stays in the background.

How White-Labeling Works

1

Configure Branding

Set your logo, accent color, CTA label, and disclaimer in the Branding dashboard.

2

Embed or Link

Use the iframe snippet, JS widget, or link directly to your branded page at /embed/your-slug.

3

Capture Leads

When buyers submit the form, leads (with their full scenario data) appear in your Leads dashboard.

Branding Options

SettingWhat It ControlsWhere to Set
Logo URLHeader image on the embed page (replaces "HomeBuyerCalc")Branding →
Primary ColorButtons, active step indicators, links, and focus ringsBranding →
CTA LabelSubmit button text on the lead capture form (e.g. "Talk to a Lender")Branding →
Disclaimer TextLegal footer shown below the calculatorBranding →

Your Branded Calculator Page

Every partner gets a hosted page that you can share directly:

URL
https://homebuyercalc.com/embed/your-partner-slug

This page includes the full 6-step wizard (entry, location, finances, profile, results, and lead capture) with your branding applied. Use it in email campaigns, social posts, or as a standalone landing page.

Lead Capture Flow

The embed widget replaces the AI Chat step (step 6) with a lead capture form. When a buyer completes the wizard:

  1. Buyer fills in name, email, phone (optional), and notes (optional)
  2. Their full buyer profile (income, debts, credit, entry mode) is attached automatically
  3. Their calculated scenarios (loan types, payments, DTI ratios) are stored with the lead
  4. The lead appears in your Leads dashboard with status "New"
  5. Buyer sees a confirmation screen with your CTA copy

Advanced: CSS Overrides (iframe)

The embed page applies your primary_color as a CSS custom property. If you need more granular control, you can override styles via the parent page:

CSS (parent page)
/* Constrain widget width and center it */
#homebuyercalc-widget iframe {
  max-width: 720px;
  margin: 0 auto;
  display: block;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}

Note: styles inside the iframe are controlled by your Branding settings. Parent-page CSS only affects the iframe container itself.

REST API

For programmatic integrations — build the calculator into your own product.

Authentication

All API requests require a Bearer token in the Authorization header. Generate API keys from your dashboard.

Header
Authorization: Bearer hbc_live_your_api_key_here

API keys use the prefix hbc_live_ followed by 32 hex characters. Keys are hashed on our side and cannot be retrieved after creation.

Calculate Scenarios

POST /v1/calculate

Generate loan scenarios with detailed monthly payment breakdowns for a given buyer profile.

Request Body

FieldTypeRequiredDescription
entry_modestringYes"price", "budget", or "cash"
home_pricenumberConditionalRequired if entry_mode is "price"
monthly_budgetnumberConditionalRequired if entry_mode is "budget"
cash_availablenumberConditionalRequired if entry_mode is "cash"
statestringYes2-letter state code (e.g. "CA")
annual_incomenumberYesGross annual income
monthly_debtsnumberYesTotal monthly debt payments
credit_bandstringYes"excellent", "good", "fair", or "poor"
cash_for_down_paymentnumberYesAvailable cash for down payment
is_first_time_buyerbooleanNoDefault: false
is_veteranbooleanNoDefault: false. Enables VA loan scenario
occupancy_typestringNo"primary", "secondary", or "investment"
property_typestringNo"single_family", "condo", "townhouse", or "multi_unit"

Example Request

cURL
curl -X POST https://homebuyercalc.com/v1/calculate \
  -H "Authorization: Bearer hbc_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "entry_mode": "price",
    "home_price": 450000,
    "state": "CA",
    "annual_income": 120000,
    "monthly_debts": 500,
    "credit_band": "good",
    "cash_for_down_payment": 50000,
    "is_first_time_buyer": true,
    "is_veteran": false
  }'

Example Response

200 OK
{
  "data": {
    "request_id": "550e8400-e29b-...",
    "scenarios": [
      {
        "loanType": "conventional",
        "downPaymentPct": 0.10,
        "downPaymentAmt": 45000,
        "loanAmount": 405000,
        "interestRate": 0.06875,
        "termYears": 30,
        "monthlyPayment": {
          "principalAndInterest": 2662,
          "propertyTax": 469,
          "homeInsurance": 150,
          "pmi": 169,
          "total": 3450
        },
        "cashToClose": 54200,
        "dtiRatio": 0.39
      }
    ],
    "max_affordable_price": 520000,
    "calculated_at": "2026-03-07T..."
  },
  "_meta": {
    "api_version": "1.0.0",
    "duration_ms": 12
  }
}

Detailed Scenarios

POST /v1/scenarios

Similar to /v1/calculate but returns extended scenario data with an input summary. Accepts the same request body using snake_case field names.

See the /v1/calculate section for the full request body reference.

Lead Capture API

POST /api/leads

Submit a lead from your own form or application. No API key required — the partner is identified by partner_slug in the request body. This is the same endpoint used by the embed widget.

Request Body

FieldTypeRequiredDescription
namestringYesBuyer's full name
emailstringYesBuyer's email address
phonestringNoPhone number
notesstringNoFree-text notes from the buyer
partner_slugstringYesYour partner slug (identifies your account)
consumer_profileobjectNoBuyer profile data (same fields as /v1/calculate)
scenario_resultsanyNoCalculated scenario data to attach to the lead

Example: Basic Lead

cURL
curl -X POST https://homebuyercalc.com/api/leads \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Jane Smith",
    "email": "jane@example.com",
    "phone": "(555) 123-4567",
    "partner_slug": "acme-lending"
  }'

Example: Lead with Full Profile + Scenarios

cURL
curl -X POST https://homebuyercalc.com/api/leads \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Jane Smith",
    "email": "jane@example.com",
    "partner_slug": "acme-lending",
    "consumer_profile": {
      "entry_mode": "price",
      "home_price": 450000,
      "state": "CA",
      "annual_income": 120000,
      "monthly_debts": 500,
      "credit_band": "good",
      "cash_for_down_payment": 50000,
      "is_first_time_buyer": true
    },
    "scenario_results": [
      { "loanType": "conventional", "monthlyPayment": { "total": 3450 } },
      { "loanType": "fha", "monthlyPayment": { "total": 3280 } }
    ]
  }'

Response

201 Created
{
  "data": {
    "lead_id": "a1b2c3d4e5f6...",
    "message": "Lead captured successfully."
  }
}

When consumer_profile is provided, a full consumer profile and scenario run are stored and linked to the lead automatically.

Error Codes

All errors follow a consistent format with an error object containing code and message fields.

HTTPCodeDescription
400INVALID_JSONRequest body is not valid JSON
401UNAUTHORIZEDMissing, invalid, or revoked API key
422VALIDATION_ERRORRequest body fails schema validation
429RATE_LIMITEDToo many requests. Retry after a short delay
500CALCULATION_ERRORServer-side calculation failure

Error Response Format

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid input.",
    "details": {
      "fieldErrors": {
        "state": ["String must contain exactly 2 character(s)"]
      }
    }
  }
}

Rate Limits

API requests are rate-limited per partner account. The default limit is 100 requests per minute. When exceeded, the API returns a 429 status with a RATE_LIMITED error code.

Brokerage and Enterprise plans can request higher limits. Contact support@homebuyercalc.com for details.

CORS

All /v1/* endpoints support CORS with Access-Control-Allow-Origin: *. This means you can call the API directly from browser-based JavaScript applications.

Preflight OPTIONS requests are handled automatically and return a 204 response with appropriate CORS headers.

Ready to integrate?

Create a free account and generate your first API key in minutes.