# US Treasury FiscalData Scraper API - Debt & Interest Rates (`pink_comic/us-treasury-fiscaldata-debt-interest-rates`) Actor

Query official Treasury FiscalData time series for Debt to the Penny and average Treasury security interest rates. Filter dates, fiscal year and calendar month; paginate and receive normalized values, units, source URLs and revision caveats.

- **URL**: https://apify.com/pink\_comic/us-treasury-fiscaldata-debt-interest-rates.md
- **Developed by:** [Ava Torres](https://apify.com/pink_comic) (community)
- **Categories:** Business, Automation, AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 us treasury fiscaldata scraper api - debt & intere evidence items

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 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 API - Debt & Interest Rates

Query official no-key Treasury FiscalData time series with normalized values, exact decimal strings, pagination evidence, units, source URLs, and revision caveats.

### Supported datasets

- `debt_to_penny` — official `/accounting/od/debt_to_penny`; USD; daily federal-business-day observations.
- `average_interest_rates` — official `/accounting/od/avg_interest_rates`; percent; monthly observations by security type and description.

Unsupported names fail before a request. Debt-limit/statutory data is not selectable because a durable exact FiscalData endpoint was not validated.

### Start here

```json
{}
```

Empty input returns one latest Debt to the Penny observation with debt held by the public, intragovernmental holdings, and total public debt outstanding. Maximum first-run charge: **$0.0021** ($0.0001 start + $0.002/item).

```json
{
  "dataset": "average_interest_rates",
  "fiscalYear": 2025,
  "calendarMonth": 6,
  "sortDirection": "desc",
  "maxResults": 25
}
```

Filters include inclusive start/end dates, record fiscal year, record calendar month, date sorting, starting source page, and a total 1–500 result cap. `calendarMonth` is not represented as fiscal month. At most 20 source pages are followed. A 25-item run costs at most $0.0501; an Apify maximum-charge budget reduces the cap before source work.

### Interpretation limits

Treasury FiscalData observations are historical administrative data and can be corrected or revised. Dataset cadences differ: Debt to the Penny is generally published for federal business days, while average rates are monthly. These records are not real-time quotes, forecasts, investment advice, legal conclusions, debt-limit analysis, or guarantees of current conditions. USD debt values and percentage interest rates remain separate. `NO_MATCH` and `SOURCE_UNAVAILABLE` outcomes are explicit.

See the [Debt to the Penny dataset](https://fiscaldata.treasury.gov/datasets/debt-to-the-penny/debt-to-the-penny), [Average Interest Rates dataset](https://fiscaldata.treasury.gov/datasets/average-interest-rates-treasury-securities/average-interest-rates-on-u-s-treasury-securities), and [API documentation](https://fiscaldata.treasury.gov/api-documentation/).

# Actor input Schema

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

Exact validated official endpoint. Debt-limit/statutory evidence is not selectable because no endpoint was validated; unsupported names fail before a request.

## `startDate` (type: `string`):

Inclusive record date, YYYY-MM-DD.

## `endDate` (type: `string`):

Inclusive record date, YYYY-MM-DD.

## `fiscalYear` (type: `integer`):

Treasury record\_fiscal\_year filter. Zero means any year.

## `calendarMonth` (type: `integer`):

Treasury record\_calendar\_month filter (1-12). This is calendar month, not a manufactured fiscal-month value. Zero means any month.

## `sortDirection` (type: `string`):

Optional record date sort filter or result-control setting. See the README for exact source semantics, bounds, and examples.

## `pageNumber` (type: `integer`):

FiscalData page number. Additional pages are fetched only as needed, up to maxResults and 20 pages.

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

Total paid output items, 1-500. At $0.002/item, 25 items cost at most $0.0501 including the $0.0001 start; an Apify run charge cap reduces this before requests.

## Actor input object example

```json
{
  "dataset": "debt_to_penny",
  "fiscalYear": 0,
  "calendarMonth": 0,
  "sortDirection": "desc",
  "pageNumber": 1,
  "maxResults": 1
}
```

# 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 = {
    "dataset": "debt_to_penny",
    "sortDirection": "desc",
    "maxResults": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("pink_comic/us-treasury-fiscaldata-debt-interest-rates").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 = {
    "dataset": "debt_to_penny",
    "sortDirection": "desc",
    "maxResults": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("pink_comic/us-treasury-fiscaldata-debt-interest-rates").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 '{
  "dataset": "debt_to_penny",
  "sortDirection": "desc",
  "maxResults": 1
}' |
apify call pink_comic/us-treasury-fiscaldata-debt-interest-rates --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=pink_comic/us-treasury-fiscaldata-debt-interest-rates",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

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