US Census of Governments Finance API
Built with the support of the Southern Economic Advancement Project.
Live API /api/v1/ — JSON envelope, governments & finance series Swagger / OpenAPI Interactive docs + schema Agent guide llms.txt — the full parameter contract, for LLM agents Bulk downloads Hugging Face — hive-partitioned parquet

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.

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

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.

Sponsored by the Southern Economic Advancement Project.