# France Postal Code Search (`bite-sized-insights/france-zip-codes`) Actor

Get location data including commune from French postal codes (zip codes).

- **URL**: https://apify.com/bite-sized-insights/france-zip-codes.md
- **Developed by:** [bite-sized-insights](https://apify.com/bite-sized-insights) (community)
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 items

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/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

***Get location data including commune name and INSEE code from French postal codes.***

Simply provide a list of postal codes and get back structured location data for each one.

No login required. No cookies needed. Pay-per-event pricing.

### Why Choose This Actor?

**"Enrich your data with French location information in seconds"**

Our France Postal Code Search provides:

- **Very Fast Responses**: Parallel processing for large batches
- **Cost-Effective**: Pay only for the rows you get back: `$2.00 / 1k rows` (one postal code can return several rows)
- **Complete Data**: Get commune name, INSEE code, routing label, and complement

### Quick Start

1. Open the actor on Apify and go to the **Input** tab.
2. Paste the example input below (or edit the prefilled list).
3. Click **Start** and wait for the run to finish.
4. Open the **Output** (dataset) tab to view or export the results as JSON, CSV or Excel.

```json
{
  "postalcodes": ["75001"]
}
```

Example output item:

```json
{
  "postalcode": "75001",
  "commune_insee_code": "75101",
  "commune_name": "PARIS 01",
  "routing_label": "PARIS",
  "complement": "",
  "error": null
}
```

### Usage Examples

#### Resolve a Single Postal Code

```json
{
  "postalcodes": ["75001"]
}
```

#### Resolve Multiple Postal Codes

```json
{
  "postalcodes": ["75001", "13001", "69001"]
}
```

Returns one row per commune/locality (a single postal code can return many rows). Example row:

```json
{
  "postalcode": "75001",
  "commune_insee_code": "75101",
  "commune_name": "PARIS 01",
  "routing_label": "PARIS",
  "complement": "",
  "error": null
}
```

### Input Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `postalcodes` | array | Yes | - | List of French postal codes (zip codes) to resolve (5 digits each). 1-1000 per run; duplicates are ignored, invalid or too many codes fail the run |

### Output Fields

| Field | Type | Description |
|-------|------|-------------|
| `postalcode` | string | 5-digit French postal code |
| `commune_insee_code` | string | 5-character INSEE commune code |
| `commune_name` | string | Commune name |
| `routing_label` | string | Delivery routing label (libellé d'acheminement), usually the commune name |
| `complement` | string | Additional address line for hamlets/localities (ligne 5), often empty |
| `error` | null/string | Error message if lookup failed |

### Free plan

Free-plan users get 5 runs in total. Each free run processes only the first 10 codes in your input (the rest is ignored without an error) and returns at most 10 results.

### Pricing

| Cost | Description |
|------|-------------|
| $0.0001 / start | Charged per actor run |
| $2.00 / 1,000 rows | Charged per row returned; one postal code can return multiple rows |

### API Integration

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_API_TOKEN")

run = client.actor("bite-sized-insights/france-zip-codes").call(
    run_input={
        "postalcodes": ["75001", "13001", "69001", "33000"]
    }
)

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(f"{item['postalcode']}: {item['commune_name']}")
```

#### JavaScript

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

const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });

const run = await client.actor('bite-sized-insights/france-zip-codes').call({
    postalcodes: ['75001', '13001', '69001']
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach(item => {
    console.log(`${item.postalcode}: ${item.commune_name}`);
});
```

### Use Cases

- **Data Enrichment**: Add location data to customer records using postal codes or zip codes
- **Address Validation**: Verify French postal codes (zip codes) exist
- **Geographic Analysis**: Map postal codes to communes and INSEE codes
- **Logistics**: Determine delivery regions from postal codes

### Going global?

Looking for postal code data in other countries? Check out our other actors:

- [US ZIP Code Search](https://apify.com/bite-sized-insights/us-zip-codes) - US ZIP codes (5-digit)
- [Norway Postal Code Search](https://apify.com/bite-sized-insights/norwegian-postalcode-to-city-name) - Norwegian postal codes (4-digit)
- [India PIN Code Search](https://apify.com/bite-sized-insights/indian-pincode-postalcode-zip-code-to-city-state) - Indian PIN codes (6-digit)

### Notes

- Postal codes (zip codes) must be provided as strings (e.g., "75001" not 75001)
- French postal codes are 5 digits, covering metropolitan France, overseas departments/territories, and Monaco
- A single postal code can map to multiple communes (e.g. rural areas sharing one postal code) — expect more than one result per code in some cases
- Invalid or non-existent postal codes will not appear in results
- Results are returned in no particular order
- Large requests are automatically split into batches and processed in parallel

***

**Need help?** Open an issue on the actor's repository or contact support through Apify Console.

# Actor input Schema

## `postalcodes` (type: `array`):

List of French postal codes (5 digits each, 1-1000 per run).

## Actor input object example

```json
{
  "postalcodes": [
    "75001",
    "13001",
    "69001",
    "33000",
    "06000",
    "97400"
  ]
}
```

# Actor output Schema

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

French postal code location data including commune name, INSEE code, and delivery routing label

# 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 = {
    "postalcodes": [
        "75001",
        "13001",
        "69001",
        "33000",
        "06000",
        "97400"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("bite-sized-insights/france-zip-codes").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 = { "postalcodes": [
        "75001",
        "13001",
        "69001",
        "33000",
        "06000",
        "97400",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("bite-sized-insights/france-zip-codes").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 '{
  "postalcodes": [
    "75001",
    "13001",
    "69001",
    "33000",
    "06000",
    "97400"
  ]
}' |
apify call bite-sized-insights/france-zip-codes --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,bite-sized-insights/france-zip-codes"
        }
    }
}
```

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/TH1eftKuwaL1DmfSm/builds/bNM33nEOeV4HuJR7J/openapi.json
