API & Integration Docs
Embed a branded calculator on your site, capture leads, or integrate via REST API.
https://homebuyercalc.com/v1Embed 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.
<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.
<div id="homebuyercalc-widget"></div> <script src="https://homebuyercalc.com/widget.js" data-slug="your-partner-slug" data-container="homebuyercalc-widget" ></script>
Widget Attributes
| Attribute | Default | Description |
|---|---|---|
| data-slug | Required | Your partner slug (found in Settings) |
| data-container | Required | ID 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.
<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
- Add an Embed or Code Block component to your page
- Paste the iframe code above (replace
your-partner-slugwith your slug) - Adjust the
max-widthwrapper to match your page layout - 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
Configure Branding
Set your logo, accent color, CTA label, and disclaimer in the Branding dashboard.
Embed or Link
Use the iframe snippet, JS widget, or link directly to your branded page at /embed/your-slug.
Capture Leads
When buyers submit the form, leads (with their full scenario data) appear in your Leads dashboard.
Branding Options
| Setting | What It Controls | Where to Set |
|---|---|---|
| Logo URL | Header image on the embed page (replaces "HomeBuyerCalc") | Branding → |
| Primary Color | Buttons, active step indicators, links, and focus rings | Branding → |
| CTA Label | Submit button text on the lead capture form (e.g. "Talk to a Lender") | Branding → |
| Disclaimer Text | Legal footer shown below the calculator | Branding → |
Your Branded Calculator Page
Every partner gets a hosted page that you can share directly:
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:
- Buyer fills in name, email, phone (optional), and notes (optional)
- Their full buyer profile (income, debts, credit, entry mode) is attached automatically
- Their calculated scenarios (loan types, payments, DTI ratios) are stored with the lead
- The lead appears in your Leads dashboard with status "New"
- 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:
/* 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.
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.
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
/v1/calculateGenerate loan scenarios with detailed monthly payment breakdowns for a given buyer profile.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| entry_mode | string | Yes | "price", "budget", or "cash" |
| home_price | number | Conditional | Required if entry_mode is "price" |
| monthly_budget | number | Conditional | Required if entry_mode is "budget" |
| cash_available | number | Conditional | Required if entry_mode is "cash" |
| state | string | Yes | 2-letter state code (e.g. "CA") |
| annual_income | number | Yes | Gross annual income |
| monthly_debts | number | Yes | Total monthly debt payments |
| credit_band | string | Yes | "excellent", "good", "fair", or "poor" |
| cash_for_down_payment | number | Yes | Available cash for down payment |
| is_first_time_buyer | boolean | No | Default: false |
| is_veteran | boolean | No | Default: false. Enables VA loan scenario |
| occupancy_type | string | No | "primary", "secondary", or "investment" |
| property_type | string | No | "single_family", "condo", "townhouse", or "multi_unit" |
Example Request
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
{
"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
/v1/scenariosSimilar 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
/api/leadsSubmit 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
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Buyer's full name |
| string | Yes | Buyer's email address | |
| phone | string | No | Phone number |
| notes | string | No | Free-text notes from the buyer |
| partner_slug | string | Yes | Your partner slug (identifies your account) |
| consumer_profile | object | No | Buyer profile data (same fields as /v1/calculate) |
| scenario_results | any | No | Calculated scenario data to attach to the lead |
Example: Basic Lead
curl -X POST https://homebuyercalc.com/api/leads \
-H "Content-Type: application/json" \
-d '{
"name": "Jane Smith",
"email": "[email protected]",
"phone": "(555) 123-4567",
"partner_slug": "acme-lending"
}'Example: Lead with Full Profile + Scenarios
curl -X POST https://homebuyercalc.com/api/leads \
-H "Content-Type: application/json" \
-d '{
"name": "Jane Smith",
"email": "[email protected]",
"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
{
"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.
| HTTP | Code | Description |
|---|---|---|
| 400 | INVALID_JSON | Request body is not valid JSON |
| 401 | UNAUTHORIZED | Missing, invalid, or revoked API key |
| 422 | VALIDATION_ERROR | Request body fails schema validation |
| 429 | RATE_LIMITED | Too many requests. Retry after a short delay |
| 500 | CALCULATION_ERROR | Server-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 [email protected] 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.