# US & Canada Address Parser, Validator & Geocoder (`geeky_goth_gamer/us-ca-address-parser-geocoder`) Actor

Parse, validate and format US and Canadian addresses (states, provinces, ZIP and postal codes), and geocode US addresses with the official Census geocoder.

- **URL**: https://apify.com/geeky_goth_gamer/us-ca-address-parser-geocoder.md
- **Developed by:** [Chris Day](https://apify.com/geeky_goth_gamer) (community)
- **Categories:** Developer tools, AI, Business
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 address parseds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/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

## US & Canada Address Parser, Validator & Geocoder

Parse, validate and format US and Canadian addresses (states, provinces, ZIP and postal codes), and geocode US addresses with the official Census geocoder.

Coverage: United States, Canada, Puerto Rico, Guam, US Virgin Islands, American Samoa, Northern Mariana Islands, US Minor Outlying Islands.

Built on Google's open [libaddressinput](https://github.com/google/libaddressinput) address rules (via `google-i18n-address`, BSD licence) for postal-code formats, required fields, state/province names and mailing formats, plus `usaddress` (MIT) for US street parsing. Runs as a normal Actor or an always-warm **Standby HTTP API**.

### When an AI agent should use this

Use it to clean messy address text before saving it, check that a postal code and region are valid for the country, split an address into fields for a form or CRM, produce a correctly ordered mailing label, or (where available) get coordinates.

Don't use it to prove that a specific building exists or receives mail. Parsing and validation check the format and the country's rules, not delivery.

### Example input

```json
{
  "addresses": [
    "1600 Amphitheatre Pkwy, Mountain View, CA 94043",
    "111 Wellington St, Ottawa, ON K1A 0A9, Canada",
    "Apt 4B 350 Fifth Ave New York NY 10118"
  ]
}
```

### Output (one item per address)

- `status`: `ok`, `empty`, `needs_country`, `unsupported_country` (with `suggestedActor`) or `invalid_country`
- `country`, `countryName`
- `components`: `houseNumber`, `street`, `unit`, `city`, `cityArea`, `region` (code), `regionName`, `postcode`
- `formatted` (mailing lines in the country's order) and `formattedSingleLine`
- `validation`: `valid`, `errors` per field (e.g. `{"postal_code": "invalid"}`), `requiredFields`
- `confidence`: `high`, `medium` or `low`
- `geocode`: `latitude`, `longitude`, `matchLevel`, `matchedAddress`, `source`, `attribution` (or `null`)
- `billed`

### Pricing

| Event | Price (USD) |
|---|---|
| `address-parsed` | $0.001 per address parsed |
| `address-geocoded` | $0.003 per address with coordinates found |
| `apify-actor-start` | $0.00005 per run |

Empty lines, unknown countries, countries outside this pack and failed geocodes are free.

### Geocoding sources

- US & Puerto Rico: U.S. Census Bureau Geocoder (public domain), address-range interpolation.

Parse-only: Canada (no free official geocoder licensed for commercial bulk use). When a result has coordinates, keep the `attribution` text with it.

### Standby HTTP API

Base URL: `https://geeky-goth-gamer--us-ca-address-parser-geocoder.apify.actor` (send `Authorization: Bearer <APIFY_TOKEN>`).

- `POST /parse`: up to 100 addresses, with geocoding
- `POST /validate`: same without geocoding
- `POST /coverage`: countries and geocoders (free)
- `GET /health`

```bash
curl -s -X POST "https://geeky-goth-gamer--us-ca-address-parser-geocoder.apify.actor/parse" -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" -d '{"addresses": ["1600 Amphitheatre Pkwy, Mountain View, CA 94043"]}'
```

### MCP

```
https://mcp.apify.com/?tools=geeky_goth_gamer/us-ca-address-parser-geocoder
```

### Limits and accuracy

1,000 addresses per run, 100 per Standby call, 500 characters per address. Parsing is rule-based and works best with commas or new lines between parts. Unusual formats come back with `confidence: low` and field-level validation errors rather than guesses. Geocoding is rate-limited politely per source.

### Related tools

- [Global Address Parser, Validator & Geocoder (250 Countries)](https://apify.com/geeky_goth_gamer/global-address-parser-geocoder)
- [Australian Address Validator & Geocoder (G-NAF)](https://apify.com/geeky_goth_gamer/au-nz-address-parser-geocoder)
- [All tools](https://apify.com/geeky_goth_gamer)

# Actor input Schema

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

Up to 1,000 addresses per run (100 per Standby call). Each item is a string, or {"address": "...", "country": "DE"} to force the country. Free-form text with commas or new lines works best.

## `bulkText` (type: `string`):

Optional alternative to addresses: paste one address per line.

## `defaultCountry` (type: `string`):

Optional ISO code or name used when an address has no country and none can be inferred from its postal code. Must be covered by this Actor.

## `geocode` (type: `boolean`):

Look up latitude/longitude with free official sources (census). Only successful matches are charged.

## Actor input object example

```json
{
  "addresses": [
    "1600 Amphitheatre Pkwy, Mountain View, CA 94043",
    "111 Wellington St, Ottawa, ON K1A 0A9, Canada"
  ],
  "defaultCountry": "US",
  "geocode": true
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# 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 Amphitheatre Pkwy, Mountain View, CA 94043",
        "111 Wellington St, Ottawa, ON K1A 0A9, Canada"
    ],
    "defaultCountry": "US"
};

// Run the Actor and wait for it to finish
const run = await client.actor("geeky_goth_gamer/us-ca-address-parser-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 Amphitheatre Pkwy, Mountain View, CA 94043",
        "111 Wellington St, Ottawa, ON K1A 0A9, Canada",
    ],
    "defaultCountry": "US",
}

# Run the Actor and wait for it to finish
run = client.actor("geeky_goth_gamer/us-ca-address-parser-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 Amphitheatre Pkwy, Mountain View, CA 94043",
    "111 Wellington St, Ottawa, ON K1A 0A9, Canada"
  ],
  "defaultCountry": "US"
}' |
apify call geeky_goth_gamer/us-ca-address-parser-geocoder --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,geeky_goth_gamer/us-ca-address-parser-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/al9YDVQRhCc8uCGxY/builds/70mlBEj0xfQ9mem2B/openapi.json
