Risk Before Buy

Public API

Climate Risk API

Free, rate-limited endpoint returning live climate risk scores for any US ZIP code. Data sourced from Risk Before Buy — powered by FEMA, NOAA, USGS, USDA, and EPA datasets.

Endpoint

GET/api/v1/risk

Query Parameters

NameTypeRequiredDescription
zipstringrequired5-digit US ZIP code (e.g. 28801, 90012, 33101)

Response Fields

FieldTypeDescription
zipstringThe queried ZIP code
overallRiskstringAggregate risk band: minimal, low, moderate, high, or extreme
estimatedPremium{ min, max } | nullEstimated annual homeowners insurance premium range in USD
premiumStrainstringPremium-to-income pressure band: low, moderate, elevated, high, or severe
marketPressurestringState insurance market health: low, moderate, high, or severe

Code Examples

cURL
curl "https://www.riskbeforebuy.com/api/v1/risk?zip=28801"
JavaScript (Fetch API)
const res = await fetch("https://www.riskbeforebuy.com/api/v1/risk?zip=28801");
const data = await res.json();
console.log(data);
Python (requests)
import requests

res = requests.get("https://www.riskbeforebuy.com/api/v1/risk", params={"zip": "28801"})
data = res.json()
print(data)

Example Response

200 OK — JSON
{
  "zip": "28801",
  "overallRisk": "moderate",
  "estimatedPremium": { "min": 1200, "max": 1800 },
  "premiumStrain": "elevated",
  "marketPressure": "moderate"
}

Error Responses

400 — Invalid or missing ZIP code

400 Bad Request
{ "error": "Invalid or missing ZIP code. Must be a 5-digit string (e.g. 28801)." }

404 — ZIP not in database

404 Not Found
{
  "error": "ZIP code not found in our database."
}

429 — Rate limit exceeded

429 Too Many Requests
{ "error": "Rate limit exceeded. Max 5 requests per minute." }

Rate Limiting

5 requests per minute per IP address. Rate limit headers are included in every response:

  • X-RateLimit-Limit — maximum requests allowed in the window
  • X-RateLimit-Remaining — requests remaining in the current window
  • Retry-After — seconds until the rate limit resets (only on 429)

Caching

Responses include Cache-Control: public, max-age=86400. ZIP-level risk data is refreshed at most once per 24 hours. Safe to cache client-side.

Data Sources

All risk scores are derived from public federal datasets. No synthetic or estimated data.

  • FEMA National Risk Index (NRI) — flood, hurricane, wildfire, earthquake
  • NOAA Storm Events Database — historical severe weather claims
  • USGS Earthquake Hazards Program — seismic risk
  • USDA Forest Service — wildfire probability
  • EPA — climate exposure overlays

This API is provided as-is for integration purposes. Not insurance, financial, or legal advice. See Methodology for scoring details.