US Census of Governments Finance API
State and local government finance — revenue, spending, and cash and security holdings — for every state, county, municipality and township the US Census Bureau surveyed from FY1967 through FY2024, as one public, read-only JSON API. No account, no key, nothing to download.
The corpus behind it harmonizes the Census Bureau’s Individual Unit
Files across five decades of changing identifiers, item codes and file
layouts, so a query for one government returns a continuous series
instead of a dozen incompatible vintages. Scope is government types 0–3
— state, county, municipality and township; special districts and
independent school districts are not included. FY1968 and FY1969 have no
source data: the published years are a set, not an unbroken
span, and GET /api/v1/ names the gaps in its scope
string.
Quickstart
Every per-government route takes a 12-character
canonical_govid in its path, and
/governments?q= is what turns a place name into one. Start
there.
curl
# 1. Resolve a name to its canonical_govid.
curl -s "https://cog-api.civilytics.org/api/v1/governments?q=Madison&state=WI&type=city"
# 2. Three snapshots of police spending, in 2024 dollars, per resident.
# years= is a comma-separated list; there is no range syntax.
curl -s "https://cog-api.civilytics.org/api/v1/governments/552025209777/spending?category=Police&years=2014,2019,2024&adjust=real&base_year=2024&per_capita=true"R
library(httr2)
base <- "https://cog-api.civilytics.org/api/v1"
# 1. Resolve a place name to its 12-character canonical_govid.
gov <- request(base) |>
req_url_path_append("governments") |>
req_url_query(q = "Madison", state = "WI", type = "city") |>
req_perform() |>
resp_body_json()
govid <- gov$data[[1]]$canonical_govid
# 2. Pull a real, per-capita police spending series for that government.
spend <- request(base) |>
req_url_path_append("governments", govid, "spending") |>
req_url_query(category = "Police", years = "2014,2019,2024",
adjust = "real", base_year = 2024, per_capita = "true") |>
req_perform() |>
resp_body_json()
for (row in spend$data) {
cat(sprintf("%d %-10s $%.2f per capita (2024 dollars)\n",
row$year, row$spend_subtype, row$amt_per_capita_real))
}Python
import requests
BASE = "https://cog-api.civilytics.org/api/v1"
# 1. Resolve a place name to its 12-character canonical_govid.
gov = requests.get(f"{BASE}/governments",
params={"q": "Madison", "state": "WI", "type": "city"},
timeout=60).json()
govid = gov["data"][0]["canonical_govid"]
# 2. Pull a real, per-capita police spending series for that government.
spend = requests.get(f"{BASE}/governments/{govid}/spending",
params={"category": "Police", "years": "2014,2019,2024",
"adjust": "real", "base_year": 2024,
"per_capita": "true"},
timeout=60).json()
for row in spend["data"]:
print(f'{row["year"]} {row["spend_subtype"]:<10} '
f'${row["amt_per_capita_real"]:.2f} per capita')Key concepts
Enough to keep you out of the common traps. The API’s own docs are the authority on parameters — see the links at the end of this section.
- One envelope, always. Every response is
{status, data, error, meta, provenance, suggestions}.provenancerecords the exact underlying call, so a figure in a report can be traced back to the query that produced it. - An empty
datais a real answer.status: "success"withdata: []means the government reported nothing matching your filters — a common, genuine condition in this data. It never means a bad ID or an unavailable year; those are 400s with their own messages. - Coverage varies enormously by year. The Census of
Governments is a complete census only in years ending in 2 or 7. Every
other year is a sample, and the sample varies: of Wisconsin’s 608
cities, 597 reported in FY2012 and 112 in FY2019. The peer endpoints
report
n_units_expectedagainstn_units_reportingso a thin year cannot mislead you silently. - Money parameters.
adjust=nominal|realwithbase_year=YYYY,per_capita=true|false, andbasis=harmonized|raw. Pinbase_yearexplicitly if you want a figure that stays stable as new years land. - Concepts change the number.
expenditure_concept=primary|direct|total(defaultprimary) andrevenue_concept=general|total(defaultgeneral) select which Census concept you get. The defaults are the narrower ones: a city’s general revenue excludes utility and liquor-store revenue, which is 15.9% of city revenue across the corpus. Ask fortotalwhen you need it. - Unknown parameters are rejected, never ignored. A misspelled filter is a 400 that names the offending key, so a typo can’t quietly widen your query.
- Vocabulary.
/categorieslists the metric dictionary;/recipeslists the harmonization recipes that stitch multi-code, cross-vintage series together.
Full parameter contract: llms.txt
(written for agents, but the most complete prose reference), the data
dictionary, and the interactive Swagger
docs.
Guides and specification
- Working with the COG Finance API — a Southern guide — an executable walkthrough for state, county and city analysis across the Census South Region. Twelve worked charts — healthcare access across the states, environmental justice in the counties, economic security in the cities — every figure fetched live from this API at the moment the page was built, with the exact call shown beneath each one. Ends with Tableau connection guidance and a plain-spoken list of known limitations.
- API specification (PDF) — the formal reference, describing the API as built. Its endpoint, parameter, category and scope tables are generated from the live server at render time, so the document cannot silently drift from the deployment it describes.
Citation
The corpus and the API are separate artifacts with separate versions; cite whichever you actually used, and cite the Census Bureau as the underlying source in both cases.
The corpus:
Jared Knowles and Hannah Miller. 2026. “US Census of Governments Finance Corpus (FY1967–FY2024).” Civilytics Consulting. Available online at: https://huggingface.co/datasets/civilytics/us-cog-finance
Released under CC-BY-4.0. main is the rolling latest;
for an immutable reference, cite the commit SHA
(resolve/<sha>/) rather than a version tag.
The API:
Jared Knowles and Hannah Miller. 2026. “US Census of Governments Finance API (v1).” Civilytics Consulting. Available online at: https://cog-api.civilytics.org/api/v1/
The underlying source, which both of the above derive from:
US Census Bureau. Annual Survey of State and Local Government Finances and Census of Governments, Individual Unit Files, FY1967–FY2024. Available online at: https://www.census.gov/programs-surveys/gov-finances.html
Acknowledgements
This work was sponsored by the Southern Economic Advancement Project, whose support paid for the multi-year harmonization that makes a single query span fifty-eight years of changing federal file formats. The interpretations here are Civilytics’ own.