# Postcode Context — Demographic, Property & Location Intelligence API for AI Agents > **Give AI agents real-world Great Britain location intelligence.** > Turn any Great Britain postcode into structured property, demographic, energy, school, healthcare, and connectivity context in one call (113 standardised variables across 19 public-sector & postal sources). Compare locations, enrich up to 50 postcodes per request, and return source-grounded evidence—with transparent pricing from $0.005 per request ($1 per 1,000 postcodes in batch). Operates 100% statelessly on Cloudflare Workers edge nodes with native x402 v2 micro-payments on Base Mainnet (USDC) and RapidAPI Gateway. ## Economics: Request Price vs. Location Price - **Single Postcode Lookup (/api/v1/postcode/{postcode}):** $0.005 / request = $5.00 per 1,000 postcodes. - **Compare Postcodes (/api/v1/compare):** $0.010 / request (2–5 postcodes) = $0.0020–$0.0050 per postcode compared ($2–$5 per 1,000 postcodes). Returns raw metrics alongside comparative trade-off synthesis. - **Batch Enrichment (/api/v1/batch):** $0.050 / request (up to 50 postcodes) = $0.0010 per postcode = **$1.00 per 1,000 postcodes** (5x cheaper than single requests). Ideal for bulk agent screening. Note: defaults to view="brief" (~80 tokens/postcode) to protect context window budgets; pass view="full" when all 113 metrics are required. - **Outcode District Summary (/api/v1/outcode/{outcode}):** $0.005 / request (~150 tokens district overview). - **Discovery, Data Dictionary & Attribution (/api/v1/dictionary, /api/v1/attribution, `/mcp` tools/list):** $0.000 USDC (no payment or authentication required; subject to Terms of Service at https://api.postcodecontext.uk/terms). ## Territorial Coverage & Licensing Model - **Coverage:** Strictly Great Britain (England, Scotland, Wales) — 1,760,216 active postcodes and 51,101 output areas/data zones. - **Northern Ireland (BT%) Policy:** Strictly excluded because Land & Property Services Northern Ireland (LPS NI) reserves proprietary rights on Pointer address data. - **Crown Dependencies:** Jersey (JE), Guernsey (GY), and Isle of Man (IM) are self-governing jurisdictions outside Great Britain Census and Land Registry coverage and are excluded. - **API & Software Rights vs. Underlying Data:** API software, Cloudflare Workers edge runtime, D1 database indexes, and composite scoring methodologies are proprietary to PostcodeContext.UK and governed by the Terms of Service (https://api.postcodecontext.uk/terms). Underlying datasets combine Open Government Licence v3.0, Ordnance Survey OS OpenData, Registers of Scotland Open Data, and Royal Mail Postcode Delivery Point Allocation (Gridlink) data supplied under Gridlink sublicence terms. Downstream reuse must preserve all statutory Crown copyright, Royal Mail database right, and OGL v3.0 notices returned in `_attribution` (full 19-source registry published at `/api/v1/attribution`). - **Regulatory Notice:** Area-level statistical indicators are for research and geographic context only — NOT for credit, insurance, lending, employment, or tenant-screening decisions. ## API Overview & Key Datasets - **ONS Census 2021, NRS Scotland Census 2022 & ONSPD:** Resident population density (per km²), age cohorts, household tenure, qualification levels, NS-SeC managerial share, and remote-work percentages at LSOA / Data Zone level. - **Heuristic Small-Area Income:** LSOA / Data Zone median household income indicator clamped to £21,000–£95,000 weighting DWP/HMRC income deprivation deciles, NS-SeC managerial shares, and Level 4 qualifications (not an observed Census return). - **Indices of Multiple Deprivation:** English IoD 2025, Welsh WIMD 2025, and Scottish SIMD 2020 deciles across all domains, including Crime Deprivation deciles (relative within each home nation; never compare raw deciles directly across national borders). - **HM Land Registry & Registers of Scotland:** Rolling 3-year residential median price, price-per-square-metre (£/sqm), and dominant property types across England & Wales (2024–2026) and Scotland (2023–2025), with explicit `price_basis` resolution metadata. - **Open EPC Register (MHCLG & Scottish EPC):** Energy efficiency rating (current & potential A–G), average internal floor area (sqm), pre-1930 housing share, and retrofit upside potential. - **Ofcom Connected Nations:** Fixed broadband download speed tiers (350, 120, 80, 68.5 Mbps baseline) and gigabit availability percentage. - **Schools, GP Healthcare & Transit:** Nearest primary & secondary schools (DfE GIAS, Scottish SEED, Welsh Address List — excluding personal staff names and admissions catchment guarantees), nearest GP practice (CQC, NHS Scotland/PHS, NHS Wales/NWSSP), and nearest NaPTAN rail/metro station + ORR Table 1410 mainline intercity hub. ## Transparent Derived Scoring Methodologies (v2026.1) - **`affluence_score_100` (1–100):** `clamp(1, 100, round(0.35 * min(100, estIncome / 72000 * 100) + 0.25 * (qualL4 * 0.5 + managerialPct * 0.5) + 0.25 * (imdDecile * 10) + 0.15 * (ownedOutrightPct + mortgagedPct)))`. Tiers: `Ultra-Prime` (>=90), `Affluent` (75–89), `Mid-Market` (50–74), `Modest-Income` (30–49), `High-Deprivation` (<30). - **`family_suitability_score_100` (1–100):** `clamp(1, 100, round(0.40 * (crimeDecile * 10) + 0.30 * eduComponent + 0.30 * min(100, (age0_15Pct + age30_44Pct) * 2)))`, where `eduComponent = max(10, round(eduDecile * 10 - (schoolDistanceKm > 3 ? min(20, (schoolDistanceKm - 3) * 2) : 0)))` using geodesic distance to the nearest primary (fallback secondary) school when present. - **`commuter_connectivity_score_100` (1–100):** `clamp(1, 100, round(stationScore * 0.45 + hubBonus + min(100, round(car0Pct * 2.2)) * 0.20 + min(100, round((broadband_speed_tier_mbps / 350) * 60 + gigabit_pct * 0.4)) * 0.15 + affluenceScore * 0.10))` based on geodesic station proximity (<=0.8km: 100, <=1.5km: 85, <=3km: 65, <=6km: 45, <=10km: 25, >10km: 10) and intercity hub bonus (<=3km: +15, <=7km: +8). - **`property_value_index` (1–100):** `clamp(1, 100, round((price_per_sqm_gbp / 16200) * 100))` benchmarked against a £16,200/sqm Prime Central London ceiling. ## Dataset Vintages, Freshness & Update Cadence - **Current Database Baseline:** v2026.10 (Last Updated: 2026-10-23T11:35:00Z) - **HM Land Registry Price Paid:** 3-Year Rolling Residential Deeds (2024–2026) · Ingested 2026-10 · Monthly (~20th) - **Registers of Scotland Sales:** 3-Year Rolling Data Zone Medians (2023–2025) · Ingested 2026-09 · Quarterly - **Open & Scottish EPC Registers:** Domestic Energy Performance Certificates (2024–2026) · Ingested 2026-09 · Monthly / Quarterly - **Deprivation Indices:** English IoD 2025 (2025-11), Welsh WIMD 2025 (2025-11), Scottish SIMD 2020v2 (2020-01) · Periodic (4–6 Years) - **Census Demographics:** ONS Census 2021 (E&W) & NRS Scotland Census 2022 · Decennial Baseline - **Ofcom Connected Nations:** Connected Nations 2026 Fixed Broadband · Ingested 2026-01 · Annual - **ONSPD, OS OpenData & Royal Mail Gridlink:** ONSPD 2026-Q3 · Ingested 2026-08 · Quarterly - **Schools & Healthcare Registers:** DfE GIAS, Scottish SEED, Welsh Address List, CQC, PHS & NWSSP Directories · Autumn 2026 · Monthly / Termly / Quarterly - **DfT NaPTAN & ORR Station Usage:** 3,483 Rail, Underground, DLR & Metro Stations with ORR Table 1410 footfall tiers · Autumn 2026 · Weekly active refresh ## x402 Payment Specifications - **Payment Protocol:** x402-v2 (Stateless HTTP 402 Payment Required) - **Network:** Base Mainnet (CAIP-2: eip155:8453) - **Asset / Token:** USDC (0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913) - **Merchant Address:** 0x8ab7568ac097523e81a94644235fcf19a2b85670 - **Gas Fees:** Sponsored by Coinbase Developer Platform (Gas-Free Sponsored) ($0.00 gas cost to payer) ## Remote MCP Server (`https://api.postcodecontext.uk/mcp`) - **Transport:** Streamable HTTP (`streamable-http`) - **Guide:** https://api.postcodecontext.uk/mcp-guide - **10 Canonical MCP Tools:** - **`lookup_postcode`** ($0.005 USDC): Single Postcode Socio-Economic Profile (Census demographics, IMD deciles, Land Registry prices) - **`compare_postcodes`** ($0.010 USDC): Multi-Postcode Comparative Demographic Synthesis (2 to 5 Great Britain postcodes side-by-side) - **`enrich_postcodes`** ($0.050 USDC): Bulk Great Britain Postcode Enrichment (1 to 50 postcodes with cohort aggregation across England, Scotland, Wales) - **`summarise_outcode`** ($0.005 USDC): Great Britain Outward Postal District Summary (~150 tokens overview of housing and demographics) - **`get_postcode_ai_brief`** ($0.005 USDC): Low-Token Postcode AI Briefing (~80 tokens affluence tier, persona & natural language brief) - **`get_property_and_energy_profile`** ($0.005 USDC): Postcode Property Valuation, EPC Energy Rating & Broadband Slice - **`get_demographics_and_deprivation`** ($0.005 USDC): Postcode Census Demographics & Statutory IMD Deciles Slice - **`screen_postcodes`** ($0.010 USDC): Ranked Leaderboard Screening across 2 to 10 Great Britain Postcodes - **`get_data_attribution`** ($0.000 USDC): Statutory Provenance & Public Sector Licence Register (19 Underlying Datasets) - **`get_data_dictionary`** ($0.000 USDC): Machine-Readable Data Dictionary & Formula Directory for all variables ## REST API Endpoints ### 1. Single Postcode Profile (/api/v1/postcode/{postcode}) - **URL:** https://api.postcodecontext.uk/api/v1/postcode/{postcode} - **Method:** GET (Query alternative: `/api/v1/postcode?postcode=SW1A1AA`) - **Price:** $0.005 USDC (5000 atomic micro-USDC) - **Query Parameters:** - `view`: `full` (default, all 113 metrics), `brief` / `summary` / `ai` (~80 tokens), `property`, `demographics`, `education`/`schools`, `healthcare`/`health`, `transit`/`transport`, `services`/`infrastructure` - `exclude`: comma-separated `schools,healthcare,transit` (applies when `view=full`) - `format`: `json` (default), `flat`, `csv`, `markdown` / `md` - **Example Call:** curl -i https://api.postcodecontext.uk/api/v1/postcode/SW1A1AA ### 2. Bulk Postcode Enrichment (/api/v1/batch) - **URL:** https://api.postcodecontext.uk/api/v1/batch - **Method:** POST (Query alternative: `GET /api/v1/batch?postcodes=SW1A1AA,BB73BB`) - **Price:** $0.050 USDC (50000 atomic micro-USDC) - **Capacity:** 1 to 50 Great Britain postcodes per request. - **Default View (Agent Protection):** Defaults to `view="brief"` (~80 tokens brief summary per postcode) to prevent context window blow-up. Explicitly pass `"view": "full"` if all 113 metrics are required. - **Request Body (JSON):** ```json { "postcodes": ["SW1A 1AA", "BB7 3BB", "EH1 1YZ"] } ``` - **CLI Example (awal):** npx awal x402 pay "https://api.postcodecontext.uk/api/v1/batch" --method POST --data '{"postcodes":["SW1A 1AA","BB7 3BB"]}' ### 3. Multi-Postcode Comparative Synthesis (/api/v1/compare) - **URL:** https://api.postcodecontext.uk/api/v1/compare - **Method:** POST (Query alternative: `GET /api/v1/compare?postcodes=SW1A1AA,BB73BB`) - **Price:** $0.010 USDC (10000 atomic micro-USDC) - **Capacity:** 2 to 5 Great Britain postcodes per request. - **Request Body (JSON):** ```json { "postcodes": ["SW1A 1AA", "BB7 3BB"] } ``` - **CLI Example (awal):** npx awal x402 pay "https://api.postcodecontext.uk/api/v1/compare" --method POST --data '{"postcodes":["SW1A 1AA","BB7 3BB"]}' ### 4. Outward Postal District Summary (/api/v1/outcode/{outcode}) - **URL:** https://api.postcodecontext.uk/api/v1/outcode/{outcode} - **Method:** GET (Query alternative: `/api/v1/outcode?outcode=BB7`) - **Price:** $0.005 USDC (5000 atomic micro-USDC) - **Path Parameter:** `outcode` (string) — Great Britain outward postal district (e.g. "SW1A", "BB7", "EH1", "CF10"). - **Example Call:** curl -i https://api.postcodecontext.uk/api/v1/outcode/SW1A ### 5. Statutory Attribution & Data Dictionary (/api/v1/attribution, /api/v1/dictionary) - **Attribution URL:** https://api.postcodecontext.uk/api/v1/attribution - **Dictionary URL:** https://api.postcodecontext.uk/api/v1/dictionary (supports `?domain=summary_for_ai` or `?field=`) - **Method:** GET - **Price:** $0.000 USDC (No payment or authentication required; subject to Terms of Service at https://api.postcodecontext.uk/terms) ## Machine-Readable Discovery Files - **A2A Agent Card (JSON):** https://api.postcodecontext.uk/.well-known/agent-card.json - **MCP Server Discovery (JSON):** https://api.postcodecontext.uk/.well-known/mcp.json - **x402 Machine Manifest (JSON):** https://api.postcodecontext.uk/.well-known/x402.json - **OpenAPI 3.1.0 Spec:** https://api.postcodecontext.uk/openapi.json - **Data Dictionary (HTML):** https://api.postcodecontext.uk/data-dictionary - **Data Dictionary (JSON):** https://api.postcodecontext.uk/api/v1/dictionary - **Attribution & Provenance (JSON):** https://api.postcodecontext.uk/api/v1/attribution - **Legal Hub & Terms:** https://api.postcodecontext.uk/legal · https://api.postcodecontext.uk/terms