# Address Geocoder: US Census Bulk Geocoding to Lat/Long (`thoob/census-address-geocoder`) Actor

Address geocoder for bulk US address geocoding with the official US Census Bureau Geocoder. Returns latitude, longitude, matched address, county, tract, block, congressional and legislative districts, place, metro area and ZCTA. No key needed. Unmatched addresses are free.

- **URL**: https://apify.com/thoob/census-address-geocoder.md
- **Developed by:** [Pono Data](https://apify.com/thoob) (community)
- **Categories:** Business, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 address geocodeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Address Geocoder: US Census, Bulk Address to Lat/Long, County, Tract

This actor turns a list of US street addresses into latitude, longitude, county, census tract and district codes using the US Census Bureau Geocoder, for analysts, researchers and anyone who needs to place addresses on Census geography.

### What you get

- Match status: `matched`, `matchCount`, `matchedAddress`
- Coordinates: `latitude`, `longitude`
- Address parts: `street`, `city`, `state`, `zip`, plus `tigerLineId` and `side`
- Census geography: `stateFips`, `countyFips`, `countyName`, `tractGeoid`, `blockGroupGeoid`, `blockGeoid`
- Districts: `congressionalDistrict`, `congress`, `stateUpperDistrict`, `stateLowerDistrict`
- Areas: `placeName`, `metroArea`, `zcta`
- Provenance: `sourceUrl`, `retrievedAt`

### Input

```json
{
  "addresses": [
    "1600 Pennsylvania Ave NW, Washington, DC 20500",
    "350 Fifth Avenue, New York, NY 10118"
  ],
  "includeGeographies": true,
  "maxRecords": 0
}
```

`includeGeographies` set to false returns only coordinates and address parts. `maxRecords` of 0 means no cap. Duplicate addresses (same text after trimming) are processed once.

### Output

Illustration only, values may differ:

```json
{
  "inputAddress": "1600 Pennsylvania Ave NW, Washington, DC 20500",
  "matched": true,
  "matchCount": 1,
  "matchedAddress": "1600 PENNSYLVANIA AVE NW, WASHINGTON, DC, 20500",
  "latitude": 38.8987,
  "longitude": -77.0352,
  "street": "PENNSYLVANIA AVE NW",
  "city": "WASHINGTON",
  "state": "DC",
  "zip": "20500",
  "tigerLineId": "76225813",
  "side": "L",
  "stateFips": "11",
  "countyFips": "11001",
  "countyName": "District of Columbia",
  "tractGeoid": "11001006202",
  "blockGroupGeoid": "110010062021",
  "blockGeoid": "110010062021031",
  "congressionalDistrict": "98",
  "congress": 119,
  "stateUpperDistrict": "2",
  "stateLowerDistrict": "7",
  "placeName": "Washington city",
  "metroArea": "Washington-Arlington-Alexandria, ...",
  "zcta": "20500",
  "sourceUrl": "https://geocoding.geo.census.gov/geocoder/geographies/onelineaddress?address=...",
  "retrievedAt": "2024-05-01T12:00:00Z"
}
```

### Pricing

Event `address-geocoded` costs USD 0.002 per matched address, which is USD 2.00 per 1,000 matched addresses. Addresses the Census Geocoder cannot match are still written as rows with `matched` false, and those rows are free.

### Data source

Data comes from the public US Census Bureau Geocoder (geocoding.geo.census.gov), using the Public_AR_Current benchmark and Current_Current vintage. Every row carries `sourceUrl`, the exact request URL, and `retrievedAt`, the time of the request.

### Limits

- US addresses only, as covered by the Census Geocoder.
- When the Census returns several matches, only the first is used; `matchCount` shows how many there were.
- Geography fields are null when the Census response does not include that layer.
- Requests are paced (up to 4 at a time with a 250 ms gap), so large lists take a while.

### Who uses it

- Data analysts who need `latitude` and `longitude` for a list of US customer or property addresses before mapping them.
- Researchers joining address lists to Census tables through `tractGeoid`, `blockGroupGeoid` and `countyFips`.
- Campaign and advocacy staff assigning supporters to a `congressionalDistrict`, `stateUpperDistrict` or `stateLowerDistrict`.
- Insurance and real estate teams adding `countyName`, `metroArea` and `zcta` to property records.

### FAQ

#### What format should `addresses` use?

Supply a list of US addresses in `addresses`. Full one-line addresses with street, city, state and ZIP give the Census Geocoder the most to match on.

#### What does an empty result mean?

A row with `matched` set to false, or no rows at all, means the Census Geocoder found no match for those addresses. Unmatched addresses are not billed.

#### What does `includeGeographies` do?

It controls whether geography fields such as `countyName`, `tractGeoid`, `congressionalDistrict`, `placeName` and `zcta` are requested along with the coordinates.

#### Can it run on a schedule or through the Apify API?

Yes. It can be started from Apify Schedules or called through the Apify API with the same input. `maxRecords` caps how many matched addresses are billed per run.

# Actor input Schema

## `addresses` (type: `array`):

US street addresses, one per line, as a single line (street, city, state ZIP). Exact duplicates after trimming are dropped.

## `includeGeographies` (type: `boolean`):

Also return state, county, tract, block group, block, congressional and state legislative districts, place, metro area and ZCTA. Off returns coordinates and matched address only.

## `maxRecords` (type: `integer`):

Cap on delivered, billed (matched) rows. 0 means no cap. Unmatched rows are free and not counted. The platform spend cap is honored regardless.

## Actor input object example

```json
{
  "addresses": [
    "1600 Pennsylvania Ave NW, Washington, DC 20500",
    "350 Fifth Avenue, New York, NY 10118"
  ],
  "includeGeographies": true,
  "maxRecords": 0
}
```

# Actor output Schema

## `addresses` (type: `string`):

One row per input address.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "addresses": [
        "1600 Pennsylvania Ave NW, Washington, DC 20500",
        "350 Fifth Avenue, New York, NY 10118"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("thoob/census-address-geocoder").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "addresses": [
        "1600 Pennsylvania Ave NW, Washington, DC 20500",
        "350 Fifth Avenue, New York, NY 10118",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("thoob/census-address-geocoder").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "addresses": [
    "1600 Pennsylvania Ave NW, Washington, DC 20500",
    "350 Fifth Avenue, New York, NY 10118"
  ]
}' |
apify call thoob/census-address-geocoder --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,thoob/census-address-geocoder"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/QAVlNOUfZCJa2c2y2/builds/OvHacnbU5cXQPLwlb/openapi.json
