Autocomplete UK postcodes by prefix. Returns formatted postcodes with latitude/longitude coordinates and country.
/v1/postcode/<query>https://autocomplete.namedone.com1import { createClient } from "@namedone/autocomplete"23const nd = createClient("nd_...")4const { results } = await nd.postcodes("sw1a")1# Exchange your API key for a token2curl -X POST https://token.namedone.com/v1 \3 -H "Content-Type: application/json" \4 -d '{"apiKey":"nd_..."}'56# Query the postcodes endpoint7curl "https://autocomplete.namedone.com/v1/postcode/sw1a?token=<jwt>"{ "results": [ { "id": "postcode-0", "text": "SW1A 1AA", "type": "postcode" "data": { "lat": <number>, "lng": <number>, "country": <string> } } ], "query": "sw1a"}| Field | Type | Description |
|---|---|---|
| lat | number | WGS84 latitude |
| lng | number | WGS84 longitude |
| country | string | Country code (E92000001=England, S92000003=Scotland, W92000004=Wales) |
Sent as query string parameters on the HTTP request to the API.
| Parameter | Type | Default | Description |
|---|---|---|---|
| token | string | — | JWT obtained from the token API. Required for authentication. |
Passed to the SDK methods (e.g. firstNames(query, opts)). These are processed client-side and never sent to the API.
| Option | Type | Default | Description |
|---|---|---|---|
| limit | number | 10 | Maximum number of results (1–50). Applied client-side by the SDK. |
| simple | boolean | false | Simplify response: deduplicate by text and strip to {text, type}. |
| sortByProximity | array | — | Sort results by proximity to coordinates. Client-side only. |
Query: sw1a
{ "results": [ { "id": "postcode-0", "text": "SW1A 1AA", "type": "postcode", "data": { "lat": 51.5074, "lng": -0.1278, "country": "E92000001" } }, { "id": "postcode-1", "text": "SW1A 2AA", "type": "postcode", "data": { "lat": 51.5072, "lng": -0.1276, "country": "E92000001" } }, { "id": "postcode-2", "text": "SW1A 0AA", "type": "postcode", "data": { "lat": 51.5071, "lng": -0.1275, "country": "E92000001" } } ], "query": "sw1a"}