{dataset}: Query dataset data

API: census.gov:census-data-api
Endpoint: /data/{year}/{dataset}
Response format: unknown
Auth: unknown
Method: GET

Description

Retrieve demographic, economic, or housing data for a specific dataset and year. Use the 'get' parameter to specify variables, and 'for' to specify geography. Common datasets include 'acs/acs5' (5-year ACS), 'acs/acs1' (1-year ACS), and 'dec/sf1' (decennial census).

Parameters (5)

dataset (string, path, required)

Dataset path. Common values: 'acs/acs5' (ACS 5-year), 'acs/acs1' (ACS 1-year), 'dec/sf1' (Decennial Summary File 1), 'cbp' (County Business Patterns)

for (string, query, required)

Geography specification using FIPS codes. Format: 'geography:code' or use '*' for wildcard. Examples: 'state:06' (California), 'state:*' (all states), 'county:037' in 'state:06' (LA County)

get (string, query, required)

Comma-separated list of variables to retrieve. First variable should typically be NAME for the geography name. Use variable codes like B01001_001E (total population estimate).

in (string, query, optional)

Parent geography for nested queries. Used when requesting smaller geographies within larger ones. Format: 'geography:code'. Example: 'state:06' when requesting counties within California.

year (string, path, required)

Vintage (year) of the dataset. Examples: 2022, 2020, 2010

Constraints: {'pattern': '^\\d{4}$'}

Examples (1)

Query dataset data openapi-spec
curl 'https://api.census.gov/data/{year}/{dataset}'
import requests

resp = requests.get("https://api.census.gov/data/{year}/{dataset}")
data = resp.json()
import zingu_apis

api = zingu_apis.api("census-data")
result = api.fetch("data/{year}/{dataset}")

for item in result:
    print(item)
const resp = await fetch("https://api.census.gov/data/{year}/{dataset}");
const data = await resp.json();

No probe data for this endpoint yet.