GET
/
api
/
v1
/
address
/
autocomplete
Address autocomplete
curl --request GET \
  --url https://api.example.com/api/v1/address/autocomplete
import 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_body

Overview

Returns UK address suggestions for an address-entry autocomplete as the user types. Pass the partial term as q; 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

ParamTypeRequiredNotesExample
qstringyesThe partial address term the user is typing. Min length 1.NW3

Request body

None.

Response — 200 OK

FieldTypeNotesExample
itemsarrayAddress suggestions matching q. Empty when nothing matches or q is blank.see below
items[].idstringOpaque UK PAF UDPRN. Send back as id to /details.17683155
items[].descriptionstringHuman-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

StatusCodeMeaning
400VALIDATION_FAILEDq is missing or empty.
401UNAUTHENTICATEDMissing, malformed, or expired access token.
502UPSTREAM_FAILUREThe address provider failed or returned an unexpected response.
503ADDRESS_LOOKUP_NOT_CONFIGUREDThe 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

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"