Address autocomplete
curl --request GET \
--url https://api.example.com/api/v1/address/autocompleteimport requests
url = "https://api.example.com/api/v1/address/autocomplete"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/address/autocomplete', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/address/autocomplete",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/address/autocomplete"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/address/autocomplete")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/address/autocomplete")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyAddress
Address autocomplete
Search UK addresses (flat-level, via the Royal Mail PAF file) for an address-entry autocomplete.
GET
/
api
/
v1
/
address
/
autocomplete
Address autocomplete
curl --request GET \
--url https://api.example.com/api/v1/address/autocompleteimport requests
url = "https://api.example.com/api/v1/address/autocomplete"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/address/autocomplete', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/address/autocomplete",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/address/autocomplete"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/address/autocomplete")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/address/autocomplete")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyOverview
Returns UK address suggestions for an address-entry autocomplete as the user types. Pass the partial term asq; the server proxies the Ideal Postcodes UK PAF (Postcode Address File) API and returns a list of one-line suggestions covering flat-level addresses (individual flats, not just buildings).
Each item carries an opaque id — a UK PAF UDPRN — which you pass to GET /api/v1/address/details to resolve the full address plus latitude/longitude once the user picks a suggestion.
The API key lives server-side; clients never see it. An all-whitespace q yields an empty list rather than an error.
Authentication
Bearer <accessToken> required. Scope: user.
Path parameters
None.Query parameters
| Param | Type | Required | Notes | Example |
|---|---|---|---|---|
q | string | yes | The partial address term the user is typing. Min length 1. | NW3 |
Request body
None.Response — 200 OK
| Field | Type | Notes | Example |
|---|---|---|---|
items | array | Address suggestions matching q. Empty when nothing matches or q is blank. | see below |
items[].id | string | Opaque UK PAF UDPRN. Send back as id to /details. | 17683155 |
items[].description | string | Human-readable one-line address suggestion. | Flat 118, Waxham, Mansfield Road, London, NW3 |
Example response
{
"items": [
{
"id": "17683155",
"description": "Flat 118, Waxham, Mansfield Road, London, NW3"
}
]
}
Error responses
| Status | Code | Meaning |
|---|---|---|
| 400 | VALIDATION_FAILED | q is missing or empty. |
| 401 | UNAUTHENTICATED | Missing, malformed, or expired access token. |
| 502 | UPSTREAM_FAILURE | The address provider failed or returned an unexpected response. |
| 503 | ADDRESS_LOOKUP_NOT_CONFIGURED | The server has no API key configured for the selected ADDRESS_PROVIDER (LOQATE_API_KEY by default, or IDEAL_POSTCODES_API_KEY). |
Side effects
None — this is a pure read that proxies a third-party lookup.See also
- Address details — resolve a selected
idto coordinates + full address.
curl
# Suggestions for a partial NW3 address
curl -X GET "https://api.swappr.co.uk/api/v1/address/autocomplete?q=NW3%202JL" \
-H "Authorization: Bearer $ACCESS_TOKEN"