Guide · Public sector data

USAspending API: federal spending data in code

USAspending.gov publishes what the US federal government has awarded: contracts, grants, loans and other assistance. Its API is free and public and needs no key. One POST request to the award search endpoint returns awarded contracts or grants that match a keyword, agency, recipient or date window. This guide shows a working request in Python, the things that most often break a first script, and how awarded spending differs from open bids.

This guide is independent and is not an official USAspending.gov resource.

You need: Python 3 and an internet connection. There's no account or key to set up.

How do I search federal spending with the USAspending API?

Send a POST to https://api.usaspending.gov/api/v2/search/spending_by_award/ with your filters, the fields you want back and a page size. This example asks for contracts that mention "semiconductor" with activity in the 30 days to 15 November 2026, largest first:

import json, urllib.request

body = {
    "filters": {
        "keywords": ["semiconductor"],
        "award_type_codes": ["A", "B", "C", "D"],  # the contracts group
        "time_period": [{"start_date": "2026-10-16", "end_date": "2026-11-15"}],
    },
    "fields": ["Award ID", "Recipient Name", "Award Amount", "Awarding Agency", "Start Date"],
    "limit": 5,
    "sort": "Award Amount",
    "order": "desc",
}
req = urllib.request.Request(
    "https://api.usaspending.gov/api/v2/search/spending_by_award/",
    data=json.dumps(body).encode(),
    headers={"Content-Type": "application/json"},
)
with urllib.request.urlopen(req, timeout=90) as r:
    data = json.load(r)
for a in data["results"]:
    print(a["Award ID"], a["Recipient Name"], a["Award Amount"], a["Awarding Agency"], a["Start Date"])
print("More pages:", data["page_metadata"]["hasNext"])

On 15 November 2026 the first two lines it printed were:

2031ZA23C00036 SPECTRA SYSTEMS CORPORATION 1995916.0 Department of the Treasury 2023-05-31
80NSSC27P0146 MICRON SEMICONDUCTOR LIMITED 287205.0 National Aeronautics and Space Administration 2026-10-27

Codes A to D are the four contract types (BPA call, purchase order, delivery order and definitive contract). To see how many awards match before you fetch them, send the same filters without award_type_codes to /api/v2/search/spending_by_award_count/. For this search it counted 12 contracts, 2 grants, 1 loan and 1 other award.

What trips people up?

Is USAspending the same as SAM.gov or Grants.gov?

No. USAspending shows money that has already been awarded. Contract opportunities that are still open are on SAM.gov, and open grant opportunities are on Grants.gov. See our SAM.gov API guide and Grants.gov API guide for those. A common pattern is to watch open bids in one source and check who won similar work before in USAspending.

We built this

Disclosure: Your Evenings built and sells this. It's independent and isn't affiliated with or endorsed by the U.S. Department of the Treasury or the Bureau of the Fiscal Service. The USAspending Federal Spending API on Apify Store runs these searches for you and returns one clean row per award.

Pricing: $0.002 per award returned, plus $0.01 per monitor run that returns new or changed awards and a small Actor start fee. Higher Apify plans pay less. A run that returns 25 awards costs 25 × $0.002 = $0.05, plus the start fee.

FAQ

Do I need an API key for the USAspending API? No. The USAspending.gov API is public and works without a key or an account.

How far back does the USAspending API go? Award searches start on 1 October 2007. An earlier start date returns an error. For older awards, use the Custom Award Download on USAspending.gov or its download endpoints.

Why does my USAspending search return old awards? The date filter matches the latest transaction by default, so an older award with a recent change is included. Set date_type to new_awards_only to keep only new awards.

Why does my agency filter return nothing? The agency filter needs USAspending's full agency name, such as National Aeronautics and Space Administration rather than NASA. An abbreviation returns no results and no error.

Is USAspending the same as SAM.gov? No. USAspending shows money already awarded. Open contract opportunities are on SAM.gov and open grant opportunities are on Grants.gov.

Product names and logos belong to their owners. Your Evenings is not affiliated with or endorsed by them. Award data from USAspending.gov (U.S. Department of the Treasury, Bureau of the Fiscal Service). Your Evenings is not affiliated with or endorsed by the U.S. Department of the Treasury or the Bureau of the Fiscal Service.