Skip to contents

The Census APIs have more than 1,000 endpoints, covering dozens of different surveys. This page shows how to get data from most of the key surveys using censusapi.

To see a current table of every available endpoint, run listCensusApis:

apis <- listCensusApis()

American Community Survey

There are multiple useful ACS datasets with slightly different purposes. Here’s how the Census Bureau describes them:

"Detailed Tables contain the most detailed cross-tabulations, many of which are published down to block groups. The data are population counts. There are over 20,000 variables in this dataset.

Subject Tables provide an overview of the estimates available in a particular topic.  The data are presented as population counts and percentages.  There are over 18,000 variables in this dataset. 

Data Profiles contain broad social, economic, housing, and demographic information. The data are presented as population counts and percentages. There are over 1,000 variables in this dataset.

Comparison Profiles are similar to Data Profiles but also include comparisons with past-year data.  The current year data are compared with prior 5-Year data and include statistical significance testing.  There are over 1,000 variables in this dataset."

ACS Detailed Tables

Get total population and median income for places (towns, cities, etc) in Indiana.

acs_income <- getCensus(
    name = "acs/acs5",
    vintage = 2022, 
    vars = c("NAME", "B01001_001E", "B19013_001E"), 
    region = "place:*",
    regionin = "state:18")
head(acs_income)
state place NAME B01001_001E B19013_001E
18 00140 Aberdeen CDP, Indiana 1756 129792
18 00154 Abington CDP, Indiana 255 70167
18 00352 Adams CDP, Indiana 190 21111
18 00532 Adams Lake CDP, Indiana 270 89923
18 00640 Advance town, Indiana 412 71042
18 00748 Akron town, Indiana 1062 58958

ACS Subject Tables

Get the percent of people without an internet subscription by income for the five counties of New York City, with associated margins of error:

  • overall: S2801_C02_019E
  • income less $20,000: S2801_C02_023E
  • income $20,000 to $74,999: S2801_C02_027E
  • income $75,000 or greater: S2801_C02_031E
acs_subject <- getCensus(
    name = "acs/acs1/subject",
    vintage = 2022, 
    vars = c("NAME", "S2801_C02_019E", "S2801_C02_019M",
                     "S2801_C02_023E", "S2801_C02_023M", 
                     "S2801_C02_027E", "S2801_C02_027M",
                     "S2801_C02_031E", "S2801_C02_031M"), 
    region = "county:005,047,061,081,085",
    regionin = "state:36")
head(acs_subject)
state county NAME S2801_C02_019E S2801_C02_019M S2801_C02_023E S2801_C02_023M S2801_C02_027E S2801_C02_027M S2801_C02_031E S2801_C02_031M
36 005 Bronx County, New York 15.8 1.0 26.7 2.4 15.0 1.8 7.5 1.4
36 047 Kings County, New York 10.9 0.7 26.9 2.2 13.0 1.2 4.0 0.6
36 061 New York County, New York 9.1 0.7 27.0 2.5 9.9 1.8 3.2 0.7
36 081 Queens County, New York 7.9 0.6 20.6 2.2 10.3 1.2 3.3 0.5
36 085 Richmond County, New York 8.9 1.3 24.5 6.7 12.8 2.3 3.9 1.2

ACS Comparison Profiles

Get the annual median household income in inflation-adjusted 2019 dollars for Alabama cities since 2018. (2020 1-year data is not available.)

acs_comparison <- getCensus(
    name = "acs/acs1/cprofile",
    vintage = 2022, 
    vars = c("NAME", "CP03_2018_062E", "CP03_2019_062E", "CP03_2021_062E", "CP03_2022_062E"), 
    region = "place:*",
    regionin = "state:01")
head(acs_comparison)
state place NAME CP03_2018_062E CP03_2019_062E CP03_2021_062E CP03_2022_062E
01 03076 Auburn city, Alabama 54286 52853 52458 54839
01 07000 Birmingham city, Alabama 42549 42201 39577 39326
01 21184 Dothan city, Alabama 57471 54438 48737 53929
01 35896 Hoover city, Alabama 102124 113316 107309 103194
01 37000 Huntsville city, Alabama 64772 62396 76483 68930
01 50000 Mobile city, Alabama 45176 53723 47329 50051

ACS Migration Flows

American Community Survey Migration Flows documentation

Get the number of people who moved in and out of Los Angeles county by their origin or destination.

flows <- getCensus(
    name = "acs/flows",
    vintage = 2019,
    vars = c("MOVEDIN", "MOVEDOUT", "GEOID2", "FULL1_NAME", "FULL2_NAME"),
    region = "county:037",
    regionin = "state:06")
head(flows, n = 15L)
state county MOVEDIN MOVEDOUT GEOID2 FULL1_NAME FULL2_NAME
06 037 2585 NA NA Los Angeles County, California Africa
06 037 37932 NA NA Los Angeles County, California Asia
06 037 13073 NA NA Los Angeles County, California Central America
06 037 962 NA NA Los Angeles County, California Caribbean
06 037 9953 NA NA Los Angeles County, California Europe
06 037 312 NA NA Los Angeles County, California U.S. Island Areas
06 037 1774 NA NA Los Angeles County, California Northern America
06 037 2001 NA NA Los Angeles County, California Oceania and At Sea
06 037 4341 NA NA Los Angeles County, California South America
06 037 0 7 01003 Los Angeles County, California Baldwin County, Alabama
06 037 9 0 01009 Los Angeles County, California Blount County, Alabama
06 037 20 40 01015 Los Angeles County, California Calhoun County, Alabama
06 037 0 9 01031 Los Angeles County, California Coffee County, Alabama
06 037 0 60 01045 Los Angeles County, California Dale County, Alabama
06 037 0 16 01051 Los Angeles County, California Elmore County, Alabama

American Community Survey Language Statistics

American Community Survey Language Statistics documentation

Get the number of people in New York state who speak each language.

languages <- getCensus(
    name = "language",
    vintage = 2013,
    vars = c("EST", "LAN", "LANLABEL"),
    region = "state:36")
head(languages)
state EST LAN LANLABEL
36 2705225 625 Spanish
36 NA 627 Ladino
36 133535 620 French
36 5645 622 Patois
36 NA 624 Cajun
36 44980 629 Portuguese

Annual Survey of Entrepreneurs

Annual Survey of Entrepreneurs documentation

ase_csa <- getCensus(
    name = "ase/csa",
    vintage = 2014,
    vars = c("GEO_TTL", "NAICS2012", "NAICS2012_TTL", "EMPSZFI", "EMPSZFI_TTL", "FIRMPDEMP"),
    region = "us:*")
head(ase_csa)
us GEO_TTL NAICS2012 NAICS2012_TTL EMPSZFI EMPSZFI_TTL FIRMPDEMP
1 United States 00 Total for all sectors 1 All firms 5437782
1 United States 00 Total for all sectors 611 Firms with no employees 547115
1 United States 00 Total for all sectors 612 Firms with 1 to 4 employees 2768756
1 United States 00 Total for all sectors 620 Firms with 5 to 9 employees 950224
1 United States 00 Total for all sectors 630 Firms with 10 to 19 employees 585516
1 United States 00 Total for all sectors 641 Firms with 20 to 49 employees 376051
ase_cscb <- getCensus(
    name = "ase/cscb",
    vintage = 2014,
    vars = c("GEO_TTL", "NAICS2012_TTL", "ASECB", "ASECB_TTL", "SPOUSES", "SPOUSES_TTL", "YEAR", 
                     "FIRMPDEMP", "FIRMPDEMP_PCT", "RCPPDEMP", "RCPPDEMP_F", "RCPPDEMP_PCT", 
                     "EMP", "EMP_PCT", "PAYANN", "PAYANN_PCT", "FIRMPDEMP_S", "FIRMPDEMP_PCT_S", 
                     "RCPPDEMP_S", "RCPPDEMP_PCT_S", "EMP_S", "EMP_PCT_S", "PAYANN_S", "PAYANN_PCT_S"),
    region = "us:*")
head(ase_cscb)
us GEO_TTL NAICS2012_TTL ASECB ASECB_TTL SPOUSES SPOUSES_TTL YEAR FIRMPDEMP FIRMPDEMP_PCT RCPPDEMP RCPPDEMP_F RCPPDEMP_PCT EMP EMP_PCT PAYANN PAYANN_PCT FIRMPDEMP_S FIRMPDEMP_PCT_S RCPPDEMP_S RCPPDEMP_PCT_S EMP_S EMP_PCT_S PAYANN_S PAYANN_PCT_S
1 United States Total for all sectors 0 All firms A1 All firms 2014 5437782 0.0 33036935112 NA 0.0 115129295 0.0 5640982990 0.0 0.0 0.0 0.5 0.0 0.3 0.0 0.3 0.0
1 United States Total for all sectors 0 All firms MA Jointly owned but primarily operated by male spouse 2014 336310 30.7 603733952 NA 18.8 3015332 21.0 109460428 20.2 0.8 0.3 3.2 1.8 1.8 3.5 3.0 3.5
1 United States Total for all sectors 0 All firms LZ Jointly owned and equally operated by spouses 2014 335149 30.6 493143589 NA 15.4 3303608 23.0 104343482 19.2 0.6 0.3 3.7 5.5 1.7 6.2 1.8 5.5
1 United States Total for all sectors 0 All firms MB Jointly owned but primarily operated by female spouse 2014 96475 8.8 140228793 NA 4.4 850573 5.9 25984506 4.8 1.9 0.2 12.6 1.1 3.6 0.6 4.7 0.3
1 United States Total for all sectors 0 All firms MC Not jointly owned by spouses 2014 328625 30.0 1966858366 NA 61.4 7222018 50.2 302838280 55.8 0.6 0.5 2.5 8.1 1.6 10.3 1.9 9.0
1 United States Total for all sectors 0 All firms MD Total reporting 2014 1096559 100.0 3203964700 NA 100.0 14391531 100.0 542626696 100.0 0.2 0.0 1.8 0.0 0.9 0.0 1.3 0.0
ase_cscbo <- getCensus(
    name = "ase/cscbo",
    vintage = 2014,
    vars = c("GEO_TTL", "NAICS2012_TTL", "ASECBO", "ASECBO_TTL", "ACQBUS", "ACQBUS_TTL", 
                     "YEAR", "OWNPDEMP", "OWNPDEMP_PCT", "OWNPDEMP_S", "OWNPDEMP_PCT_S"),
    region = "us:*")
head(ase_cscbo)
us GEO_TTL NAICS2012_TTL ASECBO ASECBO_TTL ACQBUS ACQBUS_TTL YEAR OWNPDEMP OWNPDEMP_PCT OWNPDEMP_S OWNPDEMP_PCT_S
1 United States Total for all sectors 00 All owners of respondent firms CA Founded or started 2014 4063687 70.4 0.2 0.3
1 United States Total for all sectors 00 All owners of respondent firms CB Purchased 2014 1211902 21.0 0.5 0.2
1 United States Total for all sectors 00 All owners of respondent firms CC Inherited 2014 227408 3.9 1.7 0.1
1 United States Total for all sectors 00 All owners of respondent firms CD Transfer of ownership or gift 2014 405356 7.0 0.6 0.1
1 United States Total for all sectors 00 All owners of respondent firms CE Total reporting 2014 5768389 100.0 0.2 0.0
1 United States Total for all sectors 00 All owners of respondent firms CF Item not reported 2014 14476 0.0 7.3 0.0

Annual Survey of Manufactures

Annual Survey of Manufactures documentation

asm_state <- getCensus(
    name = "timeseries/asm/state",
    vars = c("GEO_TTL", "NAICS_TTL", "EMP"),
    region = "state:*",
    time = 2016,
    NAICS = "31-33")
head(asm_state)
time state GEO_TTL NAICS_TTL EMP NAICS
2016 01 Alabama Manufacturing 234803 31-33
2016 02 Alaska Manufacturing 12178 31-33
2016 56 Wyoming Manufacturing 8377 31-33
2016 04 Arizona Manufacturing 136946 31-33
2016 05 Arkansas Manufacturing 145733 31-33
2016 06 California Manufacturing 1119896 31-33
asm_product <- getCensus(
    name = "timeseries/asm/product",
    vars = c("PSCODE_TTL", "GEO_TTL", "PRODVAL"),
    region = "us:*",
    time = 2016,
    PSCODE = 311111)
head(asm_product)
time us PSCODE_TTL GEO_TTL PRODVAL PSCODE
2016 1 Dog and cat food manufacturing United States 22933334 311111

Business Dynamic Statistics

Business Dynamic Statistics documentation

Get the number of firms (FIRM) and number of net jobs created from expanding/contracting and opening/closing establishments during the last 12 months (NET_JOB_CREATION) in the construction industry (NAICS = 23) for all years available for Queens, New York.

bds_queens <- getCensus(
    name = "timeseries/bds",
    vars = c("FIRM", "NET_JOB_CREATION", "NAICS_LABEL"),
    region = "county:081",
    regionin = "state:36",
    YEAR = "*",
    NAICS = 23)
head(bds_queens)
state county FIRM NET_JOB_CREATION NAICS_LABEL YEAR NAICS
36 081 1777 1929 Construction 1978 23
36 081 1907 2257 Construction 1979 23
36 081 1928 2175 Construction 1980 23
36 081 1934 -17 Construction 1981 23
36 081 1960 1575 Construction 1982 23
36 081 2013 687 Construction 1983 23

Get the same informtion for all states in 2021.

bds_states <- getCensus(
    name = "timeseries/bds",
    vars = c("FIRM", "NET_JOB_CREATION", "NAICS_LABEL"),
    region = "state:*",
    time = 2021,
    NAICS = 23)
head(bds_states)
time state FIRM NET_JOB_CREATION NAICS_LABEL NAICS
2021 28 3526 -1756 Construction 23
2021 29 12237 -659 Construction 23
2021 30 4958 650 Construction 23
2021 27 13798 -2298 Construction 23
2021 31 5750 101 Construction 23
2021 32 4872 1447 Construction 23

Community Resiliency Estimates

Community Resilience Estimates documentation

For Census tracts in a single county, get the rate of individuals with zero components of social vulnerability, one-two components of social vulnerability, and three or more components of social vulnerability.

cre <- getCensus(
    name = "cre",
    vintage = 2022,
    vars = c("PRED0_PE", "PRED12_PE", "PRED3_PE"),
    region = "tract:*",
    regionin = "state:01&county:001")
head(cre)
state county tract PRED0_PE PRED12_PE PRED3_PE
01 001 020100 30.33 50.75 18.92
01 001 020200 37.85 42.84 19.30
01 001 020300 39.14 40.48 20.38
01 001 020400 42.73 40.40 16.87
01 001 020501 45.57 36.92 17.51
01 001 020502 37.69 46.91 15.40

County Business Patterns and Nonemployer Statistics

County Business Patterns and Nonemployer Statistics documentation

County Business Patterns

County Business Patterns documentation

Get employment data for the construction industry.

cbp <- getCensus(
    name = "cbp",
    vintage = 2021,
    vars = c("EMP", "ESTAB"),
    region = "state:*",
    NAICS2017 = 23)
head(cbp)
state EMP ESTAB NAICS2017
01 94890 8434 23
02 15750 2580 23
04 184434 14289 23
05 51809 5939 23
06 844489 82744 23
08 178752 20299 23

Get the number of companies and employees at organizations with more than 1,000 employees (EMPSZES = 260).

cbp_large_companies <- getCensus(
    name = "cbp",
    vintage = 2021,
    vars = c("NAME", "EMP", "ESTAB"),
    region = "state:*",
    EMPSZES = 260)
head(cbp_large_companies)
state NAME EMP ESTAB EMPSZES
01 Alabama 207510 108 260
02 Alaska 17027 10 260
04 Arizona 426257 188 260
05 Arkansas 114638 67 260
06 California 2816709 1040 260
08 Colorado 365636 144 260

Zip Codes Business Patterns

Zip Codes Business Patterns documentation

zbp_2018 <- getCensus(
    name = "zbp",
    vintage = 2018,
    vars = c("EMP", "ESTAB", "EMPSZES"),
    region = "zipcode:90210")
head(zbp_2018)
zip_code EMP ESTAB EMPSZES
90210 35324 2496 001
90210 0 1758 210
90210 0 322 220
90210 0 199 230
90210 0 137 241
90210 0 50 242

Nonemployer statistics

Nonemployer statistics documentation

Get the number of nonemployer establishments by MSA for sector 54, Professional, scientific, and technical services.

nonemp <- getCensus(
    name = "nonemp",
    vintage = 2021,
    vars = c("NAME", "NESTAB", "NAICS2017_LABEL"),
    region = "metropolitan statistical area/micropolitan statistical area:*",
    NAICS2017 = 54)
head(nonemp)
metropolitan_statistical_area_micropolitan_statistical_area NAME NESTAB NAICS2017_LABEL NAICS2017
10100 Aberdeen, SD Micro Area 257 Professional, scientific, and technical services 54
10140 Aberdeen, WA Micro Area 422 Professional, scientific, and technical services 54
10180 Abilene, TX Metro Area 1350 Professional, scientific, and technical services 54
10220 Ada, OK Micro Area 237 Professional, scientific, and technical services 54
10300 Adrian, MI Micro Area 535 Professional, scientific, and technical services 54
10420 Akron, OH Metro Area 7190 Professional, scientific, and technical services 54

Decennial Census

Decennial Census documentation

2020 Decennial Census

Using the 2020 Demographic Profile, get the percent of the population that is age 65 or older (DP1_0024P) for metro and micropolitan statistical areas.

dec_elderly <- getCensus(
    name = "dec/dp",
    vintage = 2020,
    vars = c("NAME", "DP1_0024P"),
    region = "metropolitan statistical area/micropolitan statistical area:*")
head(dec_elderly)
metropolitan_statistical_area_micropolitan_statistical_area NAME DP1_0024P
10100 Aberdeen, SD Micro Area 18.6
10140 Aberdeen, WA Micro Area 22.5
10180 Abilene, TX Metro Area 16.0
10220 Ada, OK Micro Area 17.2
10300 Adrian, MI Micro Area 20.0
10380 Aguadilla-Isabela, PR Metro Area 23.0

Using the 2020 Demographic and Housing Characteristics File, get the total number of households (H9_001N) and the number of 1-person households (H9_002N) for counties in Maryland.

dec <- getCensus(
    name = "dec/dhc",
    vintage = 2020,
    vars = c("NAME", "H9_001N", "H9_002N"),
    region = "county:*",
    regionin = "state:24")
head(dec)
state county NAME H9_001N H9_002N
24 009 Calvert County, Maryland 32754 6228
24 011 Caroline County, Maryland 12327 2905
24 013 Carroll County, Maryland 63050 13324
24 015 Cecil County, Maryland 39398 9613
24 017 Charles County, Maryland 59107 13282
24 019 Dorchester County, Maryland 13721 4169

We can use the Detailed Demographic and Housing Characteristics File A (Detailed DHC-A) to get detailed data for specific race and ethnicity groups.

First, check the value labels for the POPGROUP variable.

popgroup_values <- listCensusMetadata(
    name = "dec/ddhca",
    vintage = 2020, 
    type = "values",
    variable_name = "POPGROUP") 

head(popgroup_values)
code label
001 Total population
002 White alone
003 White alone or in combination with one or more other races
004 Black or African American alone
005 Black or African American alone or in combination with one or more other races
006 American Indian and Alaska Native alone

Get the total population (T01001_001N) of people who are Japanese alone or in any combination (POPGROUP code 3824) by state.

dec_population <- getCensus(
    name = "dec/ddhca",
    vintage = 2020,
    vars = c("NAME", "T01001_001N", "POPGROUP_LABEL"),
    region = "state:*",
    POPGROUP = 3824)
head(dec_population)
state NAME T01001_001N POPGROUP_LABEL POPGROUP
01 Alabama 7276 Japanese alone or in any combination 3824
02 Alaska 4763 Japanese alone or in any combination 3824
06 California 469915 Japanese alone or in any combination 3824
04 Arizona 29186 Japanese alone or in any combination 3824
13 Georgia 22313 Japanese alone or in any combination 3824
20 Kansas 6009 Japanese alone or in any combination 3824

2010 Decennial Census

Get total population and the number of housing units for metropolitan/micropolitan statistical areas in 2010.

data2010 <- getCensus(
    name = "dec/sf1",
    vintage = 2010,
    vars = c("NAME", "P001001", "H010001"), 
    region = "metropolitan statistical area/micropolitan statistical area:*")
head(data2010)
metropolitan_statistical_area_micropolitan_statistical_area NAME P001001 H010001
31540 Madison, WI Metro Area 568593 554078
31580 Madisonville, KY Micro Area 46920 45834
36820 Oskaloosa, IA Micro Area 22381 21722
36860 Ottawa-Streator, IL Micro Area 154908 151500
36900 Ottumwa, IA Micro Area 35625 34758
36940 Owatonna, MN Micro Area 36576 35982

Get the urban/rural status group of variables (P2) by metropolitan/micropolitan statistical areas in 2010.

# Show variable metadata for the P2 group
group_p2 <- listCensusMetadata(
    name = "dec/sf1",
    vintage = 2010,
    type = "variables",
    group = "P2")

# Get the P2 variable group (URBAN AND RURAL)
data2010 <- getCensus(
    name = "dec/sf1",
    vintage = 2010,
    vars = "group(P2)", 
    region = "metropolitan statistical area/micropolitan statistical area:*")
head(data2010)
metropolitan_statistical_area_micropolitan_statistical_area GEO_ID P002001 P002002 P002003 P002004 P002005 P002006 NAME P002001ERR
31540 310M100US31540 568593 455002 401661 53341 113591 0 Madison, WI Metro Area NA
31580 310M100US31580 46920 24809 0 24809 22111 0 Madisonville, KY Micro Area NA
36820 310M100US36820 22381 12545 0 12545 9836 0 Oskaloosa, IA Micro Area NA
36860 310M100US36860 154908 94406 0 94406 60502 0 Ottawa-Streator, IL Micro Area NA
36900 310M100US36900 35625 24771 0 24771 10854 0 Ottumwa, IA Micro Area NA
36940 310M100US36940 36576 25394 0 25394 11182 0 Owatonna, MN Micro Area NA

Get 2010 population by block group within a specific tract.

tract_pop <- getCensus(
    name = "dec/sf1",
    vintage = 2010,
    vars = "P001001", 
    region = "block:*",
    regionin = "state:36+county:027+tract:010000")
head(tract_pop)
state county tract block P001001
36 027 010000 1000 31
36 027 010000 1011 17
36 027 010000 1028 41
36 027 010000 1001 0
36 027 010000 1031 0
36 027 010000 1002 4

Decennial Census Self-Response Rates

Decennial Census Self-Response Rates documentation

Get self-response rates for the 2020 and 2010 Decennial Census by state, county, tract, place and more.

Get overall and internet repose rates for all counties.

county_responses <- getCensus(
    name = "dec/responserate",
    vintage = 2020,
    vars = c("NAME", "RESP_DATE", "CRRALL", "CRRINT"),
    region = "county:*")
head(county_responses)
state county NAME RESP_DATE CRRALL CRRINT
21 137 Lincoln County, Kentucky 2021-01-29 69.1 26.7
21 139 Livingston County, Kentucky 2021-01-29 62.6 32.7
21 143 Lyon County, Kentucky 2021-01-29 55.6 24.1
21 145 McCracken County, Kentucky 2021-01-29 71.9 56.7
21 149 McLean County, Kentucky 2021-01-29 63.8 26.2
21 151 Madison County, Kentucky 2021-01-29 72.2 60.3

Get response rates for places (cities, towns, etc) within New York state.

ny_place_responses <- getCensus(
    name = "dec/responserate",
    vintage = 2020,
    vars = c("NAME", "RESP_DATE", "CRRALL", "CRRINT"),
    region = "place:*",
    regionin = "state:36")
head(ny_place_responses)
state place NAME RESP_DATE CRRALL CRRINT
36 23745 Elba village, New York 2021-01-29 66.3 52.9
36 23965 Ellenville village, New York 2021-01-29 58.5 45.3
36 24075 Ellisburg village, New York 2021-01-29 52.6 18.1
36 24229 Elmira city, New York 2021-01-29 60.1 40.8
36 24295 Elmsford village, New York 2021-01-29 62.9 55.1
36 24515 Endicott village, New York 2021-01-29 58.4 45.1

Get final 2010 Decennial Census self-response rates.

county_responses_2010 <- getCensus(
    name = "dec/responserate",
    vintage = 2010,
    vars = c("NAME", "FSRR2010"),
    region = "county:*")
head(county_responses_2010)
state county NAME FSRR2010
01 001 Autauga County, Alabama 68.6
01 003 Baldwin County, Alabama 59.4
01 005 Barbour County, Alabama 55.2
01 007 Bibb County, Alabama 54.8
01 009 Blount County, Alabama 66.3
01 011 Bullock County, Alabama 34.0

Decennial Census Surname Files

Decennial Census Surname documentation

Get counts of the top 25 most popular surnames and share of each by race.

top_surnames <- getCensus(
    name = "surname",
    vintage = 2010,
    vars = c("NAME", "COUNT", "PROP100K", "PCTWHITE", "PCTBLACK", "PCTAIAN", "PCTAPI", "PCTHISPANIC", "PCT2PRACE"),
    RANK = "1:25")
head(top_surnames)
NAME COUNT PROP100K PCTWHITE PCTBLACK PCTAIAN PCTAPI PCTHISPANIC PCT2PRACE RANK
ANDERSON 784404 265.92 75.17 18.93 0.74 0.61 2.44 2.11 15
BROWN 1437026 487.16 57.95 35.60 0.87 0.51 2.52 2.55 4
DAVIS 1116357 378.45 62.20 31.60 0.82 0.49 2.44 2.45 8
GARCIA 1166120 395.32 5.38 0.45 0.47 1.41 92.03 0.26 6
GONZALEZ 841025 285.11 4.03 0.35 0.14 0.38 94.97 0.13 13
HARRIS 624252 211.63 51.40 42.39 0.67 0.47 2.26 2.80 25

Economic Census

Economic Census documentation

ewks_2012 <- getCensus(
    name = "ewks",
    vintage = 2012,
    vars = c("EMP", "OPTAX", "GEOTYPE"),
    region = "state:*",
    NAICS2012 = 54)
head(ewks_2012)
state EMP OPTAX GEOTYPE NAICS2012
01 89988 A 02 54
01 88566 T 02 54
01 1422 Y 02 54
02 17648 A 02 54
08 4616 Y 02 54
02 17328 T 02 54
ewks_2007 <- getCensus(
    name = "ewks",
    vintage = 2007,
    vars = c("EMP", "OPTAX", "GEOTYPE"),
    region = "state:*",
    NAICS2007 = 54)
head(ewks_2007)
state EMP OPTAX GEOTYPE NAICS2007
01 94051 A 2 54
01 92759 T 2 54
01 1292 Y 2 54
02 12843 A 2 54
02 12509 T 2 54
02 334 Y 2 54

Economic Indicators

Economic Indicators documentation

eits <- getCensus(
    name = "timeseries/eits/resconst",
    vars = c("cell_value", "data_type_code", "time_slot_id", "error_data", "category_code", "seasonally_adj"),
    region = "us:*",
    time = "from 2023-01")
head(eits)
cell_value data_type_code time_slot_id error_data category_code seasonally_adj time us
999 SINGLE 0 no APERMITS yes 2023-12 1
1354 TOTAL 0 no APERMITS yes 2023-01 1
1482 TOTAL 0 no APERMITS yes 2023-02 1
1437 TOTAL 0 no APERMITS yes 2023-03 1
1417 TOTAL 0 no APERMITS yes 2023-04 1
1496 TOTAL 0 no APERMITS yes 2023-05 1

Health Insurance: Small Area Health Insurance Estimates

Health Insurance Statistics documentation

Get the uninsured rate by income group for each county for a single year.

sahie <- getCensus(
    name = "timeseries/healthins/sahie",
    vars = c("NAME", "IPRCAT", "IPR_DESC", "PCTUI_PT"),
    region = "county:*",
    time = 2021)
head(sahie)
time state county NAME IPRCAT IPR_DESC PCTUI_PT
2021 01 001 Autauga County, AL 0 All Incomes 10.0
2021 01 001 Autauga County, AL 1 <= 200% of Poverty 18.8
2021 01 001 Autauga County, AL 2 <= 250% of Poverty 17.5
2021 01 001 Autauga County, AL 3 <= 138% of Poverty 20.3
2021 01 001 Autauga County, AL 4 <= 400% of Poverty 13.6
2021 01 001 Autauga County, AL 5 138% to 400% of Poverty 10.5

Get the uninsured rate for a county from 2006 to the latest year available.

sahie_annual <- getCensus(
    name = "timeseries/healthins/sahie",
    vars = c("NAME", "PCTUI_PT"),
    region = "county:037",
    regionin = "state:06",
    time = "from 2006")
sahie_annual
time state county NAME PCTUI_PT
2006 06 037 Los Angeles County, CA 23.8
2007 06 037 Los Angeles County, CA 23.1
2008 06 037 Los Angeles County, CA 23.8
2009 06 037 Los Angeles County, CA 24.9
2010 06 037 Los Angeles County, CA 25.9
2011 06 037 Los Angeles County, CA 24.8
2012 06 037 Los Angeles County, CA 24.5
2013 06 037 Los Angeles County, CA 23.7
2014 06 037 Los Angeles County, CA 17.4
2015 06 037 Los Angeles County, CA 12.5
2016 06 037 Los Angeles County, CA 10.7
2017 06 037 Los Angeles County, CA 10.1
2018 06 037 Los Angeles County, CA 10.2
2019 06 037 Los Angeles County, CA 11.1
2020 06 037 Los Angeles County, CA 10.2
2021 06 037 Los Angeles County, CA 10.1

Get the uninsured rate for non-elderly adults (AGECAT = 1) with incomes of 138 to 400% of the poverty line (IPRCAT = 5), by race and state.

sahie_adults <- getCensus(
    name = "timeseries/healthins/sahie",
    vars = c("NAME", "PCTUI_PT", "RACECAT", "RACE_DESC"), 
    region = "state:*", 
    time = 2021,
    IPRCAT = 5,
    AGECAT = 1)
head(sahie_adults)
time state NAME PCTUI_PT RACECAT RACE_DESC IPRCAT AGECAT
2021 01 Alabama 15.9 0 All Races 5 1
2021 01 Alabama 14.1 1 White alone, not Hispanic or Latino 5 1
2021 01 Alabama 15.4 2 Black or African American alone, not Hispanic or Latino 5 1
2021 29 Missouri 23.1 6 Native Hawaiian and Other Pacific Islander alone, not Hispanic or Latino 5 1
2021 01 Alabama 40.4 3 Hispanic or Latino (any race) 5 1
2021 01 Alabama 20.8 4 American Indian and Alaska Native alone, not Hispanic or Latino 5 1

Household Pulse Survey

Household Pulse Survey documentation

Get the food scarcity rate (Percentage of adults in households where there was either sometimes or often not enough to eat in the last 7 days) and expense difficulty rate (Percentage of adults in households where it has been somewhat or very difficult to pay for usual household expenses in the last 7 days) for every state for one survey period.

hps_state <- getCensus(
    name = "timeseries/hps",
    vars = c("NAME", "FOODSCARCE_RATE", "EXPENSE_RATE",
                     "COL_START_DATE", "COL_END_DATE"),
    region = "state:*",
    WEEK = 63,
    time = 2023)
head(hps_state)
time state NAME FOODSCARCE_RATE EXPENSE_RATE COL_START_DATE COL_END_DATE WEEK
2023 01 Alabama 14.6 44.2 October 18, 2023 October 30, 2023 63
2023 02 Alaska 15.3 36.7 October 18, 2023 October 30, 2023 63
2023 04 Arizona 14.4 43.3 October 18, 2023 October 30, 2023 63
2023 05 Arkansas 13.2 45.9 October 18, 2023 October 30, 2023 63
2023 06 California 11.4 41.4 October 18, 2023 October 30, 2023 63
2023 08 Colorado 11.5 35.5 October 18, 2023 October 30, 2023 63

Get the national food scarcity rate and expense difficulty rate for every survey period available since 2022.

hps_us <- getCensus(
    name = "timeseries/hps",
    vars = c("FOODSCARCE_RATE", "EXPENSE_RATE",
                     "COL_START_DATE", "COL_END_DATE"),
    region = "us:*",
    WEEK = "*",
    time = "from 2022")
hps_us
time us FOODSCARCE_RATE EXPENSE_RATE COL_START_DATE COL_END_DATE WEEK
2023 1 12.5 40.8 October 18, 2023 October 30, 2023 63
2023 1 12.4 41.2 September 20, 2023 October 2, 2023 62
2023 1 12.1 37.3 August 23, 2023 September 4, 2023 61
2023 1 12.1 38.9 July 26, 2023 August 7, 2023 60
2023 1 12.1 37.8 June 28, 2023 July 10, 2023 59
2023 1 11.8 38.6 June 7, 2023 June 19, 2023 58
2023 1 11.3 38.5 April 26, 2023 May 8, 2023 57
2023 1 10.9 38.7 March 29, 2023 April 10, 2023 56
2023 1 10.7 38.5 March 1, 2023 March 13, 2023 55
2023 1 11.4 39.7 February 4, 2023 February 13, 2023 54
2023 1 11.2 39.5 January 4, 2023 January 16, 2023 53
2022 1 11.4 40.0 December 9, 2022 December 19, 2022 52
2022 1 11.0 39.5 November 2, 2022 November 14, 2022 51
2022 1 11.4 40.9 October 5, 2022 October 17, 2022 50
2022 1 11.5 40.1 September 14, 2022 September 26, 2022 49
2022 1 11.5 40.1 July 27, 2022 August 8, 2022 48
2022 1 11.9 40.0 June 29, 2022 July 11, 2022 47
2022 1 11.1 39.1 June 1, 2022 June 13, 2022 46
2022 1 11.2 34.4 April 27, 2022 May 9, 2022 45
2022 1 11.2 34.1 March 30, 2022 April 11, 2022 44
2022 1 10.3 34.3 March 2, 2022 March 14, 2022 43
2022 1 10.1 32.3 January 26, 2022 February 7, 2022 42
2022 1 10.2 31.3 December 29, 2021 January 10, 2022 41

International Data Base

International Data Base documentation

Get Census Bureau projections of 2024 populations and life expectancy at birth by country.

intl_pop <- getCensus(
    name = "timeseries/idb/5year",
    vars = c("NAME", "GENC", "POP", "E0"),
    time = 2024)
head(intl_pop)
time NAME GENC POP E0
2024 Andorra AD 85370 83.80
2024 United Arab Emirates AE 10032213 79.94
2024 Afghanistan AF 40121552 54.44
2024 Antigua and Barbuda AG 102634 78.28
2024 Anguilla AI 19416 82.61
2024 Albania AL 3107100 79.93

International Trade

International Trade documentation

Note: The international trade datasets can be buggy and often give the general error message of “There was an error while running your query. We’ve logged the error and we’ll correct it ASAP. Sorry for the inconvenience.” This error message comes from the U.S. Census Bureau. If you run in to repeated issues or inconsistencies, contact the Census Bureau for help or consider using a bulk data download instead.

Get the general imports value and imports for consumption value for all countries for a specific month.

imports <- getCensus(
    name = "timeseries/intltrade/imports/enduse",
    vars = c("CTY_CODE", "CTY_NAME", "GEN_VAL_MO", "CON_VAL_MO"),
    time = "2024-01")
head(imports)
time CTY_CODE CTY_NAME GEN_VAL_MO CON_VAL_MO
2024-01 - TOTAL FOR ALL COUNTRIES 253796657727 254565546221
2024-01 0003 EUROPEAN UNION 46556315322 46280913991
2024-01 0014 PACIFIC RIM COUNTRIES 79572147272 79225173215
2024-01 0017 CAFTA-DR 2478595066 2473338341
2024-01 0020 NAFTA 71351448154 71232155920
2024-01 0021 TWENTY LATIN AMERICAN REPUBLICS 50116067956 50453986362

Population Estimates and Projections

Population Estimates and Projections documentation

Population Estimates

Population Estimates documentation

PEP data from 2022 and beyond is not currently available via API. You can download the latest data files from the PEP webpage.

Get the 2021 vintage population estimates for states for 2020 and 2021.

popest <- getCensus(
    name = "pep/population",
    vintage = 2021,
    vars = c("POP_2020","POP_2021"),
    region = "state:*")
head(popest)
state POP_2020 POP_2021
40 3962031 3986639
31 1961455 1963692
15 1451911 1441553
46 887099 895376
47 6920119 6975218
32 3114071 3143991
popest_housing <- getCensus(
    name = "pep/housing",
    vintage = 2018,
    vars = c("DATE_CODE", "DATE_DESC", "HUEST"),
    region = "county:195",
    regionin = "state:02")
head(popest_housing)
state county DATE_CODE DATE_DESC HUEST
02 195 1 4/1/2010 Census housing unit count 1994
02 195 2 4/1/2010 housing unit estimates base 1644
02 195 3 7/1/2010 housing unit estimate 1646
02 195 4 7/1/2011 housing unit estimate 1647
02 195 5 7/1/2012 housing unit estimate 1659
02 195 6 7/1/2013 housing unit estimate 1662

Population Projections

Population Projections documentation

popproj <- getCensus(
    name = "pep/projpop",
    vintage = 2014,
    vars = c("YEAR", "POP", "AGE"),
    region = "us:1")
head(popproj)
us YEAR POP AGE
1 2014 3971847 0
1 2014 3957864 1
1 2014 3972081 2
1 2014 4003272 3
1 2014 4001929 4
1 2014 4002977 5

Poverty Statistics

Poverty Statistics documentation

Current Population Survey Poverty Statistics

Get national poverty rates by race since 1970.

poverty <- getCensus(
    name = "timeseries/poverty/histpov2",
    vars = c("RACE", "RACE_LABEL", "PCTPOV"),
    region = "us:*",
    time = "from 1970")
head(poverty)
time us RACE RACE_LABEL PCTPOV
2022 1 1 All races 11.5
2022 1 2 White alone 10.5
2022 1 4 White alone, not Hispanic 8.6
2022 1 6 Black alone or in combination 17.0
2022 1 7 Black alone 17.1
2022 1 9 Asian alone or in combination 8.2

Small Area Income and Poverty Estimates (SAIPE)

Get poverty rate for children and overall for a single year.

saipe <- getCensus(
    name = "timeseries/poverty/saipe",
    vars = c("NAME", "SAEPOVRT0_17_PT", "SAEPOVRTALL_PT"),
    region = "state:*",
    time = 2022)
head(saipe)
time state NAME SAEPOVRT0_17_PT SAEPOVRTALL_PT
2022 01 Alabama 21.8 16.2
2022 02 Alaska 13.4 10.8
2022 04 Arizona 16.0 12.5
2022 05 Arkansas 21.2 16.3
2022 06 California 15.3 12.2
2022 08 Colorado 11.1 9.5

Get the poverty rate for children and overall in a single county over time.

saipe_years <- getCensus(
    name = "timeseries/poverty/saipe",
    vars = c("NAME", "SAEPOVRT0_17_PT", "SAEPOVRTALL_PT"),
    region = "county:001",
    regionin = "state:12",
    time = "from 2010")
head(saipe_years)
time state county NAME SAEPOVRT0_17_PT SAEPOVRTALL_PT
2010 12 001 Alachua County 26.3 25.3
2011 12 001 Alachua County 21.8 23.5
2012 12 001 Alachua County 26.9 26.6
2013 12 001 Alachua County 25.7 25.7
2014 12 001 Alachua County 22.1 21.6
2015 12 001 Alachua County 21.6 21.1

SAIPE School Districts

Get the number (SAEPOV5_17V_PT) and rate (SAEPOVRAT5_17RV_PT) of children ages 5-17 living in poverty for unified school districts in Massachusetts.

saipe_schools <- getCensus(
    name = "timeseries/poverty/saipe/schdist",
    vars = c("SD_NAME", "SAEPOV5_17V_PT", "SAEPOVRAT5_17RV_PT"),
    region = "school district (unified):*",
    regionin = "state:25",
    time = 2022)
head(saipe_schools)
time state school_district_unified SD_NAME SAEPOV5_17V_PT SAEPOVRAT5_17RV_PT
2022 25 00001 Quabbin School District 2389 6.9
2022 25 00002 Spencer-East Brookfield School District 1949 9.5
2022 25 00013 Southwick-Tolland-Granville Regional School District 1520 6.6
2022 25 00067 Manchester Essex Regional School District 1568 4.1
2022 25 00542 Ayer-Shirley School District 2005 6.8
2022 25 00544 Monomoy Regional School District 1853 6.9

Public Sector Statistics

Public Sector Statistics documentation

This endpoint includes data from multiple surveys organized be sure to read the Census Bureau’s documentation for variable definitions and labels.

Get expenditures for Public Elementary-Secondary School System Finances for Massachusetts.

govs <- getCensus(
    name = "timeseries/govs",
    vars = c("SVY_COMP_LABEL", "AGG_DESC", "AGG_DESC_LABEL" ,"AMOUNT"),
    region = "state:25",
    time = 2021,
    SVY_COMP = "06",
    EXPENDTYPE = "001")
head(govs)
time state SVY_COMP_LABEL AGG_DESC AGG_DESC_LABEL AMOUNT SVY_COMP EXPENDTYPE
2021 25 Annual Survey of School System Finance SS0601 Total current spending 18965809 6 1
2021 25 Annual Survey of School System Finance SS0604 Current spending - Instruction - Total 12362698 6 1
2021 25 Annual Survey of School System Finance SS0610 Current spending - All other functions 417245 6 1
2021 25 Annual Survey of School System Finance SS0708 Current spending - Support services - Other and nonspecified support services 418997 6 1
2021 25 Annual Survey of School System Finance SS0701 Current spending - Support services - Total 6185866 6 1
2021 25 Annual Survey of School System Finance SS0702 Current spending - Support services - Pupil support services 1551012 6 1

Quarterly Workforce Indicators

Quarterly Workforce Indicators documentation

The QWI endpoints allow both simple calls and very specific ones. Make sure to read the documentation closely. Here’s a simple call that gets employment data by county.

qwi_counties <- getCensus(
    name = "timeseries/qwi/sa",
    vars = c("Emp", "EarnBeg"),
    region = "county:*",
    regionin = "state:01",
    time = "2023-Q2")
head(qwi_counties)
Emp EarnBeg time state county
11882 3936 2023-Q2 01 001
82571 3798 2023-Q2 01 003
7157 3208 2023-Q2 01 005
4735 3929 2023-Q2 01 007
9140 3513 2023-Q2 01 009
2267 3623 2023-Q2 01 011

Got total employment and average earnings by quarter for a single state.

qwi_time <- getCensus(
    name = "timeseries/qwi/sa",
    vars = c("Emp", "EarnBeg"),
    region = "state:01",
    time = "from 2018 to 2023")
head(qwi_time)
Emp EarnBeg time state
1881802 3515 2018-Q1 01
1891332 3471 2018-Q2 01
1911623 3434 2018-Q3 01
1908747 3687 2018-Q4 01
1913757 3597 2019-Q1 01
1918965 3578 2019-Q2 01

Here’s a much more specific call. Read the Census Bureau’s documentation closely to see all of the options allowed by the QWI APIs.

qwi <- getCensus(
    name = "timeseries/qwi/sa",
    region = "state:02",
    vars = c("Emp", "sex"),
    time = 2012,
    quarter = 1,
    agegrp = "A07",
    ownercode = "A05",
    firmsize = 1,
    seasonadj = "U",
    industry = 21)
qwi
Emp sex time quarter agegrp ownercode firmsize seasonadj industry state
54 0 2012-Q1 1 A07 A05 1 U 21 02
48 1 2012-Q1 1 A07 A05 1 U 21 02
6 2 2012-Q1 1 A07 A05 1 U 21 02

The Planning Database

The Planning Database documentation

Get population and 2010 Census mail return rates for block groups in Autauga County, AL.

pdb <- getCensus(
    name = "pdb/blockgroup",
    vintage = 2018,
    vars = c("GIDBG", "County_name", "State_name", "Tot_Population_CEN_2010", "Mail_Return_Rate_CEN_2010"),
    region = "block group:*",
    regionin = "state:01+county:001")
head(pdb)
County_name State_name Tot_Population_CEN_2010 Mail_Return_Rate_CEN_2010 state county tract block_group GIDBG
Autauga County Alabama 570 79.7 01 001 020400 4 10010204004
Autauga County Alabama 1737 84.6 01 001 020500 1 10010205001
Autauga County Alabama 7023 72.8 01 001 020500 2 10010205002
Autauga County Alabama 2006 86.0 01 001 020500 3 10010205003
Autauga County Alabama 2423 87.8 01 001 020600 1 10010206001
Autauga County Alabama 1245 73.4 01 001 020600 2 10010206002