DEV Community

Ava Torres
Ava Torres

Posted on

How to Get Industry Employment and Business Counts by Location (Census Bureau County Business Patterns API)

If you need to answer questions like "How many restaurants are in each California ZIP code?" or "Which counties have the most construction firms?" or "What's the total healthcare payroll in Texas?" -- the Census Bureau already has that data. It is called County Business Patterns (CBP), and it is one of the most useful datasets that almost nobody outside of economics and market research knows about.

CBP covers every US state, county, and ZIP code. For each geographic unit, it reports the number of business establishments, total employees, and annual payroll -- broken down by NAICS industry code. The data comes from the Census Bureau's annual survey of businesses with paid employees.

What the data contains

Each record includes:

  • naicsCode and naicsLabel -- the industry classification (e.g., "72" = Accommodation & Food Services, "54" = Professional, Scientific & Technical Services)
  • employees -- total employees counted during the mid-March pay period
  • establishments -- number of business establishments
  • annualPayroll -- total annual payroll in thousands of dollars
  • firstQuarterPayroll -- first-quarter payroll in thousands
  • stateFips, countyFips, zipCode -- geographic identifiers depending on your query level

You can query at four geographic levels: national (one summary row), state (one row per state), county (one row per county), or ZIP code (one row per ZIP).

Who uses this

Market researchers use CBP for market sizing. Before entering a new geography, you want to know how many competitors exist, how many employees the industry has, and what payroll levels look like. CBP answers all of that.

Site selection teams use it to compare business density across counties and ZIP codes. If you are opening a restaurant and want to find ZIP codes with high foot traffic but relatively few existing restaurants, CBP gives you the establishment counts to make that comparison.

Economic development agencies track industry concentration to attract investment. A county with 500 manufacturing establishments and $2B in annual payroll has a different pitch than one with 50.

Commercial real estate analysts use establishment density as a demand signal. More professional services firms in a ZIP code means more demand for Class A office space.

Sales and lead generation teams use it to prioritize territories. If you sell to healthcare organizations, knowing that Harris County, TX has 4,000+ healthcare establishments tells you where to focus outbound effort.

Querying via API

I built an Apify actor that wraps the Census CBP API and returns clean JSON. Specify the NAICS code, geographic level, and optional state filter.

import requests

API_TOKEN = "your_apify_token"

# Get restaurant industry data (NAICS 72) for every US state
run = requests.post(
    f"https://api.apify.com/v2/acts/pink_comic~census-business-patterns-industry-employment/runs?token={API_TOKEN}",
    json={
        "naicsCode": "72",
        "geography": "state",
        "maxResults": 100
    }
).json()

print(f"Run started: {run['data']['id']}")
Enter fullscreen mode Exit fullscreen mode

Fetch the results:

dataset_id = run["data"]["defaultDatasetId"]
items = requests.get(
    f"https://api.apify.com/v2/datasets/{dataset_id}/items?token={API_TOKEN}"
).json()

for record in items:
    print(f"State FIPS {record['stateFips']} | "
          f"{record['naicsLabel']} | "
          f"{record['establishments']} establishments | "
          f"{record['employees']} employees | "
          f"Payroll: ${record['annualPayroll']}K")
Enter fullscreen mode Exit fullscreen mode

Example queries

Healthcare establishments by county in California:

{
    "naicsCode": "62",
    "geography": "county",
    "stateCode": "06",
    "maxResults": 500
}
Enter fullscreen mode Exit fullscreen mode

Construction industry by ZIP code in Texas:

{
    "naicsCode": "23",
    "geography": "zipcode",
    "stateCode": "48",
    "maxResults": 1000
}
Enter fullscreen mode Exit fullscreen mode

All industries at the national level (summary):

{
    "naicsCode": "",
    "geography": "national",
    "maxResults": 500
}
Enter fullscreen mode Exit fullscreen mode

Professional services (NAICS 54) by state:

{
    "naicsCode": "54",
    "geography": "state",
    "maxResults": 60
}
Enter fullscreen mode Exit fullscreen mode

Common NAICS codes

Code Industry
23 Construction
31-33 Manufacturing
44-45 Retail Trade
52 Finance and Insurance
54 Professional, Scientific & Technical Services
62 Health Care & Social Assistance
72 Accommodation & Food Services

You can use 2-digit codes for broad sectors or drill down to 6-digit subsectors for granular industry segments.

Notes on the data

CBP uses 2021 data (the most recent release available via API). Some cells are suppressed by the Census Bureau for confidentiality reasons -- these appear as "0" or "N" in the results, which is standard Census disclosure avoidance, not missing data. ZIP code queries can return large result sets, so use the stateCode filter or maxResults to keep things manageable.

Data source

All data comes from the US Census Bureau County Business Patterns API. No API key required.

The actor is here: Census Business Patterns - Industry & Employment Data

It's part of a collection of public data tools I built covering government APIs, business registrations, SEC filings, and regulatory data. All on Apify, all written in Go.

Top comments (0)