United States Census Bureau Decennial Census API

Decennial Census population and housing counts

OpenAPI Specification

united-states-census-bureau-decennial-census-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Census Data American Community Survey Decennial Census API
  description: The United States Census Bureau Data API provides programmatic access to statistical data from Census Bureau surveys and datasets. The API covers demographic, economic, housing, and social data through a query-based interface. Key datasets include the American Community Survey (ACS), Decennial Census, Population Estimates, County Business Patterns, and many more. Users can query data by geographic level (national, state, county, tract, block group) and filter by hundreds of statistical variables. An API key is optional (up to 500 requests/day without one) but required for higher usage.
  version: 2.0.0
  contact:
    name: Census Developer Forum
    url: https://www.census.gov/data/developers.html
    email: cnmp.developers.list@census.gov
  x-tags:
  - Demographics
  - Federal Government
  - Open Data
  - Statistics
servers:
- url: https://api.census.gov/data
  description: Census Data API
tags:
- name: Decennial Census
  description: Decennial Census population and housing counts
paths:
  /{year}/dec/pl:
    get:
      operationId: getDecennialPL
      summary: Get Decennial Census Redistricting Data (P.L. 94-171)
      description: Returns Decennial Census redistricting data including population counts by race/ethnicity and housing unit counts. Data available for 2020 and 2010.
      tags:
      - Decennial Census
      parameters:
      - name: year
        in: path
        required: true
        description: Census year (2020 or 2010)
        schema:
          type: integer
          enum:
          - 2020
          - 2010
      - name: get
        in: query
        required: true
        description: Variable names (e.g., P1_001N for total population)
        schema:
          type: string
      - name: for
        in: query
        required: false
        description: Geographic level and FIPS filter
        schema:
          type: string
      - name: in
        in: query
        required: false
        description: Parent geography constraint
        schema:
          type: string
      - name: key
        in: query
        required: false
        description: Census API key
        schema:
          type: string
      responses:
        '200':
          description: 2D JSON array of decennial census data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataAPIResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
components:
  responses:
    BadRequest:
      description: Bad request — invalid parameters, missing required fields, or variable not found
      content:
        text/html:
          schema:
            type: string
  schemas:
    DataAPIResponse:
      type: array
      description: A 2D JSON array where the first element is an array of variable names (headers) and each subsequent element is an array of corresponding data values. The last elements in each row are typically geography codes.
      items:
        type: array
        description: A single data row (header row or data row)
        items:
          type: string
          nullable: true
      example:
      - - NAME
        - B01003_001E
        - state
      - - Alabama
        - '5024279'
        - '01'
      - - Alaska
        - '733391'
        - '02'
      - - Arizona
        - '7151502'
        - '04'
externalDocs:
  description: Census Data API User Guide
  url: https://www.census.gov/data/developers/guidance/api-user-guide.html