Census.gov API

Free to Use Varies (check documentation)

Overview

Census.gov provides free access to a vast collection of US demographic, economic, and geographic data from the United States Census Bureau. You can explore population counts, income statistics, housing data, and business information across states, counties, and cities. An API key is available for free and gives you higher request limits.

Beginner Tip

Register for a free API key at api.census.gov/data/key_signup.html to avoid hitting the anonymous rate limit; include it as a ?key=YOUR_API_KEY query parameter on all requests.

Available Data

Census.gov data via REST API

Example Response

JSON Response
{
  "route": "Line 1",
  "origin": "Station A",
  "destination": "Station B",
  "departure": "08:30",
  "arrival": "09:15",
  "status": "On Time",
  "delays_min": 0
}

Field Reference

NAME Human-readable name of the geographic area (e.g. state or county name)
state FIPS code for the state (e.g. 06 for California)
county FIPS code for the county within a state
P1_001N Total population count from the 2020 Decennial Census (variable name varies by dataset)

Implementation Example

Request
const url = "https://www.census.gov/data/developers/";
const response = await fetch(url);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

Invalid variable name error Census variable names differ by dataset and year (e.g. P001001 vs P1_001N)
Check the variables endpoint for your specific dataset: api.census.gov/data/[year]/[dataset]/variables.json
400 Bad Request on geography The for and in geography parameters are not correctly formatted
Use the geography hierarchy exactly as documented—for example, for=county:*&in=state:06 for all California counties
Rate limit exceeded without key Anonymous requests are limited to 500 per day per IP
Register for a free API key at api.census.gov/data/key_signup.html to increase your limit to 500 per hour

Metadata Score Breakdown

Estimated from metadata — endpoint not independently tested

This score is estimated from observable metadata — HTTPS support, authentication model, declared CORS, and documentation reachability — because the API requires authentication or exposes no publicly testable endpoint. The five-signal breakdown is only shown for live-tested APIs.

Metadata estimate · endpoint not independently tested

Technical Specifications

Auth No Auth
HTTPS REQUIRED
CORS UNKNOWN
Category Government
Difficulty Beginner
Verified: 2026-04-04

Related Tags

Similar APIs

View All →