This guide walks through building a company-level layoff risk model using the WARN Firehose API. We'll use Python with pandas, but the concepts apply to any language or analytics platform.
Step 1: Get Your API Key
Sign up for a free API key (25 calls/day) to follow along. For production models, the Pro tier ($199/mo) provides 1,000 calls/day across all 6 datasets.
import requests
import pandas as pd
API_KEY = "wf_your_key_here"
BASE = "https://warnfirehose.com"
headers = {"X-API-Key": API_KEY}
# Get risk signals for high-risk companies
resp = requests.get(f"{BASE}/api/risk-signal",
params={"min_score": 50, "limit": 100},
headers=headers)
signals = pd.DataFrame(resp.json()["results"])
Step 2: Enrich with Cross-Dataset Signals
For each high-risk company, pull SEC filings and visa petition data:
# Per-company deep dive
company = "Example Corp"
risk = requests.get(f"{BASE}/api/risk-signal/company/{company}",
headers=headers).json()
print(f"Risk Score: {risk['risk_score']}/100")
print(f"WARN Notices: {risk['warn_count']}")
print(f"SEC 8-K Filings: {risk.get('sec_filings', 0)}")
print(f"LCA Petitions: {risk.get('lca_petitions', 0)}")
print(f"H-1B Trend: {risk.get('h1b', {}).get('trend', 'N/A')}")
Step 3: Build the Scoring Model
A simple weighted model combining the signals:
def compute_risk(company_data):
score = 0
# WARN signal (35% weight)
if company_data.get("warn_count", 0) > 0:
recency_boost = 1.5 if company_data.get("days_since_last_warn", 999) < 90 else 1.0
score += min(35, company_data["warn_count"] * 5 * recency_boost)
# SEC 8-K signal (25% weight)
if company_data.get("sec_filings", 0) > 0:
score += min(25, company_data["sec_filings"] * 8)
# Bankruptcy signal (20% weight)
if company_data.get("bankruptcy_filings", 0) > 0:
score += 20
# H-1B/LCA trend (12% weight, inverse)
lca_trend = company_data.get("lca_trend", "stable")
if lca_trend == "declining":
score += 12 # Declining hiring = more risk
# Industry context (8% weight)
if company_data.get("industry_distress", False):
score += 8
return min(100, score)
Step 4: Monitor with Webhooks
Set up real-time alerts for your watchlist companies using the webhook API (available on Pro plans).
Next Steps
This basic model uses simple linear weighting. For production, consider:
- Time-series features (WARN filing velocity over rolling windows)
- Peer comparison (same industry, same size companies)
- Geographic clustering (multiple companies in same metro = contagion risk)
- Historical backtesting against stock returns
Ready to build?
Get your API key · Risk Signal API docs · Download bulk data in Parquet