Documentation

Widget Documentation

Last updated: January 27, 2026

Everything you need to embed live mortgage rate data on your website. One script tag, real-time rates.

1

Quick Start

Add live mortgage rates to your website with a single script tag. The widget automatically loads, fetches the latest rates, and renders in your page.

<>embed.html
<script
src="https://rateapi.dev/widgets/v1/embed.js"
data-rateapi
data-product="30-year-fixed"
data-theme="dark"
></script>

That's it! The widget will appear immediately after the script tag. No API keys required for the embedded widget.

How It Works

When the page loads, the embed script:

  1. Loads the widget component library
  2. Reads configuration from data-* attributes
  3. Creates a <rateapi-rates-widget> web component
  4. Fetches live rates from the RateAPI proxy
  5. Renders the widget with your chosen theme and options
2

Configuration Options

Customize the widget using data-* attributes on the script tag. All options are optional with sensible defaults.

AttributeValuesDefaultDescription
data-product30-year-fixed, 15-year-fixed, all30-year-fixedFilter rates by mortgage product type
data-themedark, light, autodarkWidget color scheme. "auto" follows user preference
data-limit3 - 155Number of rates to display
data-sortapr, rate, institutionaprHow to order the rates. apr sorts by true cost (APR + points + fees), not just headline APR
data-show-aprtrue, falsetrueShow the APR column
data-show-verifiedtrue, falsetrueShow verified badges next to lenders
data-show-metricstrue, falsetrueShow the metrics bar (top offer, median, count)
data-compactpresent or absentnot presentReduce padding for smaller spaces

Example: Compact 15-Year Widget

<>compact-widget.html
<script
src="https://rateapi.dev/widgets/v1/embed.js"
data-rateapi
data-product="15-year-fixed"
data-theme="light"
data-limit="3"
data-show-metrics="false"
data-compact
></script>
3

Platform Guides

The widget works on any website that supports custom HTML. Here are step-by-step guides for popular platforms.

📝

WordPress

Add to any post, page, or widget area.

  1. Edit your post or page
  2. Add a "Custom HTML" block
  3. Paste the embed code
  4. Save and preview
🎨

Webflow

Use the Embed element in your design.

  1. Add an Embed element
  2. Paste the embed code
  3. Click "Save & Close"
  4. Publish your site

Squarespace

Insert via Code Block.

  1. Add a Code Block
  2. Set mode to "HTML"
  3. Paste the embed code
  4. Apply changes

Other Platforms

The widget works anywhere you can add custom HTML/JavaScript. Look for options like "Custom Code", "HTML Block", "Embed", or "Code Injection" in your platform's editor.

4

Attribution Requirements

Required Attribution

The widget includes built-in attribution that must remain visible:

  • "Source: RateAPI" link in the footer
  • "Methodology" link for data transparency

These elements are required per our Terms of Service and ensure users can verify the source and methodology of the rate data. The attribution is automatically included and styled to match your chosen theme.

What's Not Allowed

  • Hiding or removing the source attribution
  • Modifying the widget to misrepresent the data source
  • Using CSS to obscure required links
  • Claiming the rate data as your own

Why Attribution Matters

Proper attribution helps your users verify data sources, builds trust in your content, and supports transparent financial journalism. It also ensures compliance with our Terms of Service.

Complete Citation Guidelines

For comprehensive guidance on citing RateAPI data in academic papers, news articles, API integrations, or AI agent responses, see our How to Cite documentation.

5

Frequently Asked Questions

Common questions about installing and using the RateAPI mortgage rate widget.

Ready to Get Started?

Use our interactive builder to configure your widget and generate the embed code in seconds.