US Treasury Fiscal Data Scraper avatar

US Treasury Fiscal Data Scraper

Pricing

Pay per event

Go to Apify Store
US Treasury Fiscal Data Scraper

US Treasury Fiscal Data Scraper

Export official US Treasury FiscalData records for debt, rates, exchange rates, statements, and interest expense into clean datasets.

Pricing

Pay per event

Rating

0.0

(0)

Developer

Stas Persiianenko

Stas Persiianenko

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

4 days ago

Last modified

Categories

Share

Export official US Treasury FiscalData API records for debt, interest rates, exchange rates, monthly statements, interest expense, and savings bond sales.

What does US Treasury Fiscal Data Scraper do?

US Treasury Fiscal Data Scraper pulls structured JSON records from the official Treasury FiscalData API and saves them as clean Apify dataset items.

It is built for repeatable fiscal-data workflows where teams need current public finance records in dashboards, alerts, spreadsheets, data warehouses, or automated reporting jobs.

The actor uses the official keyless API at api.fiscaldata.treasury.gov. No login, cookies, browser automation, or proxy is required.

Who is it for?

  • ๐Ÿ“Š Financial analysts tracking US debt, rates, and fiscal balances.
  • ๐Ÿฆ Public-finance teams building recurring Treasury dashboards.
  • ๐Ÿ“ฐ Journalists monitoring public debt and federal fiscal trends.
  • ๐Ÿงช Market researchers comparing macroeconomic indicators.
  • ๐Ÿ›๏ธ Government-data vendors normalizing public datasets for customers.
  • โš™๏ธ Data engineers who need scheduled FiscalData API exports without maintaining custom scripts.

Why use this Treasury FiscalData extractor?

  • โœ… Official Treasury source.
  • โœ… Keyless HTTP API; no scraping browser overhead.
  • โœ… Multiple high-value datasets in one run.
  • โœ… Date range filters for incremental exports.
  • โœ… Raw official row preservation for audit trails.
  • โœ… Normalized amount, value, category, date, country, and currency fields.
  • โœ… Apify scheduling, webhooks, datasets, API access, and integrations.

Supported Treasury datasets

DatasetInput valueExample fields
Debt to the Pennydebt_to_pennytotal public debt, public debt held, intragovernmental holdings
Average Interest Ratesavg_interest_ratessecurity type, security description, average rate
Rates of Exchangerates_of_exchangecountry, currency, exchange rate
Monthly Treasury Statement Table 1monthly_treasury_statementreceipts, outlays, deficit/surplus
Interest Expenseinterest_expensemonthly and fiscal YTD public debt interest expense
Savings Bonds Securities Salessecurities_salesgross sales, returned sales, net sales, count

What data can you extract?

Each output item contains a common normalized record shape:

FieldDescription
datasetIdStable dataset identifier selected in input
datasetNameHuman-readable Treasury dataset name
endpointFiscalData API endpoint path
recordDateOfficial record date
fiscalYearFiscal year, when provided
fiscalQuarterFiscal quarter, when provided
calendarYearCalendar year, when provided
calendarMonthCalendar month, when provided
categoryDataset-specific category such as security type or classification
subcategoryDataset-specific subcategory
countryExchange-rate country, when applicable
currencyExchange-rate currency, when applicable
amountPrimary numeric amount for the record
amountTypeLabel describing the amount
valuePrimary numeric/string value such as rate or count
valueTypeLabel describing the value
sourceLineNumberTreasury source line number, when available
rawDataComplete official FiscalData row
sourceUrlExact API URL used for the page
fetchedAtActor fetch timestamp

How much does it cost to scrape US Treasury fiscal data?

The actor uses pay-per-event pricing.

  • Start event: $0.005 per run.
  • Each saved Treasury record is charged as one item event.
  • Larger usage tiers receive discounted per-record pricing.
TierPrice per Treasury record
Free$0.000030363
Starter / Bronze$0.000026402
Silver$0.000020594
Gold$0.000015841
Platinum$0.000010561
Diamond$0.000010000

Because the actor uses the official HTTP API and no paid proxy, it is designed for low operating cost and high margin at dashboard scale.

Quick start

  1. Open the actor on Apify.
  2. Choose one or more Treasury datasets.
  3. Set maxRecords to the number of rows you need.
  4. Optionally set startDate and endDate.
  5. Run the actor.
  6. Download the dataset as JSON, CSV, Excel, RSS, or through the Apify API.

Input settings

datasets

Choose one or more official FiscalData datasets. Records are fetched in the order selected.

startDate

Optional lower bound for record_date in YYYY-MM-DD format.

endDate

Optional upper bound for record_date in YYYY-MM-DD format.

filters

Advanced FiscalData filter expression, such as country:eq:Canada or security_type_desc:eq:Marketable.

sort

Choose newest-first or oldest-first by record_date.

maxRecords

Maximum dataset records to save across all selected datasets.

pageSize

FiscalData API page size. The default is 100 and the maximum is 1000.

fields

Optional official FiscalData field list. Leave empty to preserve complete rows.

includeRawData

Set to true to include the full official row in rawData. This is recommended for analysts.

Example input

{
"datasets": ["debt_to_penny", "avg_interest_rates"],
"startDate": "2025-01-01",
"maxRecords": 250,
"pageSize": 250,
"sort": "newest",
"includeRawData": true
}

Example output

{
"datasetId": "debt_to_penny",
"datasetName": "Debt to the Penny",
"endpoint": "v2/accounting/od/debt_to_penny",
"recordDate": "2026-07-02",
"fiscalYear": 2026,
"calendarYear": 2026,
"amount": 39375254020492.22,
"amountType": "Total public debt outstanding",
"rawData": {
"record_date": "2026-07-02",
"tot_pub_debt_out_amt": "39375254020492.22"
},
"sourceUrl": "https://api.fiscaldata.treasury.gov/services/api/fiscal_service/...",
"fetchedAt": "2026-07-04T00:00:00.000Z"
}

Treasury debt monitoring workflow

Use debt_to_penny with a scheduled daily run to monitor public debt changes.

Send new rows to a webhook, spreadsheet, or BI table, then compare amount over time.

Interest-rate research workflow

Use avg_interest_rates for recurring interest-rate exports.

Filter or group by category and subcategory to track marketable and non-marketable security trends.

Exchange-rate workflow

Use rates_of_exchange to collect official Treasury reporting rates.

Add a FiscalData filter like country:eq:Canada when you need one country or leave filters blank for broad exports.

Monthly Treasury Statement workflow

Use monthly_treasury_statement to collect receipts, outlays, and deficit/surplus rows.

This is useful for fiscal dashboards and macroeconomic reporting.

Tips for reliable runs

  • Keep maxRecords low while testing a new dashboard.
  • Use startDate for incremental exports.
  • Leave includeRawData enabled when you need auditability.
  • Use pageSize 500 or 1000 for larger exports.
  • Use official FiscalData filter syntax for advanced narrowing.

Integrations

The actor works with common Apify integrations:

  • ๐Ÿ“ฅ Export to CSV or Excel for analyst review.
  • ๐Ÿงฑ Send results to Google Sheets or Airtable with Apify integrations.
  • ๐Ÿ—„๏ธ Pull dataset items into Snowflake, BigQuery, or Postgres via API.
  • ๐Ÿ”” Trigger webhooks when new Treasury data is available.
  • ๐Ÿค– Use from agents and automation tools through the Apify API.

API usage with Node.js

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('automation-lab/us-treasury-fiscal-data-scraper').call({
datasets: ['debt_to_penny'],
maxRecords: 100,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items[0]);

API usage with Python

from apify_client import ApifyClient
client = ApifyClient('MY-APIFY-TOKEN')
run = client.actor('automation-lab/us-treasury-fiscal-data-scraper').call(run_input={
'datasets': ['rates_of_exchange'],
'maxRecords': 100,
})
items = client.dataset(run['defaultDatasetId']).list_items().items
print(items[0])

API usage with cURL

curl -X POST "https://api.apify.com/v2/acts/automation-lab~us-treasury-fiscal-data-scraper/runs?token=$APIFY_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"datasets":["interest_expense"],"maxRecords":100}'

MCP usage

Use this actor from MCP-compatible tools with Apify MCP Server.

MCP URL:

https://mcp.apify.com/?tools=automation-lab/us-treasury-fiscal-data-scraper

Claude Code CLI setup:

$claude mcp add apify-treasury-fiscal-data https://mcp.apify.com/?tools=automation-lab/us-treasury-fiscal-data-scraper

MCP JSON config block:

{
"mcpServers": {
"apify-treasury-fiscal-data": {
"url": "https://mcp.apify.com/?tools=automation-lab/us-treasury-fiscal-data-scraper"
}
}
}

Example prompts:

  • "Run the US Treasury Fiscal Data Scraper for debt to the penny and summarize the latest total debt."
  • "Export Treasury exchange rates for Canada and save the records as CSV."
  • "Schedule a weekly Treasury interest expense monitor and notify me when new records appear."

Claude Desktop setup

Add the Apify MCP server to Claude Desktop using the JSON config above, then enable the tool for this actor using:

https://mcp.apify.com/?tools=automation-lab/us-treasury-fiscal-data-scraper

After setup, ask Claude to run the actor with your selected dataset and date range.

Data source

The data source is the official US Treasury FiscalData API:

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

The actor does not modify official values. It normalizes common fields and preserves rawData for verification.

Legality and responsible use

This actor uses a public government API intended for data access.

Always verify whether your downstream use must cite the US Treasury or FiscalData source. For regulated financial workflows, validate extracted data before making decisions.

Troubleshooting

Why did I get fewer records than expected?

Your date range or advanced filter may be too narrow. Remove filters or increase maxRecords.

Why are some normalized fields empty?

Treasury datasets have different schemas. Dataset-specific values are still available in rawData when includeRawData is enabled.

How do I fetch one country in exchange rates?

Use dataset rates_of_exchange and set filters to a FiscalData expression such as country:eq:Canada.

Other Automation Lab actors that pair well with this workflow:

FAQ

Does this actor require an API key?

No. The Treasury FiscalData API is public and keyless for this workflow.

Does it use proxies?

No. It uses direct HTTPS requests to the official API.

Can I run it on a schedule?

Yes. Use Apify schedules to run daily, weekly, or monthly and export only records in your desired date range.

Can I choose custom FiscalData fields?

Yes. Add field names to fields. The actor automatically includes normalized date and period fields needed for output consistency.

Can I combine datasets?

Yes. Select multiple datasets and set maxRecords high enough for the combined export.

Changelog

  • 0.1 โ€” Initial release with six curated Treasury FiscalData datasets.