Data endpoints that redirect to an HTML page and answer 200

Checked 2026-09-08 · Moved and dead endpoints

Two public data endpoints answer a data request with a redirect to an HTML page, so a client that follows redirects sees HTTP 200 and a JSON parse error instead of the real problem. api.census.gov 302s to /data/missing_key.html when no key is supplied, and the old coronavirus.data.gov.uk API 301s to the UKHSA dashboard home page, discarding the query string. Send the request with redirects off and read the status.

What we saw

A keyless Census data request is a 302 to an HTML page, not a JSON error. Source (status line and Location header, 2026-09-08).

302 -> https://api.census.gov/data/missing_key.html

Following that redirect gives 200 and 8531 bytes of HTML titled Missing Key. Source (status, content-type, title, 2026-09-08).

200 text/html 8531 ; <title>Missing Key</title>

A bad key redirects to a different HTML page, so the two failures are distinguishable from the Location header alone. Source (Location header and page title, 2026-09-08).

302 -> https://api.census.gov/data/invalid_key.html ; <title>Invalid Key</title>

Census metadata endpoints do not need a key, so a keyless probe of /variables.json is not a test of whether your key works. Source (status, 2026-09-08).

200 with no redirect

The retired UK coronavirus API 301s to the dashboard root and drops the whole query string. Source (status line, Location header, final URL, 2026-09-08).

301 -> https://ukhsa-dashboard.data.gov.uk/ ; final 200 text/html; charset=utf-8 2153245 https://ukhsa-dashboard.data.gov.uk/

The command

for u in 'https://api.census.gov/data/2019/acs/acs5?get=NAME&for=state:*' 'https://api.census.gov/data/2021/pep/population?get=NAME,POP_2021&for=state:*' 'https://api.census.gov/data.json' 'https://api.census.gov/data/2019/acs/acs5/variables.json'; do printf '%s\n  ' "$u"; curl -sS -o /dev/null -w '%{http_code} -> %{redirect_url}\n' "$u"; done
https://api.census.gov/data/2019/acs/acs5?get=NAME&for=state:*
  302 -> https://api.census.gov/data/missing_key.html
https://api.census.gov/data/2021/pep/population?get=NAME,POP_2021&for=state:*
  302 -> https://api.census.gov/data/missing_key.html
https://api.census.gov/data.json
  200 -> 
https://api.census.gov/data/2019/acs/acs5/variables.json
  200 -> 

Checked 2026-09-08.

curl -sSL -o /tmp/c2.txt -w '%{http_code} %{content_type} %{size_download}\n' 'https://api.census.gov/data/2019/acs/acs5?get=NAME&for=state:*'; grep -o '<title>[^<]*</title>' /tmp/c2.txt
200 text/html 8531
<title>Missing Key</title>

Checked 2026-09-08.

curl -sSL 'https://api.census.gov/data/2019/acs/acs5?get=NAME&for=state:*&key=BADKEY' | grep -o '<title>[^<]*</title>'
<title>Invalid Key</title>

Checked 2026-09-08.

curl -sS -o /dev/null -w '%{http_code} -> %{redirect_url}\n' 'https://coronavirus.data.gov.uk/api/v1/data?filters=areaType=overview&structure=%7B%22date%22:%22date%22%7D'
301 -> https://ukhsa-dashboard.data.gov.uk/

Checked 2026-09-08.

curl -sSL -o /tmp/uk.txt -w 'final %{http_code} %{content_type} %{size_download} %{url_effective}\n' 'https://coronavirus.data.gov.uk/api/v1/data?filters=areaType=overview&structure=%7B%22date%22:%22date%22%7D'; head -c 120 /tmp/uk.txt
final 200 text/html; charset=utf-8 2153245 https://ukhsa-dashboard.data.gov.uk/
<!DOCTYPE html><html lang="en" class="govuk-template roboto_430b033-module__gWWZbG__variable govuk-template--rebranded

Checked 2026-09-08.

requestno-redirect statusLocationstatus after following
api.census.gov ACS 5-year, no key302https://api.census.gov/data/missing_key.html200, 8531 bytes of HTML
api.census.gov PEP population, no key302https://api.census.gov/data/missing_key.html200, HTML
api.census.gov ACS 5-year, key=BADKEY302https://api.census.gov/data/invalid_key.html200, HTML
api.census.gov /data/2019/acs/acs5/variables.json200none200, JSON
api.census.gov /data.json200none200, JSON
coronavirus.data.gov.uk /api/v1/data with filters and structure301https://ukhsa-dashboard.data.gov.uk/200, 2153245 bytes of HTML, query string gone

Limits

Open question

Whether api.census.gov ever returns a JSON or plain-text error for a key problem under some Accept header, rather than the 302. I only sent default and no Accept.

Plain text