US Treasury Fiscal Data Scraper
Pricing
Pay per event
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
Maintained by CommunityActor 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
| Dataset | Input value | Example fields |
|---|---|---|
| Debt to the Penny | debt_to_penny | total public debt, public debt held, intragovernmental holdings |
| Average Interest Rates | avg_interest_rates | security type, security description, average rate |
| Rates of Exchange | rates_of_exchange | country, currency, exchange rate |
| Monthly Treasury Statement Table 1 | monthly_treasury_statement | receipts, outlays, deficit/surplus |
| Interest Expense | interest_expense | monthly and fiscal YTD public debt interest expense |
| Savings Bonds Securities Sales | securities_sales | gross sales, returned sales, net sales, count |
What data can you extract?
Each output item contains a common normalized record shape:
| Field | Description |
|---|---|
datasetId | Stable dataset identifier selected in input |
datasetName | Human-readable Treasury dataset name |
endpoint | FiscalData API endpoint path |
recordDate | Official record date |
fiscalYear | Fiscal year, when provided |
fiscalQuarter | Fiscal quarter, when provided |
calendarYear | Calendar year, when provided |
calendarMonth | Calendar month, when provided |
category | Dataset-specific category such as security type or classification |
subcategory | Dataset-specific subcategory |
country | Exchange-rate country, when applicable |
currency | Exchange-rate currency, when applicable |
amount | Primary numeric amount for the record |
amountType | Label describing the amount |
value | Primary numeric/string value such as rate or count |
valueType | Label describing the value |
sourceLineNumber | Treasury source line number, when available |
rawData | Complete official FiscalData row |
sourceUrl | Exact API URL used for the page |
fetchedAt | Actor 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
itemevent. - Larger usage tiers receive discounted per-record pricing.
| Tier | Price 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
- Open the actor on Apify.
- Choose one or more Treasury datasets.
- Set
maxRecordsto the number of rows you need. - Optionally set
startDateandendDate. - Run the actor.
- 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
maxRecordslow while testing a new dashboard. - Use
startDatefor incremental exports. - Leave
includeRawDataenabled when you need auditability. - Use
pageSize500 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 ApifyClientclient = 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().itemsprint(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.
Related scrapers
Other Automation Lab actors that pair well with this workflow:
- https://apify.com/automation-lab/sec-edgar-scraper
- https://apify.com/automation-lab/cfpb-complaints-scraper
- https://apify.com/automation-lab/imf-datamapper-scraper
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.