Linking US Treasury Fiscal Data as a source

Let AI connect your sources for you

Skip the manual setup — run this in your project and the wizard auto-detects your databases and APIs and connects them to PostHog.

Learn more
PostHog Wizard hedgehog

Alpha release

This source is currently in alpha. The interface and available tables may change.

The US Treasury Fiscal Data connector syncs exchange rates, average interest rates, and federal debt totals into the PostHog data warehouse, so you can analyze them alongside your product data.

Data comes from the US Treasury Fiscal Data API, a free public service that requires no API key or account.

Prerequisites

None. The US Treasury Fiscal Data API is public and requires no authentication.

Adding a data source

  1. In PostHog, go to the Sources tab of the data pipeline section.
  2. Click + New source and click Link next to this source.
  3. Enter your credentials (see Configuration below) and click Next.
  4. Select the tables you want to sync, choose a sync method and frequency, then click Import.

Once the syncs are complete, you can start querying this data in PostHog.

Because this is a public API, there are no credentials or configuration fields to fill in. Select the tables you want to sync and choose your sync mode.

Sync modes

Each table can be synced in one of several modes, depending on what the source supports:

  • Webhook (when available) – the source pushes changes to PostHog in real time. Fastest freshness, lowest ongoing cost, and the only mode that reliably captures updates and deletes.
  • Incremental – only new or updated rows are synced on each run, using a cursor field (such as an updated_at timestamp). Cheaper than a full refresh, but deletes aren't captured.
  • Append only – new rows are appended using a cursor field; existing rows are never updated. Ideal for immutable, append-only tables like event logs.
  • Full refresh – the whole table is reloaded on every sync. Use it when a table has no reliable cursor or when you need deletions reflected.

See sync methods for a full explanation of how each mode works and how to choose between them.

All US Treasury Fiscal Data tables support both incremental and full refresh sync modes.

  • Incremental sync fetches rows where the incremental field is on or after the last synced date. The incremental field is effective_date for rates_of_exchange and record_date for the other tables.

  • Full refresh re-downloads all rows each sync.

Note: The Treasury API does not expose a modification timestamp. If historical rows are corrected before your last synced date, those corrections won't appear in incremental syncs. Run a full refresh to pick up historical corrections.

Configuration

Supported tables

TableDescriptionSync methodIncremental fieldPrimary key
rates_of_exchange

Quarterly Treasury exchange rates, including amendments with separate effective dates.

Incremental, Full refresheffective_date—
avg_interest_rates

Monthly average interest rates on outstanding Treasury securities, grouped by security type.

Incremental, Full refreshrecord_date—
debt_to_penny

Daily total federal debt, split between public holdings and government accounts.

Incremental, Full refreshrecord_date—

Troubleshooting

  • If a sync fails with an access error, the Treasury API may be temporarily unavailable. Wait a few minutes and try again.
  • If a table syncs no rows, verify the table name is correct and the Treasury API is reachable at fiscaldata.treasury.gov.
  • If you suspect historical data has been corrected, run a full refresh to re-download all rows.

If your sync is failing or data looks wrong, see the Data warehouse troubleshooting guide. If that doesn't help, contact support – we're happy to help.

Still have questions?

Was this page useful?