# Freddie Mac API

> Freddie Mac returns 15-year and 30-year fixed mortgage rates, weekly history, and rate changes as a workflow and API.

Freddie Mac’s Get mortgage rates method returns 15-year and 30-year fixed mortgage rates for the latest survey or a chosen date. It also returns weekly history and week-over-week and year-ago changes; date ranges are optional.

- Page: https://fous.com/workflows/freddie-mac
- Handle: `@freddie-mac`
- Category: [Finance](https://fous.com/workflows/category/finance)
- Source website: https://freddiemac.com/pmms
- Last verified: Sep 30, 2026
- Fous is not affiliated with Freddie Mac.

## Methods

### Get mortgage rates

Operation `get_mortgage_rates`, version 1. 1 credit per call.

Get Freddie Mac’s U.S. 30-year and 15-year fixed mortgage rates for the latest survey or a chosen date, with weekly and year-ago changes. An optional date range adds up to 520 weekly results, newest first. The 15-year series begins in August 1991; earlier rates are unavailable. Year-ago changes compare with the survey week around 52 weeks earlier.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `date` | string | no | `"2026-09-22"` | Survey week on or before this date; defaults to the latest survey. |
| `end_date` | string | no | `"2025-10-31"` | Last date to include in weekly history; defaults to today when start_date is set. |
| `start_date` | string | no | `"2025-09-01"` | First date to include in weekly history; defaults to the earliest available survey when end_date is set. |

**Input schema**

```json
{
  "type": "object",
  "properties": {
    "date": {
      "type": "string",
      "format": "date",
      "example": "2026-09-24",
      "description": "Survey week on or before this date; defaults to the latest survey.",
      "examples": [
        "2026-09-22",
        "1971-04-30",
        "2026-09-24"
      ]
    },
    "end_date": {
      "type": "string",
      "format": "date",
      "example": "2025-10-31",
      "description": "Last date to include in weekly history; defaults to today when start_date is set.",
      "examples": [
        "2025-10-31",
        "1971-05-14",
        "2025-12-31"
      ]
    },
    "start_date": {
      "type": "string",
      "format": "date",
      "example": "2025-09-01",
      "description": "First date to include in weekly history; defaults to the earliest available survey when end_date is set.",
      "examples": [
        "2025-09-01",
        "1971-04-01",
        "2010-01-01"
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {},
    {
      "date": "2026-09-22",
      "end_date": "2025-10-31",
      "start_date": "2025-09-01"
    },
    {
      "date": "1971-04-30",
      "end_date": "1971-05-14",
      "start_date": "1971-04-01"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `page_url` | string | `"https://www.freddiemac.com/pmms/pmms_archives"` |  |
| `survey_date` | string | `"2026-09-24"` |  |
| `weekly_history` | array |  | Weekly survey results, newest first, within the requested date range; up to 520 weeks. Empty if no range was requested. |
| `weekly_history[].page_url` | string | `"https://www.freddiemac.com/pmms/pmms_archives"` |  |
| `weekly_history[].survey_date` | string | `"2025-10-30"` |  |
| `weekly_history[].rate_15_year_percent` | number or null | `5.41` |  |
| `weekly_history[].rate_30_year_percent` | number | `6.17` | Average fixed mortgage rate in percent (for example, 6.35 means 6.35%). |
| `rate_15_year_percent` | number or null | `6.42` |  |
| `rate_30_year_percent` | number | `7.03` | Average fixed mortgage rate in percent (for example, 6.35 means 6.35%). |
| `change_15_year_year_ago_points` | number or null | `0.93` |  |
| `change_30_year_year_ago_points` | number or null | `0.73` |  |
| `change_15_year_previous_week_points` | number or null | `0.16` |  |
| `change_30_year_previous_week_points` | number or null | `0.08` |  |

**Example input**

```json
{}
```

**Example output**

```json
{
  "page_url": "https://www.freddiemac.com/pmms/pmms_archives",
  "survey_date": "2026-09-24",
  "weekly_history": [],
  "rate_15_year_percent": 6.42,
  "rate_30_year_percent": 7.03,
  "change_15_year_year_ago_points": 0.93,
  "change_30_year_year_ago_points": 0.73,
  "change_15_year_previous_week_points": 0.16,
  "change_30_year_previous_week_points": 0.08
}
```

## Quick start

Call the API with a Fous API key (`FOUS_API_KEY`). To create one, turn on Developer mode in Fous Studio, then open Keys & connections → API keys (https://app.fous.com/keys).

```bash
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
: "${FOUS_API_KEY:?Set FOUS_API_KEY before running this example}"

curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 120 \
  -H "Authorization: Bearer $FOUS_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "api": "@freddie-mac",
  "visibility": "public",
  "operation": "get_mortgage_rates",
  "version": 1,
  "input": {},
  "response": {
    "format": "json"
  }
}'
```

```python
# Save as fous.py and run with python3 fous.py. No packages needed.
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
import json
import os
import urllib.error
import urllib.request

api_key = os.environ.get("FOUS_API_KEY")
if not api_key:
    raise RuntimeError("Set FOUS_API_KEY before running this example")

body = json.loads("{\n  \"api\": \"@freddie-mac\",\n  \"visibility\": \"public\",\n  \"operation\": \"get_mortgage_rates\",\n  \"version\": 1,\n  \"input\": {},\n  \"response\": {\n    \"format\": \"json\"\n  }\n}")
request = urllib.request.Request(
    "https://api.fous.com/v1/query",
    data=json.dumps(body).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    method="POST",
)
try:
    with urllib.request.urlopen(request, timeout=120) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    raise RuntimeError(f"HTTP {error.code}: {error.read().decode('utf-8', errors='replace')}") from error
if result.get("success") is False:
    raise RuntimeError(result.get("error", {}).get("message", "Request failed"))
print(json.dumps(result["data"]["output"], indent=2))
```

```typescript
// Save as fous.mts and run with npx tsx fous.mts.
// First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
const apiKey = process.env.FOUS_API_KEY;
if (!apiKey) throw new Error("Set FOUS_API_KEY before running this example");

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(120_000),
  body: JSON.stringify({
  "api": "@freddie-mac",
  "visibility": "public",
  "operation": "get_mortgage_rates",
  "version": 1,
  "input": {},
  "response": {
    "format": "json"
  }
}),
});
type ApiResult = { success: boolean; data?: { output: unknown }; error?: { message: string } };
const result: ApiResult = await response.json();
if (!response.ok || result.success === false) {
  throw new Error(result.error?.message ?? `HTTP ${response.status}`);
}
if (!result.data) throw new Error("Missing API response data");
console.log(result.data.output);
```

Or describe the data in plain language: send `{"api":"@freddie-mac","prompt":"Describe the data you need, with every detail"}` to the same URL. Fous fills in the input, runs the method that fits and returns only the fields you asked for; `data.route.calls[].request` is the exact call it made. Routing is free; the run costs the same.

## Use cases

- Track weekly changes in fixed mortgage rates
- Compare 15-year and 30-year mortgage rates
- Review mortgage rates over a selected date range
- Compare current rates with rates from a year ago

## FAQ

### Is Fous affiliated with Freddie Mac?

No. Fous is not affiliated with Freddie Mac. This workflow reads the public freddiemac.com website and returns its data.

### How much does it cost?

Each run costs 1 credit. With pay-as-you-go, a credit costs 1¢; monthly plans cost less per credit.

### Do I need a Freddie Mac account?

No. You only need a Fous account.

### How current is the data?

Fous gets the data from freddiemac.com when you run it; repeating the same request within a day may return the saved result. Fous checks this workflow automatically; it last passed a check on Sep 30, 2026.

### What are the latest 15-year and 30-year mortgage rates?

Get mortgage rates returns rates for the latest survey by default.

### How have mortgage rates changed week over week?

Get mortgage rates returns the previous-week changes for both fixed-rate terms.

### What were mortgage rates during a date range?

Get mortgage rates returns weekly history when you provide a date range.

## Related

- [Bankrate API](https://fous.com/workflows/bankrate.md): Bankrate provides personal finance information, national-average mortgage and refinance rates with published dates, and listed savings, CD, and money market rates that may change daily.
- [US Treasury API](https://fous.com/workflows/us-treasury.md): US Treasury provides official daily interest rates and national debt figures for requested or latest available dates, plus quarterly reporting exchange rates using the latest preceding quarter when needed.
- [FRED API](https://fous.com/workflows/fred.md): FRED provides public economic series, observations, latest values, sources, and popular topic searches with coverage dates and metadata; freshness varies by series.
- [Macrotrends API](https://fous.com/workflows/macrotrends.md): Macrotrends provides long-term financial and economic charts, company metric histories, and yearly commodity and index prices; current-year prices may be incomplete.
- [Yahoo Finance API](https://fous.com/workflows/yahoo-finance.md): Yahoo Finance provides quotes, movers, company financials, analyst ratings, earnings, news, and up to 5,000 price rows with adjusted returns; prices may be delayed.
- [MSN Money API](https://fous.com/workflows/msn-money.md): MSN Money provides stock quotes, key facts, financial news, and market data, including current market movers; quotes and prices may be delayed.
- [European Central Bank API](https://fous.com/workflows/european-central-bank.md): The European Central Bank provides official euro reference rates and informational currency conversions using the latest preceding published rates when needed, plus current key interest rates and optionally earlier changes.
- [Google Finance API](https://fous.com/workflows/google-finance.md): Google Finance returns possibly delayed prices and figures, indexes, up to four movers timed by oldest quote, currency conversions, and up to five financial periods.
- [All Finance workflows](https://fous.com/workflows/category/finance)
