Skill Tracer
Skills › Scientific Agent Skills › database-lookup › census.md

census.md

252 lines · skills/database-lookup/references/census.md at 5f2bc03

Open on GitHub
1# US Census Bureau API Reference
2

US Census Bureau API Reference

Raw lines 1 to 2
3## Overview
4The US Census Bureau API provides access to hundreds of datasets including the American Community Survey (ACS), Decennial Census, Economic Census, Population Estimates, and more. It is the primary source for US demographic, social, economic, and housing data.
5

Overview

The US Census Bureau API provides access to hundreds of datasets including the American Community Survey (ACS), Decennial Census, Economic Census, Population Estimates, and more. It is the primary source for US demographic, social, economic, and housing data.

Raw lines 3 to 5
6## Base URL
7```
8https://api.census.gov/data
9```

Base URL

https://api.census.gov/data
Raw lines 6 to 10
11## Authentication
12- **API key optional for up to 500 queries per IP per day; required above that allowance (free).** Register at https://api.census.gov/data/key_signup.html
13- Pass as query parameter: `&key=YOUR_KEY`
14- Requests without a key are throttled to ~500/day. With a key, limits are much higher.

Authentication

  • API key optional for up to 500 queries per IP per day; required above that allowance (free). Register at https://api.census.gov/data/key_signup.html
  • Pass as query parameter: &key=YOUR_KEY
  • Requests without a key are throttled to ~500/day. With a key, limits are much higher.
Raw lines 11 to 15
16## Rate Limits
17- Without key: approximately 500 requests per day.
18- Use a key when exceeding the anonymous 500-query daily allowance; do not infer an unlimited service guarantee.
19- No formal per-minute rate limit documented; keep automated requests to a few per second.
21---

Rate Limits

  • Without key: approximately 500 requests per day.
  • Use a key when exceeding the anonymous 500-query daily allowance; do not infer an unlimited service guarantee.
  • No formal per-minute rate limit documented; keep automated requests to a few per second.

Raw lines 16 to 22
23## Key Datasets and URL Patterns
25The general URL pattern is:
26```
27https://api.census.gov/data/{year}/{dataset}?get={variables}&for={geography}&key=YOUR_KEY
28```

Key Datasets and URL Patterns

The general URL pattern is:

https://api.census.gov/data/{year}/{dataset}?get={variables}&for={geography}&key=YOUR_KEY
Raw lines 23 to 29
30### Major Dataset Paths
32| Dataset | Path Segment | Description |
33|---------|-------------|-------------|
34| ACS 5-Year Detailed Tables | `acs/acs5` | 5-year estimates, most geographies (2009-present) |
35| ACS 1-Year Detailed Tables | `acs/acs1` | 1-year estimates, areas 65k+ pop (2005-present) |
36| ACS 5-Year Subject Tables | `acs/acs5/subject` | Precomputed subject tables |
37| ACS 5-Year Data Profiles | `acs/acs5/profile` | Social/economic/housing profiles |
38| Decennial Census (2020) | `dec/dhc` | Demographic and Housing Characteristics |
39| Decennial Census (2020 PL) | `dec/pl` | Redistricting data (PL 94-171) |
40| Decennial Census (2010) | `dec/sf1` | Summary File 1 |
41| Population Estimates | `pep/population` | Annual population estimates |
42| Economic Census | `ecnbasic` | Economic Census (2017, 2022) |
43| County Business Patterns | `cbp` | Business establishment counts |
44| Annual Business Survey | `abscs` | Business characteristics |
46---

Major Dataset Paths

DatasetPath SegmentDescription
ACS 5-Year Detailed Tablesacs/acs55-year estimates, most geographies (2009-present)
ACS 1-Year Detailed Tablesacs/acs11-year estimates, areas 65k+ pop (2005-present)
ACS 5-Year Subject Tablesacs/acs5/subjectPrecomputed subject tables
ACS 5-Year Data Profilesacs/acs5/profileSocial/economic/housing profiles
Decennial Census (2020)dec/dhcDemographic and Housing Characteristics
Decennial Census (2020 PL)dec/plRedistricting data (PL 94-171)
Decennial Census (2010)dec/sf1Summary File 1
Population Estimatespep/populationAnnual population estimates
Economic CensusecnbasicEconomic Census (2017, 2022)
County Business PatternscbpBusiness establishment counts
Annual Business SurveyabscsBusiness characteristics

Raw lines 30 to 47
48## Key Endpoints

Key Endpoints

Raw lines 48 to 49
50### 1. ACS 5-Year Estimates (Most Common)
52```
53GET /data/{year}/acs/acs5?get={variables}&for={geography}&key=YOUR_KEY
54```
56| Parameter | Required | Description |
57|-----------|----------|-------------|
58| `get` | Yes | Comma-separated variable names (e.g., `NAME,B01001_001E`) |
59| `for` | Yes | Target geography (e.g., `state:*`, `county:*`, `tract:*`) |
60| `in` | Sometimes | Parent geography for sub-state levels |
61| `key` | For higher volume | Your API key |
63**Example (total population for all states, 2022 ACS 5-year):**
64```
65https://api.census.gov/data/2022/acs/acs5?get=NAME,B01001_001E&for=state:*&key=YOUR_KEY
66```
68**Example (median household income for all counties in California):**
69```
70https://api.census.gov/data/2022/acs/acs5?get=NAME,B19013_001E&for=county:*&in=state:06&key=YOUR_KEY
71```
73**Example (population by race for a specific tract):**
74```
75https://api.census.gov/data/2022/acs/acs5?get=NAME,B02001_001E,B02001_002E,B02001_003E&for=tract:000100&in=state:06&in=county:075&key=YOUR_KEY
76```
78**Response (JSON array of arrays, first row is headers):**
79```json
81 ["NAME", "B01001_001E", "state"],
82 ["Alabama", "5024279", "01"],
83 ["Alaska", "733391", "02"],
84 ["Arizona", "7151502", "04"]
86```

1. ACS 5-Year Estimates (Most Common)

GET /data/{year}/acs/acs5?get={variables}&for={geography}&key=YOUR_KEY
ParameterRequiredDescription
getYesComma-separated variable names (e.g., NAME,B01001_001E)
forYesTarget geography (e.g., state:*, county:*, tract:*)
inSometimesParent geography for sub-state levels
keyFor higher volumeYour API key

Example (total population for all states, 2022 ACS 5-year):

https://api.census.gov/data/2022/acs/acs5?get=NAME,B01001_001E&for=state:*&key=YOUR_KEY

Example (median household income for all counties in California):

https://api.census.gov/data/2022/acs/acs5?get=NAME,B19013_001E&for=county:*&in=state:06&key=YOUR_KEY

Example (population by race for a specific tract):

https://api.census.gov/data/2022/acs/acs5?get=NAME,B02001_001E,B02001_002E,B02001_003E&for=tract:000100&in=state:06&in=county:075&key=YOUR_KEY

Response (JSON array of arrays, first row is headers):

[
  ["NAME", "B01001_001E", "state"],
  ["Alabama", "5024279", "01"],
  ["Alaska", "733391", "02"],
  ["Arizona", "7151502", "04"]
]
Raw lines 50 to 87
88### 2. ACS 1-Year Estimates
90```
91GET /data/{year}/acs/acs1?get={variables}&for={geography}&key=YOUR_KEY
92```
93Same parameters as ACS 5-year. Only available for geographies with 65,000+ population.
95**Example (poverty rate for all states):**
96```
97https://api.census.gov/data/2022/acs/acs1?get=NAME,B17001_001E,B17001_002E&for=state:*&key=YOUR_KEY
98```

2. ACS 1-Year Estimates

GET /data/{year}/acs/acs1?get={variables}&for={geography}&key=YOUR_KEY

Same parameters as ACS 5-year. Only available for geographies with 65,000+ population.

Example (poverty rate for all states):

https://api.census.gov/data/2022/acs/acs1?get=NAME,B17001_001E,B17001_002E&for=state:*&key=YOUR_KEY
Raw lines 88 to 99
100### 3. ACS Data Profiles
102```
103GET /data/{year}/acs/acs5/profile?get={variables}&for={geography}&key=YOUR_KEY
104```
105Uses `DP` prefix variables with precomputed percentages.
107**Example (educational attainment profile):**
108```
109https://api.census.gov/data/2022/acs/acs5/profile?get=NAME,DP02_0068PE&for=state:*&key=YOUR_KEY
110```

3. ACS Data Profiles

GET /data/{year}/acs/acs5/profile?get={variables}&for={geography}&key=YOUR_KEY

Uses DP prefix variables with precomputed percentages.

Example (educational attainment profile):

https://api.census.gov/data/2022/acs/acs5/profile?get=NAME,DP02_0068PE&for=state:*&key=YOUR_KEY
Raw lines 100 to 111
112### 4. Decennial Census 2020
114```
115GET /data/2020/dec/dhc?get={variables}&for={geography}&key=YOUR_KEY
116```
118**Example (total population by state, 2020 Census):**
119```
120https://api.census.gov/data/2020/dec/dhc?get=NAME,P1_001N&for=state:*&key=YOUR_KEY
121```

4. Decennial Census 2020

GET /data/2020/dec/dhc?get={variables}&for={geography}&key=YOUR_KEY

Example (total population by state, 2020 Census):

https://api.census.gov/data/2020/dec/dhc?get=NAME,P1_001N&for=state:*&key=YOUR_KEY
Raw lines 112 to 122
123### 5. Decennial Census 2010
125```
126GET /data/2010/dec/sf1?get={variables}&for={geography}&key=YOUR_KEY
127```
129**Example:**
130```
131https://api.census.gov/data/2010/dec/sf1?get=NAME,P001001&for=state:*&key=YOUR_KEY
132```

5. Decennial Census 2010

GET /data/2010/dec/sf1?get={variables}&for={geography}&key=YOUR_KEY

Example:

https://api.census.gov/data/2010/dec/sf1?get=NAME,P001001&for=state:*&key=YOUR_KEY
Raw lines 123 to 133
134### 6. Discover Available Variables
136```
137GET /data/{year}/{dataset}/variables.json
138```
140**Example:**
141```
142https://api.census.gov/data/2022/acs/acs5/variables.json
143```
144Returns a large JSON object listing all available variables with labels and concepts.

6. Discover Available Variables

GET /data/{year}/{dataset}/variables.json

Example:

https://api.census.gov/data/2022/acs/acs5/variables.json

Returns a large JSON object listing all available variables with labels and concepts.

Raw lines 134 to 145
146### 7. Discover Available Geographies
148```
149GET /data/{year}/{dataset}/geography.json
150```
152**Example:**
153```
154https://api.census.gov/data/2022/acs/acs5/geography.json
155```

7. Discover Available Geographies

GET /data/{year}/{dataset}/geography.json

Example:

https://api.census.gov/data/2022/acs/acs5/geography.json
Raw lines 146 to 156
157### 8. List Available Datasets
159```
160GET /data.json
161```
163Returns all available datasets with their titles, years, and API endpoints.
165---

8. List Available Datasets

GET /data.json

Returns all available datasets with their titles, years, and API endpoints.


Raw lines 157 to 166
167## Geography Syntax
169| Level | `for` syntax | `in` requirement |
170|-------|-------------|-----------------|
171| Nation | `us:1` or `us:*` | None |
172| State | `state:06` or `state:*` | None |
173| County | `county:075` or `county:*` | `in=state:06` (optional for all) |
174| County Subdivision | `county subdivision:*` | `in=state:XX&in=county:YYY` |
175| Census Tract | `tract:*` | `in=state:XX&in=county:YYY` |
176| Block Group | `block group:*` | `in=state:XX&in=county:YYY&in=tract:ZZZZZZ` |
177| Place (city) | `place:*` | `in=state:XX` |
178| Metro Area (CBSA) | `metropolitan statistical area/micropolitan statistical area:*` | None |
179| ZIP Code Tab Area | `zip code tabulation area:*` | None |
181State FIPS codes: `01`=AL, `02`=AK, `04`=AZ, `05`=AR, `06`=CA, `08`=CO, `09`=CT, `10`=DE, `11`=DC, `12`=FL, `13`=GA, `15`=HI, `16`=ID, `17`=IL, `18`=IN, `19`=IA, `20`=KS, `21`=KY, `22`=LA, `23`=ME, `24`=MD, `25`=MA, `26`=MI, `27`=MN, `28`=MS, `29`=MO, `30`=MT, `31`=NE, `32`=NV, `33`=NH, `34`=NJ, `35`=NM, `36`=NY, `37`=NC, `38`=ND, `39`=OH, `40`=OK, `41`=OR, `42`=PA, `44`=RI, `45`=SC, `46`=SD, `47`=TN, `48`=TX, `49`=UT, `50`=VT, `51`=VA, `53`=WA, `54`=WV, `55`=WI, `56`=WY
183---

Geography Syntax

Levelfor syntaxin requirement
Nationus:1 or us:*None
Statestate:06 or state:*None
Countycounty:075 or county:*in=state:06 (optional for all)
County Subdivisioncounty subdivision:*in=state:XX&in=county:YYY
Census Tracttract:*in=state:XX&in=county:YYY
Block Groupblock group:*in=state:XX&in=county:YYY&in=tract:ZZZZZZ
Place (city)place:*in=state:XX
Metro Area (CBSA)metropolitan statistical area/micropolitan statistical area:*None
ZIP Code Tab Areazip code tabulation area:*None

State FIPS codes: 01=AL, 02=AK, 04=AZ, 05=AR, 06=CA, 08=CO, 09=CT, 10=DE, 11=DC, 12=FL, 13=GA, 15=HI, 16=ID, 17=IL, 18=IN, 19=IA, 20=KS, 21=KY, 22=LA, 23=ME, 24=MD, 25=MA, 26=MI, 27=MN, 28=MS, 29=MO, 30=MT, 31=NE, 32=NV, 33=NH, 34=NJ, 35=NM, 36=NY, 37=NC, 38=ND, 39=OH, 40=OK, 41=OR, 42=PA, 44=RI, 45=SC, 46=SD, 47=TN, 48=TX, 49=UT, 50=VT, 51=VA, 53=WA, 54=WV, 55=WI, 56=WY


Raw lines 167 to 184
185## Common Variable Codes

Common Variable Codes

Raw lines 185 to 186
187### ACS Detailed Tables (B-tables)
188| Variable | Description |
189|----------|-------------|
190| `B01001_001E` | Total population |
191| `B01002_001E` | Median age |
192| `B02001_001E` | Total (race) |
193| `B02001_002E` | White alone |
194| `B02001_003E` | Black or African American alone |
195| `B03001_003E` | Hispanic or Latino |
196| `B19013_001E` | Median household income |
197| `B19001_001E` | Household income (total, for distribution) |
198| `B25077_001E` | Median home value |
199| `B25064_001E` | Median gross rent |
200| `B17001_001E` | Poverty status (total) |
201| `B17001_002E` | Poverty status (below poverty) |
202| `B15003_022E` | Bachelor's degree |
203| `B15003_023E` | Master's degree |
204| `B15003_025E` | Doctorate degree |
205| `B23025_005E` | Unemployed (civilian labor force) |
206| `B25001_001E` | Total housing units |
207| `B08301_001E` | Means of transportation to work (total) |
209Variable naming: `B{table}_{seq}E` for estimates, `B{table}_{seq}M` for margins of error.

ACS Detailed Tables (B-tables)

VariableDescription
B01001_001ETotal population
B01002_001EMedian age
B02001_001ETotal (race)
B02001_002EWhite alone
B02001_003EBlack or African American alone
B03001_003EHispanic or Latino
B19013_001EMedian household income
B19001_001EHousehold income (total, for distribution)
B25077_001EMedian home value
B25064_001EMedian gross rent
B17001_001EPoverty status (total)
B17001_002EPoverty status (below poverty)
B15003_022EBachelor's degree
B15003_023EMaster's degree
B15003_025EDoctorate degree
B23025_005EUnemployed (civilian labor force)
B25001_001ETotal housing units
B08301_001EMeans of transportation to work (total)

Variable naming: B{table}_{seq}E for estimates, B{table}_{seq}M for margins of error.

Raw lines 187 to 210
211### ACS Data Profile Variables (DP-tables)
212| Variable | Description |
213|----------|-------------|
214| `DP02_0068PE` | % with bachelor's degree or higher |
215| `DP03_0062E` | Median household income |
216| `DP03_0128PE` | % below poverty level |
217| `DP04_0089E` | Median home value |
218| `DP05_0001E` | Total population |

ACS Data Profile Variables (DP-tables)

VariableDescription
DP02_0068PE% with bachelor's degree or higher
DP03_0062EMedian household income
DP03_0128PE% below poverty level
DP04_0089EMedian home value
DP05_0001ETotal population
Raw lines 211 to 219
220### Decennial 2020 (DHC)
221| Variable | Description |
222|----------|-------------|
223| `P1_001N` | Total population |
224| `P1_003N` | White alone |
225| `P1_004N` | Black or African American alone |
226| `H1_001N` | Total housing units |
227| `H1_002N` | Occupied housing units |
229---

Decennial 2020 (DHC)

VariableDescription
P1_001NTotal population
P1_003NWhite alone
P1_004NBlack or African American alone
H1_001NTotal housing units
H1_002NOccupied housing units

Raw lines 220 to 230
231## Response Format
232Tabular dataset query responses are **JSON arrays of arrays**; discovery endpoints such as `variables.json` return objects. The first array is always the column headers; subsequent arrays are data rows.
234```json
236 ["NAME", "B01001_001E", "B19013_001E", "state", "county"],
237 ["Los Angeles County, California", "10014009", "73538", "06", "037"],
238 ["San Diego County, California", "3298634", "85750", "06", "073"]
240```
242- Values are strings (even numeric ones).
243- Missing or unavailable data may appear as null or dataset-specific numeric sentinel codes (for example ACS `-666666666`). Read the variable annotations and special-value documentation; never treat sentinels as measured values.
244- Annotation values: `"-"` (too few sample cases), `"N"` (not available), `"(X)"` (not applicable).

Response Format

Tabular dataset query responses are JSON arrays of arrays; discovery endpoints such as variables.json return objects. The first array is always the column headers; subsequent arrays are data rows.

[
  ["NAME", "B01001_001E", "B19013_001E", "state", "county"],
  ["Los Angeles County, California", "10014009", "73538", "06", "037"],
  ["San Diego County, California", "3298634", "85750", "06", "073"]
]
  • Values are strings (even numeric ones).
  • Missing or unavailable data may appear as null or dataset-specific numeric sentinel codes (for example ACS -666666666). Read the variable annotations and special-value documentation; never treat sentinels as measured values.
  • Annotation values: "-" (too few sample cases), "N" (not available), "(X)" (not applicable).
Raw lines 231 to 245
246## Notes
247- Dataset paths and available geographies are vintage-specific (especially Population Estimates); discover them in `data.json` before changing a year.
248- Always include `NAME` in your `get` parameter to get human-readable geography labels.
249- The `E` suffix means "Estimate"; use `M` suffix for Margin of Error (e.g., `B19013_001M`).
250- Variable discovery: browse https://api.census.gov/data/{year}/acs/acs5/variables.html for a searchable table.
251- For ACS, 5-year estimates cover all geographies but are less current; 1-year covers only larger geographies but is more recent.
252- Group endpoint: `?get=group(B01001)` retrieves all variables in a table group.

Notes

  • Dataset paths and available geographies are vintage-specific (especially Population Estimates); discover them in data.json before changing a year.
  • Always include NAME in your get parameter to get human-readable geography labels.
  • The E suffix means "Estimate"; use M suffix for Margin of Error (e.g., B19013_001M).
  • Variable discovery: browse https://api.census.gov/data/{year}/acs/acs5/variables.html for a searchable table.
  • For ACS, 5-year estimates cover all geographies but are less current; 1-year covers only larger geographies but is more recent.
  • Group endpoint: ?get=group(B01001) retrieves all variables in a table group.
Raw lines 246 to 252