No API key is required; construct a GET request to https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/debt_to_penny
Add query params: fields=record_date,tot_pub_debt_out_amt,debt_held_public_amt,intragov_hold_amt; sort=-record_date; page[size]=1 to get the latest record
For a date range, add filters[record_date:gte]=YYYY-MM-DD and filters[record_date:lte]=YYYY-MM-DD
Parse the JSON response: data array contains string-typed numeric fields; cast tot_pub_debt_out_amt to a decimal before arithmetic
Set up a daily scheduled job hitting the endpoint after 3:00 PM ET, when Treasury typically publishes the prior business day's figures
For historical bulk loads, use the page[number] parameter starting at 1 and increment until meta.total-pages is reached; the dataset covers from 1993 onward
Known gotchas
All numeric values are returned as strings in the JSON response — failure to cast before comparison or arithmetic will produce silent errors in strongly-typed languages
The API does not publish on federal holidays or weekends; a job expecting daily data will encounter gaps and should handle missing days gracefully rather than treating absence as an error
The filter syntax uses bracket notation (filters[field:operator]=value) not standard URL query string style; standard HTTP libraries may not encode brackets correctly without explicit percent-encoding
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp