Skip to content
Skillpedia
Analysis & spreadsheets51k · #1998

usfiscaldata

Lets your agent access U.S. government financial data. It's useful for analyzing the national budget, debt, and other fiscal statistics.

What it does

Fetches U.S. government financial data, like national debt, exchange rates, and revenue/spending statistics. No API key is needed.

When to use it

  • ✓Check the current national debt.
  • ✓Look up historical exchange rates.
  • ✓Get government spending statistics.

Example of what to ask your AI

“What was the national debt on January 1, 2023?”

Want more? Open the sections below.

How to use

The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.

Skill link

https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/usfiscaldata/SKILL.md

Ready-to-paste message

Use this skill to help me: https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/usfiscaldata/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
How it works

This tool connects to an official U.S. Treasury database. You request a type of information, and it retrieves the latest data or data for a specific period.

Installation

Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.

In the terminal (Claude Code, Codex, Cursor), in your project folder:

npx skills add K-Dense-AI/scientific-agent-skills --skill usfiscaldata

Or download just the file:

curl -L https://raw.githubusercontent.com/K-Dense-AI/scientific-agent-skills/main/skills/usfiscaldata/SKILL.md -o SKILL.md
Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

U.S. Treasury Fiscal Data API

Free, open REST API from the U.S. Department of the Treasury for federal financial data. No API key or registration required.

Base URL: https://api.fiscaldata.treasury.gov/services/api/fiscal_service

Browse the current dataset catalog via the dataset search. Verify endpoint paths on each dataset's API Quick Guide — paths change over time.

Installation

uv pip install requests pandas

Quick Start

import requests
import pandas as pd

BASE_URL = "https://api.fiscaldata.treasury.gov/services/api/fiscal_service"

# Get the current national debt (Debt to the Penny)
resp = requests.get(f"{BASE_URL}/v2/accounting/od/debt_to_penny", params={
    "sort": "-record_date",
    "page[size]": 1
}, timeout=30)
resp.raise_for_status()
data = resp.json()["data"][0]
print(f"Total public debt as of {data['record_date']}: ${float(data['tot_pub_debt_out_amt']):,.0f}")
# Preview Treasury exchange-rate rows for recent quarters (first page only)
resp = requests.get(f"{BASE_URL}/v1/accounting/od/rates_of_exchange", params={
    "fields": "country_currency_desc,exchange_rate,record_date,effective_date",
    "filter": "record_date:gte:2024-01-01",
    "sort": "-record_date",
    "page[size]": 100
}, timeout=30)
resp.raise_for_status()
df = pd.DataFrame(resp.json()["data"])

Authentication

None required. The API is fully open and free.

Core Parameters

Parameter Example Description
fields= fields=record_date,tot_pub_debt_out_amt Select specific columns
filter= filter=record_date:gte:2024-01-01 Filter records
sort= sort=-record_date Sort (prefix - for descending)
format= format=json Output format: json, csv, xml
page[size]= page[size]=100 Records per page (default 100)
page[number]= page[number]=2 Page index (starts at 1)

Filter operators: lt, lte, gt, gte, eq, in

# Multiple filters separated by comma
"filter=country_currency_desc:in:(Canada-Dollar,Mexico-Peso),record_date:gte:2024-01-01"

Key Datasets & Endpoints

Debt

Dataset Endpoint Frequency
Debt to the Penny /v2/accounting/od/debt_to_penny Daily
Historical Debt Outstanding /v2/accounting/od/debt_outstanding Annual
Schedules of Federal Debt /v1/accounting/od/schedules_fed_debt Monthly

Daily & Monthly Statements

Dataset Endpoint Frequency
DTS Operating Cash Balance /v1/accounting/dts/operating_cash_balance Daily
DTS Deposits & Withdrawals /v1/accounting/dts/deposits_withdrawals_operating_cash Daily
Monthly Treasury Statement (MTS) /v1/accounting/mts/mts_table_1 (18 tables — see datasets-fiscal.md) Monthly

Interest Rates & Exchange

Dataset Endpoint Frequency
Average Interest Rates on Treasury Securities /v2/accounting/od/avg_interest_rates Monthly
Treasury Reporting Rates of Exchange /v1/accounting/od/rates_of_exchange Quarterly
Interest Expense on Public Debt /v2/accounting/od/interest_expense Monthly

Exchange-rate interpretation: Treasury Reporting Rates are foreign-currency units per USD, so divide a foreign-currency amount by the rate to obtain USD (and multiply USD to obtain foreign currency). These are government reporting rates, not live trading quotes. Preserve both record_date and effective_date, and check amendments before applying a rate to a reporting period.

Securities & Auctions

Dataset Endpoint Frequency
Treasury Securities Auctions Data /v1/accounting/od/auctions_query As Needed
Treasury Securities Upcoming Auctions /v1/accounting/od/upcoming_auctions As Needed
Treasury Securities Buybacks /v1/accounting/od/buybacks_operations As Needed

Savings Bonds

Dataset Endpoint Frequency
I Bonds Interest Rates /v1/accounting/od/i_bonds_interest_rates Semi-Annual
Savings Bonds Issues, Redemptions & Maturities /v1/accounting/od/savings_bonds_report Monthly

Response Structure

{
  "data": [...],
  "meta": {
    "count": 100,
    "total-count": 3790,

…
FAQ

Do I need to register or pay to use this?

No, the API is free and open, requiring no registration or key.

What kinds of data can I get?

You can get data on national debt, daily and monthly Treasury statements, interest rates, exchange rates, savings bonds, and U.S. government revenue and spending statistics.

How is the data presented?

Data is returned as a list or table, usually as text. Numbers and dates might need conversion for calculations.

Details

Original description by the author

Queries the U.S. Treasury Fiscal Data REST API for federal financial data. No API key required. Use for national debt (Debt to the Penny), Daily Treasury Statements, Monthly Treasury Statements, Treasury securities auctions, interest rates, foreign exchange rates, savings bonds, or U.S. government revenue and spending statistics.

repo: K-Dense-AI/scientific-agent-skills

Popularity

GitHub stars
51k
Ranking position
#1998
License
MIT
Updated
10/15/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills