U.S. Treasury API: Get national debt
Returns US national debt (Debt to the Penny) for a given date, or the latest published day. Dates without a record use the previous published day.
Unofficial. Not affiliated with or endorsed by U.S. Treasury.
Inputs
Values from the run on Oct 23, 2026, shown under Output.
- Date optional
date Day to look up in YYYY-MM-DD; leave blank to use the latest published day. Dates from 1993-04-01 up to today. Example: 2024-07-04.
Not set
Exactly 10 characters.
Input as JSON
{}Output
{ "date": "2026-10-21", "currency": "USD", "page_url": "https://fiscaldata.treasury.gov/datasets/debt-to-the-penny/" , "debt_held_by_the_public": 32566346587338.02, "intragovernmental_holdings": 7847292424967.95, "total_public_debt_outstanding": 40413639012305.97}Code
curl https://api.fous.com/v1/runs \ -H "Authorization: Bearer $FOUS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"method":"home.treasury.gov/get_national_debt","input":{}}' # Save as fous.py, then run: python3 fous.pyimport json, os, timefrom urllib.error import HTTPErrorfrom urllib.request import Request, urlopenAPI = "https://api.fous.com/v1/runs" KEY = os.environ["FOUS_API_KEY"]HEADERS = { "Authorization": f"Bearer {KEY}", "Content-Type": "application/json" ,}def call(url, body=None): data = json.dumps(body).encode() if body else None request = Request(url, data, HEADERS) try: with urlopen(request, timeout=120) as r: return r.status, json.load(r) except HTTPError as error: message = json.load(error)["error"]["message"] raise RuntimeError(message) from errorstatus, run = call(API, { "method": "home.treasury.gov/get_national_debt" , "input": {}})# 202: still going after 30 s. Ask again until it ends.while status == 202: time.sleep(2) status, run = call(f"{API}/{run['id']}")print(json.dumps(run["data"], indent=2))// Save as fous.mjs, then run: node fous.mjsconst api = "https://api.fous.com/v1/runs" ;const headers = { Authorization: `Bearer ${process.env.FOUS_API_KEY}`, "Content-Type": "application/json" ,};let response = await fetch(api, { method: "POST", headers, body: JSON.stringify({ "method": "home.treasury.gov/get_national_debt" , "input": {} }), signal: AbortSignal.timeout(120_000),});let run = await response.json();// 202: still going after 30 s. Ask again until it ends.while (response.status === 202) { await new Promise((done) => setTimeout(done, 2_000)); response = await fetch(`${api}/${run.id}`, { headers }); run = await response.json();}if (!response.ok) throw new Error(run.error.message);console.log(run.data);# Connect your agent to Fous once, over MCP (Streamable HTTP):# https://api.fous.com/mcp# Set FOUS_API_KEY first: create a key at https://app.fous.com/keys.# Claude Codeclaude mcp add \ --scope user \ --transport http fous https://api.fous.com/mcp \ --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"# Codexcodex mcp add fous \ --url https://api.fous.com/mcp \ --bearer-token-env-var FOUS_API_KEY# Cursor, VS Code, Windsurf, Cline and morenpx -y add-mcp https://api.fous.com/mcp -g -n fous \ --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"# Then ask your agent:# "Use Fous to run home.treasury.gov/get_national_debt# with {}"Over HTTP, the answer’s data holds the output. A run still going after 30 seconds answers 202 with its id: ask GET /v1/runs/{id} until it ends.
Schema
Input schema
{ "type": "object", "required": [], "properties": { "date": { "type": "string", "examples": [ "2024-07-04" ], "maxLength": 10, "minLength": 10, "description": "Day to look up in YYYY-MM-DD; leave blank to use the latest published day. Dates from 1993-04-01 up to today. Example: 2024-07-04." } }}Output schema
{ "type": "object", "required": [ "date", "total_public_debt_outstanding", "debt_held_by_the_public", "intragovernmental_holdings", "currency", "page_url" ], "properties": { "date": { "type": "string", "format": "date", "description": "Published date used for this record." }, "currency": { "type": "string", "const": "USD", "description": "Currency of the debt amounts." }, "page_url": { "type": "string", "format": "uri", "description": "Treasury page for Debt to the Penny." }, "debt_held_by_the_public": { "type": [ "number", "null" ], "description": "Debt held by the public in US dollars, or null if not reported." }, "intragovernmental_holdings": { "type": [ "number", "null" ], "description": "Intragovernmental holdings in US dollars, or null if not reported." }, "total_public_debt_outstanding": { "type": "number", "description": "Total public debt outstanding in US dollars." } }, "additionalProperties": false}- Price
- 1 credit per completed run (1¢ with pay as you go); failed runs are free.
- Method
home.treasury.gov/get_national_debt- Returns
- date, total public debt outstanding, debt held by the public, intragovernmental holdings
Use it from your agent
Give your agent this line. It reads SKILL.md, gets a Fous API key and connects the Fous MCP server. Its run then takes the method home.treasury.gov/get_national_debt with the inputs above.
Ask your agent
- What was the total US national debt on July 4, 2024?
- Give me the latest published figure for the national debt outstanding.
- How much of the US debt was held by the public at the end of 2010-12-31?
- Show the intragovernmental holdings portion of the federal debt for 2019-06-30.
- On treasury.gov, what is today's debt to the penny broken down into public and intragovernmental amounts?
See more
All U.S. Treasury methodsGets official daily Treasury par yield curve rates for a date, or the latest published date on or before it.
home.treasury.gov/get_treasury_yieldsGets the U.S. Treasury quarterly reporting exchange rate for a country or currency on a given date. If that quarter has no published record, it uses the latest preceding quarter.
treasury.gov/get_reporting_exchange_ratesGets a federal agency's fiscal-year budgetary resources, obligations, share of federal obligations, new award count, top recipients and spending classes from USAspending.
usaspending.gov/get_agency_spendingGets the official ECB euro reference exchange rates for a day, or the latest published day. Weekends, holidays and dates before publication return the previous published day.
ecb.europa.eu/get_euro_exchange_ratesGets decades of yearly commodity or stock-index price history from Macrotrends: yearly average, open, high, low, close, annual change and inflation-adjusted value for gold, silver, crude oil, natural gas, copper, Dow Jones, S&P 500 and Nasdaq. The current year may be incomplete.
macrotrends.net/get_long_term_price_historyGets current government bond yields from Investing.com's world government bonds table, optionally filtered by country and maturity term.
investing.com/get_bond_yieldsReturns 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, and optionally a weekly history for a date range.
freddiemac.com/get_mortgage_ratesConverts an amount between currencies using ECB euro reference rates, including euro and cross-currency conversions. Uses the latest preceding published rate when the date has none.
ecb.europa.eu/convert_currency