Setup
Put them in your environment or
.env; Data APIs covers the other ways.
Notes
- Data answers are a two-dimensional JSON array: the first row is the column names, each later row one geography. Missing values are null. Numbers come back as strings.
- get takes up to 50 variables, comma-separated; NAME gives the geography’s name and group(TABLE) every variable of a table. ACS estimates end in E and their margins of error in M (B01001_001E, B01001_001M).
- Geography is for=<level>:<code or >, narrowed with in=<parent>:<code> (e.g. for=county:&in=state:06). Codes are FIPS.
- The Census Bureau’s guide says a key must be used with data queries; light keyless use is tolerated but limited per IP.
- Find datasets with GET /data.json and a dataset’s variables with its variables.json before querying.
Endpoints
List datasets
- A large catalog file (api.census.gov/data.json); filter it locally.
Query American Community Survey detailed tables
Query ACS profile or subject tables
List an ACS dataset’s variables
- Tens of thousands of variables; a group’s own variables are at /{year}/acs/{survey}/groups/{TABLE}.json.
Query decennial census data
Geocode a one-line address
- Keyless. Pass format=json, or the answer is HTML.