TL;DR
The US Treasury's FiscalData API provides programmatic access to official Treasury financial data including average interest rates on Treasury securities, national debt, federal tax revenue, government spending, and more. The example endpoint returns the average interest rate on the US federal debt — a key economic indicator. All data is authoritative US government information updated regularly, with historical records spanning decades. No API key required for basic queries.
Quick start: https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/avg_interest_rates
No API key needed — just make a request!
How to Use This API
1. Average Interest Rates
https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/avg_interest_rates
2. Filter by Date Range
https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/avg_interest_rates?filter=record_date:gte:2024-01-01
3. Get National Debt
https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/debt_to_penny
4. JavaScript — Fetch Interest Rates
fetch('https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/avg_interest_rates?page[size]=5')
.then(r => r.json())
.then(d => {
d.data.forEach(row => {
console.log(row.record_date, '—', row.avg_interest_rate_amt, '%');
});
});
5. Python — Rate History
import requests
resp = requests.get(
'https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/avg_interest_rates',
params={'page[size]': 30, 'sort': '-record_date'}
)
for row in resp.json()['data']:
print(f"{row['record_date']}: {row['avg_interest_rate_amt']}%")
https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/avg_interest_rates?page[size]=3
API Details
- API URL
https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2- Documentation
- fiscaldata.treasury.gov
- Category
- Finance
- Authentication
- Not Required
- Geographic Coverage
- USA
Frequently Asked Questions
- Do I need an API key?
- No. The Treasury FiscalData API is a free public government service with no authentication required.
- What data endpoints are available?
- Over 150 endpoints covering average interest rates, debt to the penny, tax revenues, government spending, Treasury securities, savings bonds rates, and more.
- How do I filter and sort results?
- Use
filter=field:operator:value(operators: gte, lte, eq, neq, like) andsort=-field(descending) orsort=field(ascending). Pagination viapage[size]andpage[number]. - What date format is used?
- All dates use ISO 8601 format (YYYY-MM-DD) in the
record_datefield. - Can I get data in CSV format?
- Yes, add
&format=csvto any endpoint for CSV output. JSON is the default format. - How frequently is the data updated?
- Update frequency varies by endpoint. Interest rates and debt data are typically updated daily on business days.
What You Can Build
- US national debt tracker with historical trend chart
- Treasury bond interest rate dashboard
- Federal budget analysis and visualization tool
- Tax revenue calendar showing government cash flows
- Government spending breakdown by category