Find an API

Search public APIs with auth details & Postman guides

← All APIs

US Census Bureau Data API

census.gov · Government

Government API Key Free & Open Government Financial Services Real Estate Demographics Economics Government

Access demographic, economic, and geographic data from the US Census Bureau. Covers American Community Survey (ACS), Decennial Census, Economic Census, Current Population Survey, and more. Essential for market sizing, workforce analysis, and geographic breakdowns.

Authentication

API Key Free API key from api.census.gov/data/key_signup.html. Requests without a key are allowed but limited. Key is passed as a query parameter.

Parameter name: key (in query)

Sample Requests

GET ACS 5-Year: population by state

Returns total population (B01001_001E) for all US states from the 2022 ACS 5-Year estimates.

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

Hover any highlighted part to learn what it does

curl -X GET "https://api.census.gov/data/2022/acs/acs5?for=state%3A*&get=NAME%2CB01001_001E&key=YOUR_API_KEY"
import requests
params = {
    "for": "state:*",
    "get": "NAME,B01001_001E",
    "key": "YOUR_API_KEY"
}
response = requests.get(
    "https://api.census.gov/data/2022/acs/acs5",
    params=params,
)
print(response.json())
const url = new URL('https://api.census.gov/data/2022/acs/acs5');
url.searchParams.set('for', 'state:*');
url.searchParams.set('get', 'NAME,B01001_001E');
url.searchParams.set('key', 'YOUR_API_KEY');

const response = await fetch(url); 
const data = await response.json();
console.log(data);
package main

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
)

func main() {
	baseURL, _ := url.Parse("https://api.census.gov/data/2022/acs/acs5")
	q := baseURL.Query()
	q.Set("for", "state:*")
	q.Set("get", "NAME,B01001_001E")
	q.Set("key", "YOUR_API_KEY")
	baseURL.RawQuery = q.Encode()
	targetURL := baseURL.String()
	req, _ := http.NewRequest("GET", targetURL, nil)

	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
require "net/http"
require "json"

uri = URI("https://api.census.gov/data/2022/acs/acs5")
uri.query = URI.encode_www_form({
  "for" => "state:*",
  "get" => "NAME,B01001_001E",
  "key" => "YOUR_API_KEY"
})

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"

req = Net::HTTP::Get.new(uri)

res = http.request(req)
puts JSON.parse(res.body)
<?php
$url = "https://api.census.gov/data/2022/acs/acs5?" . http_build_query([
    "for" => "state:*",
    "get" => "NAME,B01001_001E",
    "key" => "YOUR_API_KEY"
]);
$opts = ["http" => [
    "method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET ACS: median household income by county

Returns median household income (B19013_001E) for all counties in a state. Replace 06 with your state FIPS code.

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

Hover any highlighted part to learn what it does

curl -X GET "https://api.census.gov/data/2022/acs/acs5?in=state%3A06&for=county%3A*&get=NAME%2CB19013_001E&key=YOUR_API_KEY"
import requests
params = {
    "in": "state:06",
    "for": "county:*",
    "get": "NAME,B19013_001E",
    "key": "YOUR_API_KEY"
}
response = requests.get(
    "https://api.census.gov/data/2022/acs/acs5",
    params=params,
)
print(response.json())
const url = new URL('https://api.census.gov/data/2022/acs/acs5');
url.searchParams.set('in', 'state:06');
url.searchParams.set('for', 'county:*');
url.searchParams.set('get', 'NAME,B19013_001E');
url.searchParams.set('key', 'YOUR_API_KEY');

const response = await fetch(url); 
const data = await response.json();
console.log(data);
package main

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
)

func main() {
	baseURL, _ := url.Parse("https://api.census.gov/data/2022/acs/acs5")
	q := baseURL.Query()
	q.Set("in", "state:06")
	q.Set("for", "county:*")
	q.Set("get", "NAME,B19013_001E")
	q.Set("key", "YOUR_API_KEY")
	baseURL.RawQuery = q.Encode()
	targetURL := baseURL.String()
	req, _ := http.NewRequest("GET", targetURL, nil)

	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
require "net/http"
require "json"

uri = URI("https://api.census.gov/data/2022/acs/acs5")
uri.query = URI.encode_www_form({
  "in" => "state:06",
  "for" => "county:*",
  "get" => "NAME,B19013_001E",
  "key" => "YOUR_API_KEY"
})

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"

req = Net::HTTP::Get.new(uri)

res = http.request(req)
puts JSON.parse(res.body)
<?php
$url = "https://api.census.gov/data/2022/acs/acs5?" . http_build_query([
    "in" => "state:06",
    "for" => "county:*",
    "get" => "NAME,B19013_001E",
    "key" => "YOUR_API_KEY"
]);
$opts = ["http" => [
    "method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));

Postman Setup Guide

Get Postman ↗
  1. Get a free API key at https://api.census.gov/data/key_signup.html
  2. Browse available datasets at https://api.census.gov/data.html
  3. Find variable codes at https://api.census.gov/data/2022/acs/acs5/variables.html
  4. In Postman, GET https://api.census.gov/data/{year}/{dataset}
  5. Required params: get (comma-separated variable codes), for (geographic level)
  6. Common datasets: acs/acs5 (5-yr estimates), acs/acs1 (1-yr), dec/pl (decennial)
  7. Response is a 2D array — first row is headers, remaining rows are data

What can you build with US Census Bureau Data API?

US Census Bureau Data API is a Government API. Developers commonly use government APIs for:

  • surfacing public datasets in citizen-facing apps
  • building transparency and civic engagement tools
  • accessing legislation, court records, and official data
  • powering research and journalism tools
  • creating compliance and regulatory monitoring dashboards

API Key authentication. You'll receive a key after signing up. Send it with every request — in a header or query parameter. Keep it out of client-side code and never commit it to version control. US Census Bureau Data API is free to use, making it a low-risk choice to experiment with.

New to APIs? Read our beginner's guide · Learn about API keys · What is REST?

Open documentation ↗