> ## Documentation Index
> Fetch the complete documentation index at: https://lava.so/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# U.S. Treasury

> U.S.

U.S. Treasury fiscal data API providing national debt levels, federal spending, revenue, and exchange rate data. Best for fiscal policy analysis, tracking government debt trends, or retrieving official U.S. exchange rates. Covers the federal government's financial position — complementary to BEA (economic output) and BLS (labor/prices).

2 example endpoints available through Lava's AI Gateway. See the [U.S. Treasury API docs](https://fiscaldata.treasury.gov/api-documentation/) for full documentation.

<Info>This provider is **managed** — no additional setup required.</Info>

<Info>This is a **catch-all provider** — any valid URL under `https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2` is supported. US Treasury fiscal data API. Construct URL as [https://api.fiscaldata.treasury.gov/services/api/fiscal\_service/v2/\&#123;endpoint\&#125](https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/\&#123;endpoint\&#125);. Common endpoints: /accounting/od/debt\_to\_penny, /accounting/od/rates\_of\_exchange, /revenue/mts/mts\_table\_1. Supports ?fields=, ?filter=, ?sort=, ?page\[size]= query params. The endpoints below are curated examples.</Info>

## Endpoints

### Get US national debt (debt to the penny)

**GET** `https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/debt_to_penny?fields=record_date,tot_pub_debt_out_amt&sort=-record_date&page%5Bsize%5D=5` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/debt_to_penny?fields=record_date,tot_pub_debt_out_amt&sort=-record_date&page%5Bsize%5D=5', { method: 'GET' });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.fiscaldata.treasury.gov%2Fservices%2Fapi%2Ffiscal_service%2Fv2%2Faccounting%2Fod%2Fdebt_to_penny%3Ffields%3Drecord_date%2Ctot_pub_debt_out_amt%26sort%3D-record_date%26page%255Bsize%255D%3D5" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY"
    ```
  </Tab>
</Tabs>

### Get Treasury exchange rates

**GET** `https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v1/accounting/od/rates_of_exchange?fields=record_date,country_currency_desc,exchange_rate&sort=-record_date&page%5Bsize%5D=5` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v1/accounting/od/rates_of_exchange?fields=record_date,country_currency_desc,exchange_rate&sort=-record_date&page%5Bsize%5D=5', { method: 'GET' });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.fiscaldata.treasury.gov%2Fservices%2Fapi%2Ffiscal_service%2Fv1%2Faccounting%2Fod%2Frates_of_exchange%3Ffields%3Drecord_date%2Ccountry_currency_desc%2Cexchange_rate%26sort%3D-record_date%26page%255Bsize%255D%3D5" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY"
    ```
  </Tab>
</Tabs>

## Next Steps

<CardGroup cols={2}>
  <Card title="All Providers" icon="grid" href="/gateway/supported-providers">
    Browse all supported AI providers
  </Card>

  <Card title="Forward Proxy" icon="route" href="/gateway/forward-proxy">
    Learn how to construct proxy URLs and authenticate requests
  </Card>
</CardGroup>
