# Postcodes.io API

> Postcodes.io returns UK postcode locations and nearby postcode data, available as a workflow and API.

Postcodes.io returns location, administrative, and in-use details for a UK postcode; enter the postcode. List nearby postcodes returns nearby postcode locations and distances; enter a UK postcode or place name, with optional distance and result settings.

- Page: https://fous.com/workflows/postcodes-io
- Handle: `@postcodes-io`
- Category: [Maps](https://fous.com/workflows/category/maps)
- Source website: https://postcodes.io
- Last verified: Sep 29, 2026
- Fous is not affiliated with Postcodes.io.

## Methods

### Get postcode

Operation `get_postcode`, version 1. 1 credit per call.

Get the location and administrative details of a UK postcode, including whether it is still in use. Retired postcodes have limited records: administrative details are unavailable and returned as null.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `postcode` | string | yes | `"e1w1uu"` | UK postcode, with or without a space and in any letter case, for example SW1A 1AA. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "postcode"
  ],
  "properties": {
    "postcode": {
      "type": "string",
      "minLength": 1,
      "description": "UK postcode, with or without a space and in any letter case, for example SW1A 1AA.",
      "examples": [
        "e1w1uu",
        "SW1A 1AA",
        "EH1 1YZ"
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "postcode": "e1w1uu"
    },
    {
      "postcode": "SW1A 1AA"
    },
    {
      "postcode": "EH1 1YZ"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `ward` | string or null | `"St James's"` | Administrative ward. |
| `county` | string or null |  | Administrative county, if applicable. |
| `in_use` | boolean | `false` | Whether the postcode is currently active. |
| `parish` | string or null | `"Westminster, unparished area"` | Civil parish or equivalent, if recorded. |
| `region` | string or null | `"London"` | Region, if available. |
| `country` | string or null | `"England"` | UK country. |
| `eastings` | integer or null | `533779` | British National Grid easting when provided. |
| `latitude` | number or null | `51.508009` | Latitude in decimal degrees. |
| `postcode` | string | `"E1W 1UU"` | Postcode with standard spacing and uppercase letters. |
| `longitude` | number or null | `-0.073706` | Longitude in decimal degrees. |
| `northings` | integer or null | `180545` | British National Grid northing when provided. |
| `page_link` | string | `"https://postcodes.io/terminated_postcodes/E1W1UU"` | Link to the postcode record on Postcodes.io. |
| `area_codes` | object |  | Official area identifiers supplied for the postcode; null where unavailable. |
| `area_codes.ward` | string or null | `"E05013806"` |  |
| `area_codes.county` | string or null |  |  |
| `area_codes.parish` | string or null | `"E43000236"` |  |
| `area_codes.local_council` | string or null | `"E09000033"` |  |
| `area_codes.integrated_care_board` | string or null | `"E54000071"` |  |
| `area_codes.parliamentary_constituency` | string or null | `"E14001172"` |  |
| `year_retired` | integer or null | `2015` | Year the postcode was retired, if known. |
| `local_council` | string or null | `"Westminster"` | Local authority or council area. |
| `parliamentary_constituency` | string or null | `"Cities of London and Westminster"` | UK parliamentary constituency. |
| `health_board_or_integrated_care_board` | string or null | `"NHS West and North London Integrated Care Board"` | Integrated care board in England or the available health authority or board elsewhere. |

**Example input**

```json
{
  "postcode": "e1w1uu"
}
```

**Example output**

```json
{
  "ward": null,
  "county": null,
  "in_use": false,
  "parish": null,
  "region": null,
  "country": null,
  "eastings": 533779,
  "latitude": 51.508009,
  "postcode": "E1W 1UU",
  "longitude": -0.073706,
  "northings": 180545,
  "page_link": "https://postcodes.io/terminated_postcodes/E1W1UU",
  "area_codes": {
    "ward": null,
    "county": null,
    "parish": null,
    "local_council": null,
    "integrated_care_board": null,
    "parliamentary_constituency": null
  },
  "year_retired": 2015,
  "local_council": null,
  "parliamentary_constituency": null,
  "health_board_or_integrated_care_board": null
}
```

### List nearby postcodes

Operation `list_nearby_postcodes`, version 1. 1 credit per call.

List UK postcodes nearest to a postcode or named place, with distance, ward, council and coordinates. For places with the same name, a city or town is preferred.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `near` | string | yes | `"SW1A 1AA"` | A UK postcode or place name, for example SW1A 1AA or Oxford. |
| `max_results` | integer | no | `4` | Maximum number of nearest postcodes, for example 10. |
| `radius_metres` | integer | no | `1000` | Maximum distance in metres from the postcode or place, for example 1000. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "near"
  ],
  "properties": {
    "near": {
      "type": "string",
      "minLength": 1,
      "description": "A UK postcode or place name, for example SW1A 1AA or Oxford.",
      "examples": [
        "SW1A 1AA",
        "Oxford",
        "EH1 1YZ"
      ]
    },
    "max_results": {
      "type": "integer",
      "default": 10,
      "maximum": 100,
      "minimum": 1,
      "description": "Maximum number of nearest postcodes, for example 10.",
      "x-fous-developer": true,
      "examples": [
        4,
        10,
        100
      ]
    },
    "radius_metres": {
      "type": "integer",
      "default": 1000,
      "maximum": 2000,
      "minimum": 1,
      "description": "Maximum distance in metres from the postcode or place, for example 1000.",
      "x-fous-developer": true,
      "examples": [
        1000,
        1,
        2000
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "near": "SW1A 1AA"
    },
    {
      "near": "Oxford",
      "max_results": 4,
      "radius_metres": 1000
    },
    {
      "near": "Oxford",
      "max_results": 10,
      "radius_metres": 1
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `postcodes` | array |  | Postcodes ordered nearest first. |
| `postcodes[].ward` | string or null | `"St James's"` |  |
| `postcodes[].latitude` | number or null | `51.50101` |  |
| `postcodes[].page_url` | string | `"https://postcodes.io/postcodes/SW1A%201AA"` |  |
| `postcodes[].postcode` | string | `"SW1A 1AA"` |  |
| `postcodes[].longitude` | number or null | `-0.141563` |  |
| `postcodes[].local_council` | string or null | `"Westminster"` |  |
| `postcodes[].distance_metres` | number | `0` |  |

**Example input**

```json
{
  "near": "SW1A 1AA"
}
```

**Example output**

```json
{
  "postcodes": [
    {
      "ward": "St James's",
      "latitude": 51.50101,
      "page_url": "https://postcodes.io/postcodes/SW1A%201AA",
      "postcode": "SW1A 1AA",
      "longitude": -0.141563,
      "local_council": "Westminster",
      "distance_metres": 0
    },
    {
      "ward": "St James's",
      "latitude": 51.499933,
      "page_url": "https://postcodes.io/postcodes/SW1E%206LA",
      "postcode": "SW1E 6LA",
      "longitude": -0.141117,
      "local_council": "Westminster",
      "distance_metres": 123.67233656624896
    },
    {
      "ward": "St James's",
      "latitude": 51.499738,
      "page_url": "https://postcodes.io/postcodes/SW1E%206AY",
      "postcode": "SW1E 6AY",
      "longitude": -0.140736,
      "local_council": "Westminster",
      "distance_metres": 152.5853742672548
    }
  ]
}
```

## Quick start

Call the API with a Fous API key (`FOUS_API_KEY`). To create one, turn on Developer mode in Fous Studio, then open Keys & connections → API keys (https://app.fous.com/keys).

```bash
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
: "${FOUS_API_KEY:?Set FOUS_API_KEY before running this example}"

curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 120 \
  -H "Authorization: Bearer $FOUS_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "api": "@postcodes-io",
  "visibility": "public",
  "operation": "get_postcode",
  "version": 1,
  "input": {
    "postcode": "e1w1uu"
  },
  "response": {
    "format": "json"
  }
}'
```

```python
# Save as fous.py and run with python3 fous.py. No packages needed.
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
import json
import os
import urllib.error
import urllib.request

api_key = os.environ.get("FOUS_API_KEY")
if not api_key:
    raise RuntimeError("Set FOUS_API_KEY before running this example")

body = json.loads("{\n  \"api\": \"@postcodes-io\",\n  \"visibility\": \"public\",\n  \"operation\": \"get_postcode\",\n  \"version\": 1,\n  \"input\": {\n    \"postcode\": \"e1w1uu\"\n  },\n  \"response\": {\n    \"format\": \"json\"\n  }\n}")
request = urllib.request.Request(
    "https://api.fous.com/v1/query",
    data=json.dumps(body).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    method="POST",
)
try:
    with urllib.request.urlopen(request, timeout=120) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    raise RuntimeError(f"HTTP {error.code}: {error.read().decode('utf-8', errors='replace')}") from error
if result.get("success") is False:
    raise RuntimeError(result.get("error", {}).get("message", "Request failed"))
print(json.dumps(result["data"]["output"], indent=2))
```

```typescript
// Save as fous.mts and run with npx tsx fous.mts.
// First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
const apiKey = process.env.FOUS_API_KEY;
if (!apiKey) throw new Error("Set FOUS_API_KEY before running this example");

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(120_000),
  body: JSON.stringify({
  "api": "@postcodes-io",
  "visibility": "public",
  "operation": "get_postcode",
  "version": 1,
  "input": {
    "postcode": "e1w1uu"
  },
  "response": {
    "format": "json"
  }
}),
});
type ApiResult = { success: boolean; data?: { output: unknown }; error?: { message: string } };
const result: ApiResult = await response.json();
if (!response.ok || result.success === false) {
  throw new Error(result.error?.message ?? `HTTP ${response.status}`);
}
if (!result.data) throw new Error("Missing API response data");
console.log(result.data.output);
```

Or describe the data in plain language: send `{"api":"@postcodes-io","prompt":"Describe the data you need, with every detail"}` to the same URL. Fous fills in the input, runs the method that fits and returns only the fields you asked for; `data.route.calls[].request` is the exact call it made. Routing is free; the run costs the same.

## Use cases

- Find a postcode’s coordinates and administrative areas
- Check whether a postcode is still in use
- Find postcodes near a place or postcode
- Compare distances between nearby postcodes

## FAQ

### Is Fous affiliated with Postcodes.io?

No. Fous is not affiliated with Postcodes.io. This workflow reads the public postcodes.io website and returns its data.

### How much does it cost?

Each run costs 1 credit. With pay-as-you-go, a credit costs 1¢; monthly plans cost less per credit.

### Do I need a Postcodes.io account?

No. You only need a Fous account.

### How current is the data?

Fous gets the data from postcodes.io when you run it; repeating the same request within a day may return the saved result. Fous checks this workflow automatically; it last passed a check on Sep 29, 2026.

### Where is a UK postcode located?

Get postcode returns latitude, longitude, and other location details for a supplied UK postcode.

### Is a postcode currently in use?

Get postcode returns whether the supplied postcode is currently in use.

### Which postcodes are nearest to a place?

List nearby postcodes returns postcodes ordered nearest first, with distance and location details.

## Related

- [Police.uk API](https://fous.com/workflows/police-uk.md): Police.uk provides street-level crime data for England, Wales and Northern Ireland, using the latest published month by default, plus local policing team details where forces publish them.
- [NHS API](https://fous.com/workflows/nhs.md): NHS provides condition and medicine guidance, with condition dates reflecting the latest pages used, and nearby England service listings ordered by distance; availability details may be missing.
- [Zippopotam.us API](https://fous.com/workflows/zippopotam-us.md): Zippopotam.us returns places, regions and coordinates for postal codes in supported countries, and finds postal codes, places and coordinates by town and region.
- [ipinfo.io API](https://fous.com/workflows/ipinfo-io.md): IP address location and network information.
- [India Post PIN Codes API](https://fous.com/workflows/india-post-pin-codes.md): India Post PIN Codes returns Indian six-digit PIN codes and matching post offices, with branch types, delivery status, postal areas, districts, and states.
- [OpenStreetMap API](https://fous.com/workflows/openstreetmap.md): OpenStreetMap returns place coordinates, address details, nearby readable place information, and ordered place search results from contributor-created data; results reflect mapped features and may be incomplete or differ from landmarks.
- [Google Maps API](https://fous.com/workflows/google-maps.md): Google Maps returns nearby places, public place details, up to 100 public reviews, and up to three routes; transit options vary by departure time.
- [Rightmove API](https://fous.com/workflows/rightmove.md): Rightmove searches UK homes for sale or rent and finds recent sold prices; searches return up to 100 listings, and area averages reflect returned properties only.
- [All Maps workflows](https://fous.com/workflows/category/maps)
