See it on GitHub

A daily data feed for the U.S. Treasury

$ About

⚠️ Under renovation ⚠️

Hey there! We're in the process of porting this website over to Engima's instance of this database and revamping our query builder, if possible. In the meantime, you can access the data directly via their query interface here:

The data

Every day at 4pm, the United States Treasury publishes data tables summarizing the cash spending, deposits, and borrowing of the Federal government. These files catalog all the money taken in that day from taxes, the programs, and how much debt the government took out to make it happen. It comes from a section of the U.S. Treasury called the Bureau of the Fiscal Service

At a time of record fiscal deficits and continual debates over spending, taxation, and the debt, this daily accounting of our government's main checking account is an essential data point that the public should have ready access to.

Original data format

The Treasury told us in response to a Freedom of Information Act Request that it does not store this data in any format other than inconsistently structured text files that don't lend themselves to programmatic analysis.

New data format

We have created the first-ever electronically-searchable database of the Federal government's daily cash spending and borrowing. It updates daily and the data can be exported in various formats and loaded into a variety of systems. It is also 100% open source and free to use. We started the project at the Columbia and Stanford Bi-Coastal Datafest Hackathon and continued the it with support from a Knight-Mozilla OpenNews Code Sprint Grant.

We want to make it easy for people to search, explore, and visualize how the government spends their tax dollars.

$ Documentation

We created a fully-documented data dictionary that details the structure of these tables as well as descriptions of many programs and classifications. If you're the kind to prefer your data dictionaries in hard-copies, here's the full documentation as a PDF. We also have an FAQ or any other questions you might have.

The data is complicated, however, and we recommend that you reach out to the Bureau of the Fiscal Service at the U.S. Treasury directly via that page or at Note that the units of the data are in millions e.g. 1000 equals $1 billion.

Always query responsibly.

This API provides eight tables. You can access them with the short names in parentheses. Click "preview" to download the first ten rows of the table as CSV, and click "full" to download the full table as CSV.

You can also download the full SQLite3 database, with all of the tables. It's about 50mb in total.

To see the table schema and column types, you can use this query: "name","sql" FROM sqlite_master

$ Usage

The eight tables are stored in one SQLite database and the API. To get the data back as JSON, query it from a URL like this:

where YOUR_QUERY is a URL-encoded SQL command. This query will show the ten most recent withdrawals. * FROM t2 WHERE transaction_type = 'withdrawal' ORDER BY date DESC LIMIT 10

Note: We're submitting a plain-text query string because the browser is doing the URL-encoding here. The libraries we've written either do that for you or expect it a URL-encoded query, as shown in the examples.

Host it yourself

If you want to install the database locally, follow the instructions on the GitHub page


You can cite this data as "U.S. Treasury data via" Or, with links:

<a href="" target="_blank">U.S. Treasury data</a> via <a href="" target="_blank"></a>.

$ Libraries

  • Python

    Install with pip.

    pip install treasuryio

    Alternatively, copy the query function from here.

    Send SQL, and get a pandas DataFrame.

    import treasuryio
    treasuryio.query('SELECT * FROM sqlite_master')

    This package lives here.

  • R

    install_github('Rtreasuryio', 'csvsoundsystem')

    Alternatively, copy the treasuryio function from here.

    Send SQL, and get a data.frame.

    treasuryio('SELECT * FROM sqlite_master')

    This package lives here.

  • JavaScript

    There isn't a separate library for JavaScript (if you want one, let us know), you can just call it through jQuery's $.ajax().

    Include jQuery :

    <script src="//"></script>

    Create a function treasuryIo() that holds the API endpoint and accepts a query string. Pass it a query and get the JSON response.

    function treasuryIo(query){
      return $.ajax({
        url: ''+query
    treasuryIo('SELECT * FROM t1 LIMIT 10')

    If you want a CSV response instead of JSON, you can include the dsv.js library, which is the CSV parser and formatter from d3.js.

    <script src="js/thirdparty/dsv.min.js"></script>

    Then, when you call treasuryIo(), convert into a CSV like so :

    treasuryIo('SELECT * FROM t1 LIMIT 10')
        var csv_response = dsv.csv.format(response);
  • Node.js

    Install with npm

    npm install treasuryio

    Send SQL, and get a csv or json representation of the data, depending on what string you pass as the second argument.

    var treasuryio = require('treasuryio')
    treasuryio('SELECT * FROM t1 LIMIT 10', 'csv', function(err, response){
        if (err) console.log(err)

    This module lives here.

  • Ruby

    Install the gem

    gem install treasuryio

    Send SQL, and get a list of hashes.

    require 'treasuryio'
    puts (treasuryio 'SELECT * FROM t1 LIMIT 10')

    This module lives here.

  • Google Docs

    Paste this function into the script editor. (Or wait a bit; we've submitted it to the script gallery.)

    function treasuryio(sql) {
      var response = UrlFetchApp.fetch("" + encodeURIComponent(sql));
      var data = JSON.parse(response.getContentText());
      if (data.length == 0){
        return [];
      } else {
        // Unfortunately, this is ordered arbitrarily and is not guaranteed to be consistant.
        var keys = Object.keys(data[0]);
        return [keys].concat({return{return row[key]})}))

    Then use it like so

    =treasuryio("SELECT * FROM t1 limit 10")

    Here's an example.

$ The Robot

The twitter account @TreasuryIO is a python Twitter bot we made that tweets out daily analyses of the data.

It runs SQL queries on the database and then turns the results into tweetable messages. You can make your own bot by using our PyTreasuryIO package on GitHub, which includes instructions on how to make your own bot based on a SQL query of your choosing. The example bot calculates the total outstanding federal debt.

Some sample tweets the bot makes:

  • The distance to the debt ceiling.
  • Notifications of income from taxes.
  • How much the money spent on different programs like:
    • Food Stamps
    • Veterans Affairs Benefits Programs
    • Medicare

$ Contact

For help with accessing the API or running it yourself, contact us via any of these means.

You should also contact us if you've done something cool with the API because we'd love to hear about it.

$ Testimonials

.@TreasuryIO is just awesome. Simple to use, clear docs, data dictionary, client libraries and code on @GitHub. #opendata done right.

Mark Headd

Well [this] is literally bad ass as fuck. I didn't even know that data was publicly available!