# Postcode & ZIP Code Lookup API Worldwide (Geocode, Reverse) (`tudorlane/world-postcode-lookup`) Actor

Look up postcodes and ZIP codes in 100+ countries: place, region, coordinates and time zone. Plus place-name geocoding, reverse geocoding (lat/lon to nearest postcode) and distance. UK adds council, ward and constituency. Built for AI agents.

- **URL**: https://apify.com/tudorlane/world-postcode-lookup.md
- **Developed by:** [Tudor Lane](https://apify.com/tudorlane) (community)
- **Categories:** Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$3.00 / 1,000 location lookups

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

## Postcode & ZIP Code Lookup API worldwide

**What it does:** Postcode/ZIP lookup in 100+ countries, place geocoding, reverse geocoding and distances, plus UK council/ward/constituency detail.

**Who it's for:** Delivery, CRM, property, form-filling and location agents.

**Price:** Pay per event: **$0.003 per lookup**. Not-found results are not charged. You only pay Apify for what you run; there is no monthly fee for this Actor.

Fast, cheap location lookups for AI agents and apps, from open data, with no API key needed:

- **Postcode / ZIP lookup** in 100+ countries (US ZIP, UK postcode, Canada, Germany, France, India, Australia, Japan...): place name, state/region, district, coordinates, time zone. Partial codes fall back to the area (e.g. UK outward code, Canada FSA).
- **UK extra detail** (via postcodes.io): council, ward, parish, parliamentary constituency, LSOA/MSOA, eastings/northings.
- **Place geocoding**: "Springfield, Illinois, US" → coordinates, population, time zone, postcodes.
- **Reverse geocoding**: lat/lon → nearest town and nearest postcode.
- **Distance** between two postcodes, places or points (km and miles).

### Input

```json
{"requests": ["90210", {"postcode": "75008", "country": "FR"}, {"place": "Osaka, JP"}, {"lat": -33.86, "lon": 151.2}, {"from": "SW1A 1AA", "to": "Paris"}]}
```

Postcodes from the US, UK and Canada are auto-detected; for others pass `country` (ISO code or name).

### Pricing

Pay per event: **$0.003 per lookup**. Not-found results are not charged.

### Sources and licences

GeoNames postal codes and cities1000 gazetteer (CC BY 4.0, geonames.org), rebuilt with each Actor build. UK detail from postcodes.io (Ordnance Survey / ONS data, Open Government Licence v3; contains OS data © Crown copyright and database right). Coordinates for postcodes are area centroids, not exact addresses.

### Quick example

**Input**

```json
{
 "requests": [
  {
   "postcode": "SW1A 1AA"
  },
  {
   "postcode": "10001",
   "country": "US"
  },
  {
   "place": "Paris, FR"
  },
  {
   "lat": 48.8584,
   "lon": 2.2945
  }
 ]
}
```

**Output** (one dataset item, shortened)

```json
{
 "action": "postcode",
 "query": "SW1A 1AA",
 "results": [
  {
   "place": "Westminster Abbey",
   "admin1": "England",
   "admin2": "Westminster",
   "admin3": null,
   "lat": 51.50101,
   "lon": -0.141563,
   "acc": 1,
   "country_code": "GB",
   "postcode": "SW1A 1AA",
   "country": "United Kingdom",
   "precision": "exact",
   "timezone": "Europe/London"
  }
 ],
 "source": "GeoNames postal codes & places (CC BY 4.0); postcodes.io (ONS/OS data, OGL v3)",
 "uk_detail": {
  "postcode": "SW1A 1AA",
  "country": "England",
  "region": "London",
  "admin_district": "Westminster",
  "admin_county": null,
  "admin_ward": "St James's",
  "parish": "Westminster, unparished area",
  "parliamentary_constituency": "Cities of London and Westminster",
  "european_electoral_region": "London",
  "primary_care_trust": "Westminster",
  "lsoa": "Westminster 018C",
  "msoa": "Westminster 018",
  "nuts": "Westminster",
  "incode": "1AA"
 },
 "error": null
}
```

### Use it from AI agents (MCP) and code

- **Apify MCP server:** add `https://mcp.apify.com/?tools=tudorlane/world-postcode-lookup` to Claude, Cursor, ChatGPT connectors, VS Code or any MCP client (sign in with Apify OAuth or an API token). The Actor appears as a tool the model can call.
- **REST (sync):** `POST https://api.apify.com/v2/acts/tudorlane~world-postcode-lookup/run-sync-get-dataset-items?token=YOUR_TOKEN` with the input JSON as the body; results come back in the response.
- **SDKs / no-code:** `apify-client` (Python/JS), LangChain, LlamaIndex, CrewAI, n8n, Make and Zapier integrations.

### FAQ

**Exact addresses?** No, postcode/area centroids, not rooftop addresses.

**Which countries are auto-detected?** US, UK and Canada; pass `country` for others.

**What if the source is down?** You get an `error` row and are not charged for it.

**Support?** Open an issue on the Actor's Issues tab.

***

Keywords: postcode lookup API, ZIP code API, geocoding API, reverse geocoding, UK postcode API, distance between postcodes, MCP tool, Apify Actor, AI agent tool.

# Actor input Schema

## `requests` (type: `array`):

Max 1000. Errors (not found) are not charged.

## Actor input object example

```json
{
  "requests": [
    {
      "postcode": "SW1A 1AA"
    },
    {
      "postcode": "10001",
      "country": "US"
    },
    {
      "place": "Paris, FR"
    },
    {
      "lat": 48.8584,
      "lon": 2.2945
    }
  ]
}
```

# Actor output Schema

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

One item per request.

## `dataset` (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 = {
    "requests": [
        {
            "postcode": "SW1A 1AA"
        },
        {
            "postcode": "10001",
            "country": "US"
        },
        {
            "place": "Paris, FR"
        },
        {
            "lat": 48.8584,
            "lon": 2.2945
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("tudorlane/world-postcode-lookup").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 = { "requests": [
        { "postcode": "SW1A 1AA" },
        {
            "postcode": "10001",
            "country": "US",
        },
        { "place": "Paris, FR" },
        {
            "lat": 48.8584,
            "lon": 2.2945,
        },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("tudorlane/world-postcode-lookup").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 '{
  "requests": [
    {
      "postcode": "SW1A 1AA"
    },
    {
      "postcode": "10001",
      "country": "US"
    },
    {
      "place": "Paris, FR"
    },
    {
      "lat": 48.8584,
      "lon": 2.2945
    }
  ]
}' |
apify call tudorlane/world-postcode-lookup --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,tudorlane/world-postcode-lookup"
        }
    }
}
```

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/9N21zwmgLMqCwlYW2/builds/Cjn4JXUAa6fhUgGra/openapi.json
