⚡ 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-ukTypeScript / 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
GET
https://fastaddress.ahm-labs.com/api/v1/autocompletecURL
curl -X GET "https://fastaddress.ahm-labs.com/api/v1/autocomplete?q=10+Downing+Street" \
-H "Accept: application/json"Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
q | string | Yes | Search string. Can be a full or partial postcode, street name, house number, or city. Minimum 2 characters. |
limit | integer | No | Maximum 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
| Field | Type | Description |
|---|---|---|
id | integer | Unique database identifier for the address entity. |
address_string | string | Normalized, human-readable address line, optimized for form autofill and shipping labels. |
postcode | string | Official Royal Mail formatted UK Postal Code (e.g., SW1A 2AA). |
latitude | float | Geographic WGS84 Latitude coordinate. |
longitude | float | Geographic WGS84 Longitude coordinate. |
uprn | integer / null | Official 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 Code | Reason | Resolution |
|---|---|---|
200 OK | Request successful | Returns array of matching addresses. |
400 Bad Request | Missing or invalid q query parameter | Provide a non-empty query string with at least 2 characters. |
429 Too Many Requests | Exceeded RapidAPI plan request quota | Upgrade plan or wait for the quota window to reset. |