# UK Postcode Nearest Lookup

> UK Postcode Nearest Lookup is a paid API for AI agents from postcode.payapi.market, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-30).

Returns the nearest UK postcodes to a given latitude/longitude coordinate, with full administrative and geographic metadata for each result.

## Facts

- Endpoint: POST https://postcode.payapi.market/lookup/nearest?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-30
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/uk-postcode-nearest-lookup-00bcf858
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_y87qkh5fTE6JjMvXjjyFa

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability uk-postcode-nearest-lookup-00bcf858 -d '<json body>'
```

Example prompt: Find the nearest UK postcodes to latitude 51.5014, longitude -0.1419, searching within 500 metres and returning up to 5 results.

## When to prefer this

Choose this endpoint when you need to reverse-geocode a GPS coordinate to one or more nearby UK postcodes with rich administrative metadata (ward, district, LSOA, CCG, parliamentary constituency). It is ideal for location-aware UK services such as delivery routing, patient catchment mapping, electoral analysis, or any workflow that needs to map coordinates to UK administrative geographies. Prefer it over a simple postcode validation endpoint when proximity search (multiple postcodes within a radius) is needed rather than a single exact postcode lookup.

## Known failure modes

- No postcodes found within the specified radius — returns empty results array
- Coordinates outside the UK (e.g. non-GB lat/lng) — may return no results or error
- Radius out of allowed range (below 100m or above 2000m) — validation error
- Limit out of allowed range (below 1 or above 100) — validation error
- Payment failure or insufficient USDC balance — x402 payment required error
- Malformed request body — missing or invalid lat/lng fields

## How this service works

UK postcode lookup, search, validation and autocomplete with x402 payments.

## Output

A JSON object containing the input coordinates, the search radius used, a count of results, and an array of postcode records. Each record includes the full postcode, outcode, incode, latitude, longitude, distance in metres from the query point, admin district, admin ward, region, country, LSOA, MSOA, parish, parliamentary constituency, NHS CCG, primary care trust, NUTS area, European electoral region, date of introduction, and ONS codes for admin ward and district.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "lat": {
   "type": "number",
   "description": "Latitude in decimal degrees, e.g. 51.5014."
  },
  "lng": {
   "type": "number",
   "description": "Longitude in decimal degrees, e.g. -0.1419."
  },
  "limit": {
   "type": "integer",
   "maximum": 100,
   "minimum": 1,
   "description": "Maximum number of postcodes to return (1-100, default 10)."
  },
  "radius": {
   "type": "integer",
   "maximum": 2000,
   "minimum": 100,
   "description": "Search radius in metres (100-2000, default 1000)."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "lat": 51.5014,
  "lng": -0.1419,
  "count": 1,
  "results": [
   {
    "ccg": "NHS North West London",
    "lsoa": "Westminster 018C",
    "msoa": "Westminster 018",
    "nuts": "Westminster",
    "codes": {
     "admin_ward": "E05013806",
     "admin_district": "E09000033"
    },
    "incode": "1AA",
    "parish": "Westminster, unparished area",
    "region": "London",
    "country": "England",
    "outcode": "SW1A",
    "quality": 1,
    "latitude": 51.501009,
    "postcode": "SW1A 1AA",
    "longitude": -0.141588,
    "admin_ward": "St James's",
    "distance_m": 42.7,
    "admin_county": null,
    "admin_district": "Westminster",
    "primary_care_trust": "Westminster",
    "date_of_introduction": "198001",
    "european_electoral_region": "London",
    "parliamentary_constituency": "Cities of London and Westminster"
   }
  ],
  "radius_m": 1000
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/uk-postcode-nearest-lookup-00bcf858/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from postcode.payapi.market](https://www.zero.xyz/host/postcode.payapi.market/llms.txt)
