# Swiftcomplete Postcode Lookup API Integration

Use the Postcode Lookup API to list addresses within a postcode, and receive full address details when a user selects their address.

Topics: SwiftComplete, Server and Scripting

Section: [Postal Addresses via Swiftcomplete](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete.md)

Source: https://developer.what3words.com/tutorial/swiftcomplete-postcode-lookup-api

Updated: 2026-11-29

> [!TIP]
> For support getting set up, contact us via the [Swiftcomplete webpage](https://what3words.com/swiftcomplete).

## 1. Check postcode exists

Pass the postcode in the `text` parameter:

**Request**

```http
GET https://api.swiftcomplete.com/v1/swiftlookup/?key=INSERTKEYHERE&text=W2%205EU
```

**Response**

```json
[
  {
    "primary": { "text": "W2 5EU", "highlights": [0, 1, 3, 5] },
    "secondary": { "text": "Alfred Rd", "highlights": [] },
    "type": "place.area.postcode",
    "isContainer": true,
    "container": "V1;W2 5EU;51.521198;-0.196334",
    "countryCode": "GB"
  }
]
```

## 2. List addresses in a postcode

Take the `container` from the previous request and pass it in as a parameter to list the first 100 addresses in the postcode:

**Request**

```http
GET https://api.swiftcomplete.com/v1/swiftlookup/?key=INSERTKEYHERE&container=V1;W2%205EU;51.521198;-0.196334&maxResults=100
```

**Response**

```json
[
  {
    "primary": { "text": "Blaiz, 65 Alfred Rd", "highlights": [] },
    "secondary": { "text": "W2 5EU", "highlights": [0, 1, 3, 5] },
    "type": "address.business",
    "isContainer": false,
    "countryCode": "GB"
  },
  {
    "primary": { "text": "Carnot, 65 Alfred Rd", "highlights": [] },
    "secondary": { "text": "W2 5EU", "highlights": [0, 1, 3, 5] },
    "type": "address.business",
    "isContainer": false,
    "countryCode": "GB"
  },
  {
    "primary": { "text": "Craster, 65 Alfred Rd", "highlights": [] },
    "secondary": { "text": "W2 5EU", "highlights": [0, 1, 3, 5] },
    "type": "address.business",
    "isContainer": false,
    "countryCode": "GB"
  },
  ...
]
```

### Need to show more than 100 addresses?

There can occasionally be more than 100 addresses in a postcode, and each API request returns a maximum of 100 addresses. If exactly 100 addresses are returned, use `pageFrom` to show the next 100, and so on.

**Request**

```http
GET https://api.swiftcomplete.com/v1/swiftlookup/?key=INSERTKEYHERE&container=V1;W2%205EU;51.521198;-0.196334&maxResults=100&pageFrom=100
```

## 3. Retrieve full address details

Get the full address by passing `populateIndex=x`, where `x` is the index of the address in the array. So if you’d like to select the first address, pass `populateIndex=0`, or to pick the 5th address, pass `populateIndex=4`, and so on.

Optionally pass in `lineFormat` parameters to customise the response format for the address.

Make sure you pass the container ID in again from Step 2.

**Request**

```http
GET https://api.swiftcomplete.com/v1/swiftlookup/?key=INSERTKEYHERE&container=V1;W2%205EU;51.521198;-0.196334&lineFormat0=addressLine1&lineFormat1=addressLine2&lineFormat2=TertiaryLocality,%20SecondaryLocality,%20PrimaryLocality&lineFormat3=POSTCODE&populateIndex=0
```

The address appears as a new `populatedRecord` object within the address at the index specified by `populateIndex`. You can use `populatedRecord.lines` to obtain the address as specified by `lineFormat` in the request, or use `populatedRecord.label` for the fully formatted postal address.

**Response**

```json
[
    {
        "primary": {
            "text": "The Harbour Club, 1 Alfred Rd",
            "highlights": []
        },
        "secondary": {
            "text": "W2 5EU",
            "highlights": [
                0,
                1,
                3,
                5
            ]
        },
        "type": "address.business",
        "isContainer": false,
        "geometry": {
            "centre": {
                "lat": 51.521198,
                "lon": -0.196334,
                "type": "postcode"
            }
        },
        "populatedRecord": {
            "lines": [
                "The Harbour Club",
                "1 Alfred Road",
                "London",
                "W2 5EU"
            ],
            "licenses": [],
            "label": "The Harbour Club\n1 Alfred Road\nLONDON\nW2 5EU\nUnited Kingdom",
            "data": {
                "postalCode": {
                    "text": "W2 5EU",
                    "isFullPostalCode": true,
                    "gb": {
                        "incode": {
                            "text": "5EU"
                        },
                        "postcodeSector": {
                            "text": "5"
                        },
                        "postcodeUnit": {
                            "text": "EU"
                        },
                        "outcode": {
                            "text": "W2"
                        },
                        "postcodeArea": {
                            "text": "W"
                        },
                        "postcodeDistrict": {
                            "text": "2"
                        }
                    }
                },
                "business": {
                    "name": {
                        "text": "The Harbour Club"
                    }
                },
                "subBuilding": null,
                "building": {
                    "name": null,
                    "number": {
                        "text": "1"
                    }
                },
                "road": {
                    "primary": {
                        "text": "Alfred Road"
                    },
                    "secondary": null
                },
                "poBox": null,
                "country": {
                    "primary": {
                        "text": "United Kingdom",
                        "iso3166-2": "GB"
                    },
                    "secondary": null
                },
                "place": {
                    "primary": {
                        "text": "LONDON"
                    },
                    "secondary": null,
                    "tertiary": null
                },
                "admin": {
                    "stateProvince": null,
                    "stateProvinceAbbreviation": null,
                    "gb": {
                        "county": null,
                        "ceremonialCounty": {
                            "text": "Greater London",
                            "code": null
                        },
                        "region": {
                            "text": "London",
                            "code": "E12000007"
                        },
                        "ward": {
                            "text": "Westbourne",
                            "code": "E05013809"
                        },
                        "district": null,
                        "londonBorough": {
                            "text": "Westminster",
                            "code": "E09000033"
                        },
                        "innerOuterLondon": {
                            "text": "Inner London",
                            "code": "E13000001"
                        },
                        "unitaryAuthority": null
                    }
                }
            }
        },
        "countryCode": "GB"
    },
    ...
]
```

### Find out more

[Explore the Swiftcomplete website](https://what3words.com/swiftcomplete)

Can’t find what you’re looking for, or want to report an issue? [Get in touch here](https://share.hsforms.com/1gonG2sDNQhWIqB3BhKVK7A1p3ix).
