To improve access to data and encourage innovation, the Census Bureau has begun to provide API access to some data sets. We invite developers to use these APIs, join our Developer Forum, and provide feedback to help us move forward with continued API development.
Please read the Terms of Service for using the API.
Data are accessible to software developers through a stateless HTTP GET request. Up to 50 variables can be requested with a single API call. In order to access data, you will need to insert a key into the request URL in order for query results to be returned. If you do not have a key assigned to you, you will be directed to the Request a Key page where you can register for one.
1) Example of the request URL for 2010 Census SF1 data that has an assigned key inserted:
2) Example of the request URL for ACS 2010 5 Year data for Total Population for California and New York:
3) Example of the request URL for ACS 2010 5 Year data for Gross Rent as a Percentage of Household Income, 10.0 to 14.9 percent for all counties in CA:
4) Example of the request URL for 2010 Census SF1 white population of 12 year olds in Alabama
The response for all queries is formatted as a two dimensional JSON array where the first row provides column names and subsequent rows provide data values.
An example query response looks like this:
Each query response will include an HTTP status code. The table below lists the status codes and what they mean.
Indicates success. The response body will contain a JSON array as described above.
Indicates the request succeeded but no records matched your query.
Indicates that the request was not valid. Examples include queries for unknown variables or unknown geographies. A message describing the error will be included in the response body.
Indicates that there was a server-side error while processing the request. Please wait a few minutes and try your query again.
If you're writing a browser-based web application for modern web browsers with support for CORS then you may simply use an XMLHttpRequest as usual, without any changes. All HTTP responses generated by the API will include the necessary CORS headers.
If you're writing a browser-based web application for legacy browsers without support for CORS then your request URL query string may include a jsonp argument. If present, this prefix will be wrapped around the response, allowing you to capture the result of the query.
[Census API Release 1.0]