⚡ OFFICIAL SDK & REST API v1

FastAddress UK Documentation

Integrate lightning-fast UK address autocomplete and postcode verification into your checkouts, CRM, or data pipelines with sub-15ms latency across 21.1+ million records.

Official TypeScript SDK (@ahm-labs/fast-address-uk)

Install the official zero-dependency package for TypeScript, Node, Bun, Deno, and React:

Install
npm install @ahm-labs/fast-address-uk
# or
pnpm add @ahm-labs/fast-address-uk
TypeScript / Node
import { lookupAddress, createFastAddressClient } from '@ahm-labs/fast-address-uk';

// 1. One-off quick lookup (zero-config with in-memory caching)
const addresses = await lookupAddress('10 Downing Street', { limit: 5 });
console.log(addresses[0].address_string, addresses[0].uprn, addresses[0].postcode);

// 2. Reusable client instance with API key
const client = createFastAddressClient({
  apiKey: process.env.FAST_ADDRESS_KEY,
  defaultLimit: 10
});

const results = await client.lookup('SW1A 1AA');

Multi-Framework & Platform Integration Hub

Select your frontend or backend framework below for instant copy-paste integration code:

Official Hook📁 AddressInput.tsx

Zero-configuration React hook with built-in debouncing, loading states, and automatic request cancellation.

import React from 'react';
import { useFastAddress } from '@ahm-labs/fast-address-uk/react';

export function AddressInput({ onSelect }: { onSelect?: (addr: any) => void }) {
  const { query, results, isLoading, search, clear } = useFastAddress({
    debounceMs: 200,
    minQueryLength: 2
  });

  return (
    <div style={{ position: 'relative', width: '100%' }}>
      <input
        type="text"
        value={query}
        onChange={(e) => search(e.target.value)}
        placeholder="Enter postcode or street (e.g. SW1A 1AA)..."
        className="form-input"
      />
      {isLoading && <span className="spinner">Searching...</span>}

      {results.length > 0 && (
        <ul className="dropdown-menu">
          {results.map((addr) => (
            <li key={addr.id || addr.uprn} onClick={() => { onSelect?.(addr); clear(); }}>
              <strong>{addr.address_string}</strong>
              <span>{addr.postcode} • UPRN: {addr.uprn || 'N/A'}</span>
            </li>
          ))}
        </ul>
      )}
    </div>
  );
}

Zero-Install Script Tag (WordPress / Shopify / Webflow)

Drop a single script tag into any HTML or ecommerce checkout page:

HTML
<script src="https://fastaddress.ahm-labs.com/sdk/fast-address.min.js"></script>
<script>
  FastAddress.attachToInput('#checkout-address', {
    onSelect: (addr) => console.log('Selected UPRN:', addr.uprn)
  });
</script>

Address Autocomplete REST Endpoint

GEThttps://fastaddress.ahm-labs.com/api/v1/autocomplete
cURL
curl -X GET "https://fastaddress.ahm-labs.com/api/v1/autocomplete?q=10+Downing+Street" \
  -H "Accept: application/json"

Query Parameters

ParameterTypeRequiredDescription
qstringYesSearch string. Can be a full or partial postcode, street name, house number, or city. Minimum 2 characters.
limitintegerNoMaximum number of suggestions returned (default: 10, max: 50).

Response Schema

The endpoint returns a JSON array of matched addresses sorted by FTS5 match score:

JSON Response
[
  {
    "id": 100121005441,
    "address_string": "10 Downing Street, Wiltshire",
    "postcode": "SN14 0AA",
    "latitude": 51.461924,
    "longitude": -2.12757,
    "uprn": 100121005441
  },
  {
    "id": 100030048320,
    "address_string": "10 Downing Street, South Normanton, Bolsover",
    "postcode": "DE55 2HE",
    "latitude": 53.106679,
    "longitude": -1.340282,
    "uprn": 100030048320
  }
]

Field Definitions

FieldTypeDescription
idintegerUnique database identifier for the address entity.
address_stringstringNormalized, human-readable address line, optimized for form autofill and shipping labels.
postcodestringOfficial Royal Mail formatted UK Postal Code (e.g., SW1A 2AA).
latitudefloatGeographic WGS84 Latitude coordinate.
longitudefloatGeographic WGS84 Longitude coordinate.
uprninteger / nullOfficial 12-digit Ordnance Survey Unique Property Reference Number.

Backend Language Examples

Python (requests)

Python
import requests

def search_address(query: str):
    url = "https://fastaddress.ahm-labs.com/api/v1/autocomplete"
    params = {"q": query}
    
    response = requests.get(url, params=params)
    response.raise_for_status()
    
    return response.json()

# Example usage:
results = search_address("10 Downing Street")
for item in results:
    print(f"{item['address_string']} ({item['postcode']}) - UPRN: {item.get('uprn')}")

Go (net/http)

Go
package main

import (
	"encoding/json"
	"fmt"
	"net/http"
	"net/url"
)

type Address struct {
	ID            int64   `json:"id"`
	AddressString string  `json:"address_string"`
	Postcode      string  `json:"postcode"`
	Latitude      float64 `json:"latitude"`
	Longitude     float64 `json:"longitude"`
	UPRN          int64   `json:"uprn"`
}

func Autocomplete(query string) ([]Address, error) {
	apiURL := fmt.Sprintf("https://fastaddress.ahm-labs.com/api/v1/autocomplete?q=%s", url.QueryEscape(query))
	resp, err := http.Get(apiURL)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	var addresses []Address
	if err := json.NewDecoder(resp.Body).Decode(&addresses); err != nil {
		return nil, err
	}
	return addresses, nil
}

HTTP Status & Error Codes

Status CodeReasonResolution
200 OKRequest successfulReturns array of matching addresses.
400 Bad RequestMissing or invalid q query parameterProvide a non-empty query string with at least 2 characters.
429 Too Many RequestsExceeded RapidAPI plan request quotaUpgrade plan or wait for the quota window to reset.