US federal spending by state API
US federal spending summed by state, county or country, filtered by industry, product code or keyword, from USAspending.gov.
GET /v1/economy/government-spend1 credit per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/economy/government-spend?naics=4811&geo=state",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()Response
200 · 1 credit{ "scope": "place_of_performance", "geo_layer": "state", "from_date": "2024-10-01", "to_date": "2025-09-30", "results": [ { "shape_code": "WA", "display_name": "Washington", "aggregated_amount": 7069768.11, "population": 7705281, "per_capita": 0.92 }, { "shape_code": "GA", "display_name": "Georgia", "aggregated_amount": 6901096.24, "population": 10711908, "per_capita": 0.64 }, "… 25 more" ]}Parameters
| Name | Type | Description |
|---|---|---|
naicsquery | string | NAICS codes (2, 4 or 6 digits), comma-separated, up to 20. |
pscquery | string | Product or service codes (1 to 4 characters), comma-separated, up to 20. |
keywordquery | string | Free text matched against award descriptions (3 to 120 characters). |
from_datequery | string | YYYY-MM-DD, from 2007-10-01. Defaults to the last complete federal fiscal year. |
to_datequery | string | YYYY-MM-DD. |
geoquery | "state" | "county" | "country" | One of state, county, country. |
scopequery | "place_of_performance" | "recipient_location" | One of place_of_performance, recipient_location. |
award_typequery | "contracts" | "grants" | "all" | One of contracts, grants, all. |
Response fields
200 with a EconomyGovernmentSpend, in Economy’s own JSON.
| Field | Type | Description |
|---|---|---|
scope | string | |
geo_layer | string | |
from_date | string | |
to_date | string | |
results | object[] |
Status codes
| Status | Meaning |
|---|---|
200 | Amounts by place, largest first. |
400 | Invalid input. Nothing was charged. |
401 | Missing or invalid API key. |
402 | Not enough credits, a spend cap was reached, or payment is required. |
403 | The target is private, or the account is suspended. |
404 | No data matches. |
429 | Too many requests. Wait for Retry-After seconds. |
503 | Economy is temporarily unavailable. Retryable; nothing was charged. |
Every error has code, message, hint and retryable. All error codes
Questions
Which years?
Any window from fiscal 2008; the last complete fiscal year by default.
Economy is a trademark of their publishers (Eurostat, the US Treasury, ImportYeti). We are not affiliated with or endorsed by their publishers (Eurostat, the US Treasury, ImportYeti).