# US Treasury FiscalData Scraper: Debt, Rates, FX, MTS (`scrapers_lat/us-treasury-fiscaldata-scraper`) Actor

Get official US Treasury data: national debt (Debt to the Penny), Treasury security interest rates, government exchange rates for 170+ currencies, and the Monthly Treasury Statement. Date filters, per-currency filter, optional AI trend insight. JSON, CSV, Excel.

- **URL**: https://apify.com/scrapers\_lat/us-treasury-fiscaldata-scraper.md
- **Developed by:** [Scrapers Lat](https://apify.com/scrapers_lat) (community)
- **Categories:** Other, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $8.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

[![US Treasury FiscalData Scraper: Debt, Rates, FX, MTS](https://scrapers.lat/banners/us-treasury-fiscaldata-scraper.png)](https://apify.com/scrapers_lat/us-treasury-fiscaldata-scraper)

## US Treasury FiscalData Scraper: Debt, Rates, FX, MTS

Pull official **US Treasury** financial data from a single actor: the daily **national debt** (Debt to the Penny), **average interest rates** on Treasury securities, official **government exchange rates** for 170+ currencies, and the **Monthly Treasury Statement** (receipts, outlays, deficit/surplus). Clean date filters, a per-currency filter, and an optional one-call **AI trend insight** over the returned series. Results come back as JSON, CSV or Excel.

Most tools give you one of these feeds. This actor exposes four high-value Treasury datasets through one uniform interface, keeps every raw field, and adds parsed numeric versions so the numbers are ready to chart or reconcile.

### What you get

- **National debt (daily)** total public debt outstanding, debt held by the public, intragovernmental holdings.
- **Treasury security interest rates (monthly)** average interest rate by security type and description.
- **Government exchange rates (quarterly)** the official Treasury reporting rate of exchange for 170+ currencies, the rate US federal agencies and many companies must use for foreign-currency reporting and compliance.
- **Monthly Treasury Statement** receipts, outlays and the monthly deficit/surplus by classification line.
- **Optional AI trend insight** one plain-English summary of the series direction and change.

### Example output

National debt (`debt_to_penny`), one record per day:

```json
{
  "dataset": "debt_to_penny",
  "recordDate": "2026-08-13",
  "record_date": "2026-08-13",
  "tot_pub_debt_out_amt": "39934816207844.37",
  "debt_held_public_amt": "32200971487306.14",
  "intragov_hold_amt": "7733844720538.23",
  "debtTotalUsd": 39934816207844.37,
  "debtHeldPublicUsd": 32200971487306.14,
  "intragovHoldingsUsd": 7733844720538.23,
  "observedAt": "2026-08-16T18:23:14.981Z",
  "error": null
}
```

Government exchange rate (`rates_of_exchange`):

```json
{
  "dataset": "rates_of_exchange",
  "recordDate": "2026-06-30",
  "country": "Euro Zone",
  "currency": "Euro",
  "country_currency_desc": "Euro Zone-Euro",
  "exchange_rate": "0.877",
  "exchangeRate": 0.877,
  "effectiveDate": "2026-06-30",
  "observedAt": "2026-08-16T18:23:34.912Z",
  "error": null
}
```

Optional AI trend insight (one row per run, only when `withAiInsight` is on):

```json
{
  "dataset": "debt_to_penny",
  "recordType": "ai_insight",
  "aiTrend": "The national debt is on an upward trajectory.",
  "aiChangeSummary": "The total public debt increased by approximately $1.42 trillion from July 24, 2026, to August 13, 2026.",
  "aiNotableObservations": [
    "Debt rose consistently over the observed period.",
    "The largest single-day increase was on August 13, 2026."
  ],
  "seriesRecordCount": 15
}
```

### Input

| Field | Type | Description |
| --- | --- | --- |
| `dataset` | select | Which dataset: `debt_to_penny`, `avg_interest_rates`, `rates_of_exchange`, `mts_mtss`. Default `debt_to_penny`. |
| `dateFrom` | string | Only records with record date on or after this date (YYYY-MM-DD). |
| `dateTo` | string | Only records with record date on or before this date (YYYY-MM-DD). |
| `currency` | string | For `rates_of_exchange` only: keep rows whose country/currency contains this text (for example Euro, Canada, Yen). |
| `extraFilter` | string | Advanced passthrough appended to the Treasury `filter=` parameter. |
| `sort` | string | Sort expression. Default `-record_date` (newest first). |
| `withAiInsight` | boolean | Opt-in AI trend insight, one call and one charge per run. Disabled for free users. Default off. |
| `maxResults` | integer | Maximum records to collect. Free Apify plans are capped at 10 per run. |

### Datasets

| `dataset` value | Contents | Cadence |
| --- | --- | --- |
| `debt_to_penny` | Total public debt outstanding, debt held by the public, intragovernmental holdings | Daily |
| `avg_interest_rates` | Average interest rate by security type and description | Monthly |
| `rates_of_exchange` | Official Treasury reporting rate of exchange, 170+ currencies | Quarterly |
| `mts_mtss` | Monthly Treasury Statement receipts, outlays, deficit/surplus | Monthly |

### Output fields

| Field | Description |
| --- | --- |
| `dataset` | The dataset the record belongs to. |
| `recordDate` | Record date (YYYY-MM-DD). |
| `debtTotalUsd`, `debtHeldPublicUsd`, `intragovHoldingsUsd` | Parsed national-debt figures (numbers, USD). |
| `avgInterestRate` | Parsed average interest rate (number, percent). |
| `country`, `currency`, `exchangeRate`, `effectiveDate` | Exchange-rate fields; `exchangeRate` is a number. |
| `classification`, `receiptsUsd`, `outlaysUsd`, `deficitSurplusUsd` | Monthly Treasury Statement figures. |
| `aiTrend`, `aiChangeSummary`, `aiNotableObservations` | AI insight row (when enabled). |
| `observedAt` | When the record was collected. |
| `error` | Null on success; a short message if a run could not complete. |

All original Treasury field names are also passed through untouched alongside the parsed helpers.

### Use cases

- **Foreign-currency accounting and compliance** use the official Treasury quarterly FX rates required for US federal foreign-currency reporting and many corporate filings.
- **Fintech and treasury dashboards** stream the daily national debt and Treasury security interest rates into your product.
- **Economic and macro research** build deficit, debt trajectory and interest-rate time series for models and reports.
- **Government contractors and auditors** reconcile Monthly Treasury Statement receipts, outlays and deficit lines.
- **FX and multi-currency invoicing** value cross-border transactions against the recognized government exchange rate.
- **Data journalism** chart the US debt, spending and deficit with clean, source-of-truth numbers.

### Billing

This actor is priced pay per event:

| Event | Price (USD) | When it is charged |
| --- | --- | --- |
| `result` | $0.008 | Once per Treasury record returned in the dataset. |
| `ai_insight` | $0.012 | Once per run, only when the optional AI trend insight produces usable output. Disabled for free users. |

You are never charged when a run fails or returns no data. Free Apify plans are capped at 10 results per run and the AI add-on is disabled for them.

# Actor input Schema

## `dataset` (type: `string`):

Which official US Treasury FiscalData dataset to pull. debt\_to\_penny = daily national debt; avg\_interest\_rates = monthly average interest rates on Treasury securities; rates\_of\_exchange = quarterly official government exchange rates for 170+ currencies; mts\_mtss = Monthly Treasury Statement summary (receipts, outlays, deficit/surplus).

## `dateFrom` (type: `string`):

Only include records with record\_date on or after this date (YYYY-MM-DD).

## `dateTo` (type: `string`):

Only include records with record\_date on or before this date (YYYY-MM-DD).

## `currency` (type: `string`):

For the rates\_of\_exchange dataset only: keep only rows whose country/currency description contains this text, for example Euro, Canada, Mexico-Peso or Yen. Case-insensitive contains match.

## `extraFilter` (type: `string`):

Power-user passthrough appended to the FiscalData `filter=` parameter, for example security\_desc:eq:Treasury Bills or country\_currency\_desc:eq:Canada-Dollar. Combined with the date range using AND.

## `sort` (type: `string`):

FiscalData sort expression. Default -record\_date (newest first). Prefix a field with - for descending, for example record\_date for oldest first.

## `withAiInsight` (type: `boolean`):

Opt-in AI add-on ($0.012 per run, not per row). After fetching the series, make ONE AI call (OpenRouter gpt-4o-mini) that summarizes the trend in plain English: overall direction, quantified change from start to end, and notable observations. Emitted as a single ai\_insight row and charged once, only when usable output is produced. Disabled for free Apify users.

## `maxResults` (type: `integer`):

Maximum number of records to collect. Free Apify plans are capped at 10 per run.

## `proxyConfiguration` (type: `object`):

Optional. The Treasury FiscalData API is open and needs no proxy, but you can route requests through an Apify proxy if you prefer.

## Actor input object example

```json
{
  "dataset": "debt_to_penny",
  "sort": "-record_date",
  "withAiInsight": false,
  "maxResults": 100,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "maxResults": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapers_lat/us-treasury-fiscaldata-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "maxResults": 100 }

# Run the Actor and wait for it to finish
run = client.actor("scrapers_lat/us-treasury-fiscaldata-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "maxResults": 100
}' |
apify call scrapers_lat/us-treasury-fiscaldata-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scrapers_lat/us-treasury-fiscaldata-scraper"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/bMbwk6Hw6liWWPzQ8/builds/XQcaqNV1FpvlnZkIa/openapi.json
