tidycensus icon indicating copy to clipboard operation
tidycensus copied to clipboard

Error: Your API call has errors. The API message returned is .

Open sawhitta opened this issue 8 months ago • 2 comments

Hi Kyle,

I hope all is well! I am in the process of trying to map 2019-2023 acs year estimates but before I do that I just wanted to select my necessary variables. I checked and double checked if the variable were available using the load_variables function and they are but my code keeps throwing this error message :

Getting data from the 2019-2023 5-year ACS Downloading feature geometry from the Census website. To cache shapefiles for use in future sessions, set options(tigris_use_cache = TRUE). Using FIPS code '09' for state 'CT' Using FIPS code '009' for 'New Haven County' Error: Your API call has errors. The API message returned is .

My code is: `nhv_23 <- get_acs( geography = "block group", variables = c(medhinc23 = "B19013_001", medgren23 = "B25064_001", medhomeval23 = "B25077_001", medrent_perhhi23 = "B25071_001", vacstat23 = "B25002_003", rentvac23 = "B25004_003", homevac23 = "B25004_004", totoccu23 = "B25008_001", rentocc23 = "B25008_003", ownocc23 = "B25008_002", built20_023 = "B25036_003", built20_r23 = "B25036_013", totalbuilt23 = "B25036_001"),

state = "CT", county = "New Haven County", year = 2023, survey = "acs5", output = "wide", geometry = TRUE )`

not sure why this code isn't working but I used the same code for variables in 2013-2017 acs5? Also, the data I wanted to use for this was tract-level data, but I can only find block group. Maybe it's a New Haven specific thing? Just wanted to ask for help!

Thank you!

sawhitta avatar Apr 01 '25 02:04 sawhitta

This is because Connecticut changed its county definitions. New Haven no longer exists as a county. https://www.census.gov/programs-surveys/acs/technical-documentation/user-notes/2023-01.html

szimmer avatar Apr 01 '25 09:04 szimmer

Oh thank you! That makes sense. Do you have any advice for how to get tracts within New Haven city? I’m newish to this and would love any guidance! Thank you so much!

Get Outlook for iOShttps://aka.ms/o0ukef


From: Stephanie Zimmer @.> Sent: Tuesday, April 1, 2025 5:49:10 AM To: walkerke/tidycensus @.> Cc: Whittaker, Shannon @.>; Author @.> Subject: Re: [walkerke/tidycensus] Error: Your API call has errors. The API message returned is . (Issue #606)

You don't often get email from @.*** Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification

This is because Connecticut changed it's county definitions. New Haven no longer exists as a county. https://www.census.gov/programs-surveys/acs/technical-documentation/user-notes/2023-01.html

— Reply to this email directly, view it on GitHubhttps://github.com/walkerke/tidycensus/issues/606#issuecomment-2768805193, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BQMTA2V7TNUM6FKKOBJZYFL2XJOJNAVCNFSM6AAAAAB2FXFAJWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONRYHAYDKMJZGM. You are receiving this because you authored the thread.Message ID: @.***>

[szimmer]szimmer left a comment (walkerke/tidycensus#606)https://github.com/walkerke/tidycensus/issues/606#issuecomment-2768805193

This is because Connecticut changed it's county definitions. New Haven no longer exists as a county. https://www.census.gov/programs-surveys/acs/technical-documentation/user-notes/2023-01.html

— Reply to this email directly, view it on GitHubhttps://github.com/walkerke/tidycensus/issues/606#issuecomment-2768805193, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BQMTA2V7TNUM6FKKOBJZYFL2XJOJNAVCNFSM6AAAAAB2FXFAJWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONRYHAYDKMJZGM. You are receiving this because you authored the thread.Message ID: @.***>

sawhitta avatar Apr 01 '25 13:04 sawhitta

I am having the same issue. In all fairness, I am very (to infinity) new at this, but I have tried several permutations of code, different tables, double checked variables, etc.

I'm trying to get the information from table B10002 for Kentucky and all counties. Some of the code I have tried:

gparent <- get_acs(geography = "state", table = "b10002", state = "KY")

gparent <- get_acs(geography = "state", table = "b10001", state = "KY", year = 2023)

Tried to get just a variable here: gparent <- get_acs(geography= "state", variables = "b10002_003",state= "KY")

Occasionally I'll get an unknown variable, but most of the time, it just has a blank API error code.

Any help appreciated!

lpbowlingdvm03 avatar Jul 24 '25 14:07 lpbowlingdvm03

@lpbowlingdvm03 perhaps we should handle this internally, but the Census API (and consequently tidycensus) expects capitalized variable and table names:

library(tidycensus)

get_acs(geography = "state", table = "B10001", state = "KY", year = 2023)
#> Getting data from the 2019-2023 5-year ACS
#> # A tibble: 4 × 5
#>   GEOID NAME     variable   estimate   moe
#>   <chr> <chr>    <chr>         <dbl> <dbl>
#> 1 21    Kentucky B10001_001    93096  2806
#> 2 21    Kentucky B10001_002    32113  1282
#> 3 21    Kentucky B10001_003    30930  1703
#> 4 21    Kentucky B10001_004    30053  1499

Created on 2025-07-24 with reprex v2.1.1

walkerke avatar Jul 24 '25 14:07 walkerke

Thank you!

lpbowlingdvm03 avatar Jul 24 '25 15:07 lpbowlingdvm03