# Postal Code Checker: Global ZIP & Postcode Lookup (`scrapemint/postal-code-checker`) Actor

Validate and enrich postal codes for 121 countries. Paste codes like "US 90210" or "DE 10115" and get place name, region, district and GPS coordinates per code, from a bundled open dataset of 1.8 million codes. For checkout validation, logistics and CRM cleaning. No API key needed.

- **URL**: https://apify.com/scrapemint/postal-code-checker.md
- **Developed by:** [Ken M](https://apify.com/scrapemint) (community)
- **Categories:** Business, Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Postal Code Checker: Global ZIP & Postcode Lookup

Validate and enrich postal codes for **121 countries** in one run. Paste codes like `US 90210`, `DE 10115` or `GB SW1A 1AA` and get one clean row per code: place name, region, district and GPS coordinates — matched against a bundled open dataset of **1.8 million postal codes**, with no network calls, no signup and no API key.

Built for **e-commerce checkout validation, logistics and shipping teams, CRM and mailing list cleaning**. Works for any country's codes in the same run: US ZIP codes, UK postcodes, EU codes, Japanese, Kenyan, Indian and more.

### What you get for each code

- **countryCode** and **countryName**
- **placeName**, **region**, **district**: where the code points
- **latitude** and **longitude**: for mapping, routing and distance math
- **places** and **placeCount**: every locality sharing the code (up to 20)
- **matchedBy**: how the match was made (exact, or a documented fallback)

### Example output

```json
{
  "input": "US 90210",
  "found": true,
  "countryCode": "US",
  "countryName": "United States",
  "postalCode": "90210",
  "matchedBy": "exact",
  "placeName": "Beverly Hills",
  "region": "California",
  "latitude": 34.0901,
  "longitude": -118.4065,
  "placeCount": 1
}
````

### How to write code lines

- **With a country (recommended)**: `US 90210`, `JP 100-0001`, `KE 00100`. Exact and fast.
- **Bare code**: `90210` returns a row for **every country** that uses it (90210 exists in the US, Kenya, Mexico, Thailand and more). Set **default country** to pin bare codes to one country.
- **Full UK and Canadian codes work**: `GB SW1A 1AA` matches the outward part (`SW1A`), `CA K1A 0B1` matches the FSA (`K1A`) — the row's `matchedBy` field tells you.

### Pricing

**$0.002 per matched code.** Codes that match nothing are **free**, and the first 2 rows of every run are free. Cleaning a 10,000-address CRM list costs about $20, versus per-seat subscriptions of address-validation SaaS.

### How to run it via API

```bash
curl -X POST "https://api.apify.com/v2/acts/scrapemint~postal-code-checker/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"codes": ["US 90210", "DE 10115", "GB SW1A 1AA"]}'
```

### Frequently asked questions

**Where does the data come from?** The [GeoNames](https://www.geonames.org) postal code dataset (1.8M codes, 121 countries), licensed [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). The dataset is bundled inside the actor, so runs make zero network calls and always return in seconds.

**What granularity should I expect?** Most countries are covered at full postal code level. Known exceptions: UK codes resolve to the outward part (`SW1A`), Canadian codes to the FSA (`K1A`), and Brazil to municipality-level CEPs only (street-level CEPs like `01310-100` in big cities return not found, free).

**Does it verify that a street address exists?** No — it validates and enriches the postal code itself. Pair it with our US Address Checker for full US address verification.

**A code I know exists returned not found.** Newly introduced codes appear in the dataset with some lag, and a few countries have partial coverage. Those rows are free and marked `found: false`.

### More tools from Scrapemint

- [Email List Checker](https://apify.com/scrapemint/email-list-checker): DNS-level validation for email lists.
- [Phone Number Checker](https://apify.com/scrapemint/phone-number-checker): validate and type phone numbers for any country.
- [US Address Checker & GPS Finder](https://apify.com/scrapemint/us-address-checker): full US street address verification.
- [EU VAT Number Checker](https://apify.com/scrapemint/vat-number-checker): validate EU VAT numbers with company names.

# Actor input Schema

## `codes` (type: `array`):

One per line, ideally with the 2-letter country first: "US 90210", "DE 10115", "GB SW1A 1AA". A bare code without a country matches every country that uses it (or the default country below).

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

Optional 2-letter country code (ISO 3166-1) applied to bare codes without a country prefix. Leave empty to match bare codes against all countries.

## `maxRows` (type: `integer`):

Stop after this many rows in total.

## Actor input object example

```json
{
  "codes": [
    "US 90210",
    "GB SW1A 1AA",
    "DE 10115",
    "JP 100-0001",
    "KE 00100"
  ],
  "defaultCountry": "",
  "maxRows": 1000
}
```

# 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 = {
    "codes": [
        "US 90210",
        "GB SW1A 1AA",
        "DE 10115",
        "JP 100-0001",
        "KE 00100"
    ],
    "defaultCountry": ""
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapemint/postal-code-checker").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 = {
    "codes": [
        "US 90210",
        "GB SW1A 1AA",
        "DE 10115",
        "JP 100-0001",
        "KE 00100",
    ],
    "defaultCountry": "",
}

# Run the Actor and wait for it to finish
run = client.actor("scrapemint/postal-code-checker").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "codes": [
    "US 90210",
    "GB SW1A 1AA",
    "DE 10115",
    "JP 100-0001",
    "KE 00100"
  ],
  "defaultCountry": ""
}' |
apify call scrapemint/postal-code-checker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=scrapemint/postal-code-checker",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Postal Code Checker: Global ZIP & Postcode Lookup",
        "description": "Validate and enrich postal codes for 121 countries. Paste codes like \"US 90210\" or \"DE 10115\" and get place name, region, district and GPS coordinates per code, from a bundled open dataset of 1.8 million codes. For checkout validation, logistics and CRM cleaning. No API key needed.",
        "version": "0.1",
        "x-build-id": "bDhWIwafbspx5QUqK"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/scrapemint~postal-code-checker/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-scrapemint-postal-code-checker",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/scrapemint~postal-code-checker/runs": {
            "post": {
                "operationId": "runs-sync-scrapemint-postal-code-checker",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/scrapemint~postal-code-checker/run-sync": {
            "post": {
                "operationId": "run-sync-scrapemint-postal-code-checker",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "codes": {
                        "title": "Postal codes",
                        "type": "array",
                        "description": "One per line, ideally with the 2-letter country first: \"US 90210\", \"DE 10115\", \"GB SW1A 1AA\". A bare code without a country matches every country that uses it (or the default country below).",
                        "items": {
                            "type": "string"
                        }
                    },
                    "defaultCountry": {
                        "title": "Default country",
                        "type": "string",
                        "description": "Optional 2-letter country code (ISO 3166-1) applied to bare codes without a country prefix. Leave empty to match bare codes against all countries.",
                        "default": ""
                    },
                    "maxRows": {
                        "title": "Max rows",
                        "minimum": 1,
                        "maximum": 50000,
                        "type": "integer",
                        "description": "Stop after this many rows in total.",
                        "default": 1000
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
