# 🇺🇸 US Treasury Data Scraper (`taroyamada/treasury-fiscal-data-digest`) Actor

Extract official US national debt figures, federal outlays, and average interest rates directly from the Treasury API into structured financial rows.

- **URL**: https://apify.com/taroyamada/treasury-fiscal-data-digest.md
- **Developed by:** [太郎 山田](https://apify.com/taroyamada) (community)
- **Categories:** News, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $9.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.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## Treasury Fiscal Data Digest | Debt, Rates & Budget Monitor

Extract structured financial records directly from the official U.S. Treasury Fiscal Data API without writing custom code or maintaining fragile web scrapers. This tool is purpose-built for data engineering teams, financial analysts, and compliance researchers who need to reliably schedule and integrate official government economic metrics into their internal dashboards.

Instead of manually polling a complex government website or relying on delayed third-party financial aggregators, this scraper connects directly to the underlying agency feeds. Run the scraper daily or weekly to extract critical updates on the national debt, average interest rates, Monthly Treasury Statement receipts, and federal outlays. You can configure custom keyword watchlists to filter exactly what your research teams need, returning a clean, summary-first digest row per configured feed.

The extracted data includes exact publication dates, reporting periods, agency identifiers, and numeric totals for debt and interest rates. By using this tool, you can schedule automated checks that run seamlessly in the background, piping scraped results directly into your data warehouse. Whether you are building predictive economic models, tracking long-term budget trends, or simply monitoring the latest fiscal policy details, this API data scraper provides the robust infrastructure needed to extract and integrate government financial data securely. Get complete, structured results that feed directly into your analytical tools without any manual oversight.

### Store Quickstart

What first success looks like:

### Key Features

- 🏛️ **Government-sourced** — Pulls directly from official agency feeds — no third-party aggregators
- ⏱️ **Timely digests** — Daily/weekly rollups of new filings, rulings, or actions
- 🔍 **Keyword watchlists** — Flag items matching your compliance/legal watch terms
- 📊 **Structured metadata** — Agency, date, docket, document type, link — all dataset-ready
- 📡 **Webhook alerts** — Push to legal/compliance teams the moment new items match watchlist

### Use Cases

| Who | Why |
|-----|-----|
| Developers | Automate recurring data fetches without building custom scrapers |
| Data teams | Pipe structured output into analytics warehouses |
| Ops teams | Monitor changes via webhook alerts |
| Product managers | Track competitor/market signals without engineering time |

### Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| feeds | array | **required** | One entry per watch target. Each feed produces one summary digest row. Use debt_to_penny for headline debt, avg_interest |
| watchTerms | string | — | Keywords to flag in digest evidence titles, summaries, and source dimensions. Use this for terms like deficit, 10-Year,  |
| lookbackDays | integer | `90` | Used to fetch enough history for comparisons and to determine recency for record-setting auction dates. 90 works well fo |
| maxEvidencePerFeed | integer | `10` | Upper bound on nested evidence rows per feed digest. Keep it low for summary-first output; raise it only when you intent |
| delivery | string | `"dataset"` | dataset stores results in the Apify dataset. webhook posts the digest JSON to webhookUrl. |
| webhookUrl | string | — | POST target for the digest payload. Leave empty for dataset delivery. |
| datasetMode | string | `"all"` | all emits every feed digest row. action_needed emits only feeds with critical signals or watch-term hits. new_only emits |
| snapshotKey | string | `"treasury-fiscal-data-digest-state"` | Stable key used to persist seen evidence hashes across recurring runs so changedSinceLastRun and new_only mode stay comp |

#### Input Example

```json
{
  "feeds": [
    {
      "id": "debt-daily",
      "name": "Debt to the Penny",
      "source": "debt_to_penny"
    },
    {
      "id": "marketable-rates",
      "name": "Marketable Treasury Rates",
      "source": "avg_interest_rates",
      "securityDescriptions": "Treasury Bills,Treasury Notes,Treasury Bonds"
    },
    {
      "id": "monthly-budget",
      "name": "MTS Receipts & Outlays",
      "source": "mts_table_1"
    },
    {
      "id": "record-auctions",
      "name": "Recent Record-Setting Auctions",
      "source": "record_setting_auction",
      "securityTypes": "Bills,Notes",
      "lookbackDays": 180
    }
  ],
  "watchTerms": "deficit,10-Year,Treasury Bills",
  "lookbackDays": 180,
  "maxEvidencePerFeed": 5,
  "delivery": "dataset",
  "datasetMode": "all",
  "snapshotKey": "treasury-fiscal-data-digest-quickstart",
  "notifyOnNoNew": true,
  "dryRun": false
}
````

### Output

| Field | Type | Description |
|-------|------|-------------|
| `meta` | object |  |
| `errors` | array |  |
| `digests` | array |  |
| `digests[].feedId` | string |  |
| `digests[].feedName` | string |  |
| `digests[].source` | string |  |
| `digests[].checkedAt` | timestamp |  |
| `digests[].latestRecordDate` | timestamp |  |
| `digests[].status` | string |  |
| `digests[].changedSinceLastRun` | boolean |  |
| `digests[].newEvidenceCount` | number |  |
| `digests[].totalEvidenceCount` | number |  |
| `digests[].actionNeeded` | boolean |  |
| `digests[].headline` | string |  |
| `digests[].recommendedAction` | string |  |
| `digests[].signalTags` | array |  |
| `digests[].watchTermHits` | array |  |
| `digests[].summaryMetrics` | object |  |
| `digests[].evidence` | array |  |
| `digests[].error` | null |  |

#### Output Example

```json
{
  "meta": {
    "feedCount": 4,
    "totalEvidenceRows": 8,
    "actionNeededCount": 3,
    "executiveSummary": {
      "overallStatus": "action_needed",
      "brief": "3 feed(s) require review; 4 changed since the last run."
    }
  },
  "digests": [
    {
      "feedId": "monthly-budget",
      "status": "action_needed",
      "headline": "February MTS: $307.5B deficit; FYTD $1T deficit.",
      "recommendedAction": "Review the widening monthly deficit and update receipts/outlays commentary.",
      "changedSinceLastRun": true,
      "evidence": [
        {
          "title": "Current-month receipts vs outlays (February)",
          "primaryValue": 307501433426.17,
          "unit": "USD"
        }
      ]
    }
  ]
}
```

### API Usage

Run this actor programmatically using the Apify API. Replace `YOUR_API_TOKEN` with your token from [Apify Console → Settings → Integrations](https://console.apify.com/account/integrations).

#### cURL

```bash
curl -X POST "https://api.apify.com/v2/acts/taroyamada~treasury-fiscal-data-digest/run-sync-get-dataset-items?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "feeds": [ { "id": "debt-daily", "name": "Debt to the Penny", "source": "debt_to_penny" }, { "id": "marketable-rates", "name": "Marketable Treasury Rates", "source": "avg_interest_rates", "securityDescriptions": "Treasury Bills,Treasury Notes,Treasury Bonds" }, { "id": "monthly-budget", "name": "MTS Receipts & Outlays", "source": "mts_table_1" }, { "id": "record-auctions", "name": "Recent Record-Setting Auctions", "source": "record_setting_auction", "securityTypes": "Bills,Notes", "lookbackDays": 180 } ], "watchTerms": "deficit,10-Year,Treasury Bills", "lookbackDays": 180, "maxEvidencePerFeed": 5, "delivery": "dataset", "datasetMode": "all", "snapshotKey": "treasury-fiscal-data-digest-quickstart", "notifyOnNoNew": true, "dryRun": false }'
```

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_API_TOKEN")
run = client.actor("taroyamada/treasury-fiscal-data-digest").call(run_input={
  "feeds": [
    {
      "id": "debt-daily",
      "name": "Debt to the Penny",
      "source": "debt_to_penny"
    },
    {
      "id": "marketable-rates",
      "name": "Marketable Treasury Rates",
      "source": "avg_interest_rates",
      "securityDescriptions": "Treasury Bills,Treasury Notes,Treasury Bonds"
    },
    {
      "id": "monthly-budget",
      "name": "MTS Receipts & Outlays",
      "source": "mts_table_1"
    },
    {
      "id": "record-auctions",
      "name": "Recent Record-Setting Auctions",
      "source": "record_setting_auction",
      "securityTypes": "Bills,Notes",
      "lookbackDays": 180
    }
  ],
  "watchTerms": "deficit,10-Year,Treasury Bills",
  "lookbackDays": 180,
  "maxEvidencePerFeed": 5,
  "delivery": "dataset",
  "datasetMode": "all",
  "snapshotKey": "treasury-fiscal-data-digest-quickstart",
  "notifyOnNoNew": true,
  "dryRun": false
})

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

#### JavaScript / Node.js

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

const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });
const run = await client.actor('taroyamada/treasury-fiscal-data-digest').call({
  "feeds": [
    {
      "id": "debt-daily",
      "name": "Debt to the Penny",
      "source": "debt_to_penny"
    },
    {
      "id": "marketable-rates",
      "name": "Marketable Treasury Rates",
      "source": "avg_interest_rates",
      "securityDescriptions": "Treasury Bills,Treasury Notes,Treasury Bonds"
    },
    {
      "id": "monthly-budget",
      "name": "MTS Receipts & Outlays",
      "source": "mts_table_1"
    },
    {
      "id": "record-auctions",
      "name": "Recent Record-Setting Auctions",
      "source": "record_setting_auction",
      "securityTypes": "Bills,Notes",
      "lookbackDays": 180
    }
  ],
  "watchTerms": "deficit,10-Year,Treasury Bills",
  "lookbackDays": 180,
  "maxEvidencePerFeed": 5,
  "delivery": "dataset",
  "datasetMode": "all",
  "snapshotKey": "treasury-fiscal-data-digest-quickstart",
  "notifyOnNoNew": true,
  "dryRun": false
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

### Tips & Limitations

- Run daily for active watchlists; weekly for passive monitoring.
- Webhook delivery works well for compliance team Slack channels — include docket URL for 1-click access.
- Use `watchKeywords` generously — false positives are cheap to triage, false negatives miss filings.
- Pair with `regulatory-change-monitor` for cross-agency coverage.
- Archive Dataset rows weekly for long-term compliance evidence retention.

### FAQ

**How far back does history go?**

This actor monitors forward-only — new items since first run. For historical data, use the agency's own search tool.

**What timezones are used?**

All timestamps are UTC. Use your downstream pipeline to convert to agency-local time if needed.

**Does it translate non-English content?**

No — original language is preserved. Use downstream translation services if needed.

**Is the data official?**

Yes — sourced directly from official government websites and feeds. Not a third-party aggregator.

**Can I use this for legal research?**

For alerting and monitoring, yes. For litigation research, cross-verify with primary sources (agency websites) — this actor is a monitoring tool, not a legal database.

### Related Actors

Government & Regulatory cluster — explore related Apify tools:

- [EPA Enforcement Digest | ECHO Compliance Risk Monitor](https://apify.com/taroyamada/epa-enforcement-digest) — Monitor EPA ECHO all-media facility search, corporate compliance screener, and enforcement case feeds with one summary-first digest row per watched company, facility, or case feed.
- [FDA Warning Letters Digest | Summary-First Feed](https://apify.com/taroyamada/fda-warning-letter-digest) — Monitor public FDA warning letters with one summary-first digest row per configured feed.
- [Federal Register Digest | Agency Rule & Notice Monitor](https://apify.com/taroyamada/federal-register-digest) — Monitor Federal Register documents — rules, proposed rules, and notices — per configured agency feed.
- [Government Contract Award Monitor | Award & Competitor Watch](https://apify.com/taroyamada/government-contract-award-monitor) — Monitor public-sector contract award notices for new wins, notable awardees, incumbent recompetes, and competitor signals — one digest row per configured feed without brittle broad crawling.
- [Grants.gov Funding Digest | Opportunity Watch & Signal Digest](https://apify.com/taroyamada/grants-gov-funding-digest) — Monitor Grants.
- [NHTSA Vehicle Recall Digest | Recalls + Complaints Watch](https://apify.com/taroyamada/nhtsa-vehicle-recall-digest) — Monitor official NHTSA vehicle recall and complaint endpoints for watched model-family, VIN, and manufacturer feeds.
- [Product Safety Recall Digest | CPSC + openFDA Alerts](https://apify.com/taroyamada/product-safety-recall-digest) — Monitor CPSC saferproducts.
- [Regulatory Change Monitor API](https://apify.com/taroyamada/regulatory-change-monitor) — Monitor official regulator update feeds, government bulletin pages, and public compliance notices with one action-oriented digest row per monitored source.
- [OFAC Sanctions Change Digest | SDN List Monitor](https://apify.com/taroyamada/sanctions-change-digest) — Monitor the OFAC SDN (Specially Designated Nationals) sanctions list for additions and removals.
- [Tariff Trade Change Digest | Federal Register + HTS Monitor](https://apify.com/taroyamada/tariff-trade-change-digest) — Monitor U.
- [USPTO Patent Monitor API | JSON + Webhook](https://apify.com/taroyamada/uspto-patent-scraper) — Search and monitor US patent filings with multi-source fallback.
- [Campaign Finance & Lobbying Digest | FEC + LDA Watch](https://apify.com/taroyamada/campaign-finance-lobbying-digest) — Monitor official FEC OpenFEC committee reports and LDA.

### Cost

**Pay Per Event**:

- `actor-start`: $0.01 (flat fee per run)
- `dataset-item`: $0.003 per output item

**Example**: 1,000 items = $0.01 + (1,000 × $0.003) = **$3.01**

No subscription required — you only pay for what you use.

### ⭐ Was this helpful?

If this actor saved you time, please [**leave a ★ rating**](https://apify.com/taroyamada/treasury-fiscal-data-digest/reviews) on Apify Store. It takes 10 seconds, helps other developers discover it, and keeps updates free.

Bug report or feature request? Open an issue on the [Issues tab](https://apify.com/taroyamada/treasury-fiscal-data-digest/issues) of this actor.

# Actor input Schema

## `feeds` (type: `array`):

One entry per watch target. Each feed produces one summary digest row. Use debt\_to\_penny for headline debt, avg\_interest\_rates for monthly rates, mts\_table\_1 for receipts/outlays, and record\_setting\_auction for auction record watches.

## `watchTerms` (type: `string`):

Keywords to flag in digest evidence titles, summaries, and source dimensions. Use this for terms like deficit, 10-Year, Treasury Bills, or Bonds.

## `lookbackDays` (type: `integer`):

Used to fetch enough history for comparisons and to determine recency for record-setting auction dates. 90 works well for recurring runs; 365 is broader for discovery.

## `maxEvidencePerFeed` (type: `integer`):

Upper bound on nested evidence rows per feed digest. Keep it low for summary-first output; raise it only when you intentionally want a broader panel of securities or auction terms.

## `delivery` (type: `string`):

dataset stores results in the Apify dataset. webhook posts the digest JSON to webhookUrl.

## `webhookUrl` (type: `string`):

POST target for the digest payload. Leave empty for dataset delivery.

## `datasetMode` (type: `string`):

all emits every feed digest row. action\_needed emits only feeds with critical signals or watch-term hits. new\_only emits only feeds whose evidence changed since the prior run.

## `snapshotKey` (type: `string`):

Stable key used to persist seen evidence hashes across recurring runs so changedSinceLastRun and new\_only mode stay comparable. Use the same key across scheduled runs.

## `debtToPennyApiUrl` (type: `string`):

Treasury Fiscal Data endpoint for daily debt totals. No authentication required.

## `avgInterestRatesApiUrl` (type: `string`):

Treasury Fiscal Data endpoint for monthly average rates across marketable and non-marketable debt.

## `mtsTable1ApiUrl` (type: `string`):

Treasury Fiscal Data endpoint for receipts, outlays, and surplus/deficit summary rows.

## `recordSettingAuctionApiUrl` (type: `string`):

Treasury Fiscal Data endpoint for record-setting auction highs and lows by security type and term.

## `requestTimeoutSeconds` (type: `integer`):

Timeout for each Treasury API or webhook request.

## `notifyOnNoNew` (type: `boolean`):

When true, every feed always produces a digest row even if no new evidence was detected. When false, stable feeds are omitted from all mode output.

## `dryRun` (type: `boolean`):

Validate and fetch without persisting state or posting webhooks. Safe for testing input shapes.

## `nowIso` (type: `string`):

Set a fixed ISO timestamp to make runs deterministic against fixture data.

## `debtFixturePath` (type: `string`):

Local JSON fixture for offline debt\_to\_penny tests.

## `ratesFixturePath` (type: `string`):

Local JSON fixture for offline avg\_interest\_rates tests.

## `mtsFixturePath` (type: `string`):

Local JSON fixture for offline mts\_table\_1 tests.

## `auctionFixturePath` (type: `string`):

Local JSON fixture for offline record\_setting\_auction tests.

## Actor input object example

```json
{
  "feeds": [
    {
      "id": "debt-daily",
      "name": "Debt to the Penny",
      "source": "debt_to_penny"
    }
  ],
  "lookbackDays": 90,
  "maxEvidencePerFeed": 10,
  "delivery": "dataset",
  "datasetMode": "all",
  "snapshotKey": "treasury-fiscal-data-digest-state",
  "debtToPennyApiUrl": "https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/debt_to_penny",
  "avgInterestRatesApiUrl": "https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/avg_interest_rates",
  "mtsTable1ApiUrl": "https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v1/accounting/mts/mts_table_1",
  "recordSettingAuctionApiUrl": "https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/record_setting_auction",
  "requestTimeoutSeconds": 30,
  "notifyOnNoNew": true,
  "dryRun": false
}
```

# 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 = {
    "feeds": [
        {
            "id": "debt-daily",
            "name": "Debt to the Penny",
            "source": "debt_to_penny"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("taroyamada/treasury-fiscal-data-digest").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 = { "feeds": [{
            "id": "debt-daily",
            "name": "Debt to the Penny",
            "source": "debt_to_penny",
        }] }

# Run the Actor and wait for it to finish
run = client.actor("taroyamada/treasury-fiscal-data-digest").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "feeds": [
    {
      "id": "debt-daily",
      "name": "Debt to the Penny",
      "source": "debt_to_penny"
    }
  ]
}' |
apify call taroyamada/treasury-fiscal-data-digest --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=taroyamada/treasury-fiscal-data-digest",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "🇺🇸 US Treasury Data Scraper",
        "description": "Extract official US national debt figures, federal outlays, and average interest rates directly from the Treasury API into structured financial rows.",
        "version": "0.1",
        "x-build-id": "ki9cw48SnHzHcz1dQ"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/taroyamada~treasury-fiscal-data-digest/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-taroyamada-treasury-fiscal-data-digest",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/taroyamada~treasury-fiscal-data-digest/runs": {
            "post": {
                "operationId": "runs-sync-taroyamada-treasury-fiscal-data-digest",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/taroyamada~treasury-fiscal-data-digest/run-sync": {
            "post": {
                "operationId": "run-sync-taroyamada-treasury-fiscal-data-digest",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "feeds"
                ],
                "properties": {
                    "feeds": {
                        "title": "Treasury feeds to monitor (required)",
                        "type": "array",
                        "description": "One entry per watch target. Each feed produces one summary digest row. Use debt_to_penny for headline debt, avg_interest_rates for monthly rates, mts_table_1 for receipts/outlays, and record_setting_auction for auction record watches.",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "title": "Feed ID",
                                    "type": "string",
                                    "description": "Stable identifier used in snapshots and output rows."
                                },
                                "name": {
                                    "title": "Feed name",
                                    "type": "string",
                                    "description": "Human-readable label for this feed in the digest output."
                                },
                                "source": {
                                    "title": "Feed source",
                                    "type": "string",
                                    "description": "Treasury Fiscal Data endpoint family to summarize.",
                                    "enum": [
                                        "debt_to_penny",
                                        "avg_interest_rates",
                                        "mts_table_1",
                                        "record_setting_auction"
                                    ]
                                },
                                "securityTypes": {
                                    "title": "Security types",
                                    "type": "string",
                                    "description": "Comma-separated security type filter. Used mainly by record_setting_auction (Bills, Notes, Bonds, TIPS, FRNs, CMBs) and optionally avg_interest_rates (Marketable, Non-marketable)."
                                },
                                "securityDescriptions": {
                                    "title": "Security descriptions",
                                    "type": "string",
                                    "description": "Comma-separated security description filter for avg_interest_rates feeds (for example Treasury Bills,Treasury Notes,Treasury Bonds)."
                                },
                                "securityTerms": {
                                    "title": "Security terms",
                                    "type": "string",
                                    "description": "Comma-separated tenor filter for record_setting_auction feeds (for example 4-Week,13-Week,10-Year,30-Year)."
                                },
                                "lookbackDays": {
                                    "title": "Feed-specific lookback window (days)",
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 730,
                                    "description": "Override the global lookbackDays for this individual feed. For record_setting_auction this controls how recent a record-setting date must be to get a recent_record_event signal."
                                },
                                "maxEvidence": {
                                    "title": "Feed-specific evidence cap",
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 50,
                                    "description": "Override the global maxEvidencePerFeed for this individual feed."
                                }
                            }
                        }
                    },
                    "watchTerms": {
                        "title": "Watch terms (comma-separated)",
                        "type": "string",
                        "description": "Keywords to flag in digest evidence titles, summaries, and source dimensions. Use this for terms like deficit, 10-Year, Treasury Bills, or Bonds."
                    },
                    "lookbackDays": {
                        "title": "Global lookback window (days)",
                        "minimum": 1,
                        "maximum": 730,
                        "type": "integer",
                        "description": "Used to fetch enough history for comparisons and to determine recency for record-setting auction dates. 90 works well for recurring runs; 365 is broader for discovery.",
                        "default": 90
                    },
                    "maxEvidencePerFeed": {
                        "title": "Max evidence rows per feed",
                        "minimum": 1,
                        "maximum": 50,
                        "type": "integer",
                        "description": "Upper bound on nested evidence rows per feed digest. Keep it low for summary-first output; raise it only when you intentionally want a broader panel of securities or auction terms.",
                        "default": 10
                    },
                    "delivery": {
                        "title": "Delivery mode",
                        "enum": [
                            "dataset",
                            "webhook"
                        ],
                        "type": "string",
                        "description": "dataset stores results in the Apify dataset. webhook posts the digest JSON to webhookUrl.",
                        "default": "dataset"
                    },
                    "webhookUrl": {
                        "title": "Webhook URL (required when delivery=webhook)",
                        "type": "string",
                        "description": "POST target for the digest payload. Leave empty for dataset delivery."
                    },
                    "datasetMode": {
                        "title": "Dataset output mode",
                        "enum": [
                            "all",
                            "action_needed",
                            "new_only"
                        ],
                        "type": "string",
                        "description": "all emits every feed digest row. action_needed emits only feeds with critical signals or watch-term hits. new_only emits only feeds whose evidence changed since the prior run.",
                        "default": "all"
                    },
                    "snapshotKey": {
                        "title": "Snapshot key for recurring state",
                        "type": "string",
                        "description": "Stable key used to persist seen evidence hashes across recurring runs so changedSinceLastRun and new_only mode stay comparable. Use the same key across scheduled runs.",
                        "default": "treasury-fiscal-data-digest-state"
                    },
                    "debtToPennyApiUrl": {
                        "title": "Debt to the Penny API URL",
                        "type": "string",
                        "description": "Treasury Fiscal Data endpoint for daily debt totals. No authentication required.",
                        "default": "https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/debt_to_penny"
                    },
                    "avgInterestRatesApiUrl": {
                        "title": "Average interest rates API URL",
                        "type": "string",
                        "description": "Treasury Fiscal Data endpoint for monthly average rates across marketable and non-marketable debt.",
                        "default": "https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/avg_interest_rates"
                    },
                    "mtsTable1ApiUrl": {
                        "title": "Monthly Treasury Statement Table 1 API URL",
                        "type": "string",
                        "description": "Treasury Fiscal Data endpoint for receipts, outlays, and surplus/deficit summary rows.",
                        "default": "https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v1/accounting/mts/mts_table_1"
                    },
                    "recordSettingAuctionApiUrl": {
                        "title": "Record-setting auction API URL",
                        "type": "string",
                        "description": "Treasury Fiscal Data endpoint for record-setting auction highs and lows by security type and term.",
                        "default": "https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/record_setting_auction"
                    },
                    "requestTimeoutSeconds": {
                        "title": "HTTP request timeout (seconds)",
                        "minimum": 5,
                        "maximum": 120,
                        "type": "integer",
                        "description": "Timeout for each Treasury API or webhook request.",
                        "default": 30
                    },
                    "notifyOnNoNew": {
                        "title": "Emit digest even when no changes were found",
                        "type": "boolean",
                        "description": "When true, every feed always produces a digest row even if no new evidence was detected. When false, stable feeds are omitted from all mode output.",
                        "default": true
                    },
                    "dryRun": {
                        "title": "Dry run (skip snapshot writes and webhook delivery)",
                        "type": "boolean",
                        "description": "Validate and fetch without persisting state or posting webhooks. Safe for testing input shapes.",
                        "default": false
                    },
                    "nowIso": {
                        "title": "Override current time (ISO string, for testing)",
                        "type": "string",
                        "description": "Set a fixed ISO timestamp to make runs deterministic against fixture data."
                    },
                    "debtFixturePath": {
                        "title": "Debt fixture file path (testing)",
                        "type": "string",
                        "description": "Local JSON fixture for offline debt_to_penny tests."
                    },
                    "ratesFixturePath": {
                        "title": "Rates fixture file path (testing)",
                        "type": "string",
                        "description": "Local JSON fixture for offline avg_interest_rates tests."
                    },
                    "mtsFixturePath": {
                        "title": "MTS fixture file path (testing)",
                        "type": "string",
                        "description": "Local JSON fixture for offline mts_table_1 tests."
                    },
                    "auctionFixturePath": {
                        "title": "Auction fixture file path (testing)",
                        "type": "string",
                        "description": "Local JSON fixture for offline record_setting_auction tests."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
