# what3words developer documentation: Postal Addresses via Swiftcomplete > Swiftcomplete address autocomplete, postcode lookup, validation and voice capture for postal addresses, with what3words addresses built in. Every page in this section, in menu order, as Markdown. Section page: https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete.md. All sections: https://developer.what3words.com/llms.txt --- # Swiftcomplete BigCommerce Integration: Add Address Autocomplete to Checkout Add Address Autocomplete to Checkout using Swiftcomplete BigCommerce Integration. Topics: BigCommerce, SwiftComplete, E-Commerce Section: [Postal Addresses via Swiftcomplete](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete.md) > [Address Autocomplete](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete/address-autocomplete.md) > [Plugins](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete/address-autocomplete/plugins.md) Source: https://developer.what3words.com/tutorial/swiftcomplete-address-autocomplete-bigcommerce Updated: 2026-11-27 The [Swiftcomplete](https://what3words.com/swiftcomplete/) Plugin for BigCommerce adds address lookup fields to the billing and shipping fields in your checkout to capture accurate addresses and improve conversion rates. ## 1. Get a Swiftcomplete API key Create a Swiftcomplete account (or sign in) if you’re already registered. [GET API KEY](https://www.swiftcomplete.com/account/register) ## 2. Add Swiftcomplete to your checkout page ### Step 1 – Find Script Manager To integrate the Swiftcomplete script, log in to BigCommerce and go to `Script Manager`. You can access this by clicking on the `Storefront > Script Manager` link in your sidebar. ![swiftcomplete-bigcommerce-find-script-manager](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/7e8b990c1496c11016578d75901a406cdaf9caac1bc8d4cb995291f644facc3a.w1600.webp) ### Step 2 – Create a Script Once in this section you want to click on `Create a Script` : ![swiftcomplete-bigcommerce-create-script](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/930707620e13b4a1533a8d3da056915756d864d7647c0e0e1b67c4227f2f3dc8.w1600.webp) ### Step 3 – Fill out the Script form Fill out the checkboxes as follows: In `Placement` choose `header` In `Location` choose `Checkout` In `Script category` choose `Essential` In `Script type` choose `Script` ![swiftcomplete-bigcommerce-fill-out-script](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/56d453e0aec46aa796167cdd081bfbb46a2e02d6db0234b0466c76f556842e9d.w1600.webp) ### Step 4 – Paste the code snippet into the Script Contents In the `Script Contents` Paste this code snippet: **JavaScript** ```javascript ``` ### Step 5 – Add a what3words field to the checkout page To add a what3words address as a custom field to the checkout page, you can select **`Settings > Advanced > Account sign up form > Address Fields > Create a New Field > Text Field`** Make sure that in **`Field Name`**, you write `what3words Address` or `what3words` Then this field too will be populated by the Swiftcomplete if you search for a what3words address. ![swiftcomplete-bigcommerce-plus-what3words](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/4d77ded149e56645c2bfb76b35a4992d1a996377b426ed1b3de02091fbb55f32.w1600.webp) ## 3. Swiftcomplete is now active on your checkout page Once this has been done, go to your BigCommerce checkout. Swiftcomplete should now appear in the billing and shipping address sections. Try searching for an address, what3words or postcode. Click the address, and it should be filled into your form correctly. ![swiftcomplete-bigcommerce-at-checkout](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/b2481a8183b7d539c8802bccb7fd08bf7cc675603633dad0c90d31c879634df4.w1600.webp) ## 4. Customisation and extra features ### Country setting Set the country by changing the script by comma-separated ISO codes, e.g. gb,de `control.setCountries('gb,de');` ![Swiftcomplete Bigcommerce Country](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/fd8b4d9eafb741a8b47ce1de1b7c73f6b3666d9491a76f3699670f4c15070c98.w1600.webp) ### Troubleshooting **Need help, or have any questions?** Get in touch with our customer support team at [support@swiftcomplete.com](mailto:support@swiftcomplete.com), and we’ll help you get started with the Swiftcomplete Script Integration. --- # Swiftcomplete Ecwid Integration: Add Address Autocomplete to Checkout Add Address Autocomplete to Checkout using Swiftcomplete Ecwid Integration. Topics: Ecwid, SwiftComplete, E-Commerce Section: [Postal Addresses via Swiftcomplete](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete.md) > [Address Autocomplete](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete/address-autocomplete.md) > [Plugins](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete/address-autocomplete/plugins.md) Source: https://developer.what3words.com/tutorial/swiftcomplete-address-autocomplete-ecwid Updated: 2026-11-27 The [Swiftcomplete](https://what3words.com/swiftcomplete/) Plugin for Ecwid adds address lookup fields to the billing and shipping fields in your checkout to capture accurate addresses and improve conversion rates. ## 1. Get a Swiftcomplete API key Create a Swiftcomplete account (or sign in) if you’re already registered. [GET API KEY](https://www.swiftcomplete.com/account/register) ## 2. Add Swiftcomplete to your checkout page ### Step 1 – Add script to the Ecwid store 1. **Log in** to your Ecwid admin. 2. Go to **Website → Overview → Advanced website settings → Add custom code**. 3. In the **“Custom JavaScript code”** box 4. Paste the entire script below. *Save*. ![swifcomplete-ecwid-add-script](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/b5abda454337644098992a8ea22f4058918bdeed11971662f2470081bdd6f668.w1600.webp) Here is the script that you need to use: **JavaScript** ```javascript ``` > **Tip:** Replace the API key with your own; everything else can stay as‑is. ### Step 2 – Add a what3words custom checkout field 1. Go to **Settings → Cart & Checkout → Checkout Fields**. 2. Click **Add Field → Text**. 3. Configure: - **Field name:** what3words - **Label (shown to shopper):** what3words - **Checkout step:** *Shipping & Payment Details* (or whichever step you want). - **Show on invoices & e‑mails:** enable both toggles. Ecwid will create the input inside the checkout form; the script locates it automatically and fills it when the customer selects an address. ![swifcomplete-ecwid-create-field](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/29a6eeff5f280652f2bafee017ce3699e875fb50409b31b0fd56599cd17c19b0.w1600.webp) ## 3. Swiftcomplete is now active on your checkout page 1. Open your storefront checkout in a private window. 2. In **Street address**, start typing “SW1A 1AA” or ///filled.count.soap. 3. Select a suggestion – Ecwid should auto‑fill: - address lines - city, postcode, country - **what3words field** (exact what3words address) ![swifcomplete-ecwid-at-checkout](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/3cb7a1556d84eab3b57ef9c6df2c98dcba6d5d8e10d00a6e23eded22c64e4fb7.w1600.webp) Displayed what3words in the orders, if it is searched in the Swiftcomplete: ![swifcomplete-ecwid-at-orders](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/653a08308c1892794a1e6b744a08acc7cf0c89aa6f7ef039f983138db068ee2d.w1600.webp) ## 4. Troubleshooting **Need help, or have any questions?** Get in touch with our customer support team at [support@swiftcomplete.com](mailto:support@swiftcomplete.com), and we’ll help you get started with the Swiftcomplete Script Integration. --- # Swiftcomplete Shopify Plus Integration: Add Address Autocomplete to Checkout Swiftcomplete for Shopify Plus adds real-time address lookup to your checkout, improving accuracy, conversion rates, and delivery success. Topics: Shopify, SwiftComplete, E-Commerce Section: [Postal Addresses via Swiftcomplete](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete.md) > [Address Autocomplete](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete/address-autocomplete.md) > [Plugins](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete/address-autocomplete/plugins.md) Source: https://developer.what3words.com/tutorial/swiftcomplete-address-autocomplete-shopify Updated: 2026-11-27 [Swiftcomplete](http://what3words.com/swiftcomplete) for Shopify Plus adds real-time address lookup to your checkout, improving accuracy, conversion rates, and delivery success. Shopify Plus merchants (as well as Basic/Grow/Advanced merchants) can also [enable address validation at Post purchase page](https://developer.what3words.com/tutorial/swiftcomplete-address-validation-shopify#add-swiftcomplete-to-your-shopify-store), helping customers confirm or correct their shipping address after purchase. ## What you need - A Shopify Plus store. - Access to the Shopify admin and checkout editor. ## 1. Add Swiftcomplete to your Shopify Plus Store Install the Swiftcomplete app on your Shopify Plus store by clicking the button below [INSTALL](https://apps.shopify.com/swiftcomplete) ## 2. Add Swiftcomplete autocomplete to your checkout page ### Step 1 – Complete the onboarding flow - Go to **Admin > Apps > Swiftcomplete** - Click **Enable** button in **Checkout** section to navigate to **Checkout Editor** page ![Swiftcomplete - Shopify Plus onboarding flow](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/d4e83030cfaacf1a333053dd3bf08232f69294ff8269bfd2a76287aeb8d569ed.w1600.webp) ### Step 2 – Add App Block - Under **Main,** select **Add App Block** - Choose **Swiftcomplete** - Click **Save** ![Adding Swiftcomplete autocomplete to Checkout page](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/8f1cef593614a8f7e718ff43045befe591c49adf0b6857fa090375b9977befd0.w1600.webp) ### Step 3 – Disable Address Autocompletion - Go to the **Settings** page of your **Checkout Editor** page, - Scroll down to the **Address Autocompletion** section, - Confirm that **Address autocompletion** is **disabled**. This prevents conflicts from Shopify’s standard address validation. ![Disable address autocomplete in Checkout editor](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/7721f83d9aa3d9946d63137d8bb236ca397409cff904f8ea848cc8519df8e4d3.w1600.webp) ### Step 4 – Enable the Company field (Recommended) - Go to the **Settings** page of your store, - Click on the **Checkout** tab on the sidebar, - Scroll down to the **Customer information** and enable the optional field for **Company name**. This prevents business names provided by shoppers from being lost ![](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/07ec0266de1c885dc25e98b57c7e066bbf1af8b5569567ffb0401d66132e6f79.w1600.webp) ### Step 5 – Test It Out - Go to checkout and enter an address, postcode, or what3words (e.g. ///zones.mixer.scales) - Select a suggestion from the dropdown, and the address fields will auto-fill ![Swiftcomplete address autocomplete in Checkout page](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/d66ec25e7f1cef446ba8a5892549bdf99d3a8c59245d4edd5fb02315083458f6.w1600.webp) - If a what3words address is entered as the input for autocomplete, it will be saved against an order within the **Order notes** section of the order page as a dedicated line: `what3words: ///zones.mixer.scales` This can then be printed on order summaries or exported with orders to pass on to delivery companies. ![what3words address in Order notes](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/be9af4d1243ee17a332b29f74847e30da724762f935a484d3eec4d7bf5d49b7a.w1600.webp) ### Troubleshooting If you are stuck with the installation of our plugin or are using a custom theme, you can give our support team collaborator access to your Shopify admin directly through your own Partner Dashboard or using the Shopify app. These collaborator permissions give our support team access to only the sections of your store that you want us to see. Only the store owner or staff with **Manage collaborator requests** permission can view collaborator access requests or grant collaborator access to a store. Otherwise, contact our [support team](mailto:support@swiftcomplete.com), and they will be able to submit a request to access your store, and you will receive an email about the request and a notification on your Shopify Home. Please make sure you mentioned your store website. Alternatively, if you have a collaborator request code enabled, then you need to provide the collaborator request code to our [support team](mailto:support@swiftcomplete.com). --- # Swiftcomplete WooCommerce Integration: Add Address Autocomplete to Checkout Adding and configuring the Swiftcomplete WooCommerce. Topics: SwiftComplete, Wix, WooCommerce, WordPress, E-Commerce Section: [Postal Addresses via Swiftcomplete](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete.md) > [Address Autocomplete](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete/address-autocomplete.md) > [Plugins](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete/address-autocomplete/plugins.md) Source: https://developer.what3words.com/tutorial/swiftcomplete-address-autocomplete-woocommerce Updated: 2026-11-30 The [Swiftcomplete](https://what3words.com/news/blog/how-to-reduce-checkout-churn-speed-up-address-entry-by-up-to-90-with-swiftcomplete/) Plugin for WooCommerce adds address lookup fields to your checkout’s billing and shipping fields to capture accurate addresses and improve conversion rates. ## 1. WordPress Installation (recommended) You can install Swiftcomplete plugin through the WordPress plugins page in your WordPress admin panel. 1. Navigate to the *Plugins > Add New* page 2. Search for “Swiftcomplete” 3. Click the *Install Now* button. 4. Once installed, you can activate the plugin on the *Plugins* page. ## 2. Manual Installation Don’t unzip the plugin – you’ll need this in the next step. [Download Plugin](https://www.swiftcomplete.com/woocommerce/download/) ## 3. Add the plugin to your WordPress Dashboard **Step 1:** Go to your **WordPress Dashboard**, click **Plugins** and then **Add New.** ![swiftcomplete-woocommerce-add-plugin](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/246bed367fbc14249dd1d5e815ca23e4e8ed74777a8d85dab045afd82ad7d31b.w1600.webp) > **NOTE:** To install the plugin, you’ll need access to your WordPress Dashboard. If you don’t have access, send this guide to your developer, who will be able to install the plugin on your behalf. **Step 2:** Click **Upload Plugin**, then **Choose File.** **Step 3:** Select the Swiftcomplete ZIP file and click **Install Now**. ![swiftcomplete-woocommerce-upload-plugins](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/397fcc327eeeff2cb8d9822a1df48555905e4671d1d8dbadce0adfeb06c3f7af.w1600.webp) **Step 4:** Once the plugin has been installed, click **Activate Plugin**. ![swiftcomplete-woocommerce-upload-plugins2](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/17c17864a051f6983792e4b2c717a80944ed98a0dd57a54dfa8717114105a170.w1600.webp) ## 4. Swiftcomplete is now active on your checkout page Go to your WooCommerce checkout. Swiftcomplete should now appear in the billing and shipping address sections. Try searching for a postcode or address. Click the address, and it should be filled into your form correctly. ### Troubleshooting **Need help, or have any questions?** Get in touch with our customer support team at [support@swiftcomplete.com](mailto:support@swiftcomplete.com), and we’ll help you get started with the Swiftcomplete plugin. --- # Adding Swiftcomplete to e-commerce checkout The tutorial explains how e-commerce businesses can integrate Swiftcomplete to enhance delivery accuracy and reduce costs by allowing customers to specify precise locations at checkout. Topics: BigCommerce, Ecwid, Shopify, SwiftComplete, Wix, WooCommerce, WordPress, E-Commerce Section: [Postal Addresses via Swiftcomplete](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete.md) > [Address Autocomplete](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete/address-autocomplete.md) > [Plugins](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete/address-autocomplete/plugins.md) Source: https://developer.what3words.com/tutorial/adding-swiftcomplete-address-autocomplete-to-ecommerce-checkout Updated: 2026-11-27 [Swiftcomplete](https://what3words.com/swiftcomplete/) helps your customers add their address quickly and accurately at checkout. It reduces delivery issues, supports what3words, and works with both major platforms and custom checkouts, all for just 3p per validated address. This tutorial explains how e-commerce businesses can integrate Swiftcomplete at checkout to enhance delivery accuracy. [Watch this walkthrough on YouTube](https://www.youtube.com/watch?v=TquHOfzA-0E) ## Why use Swiftcomplete for e-commerce? **⚡ Low-latency autocomplete:** Suggestions appear almost instantly, shortening checkout time. **🏠 Delivery‑ready results:** Multi-residence data **and Not Yet Built data** ensure couriers reach the correct flat or unit. **/// what3words address field:** Let’s shoppers add their 3‑word address so drivers stop at the right entrance. **💸 Flat 3p per lookup:** Transparent cost—no surprises at peak traffic. **🧩 Plugins & SDK:** Choose a 5‑minute plugin install or JavaScript component for headless builds. **📈 Fewer failed deliveries:** Validated addresses cut “return‑to‑sender” costs and boost CSAT. ## How do I start using Swiftcomplete? (2 Steps) ## 1. Get a Swiftcomplete API key Create a Swiftcomplete account (or sign in) if you’re already registered. [GET API KEY](https://www.swiftcomplete.com/account/register) ## 2. Pick the integration method that matches your stack #### A) Pre‑built e‑commerce plugins (manual installation required) Swiftcomplete provides downloadable plugin packages for the following platforms. These are not available via standard app marketplaces and must be manually uploaded and configured: [ ![WooCommerce](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/29b7db83d00eeacafa4f33980464aac7788d94fcfa3596fa25c8cdebce50a7e9.w1600.webp) ](https://developer.what3words.com/tutorial/swiftcomplete-address-autocomplete-woocommerce)[ ![Shopify Plus](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/46da8593bcb6e86025186ce45a69be8c2ece83eed05aa67225ecc96d9df42f85.w1600.webp) ](https://developer.what3words.com/tutorial/swiftcomplete-address-autocomplete-shopify)[ ![BigCommerce](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/07ca3a79ce901d7dd157a9b2dc27f79fd0a9788ae48de7b82d1f7268e0be91cd.w1600.webp) ](https://developer.what3words.com/tutorial/swiftcomplete-address-autocomplete-bigcommerce)[ ![Ecwid](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/1cb19da39cf15b01ad6b5ad7f5bfd490babd6db3c84b277a74d1e5437f334c7f.w1600.webp) ](https://developer.what3words.com/tutorial/swiftcomplete-address-autocomplete-ecwid) #### B) JavaScript Component (for bespoke or headless builds) Use this when you control the HTML of your checkout or need a single‑page app integration. - Drop-in script - Fully customisable fields & events - See [guide](https://developer.what3words.com/tutorial/swiftcomplete-address-autocomplete-javascript-component) ### Retrieval of the what3words address ### How to extract the what3words address from the order data? You will need to extract or isolate the what3words address within the order data to pass it on correctly. - **E-commerce platforms:** For instructions on retrieving what3words addresses from your platform, please get in touch with us at [Technology.partnerships@what3words.com](mailto:Technology.partnerships@what3words.com) for further support. - **Bespoke/Self-built e-commerce sites:** See the following guide, which describes how you can use what3words API wrapper functions such as “**IsPossible3wa**”, “**isValid3wa**”, or the what3words RegEx formulae to detect a what3words address format. Using these tools, you can extract and validate what3words addresses from a bulk of text, so that you can isolate them and pass them forward as required. - [Detecting if the text is in the format of a what3words address using RegEx](https://developer.what3words.com/tutorial/detecting-if-text-is-in-the-format-of-a-3-word-address) ### Delivery to the what3words address ### Does a third party(s) handle your e-commerce deliveries? Assess where your customer-provided address data flows in third-party systems and ensure that what3words is sent to the correct data field. - **Order management systems:** Many order management systems will have a dedicated field for what3words. Check with your account manager or contact us at [Technology.partnerships@what3words.com](mailto:Technology.partnerships@what3words.com) for further support. - **Last-mile carriers:** Many last-mile carriers have a dedicated field for sending what3words addresses within delivery order creation. Contact your account manager to check, or contact [Technology.partnerships@what3words.com](mailto:Technology.partnerships@what3words.com)  for further support. You can see a full list of our carriers and logistics software partners [here](https://what3words.com/business/what3words-enabled-logistics-carriers-and-software). ### Do you handle your own e-commerce deliveries? Follow these steps if you have your own delivery fleet or handle all e-commerce deliveries yourself. You can retrieve the coordinates for any what3words addresses sent to you by consumers. 1. To retrieve the coordinates for a what3words address, use the `convert-to-coordinates` call of the what3words API. See this guide: [Public API – convert-to-coordinates](https://developer.what3words.com/public-api/docs#convert-to-coords); 2. If you are using a what3words component, the `return_coordinates` parameter may be used for simplicity in retrieving the coordinates; 3. Important notes regarding convert-to-coordinates: - This call type is chargeable – [see available API usage plans here](https://accounts.what3words.com/select-plan); - If you are retrieving coordinates for what3words addresses, the `convert-to-coordinates` call must be executed once for every e-commerce delivery made to a what3words address. This applies even for repeat deliveries to the same what3words address, to comply with what3words T&C’s. ## Contact Support ### Have any questions? We’re here to support you! If you have any questions while using our what3words Regex expressions, get in touch with us by writing us an email at [support@what3words.com](mailto:support@what3words.com). --- # Address Autocomplete Component: Integrate Swiftcomplete into Web Forms The JavaScript Swiftcomplete integration is a code snippet that can be included on your website or in your checkout to provide address search with real-time suggestions as you type. Topics: JavaScript, SwiftComplete, Website Section: [Postal Addresses via Swiftcomplete](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete.md) > [Address Autocomplete](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete/address-autocomplete.md) > [Web and Mobile Components](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete/address-autocomplete/web-and-mobile-components.md) Source: https://developer.what3words.com/tutorial/javascript-component-integrate-swiftcomplete-into-web-forms-new Updated: 2026-11-27 The [Swiftcomplete](https://what3words.com/swiftcomplete/) API provides real-time address suggestions as you type, eliminating typos and mistakes and reducing the time it takes to find accurate postal addresses. If you need help integrating our Swiftcomplete API into your website or application, [contact us](mailto:support@swiftcomplete.com), and one of our product experts will help you get started. ## 1. Get a Swiftcomplete API key Each request must be authenticated with a Swiftcomplete API key, which you can create in your Swiftcomplete account. [GET API KEY](https://www.swiftcomplete.com/account/api/) ## 2. Add the search field Pick your framework. Each tab below is a working snippet. Copy it, drop in your API key, and you have address search. ### HTML No build step, no npm. Add one script tag and one element. **HTML** ```html ``` That is a working address search. To do something with the result, listen for the select event: **HTML** ```html ``` ### React **Bash** ```shellscript npm install @swiftcomplete/react ``` **AddressForm.tsx** ```tsx import { useRef, useCallback } from 'react'; import { Swiftcomplete, useSelectedAddress, useApi } from '@swiftcomplete/react'; import type { SwiftcompleteRef } from '@swiftcomplete/react'; export function AddressForm() { const ref = useRef(null); useApi({ apiKey: 'YOUR_API_KEY', country: 'gb' }); useSelectedAddress(ref, useCallback((address) => { console.log(address.addressLine1, address.city, address.postalCode); }, [])); return ; } ``` Every event has a matching hook: `useSearchStarted`, `useSearchEnded`, `useManualEntry`, `useSearchClear`, `useSearchFocus`, `useSearchBlur`. Or use `useEvents` to subscribe to all of them at once. Requires React 18 or later. ### Vue **Bash** ```shellscript npm install @swiftcomplete/vue ``` **AddressForm.vue** ```vue ``` The same composables are available as the React hooks. Requires Vue 3.4 or later. ### Angular **Bash** ```shellscript npm install @swiftcomplete/angular ``` **address-form.component.ts** ```typescript import { Component } from '@angular/core'; import { SwiftcompleteComponent, configureSwiftcomplete } from '@swiftcomplete/angular'; import type { Address } from '@swiftcomplete/angular'; @Component({ selector: 'address-form', standalone: true, imports: [SwiftcompleteComponent], template: ` `, }) export class AddressFormComponent { constructor() { configureSwiftcomplete({ apiKey: 'YOUR_API_KEY', country: 'gb' }); } onSelect(address: Address) { console.log(address.addressLine1, address.city, address.postalCode); } } ``` Outputs mirror the events: `selectAddress`, `searchStart`, `searchEnd`, `manualEntry`, `searchClear`, `searchFocus`, `searchBlur`. Requires Angular 18 or later. ## 3. Fill in your form fields Most integrations want the selected address split across the fields of an existing checkout form. Give the component a map of your field IDs and it fills them in on selection. ### HTML **HTML** ```html ``` **JavaScript** ```javascript const el = document.querySelector('swiftcomplete-search'); el.populateFields({ addressLine1: { fieldId: 'address-line-1', format: 'AddressLine1' }, addressLine2: { fieldId: 'address-line-2', format: 'AddressLine2' }, city: { fieldId: 'address-city', format: 'TertiaryLocality, SecondaryLocality, PrimaryLocality' }, postalCode: { fieldId: 'address-postcode', format: 'POSTCODE' }, what3words: { fieldId: 'address-w3w', format: 'what3words' }, }); ``` When the user picks a result, each `fieldId` is looked up with `document.getElementById()` and its value is set. Only `` elements are filled; anything else logs a warning naming the key. > [!NOTE] > **The keys you choose become the keys on `e.detail.selected`.** They’re your own labels, not fixed names, so if you map `postalcode`, you read back `selected.postalcode`, not `selected.postalCode`. Match the default key names below unless you have a reason not to. The one key that is special is `what3words`, which the component recognises and fills with the three word address. Call `populateFields()` once the component is in the DOM, and make sure each `fieldId` matches exactly one element. ### React **TSX** ```tsx const ref = useRef(null); useEffect(() => { ref.current?.getElement()?.populateFields({ addressLine1: { fieldId: 'address-line-1', format: 'AddressLine1' }, postalCode: { fieldId: 'address-postcode', format: 'POSTCODE' }, }); }, []); ``` > [!NOTE] > **In React you usually don’t need this.** If your form fields are controlled inputs, take the address from `useSelectedAddress` and set state instead. `populateFields` writes to the DOM directly, and React will not know about it. **TSX** ```tsx useSelectedAddress(ref, useCallback((address) => { setForm({ line1: address.addressLine1, city: address.city, postcode: address.postalCode, }); }, [])); ``` ### Vue > [!NOTE] > **With Vue, bind your own state.** Take the address from `useSelectedAddress` and assign it to your reactive form object. `populateFields` writes to the DOM directly and will not update Vue’s state. **Vue** ```vue const form = reactive({ line1: '', city: '', postcode: '' }); useSelectedAddress(search, (address) => { form.line1 = address.addressLine1; form.city = address.city; form.postcode = address.postalCode; }); ``` ### Angular **TypeScript** ```typescript onSelect(address: Address) { this.form.patchValue({ line1: address.addressLine1, city: address.city, postcode: address.postalCode, }); } ``` Bind the output to your reactive form rather than using `populateFields`, so Angular stays in control of the values. ### Default address keys If you never call `populateFields`, `e.detail.selected` still arrives with these keys: | KEY | FORMAT STRING | EXAMPLE | | --- | --- | --- | | company | Company | what3words Ltd | | addressLine1 | AddressLine1 | 65 Alfred Road | | addressLine2 | AddressLine2 | | | city | TertiaryLocality, SecondaryLocality, PrimaryLocality | London | | postalCode | POSTCODE | W2 5EU | | country | PrimaryCountry | United Kingdom | | what3words | what3words | filled.count.soap | ## 4. Configure it There are two ways to configure the component, and you can mix them freely. Attributes are simplest for a static page; the JavaScript API is better when settings come from config, or when you need to change them at runtime. ### With attributes Set everything on the tag. Attributes are live: change one at runtime and the component updates. **HTML** ```html ``` Good for static pages, server-rendered templates and CMS blocks where the key is safe to put in markup. ### With Javascript Use `runWhenReady` so the component is registered before you call the service. **JavaScript** ```javascript window.swiftcomplete.runWhenReady((api) => { api.setApiKey('YOUR_API_KEY'); api.setCountry('gb'); api.setSearchFor('address', 'what3words'); api.enableDeviceLocation(); api.setDebounce(0); }); ``` Installed from npm, import the `sdk` instead of reaching for `window`: **JavaScript** ```javascript import '@swiftcomplete/component'; import { sdk, SearchEvents } from '@swiftcomplete/component'; sdk.runWhenReady((api) => api.setApiKey('YOUR_API_KEY')); ``` ### Debouncing requests By default the component searches on every keystroke. On a busy checkout that can be a dozen requests for one address, and a fast typist can push an API key past its queue depth, which returns HTTP 503. Set a debounce so the component waits until typing pauses before it searches. **JavaScript** ```javascript // Vanilla JavaScript window.swiftcomplete.runWhenReady((api) => api.setDebounce(0)); // React and Vue useApi({ debounce: 0 }); // Angular configureSwiftcomplete({ debounce: 0 }); ``` The value is in milliseconds and applies to every search field on the page. The default is `0`, meaning no debounce. ### Turning an existing input into a search field If you already have an address input in a checkout form you’d rather not restructure, wrap it. The original input is preserved inside the component, along with its `id`, `name` and any `data-` attributes. **JavaScript** ```javascript import { Swiftcomplete } from '@swiftcomplete/component'; // const search = Swiftcomplete.wrap(document.getElementById('my-input')); ``` > [!NOTE] > **This is the closest equivalent to the v1 component**, which always attached to an input you already had. `wrap()` requires an `` element and throws a `TypeError` on anything else. ### Creating one from scratch **JavaScript** ```javascript import { Swiftcomplete, SearchEvents } from '@swiftcomplete/component'; const search = new Swiftcomplete(); search.setAttribute('api-key', 'YOUR_API_KEY'); search.setAttribute('placeholder', 'Search address…'); document.getElementById('container').append(search); search.addEventListener(SearchEvents.Select, (e) => { console.log(e.detail.index, e.detail.selected); }); ``` ## 5. Going further Three things most integrations reach for eventually. None are required to get started. ### what3words search The component can search addresses (the default), three word addresses, or both in the same input. This is controlled on the service, not per element, so every search field on the page follows it. **JavaScript** ```javascript window.swiftcomplete.runWhenReady((api) => { api.setApiKey('YOUR_API_KEY'); api.setSearchFor('address'); // default api.setSearchFor('what3words'); // three word addresses only api.setSearchFor('address', 'what3words'); // both in one box }); ``` Any field without an explicit `placeholder` updates its own wording to match. To capture the three word address, add a `what3words` entry to your field map. > [!NOTE] > **Pasted what3words links work too.** If someone pastes `https://what3words.com/filled.count.soap`, the component strips the URL and searches the three words, including locale subdomains. ### Location biasing > [!NOTE] > **Pasted what3words links work too.** If someone pastes `https://what3words.com/filled.count.soap`, the component strips the URL and searches the three words, including locale subdomains. **JavaScript** ```javascript window.swiftcomplete.runWhenReady((api) => { api.setApiKey('YOUR_API_KEY'); api.enableDeviceLocation(); }); ``` That is the whole setup, with no extra markup. The browser prompts for permission, and the position is reused across searches until you call `disableDeviceLocation()`. Clearing the input does not discard it. > [!NOTE] > **Call it inside `runWhenReady`.** Each search field registers for location updates when it enters the DOM, so requesting the position before the fields exist means nothing receives it. To test with a fixed position in Chrome: DevTools → More tools → Sensors → Location. ### Custom UI Replace the built-in icons and indicators on any element instance. Each method takes an HTML string or a DOM node. **JavaScript** ```javascript const el = document.querySelector('swiftcomplete-search'); el.overrideResetSearchElement(''); el.overrideLoadingElement('Loading…'); el.overrideBackElement('Back'); el.overrideExpandContainerElement('→'); el.overrideScrollHintElement('Scroll for more'); ``` The shadow root is closed, so if you need the input itself, for tests, validation or focus management, use `getInput()` rather than querying into the component. **JavaScript** ```javascript const input = el.getInput(); // HTMLInputElement ``` > [!NOTE] > **Several fields on one page** share one service: API key, country, search type and device location are set once. Field maps and UI overrides stay per element. ## 6. Reference ### Attributes | ATTRIBUTE | VALUES | DESCRIPTION | | --- | --- | --- | | api-key | string | Your Swiftcomplete API key. | | country | ISO 3166-1 alpha-2 | Restrict suggestions to one country. Omit to search all available countries. | | placeholder | string | Placeholder text. If omitted it follows what you're searching for: "Type your address or postcode", or "Type your address, what3words, or postcode" when both are enabled. | | name | string | Form field name, so the value submits with your form. | | value | string | Initial value of the input. | | variant | outlined · filled · minimal · modern | Preset visual style. | | size | default · small · large | Scales font and icon size. | | theme | auto · light · dark | auto is the default and follows the page's prefers-color-scheme. | | class / style | string | Copied onto the inner input. Layout properties are ignored; style the host element for those. | ### Events All events fire on the `` element. They bubble and are composed, so they cross the shadow boundary and you can listen on a parent element or on `document` instead. The constants in `SearchEvents` and `FieldEvents` are the same strings, so you can use either. | EVENT | CONSTANT | EVENT.DETAIL | | --- | --- | --- | | swiftcomplete:swiftcomplete:start | SearchEvents.Start | { query } | | swiftcomplete:swiftcomplete:end | SearchEvents.End | { query, success, results?, reason?, canceled? } | | swiftcomplete:swiftcomplete:select | SearchEvents.Select | { index, selected } | | swiftcomplete:swiftcomplete:manualentry | SearchEvents.ManualEntry | None | | swiftcomplete:field:clear | FieldEvents.Clear | None | | swiftcomplete:field:focus | FieldEvents.Focus | None | | swiftcomplete:field:blur | FieldEvents.Blur | None | ### Service methods Available on the `api` object passed to `runWhenReady`. | METHOD | DEFAULT | DESCRIPTION | | --- | --- | --- | | setApiKey(key) | None | Sets the API key for every component on the page. | | setCountry(code) | all countries | Restricts suggestions to one country. | | setSearchFor(...types) | 'address' | Pass 'address', 'what3words' or both. | | setResultOrdering(order) | None | location\_biasing | | setHideOnEmptyResults(bool) | false | Hide the dropdown instead of showing "no results". | | setEnableSearchOnEmptySearch(bool) | false | Show nearby roads on focus, before the user types. | | enableDeviceLocation() | off | Asks for browser geolocation and biases results towards the user. | > [!NOTE] > **what3words search is off by default.** The component searches addresses only unless you call `setSearchFor('address', 'what3words')`. The v1 component’s snippet enabled both, so this is a deliberate step when migrating. ### Supported countries Austria `at` · Canada `ca` · Denmark `dk` · France `fr` · Germany `de` · Guernsey `gg` · Isle of Man `im` · Italy `it` · Jersey `je` · Liechtenstein `li` · Luxembourg `lu` · Netherlands `nl` · Norway `no` · Switzerland `ch` · United Kingdom `gb` ### Styling The component renders inside a shadow root, so your page’s CSS won’t reach into it. Style it by setting custom properties on the element. **CSS** ```css swiftcomplete-search { --swiftcomplete-input-border-radius: 4px; --swiftcomplete-focus-border-color: #e11f26; --swiftcomplete-font-family: inherit; --swiftcomplete-padding: 0.75em; --swiftcomplete-result-max-items: 6; } ``` | CUSTOM PROPERTY | DEFAULT | | --- | --- | | \--swiftcomplete-background | #fff | | \--swiftcomplete-primary-text-color | #474747 | | \--swiftcomplete-secondary-text-color | #707070 | | \--swiftcomplete-focus-border-color | #007bff | | \--swiftcomplete-error-color | #dc3545 | | \--swiftcomplete-input-border | 1px solid #dedede | | \--swiftcomplete-input-border-radius | 8px | | \--swiftcomplete-padding | 1em | | \--swiftcomplete-icon-size | 16px | | \--swiftcomplete-result-max-items | 5 (4 on tablet, 3 on mobile) | | \--swiftcomplete-min-width | 250px | Around twenty further properties cover the results list, header, footer, scrollbar and hover states. See the [component README](https://www.npmjs.com/package/@swiftcomplete/component) for the full list. --- # Swiftcomplete Address Autocomplete API Suggest addresses as users type a street, postcode or full address, then retrieve the structured address they select. Topics: SwiftComplete, Server and Scripting Section: [Postal Addresses via Swiftcomplete](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete.md) > [Address Autocomplete](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete/address-autocomplete.md) Source: https://developer.what3words.com/tutorial/swiftcomplete-address-autocomplete-api Updated: 2026-11-30 > [!TIP] > For support getting set up, contact us via the [Swiftcomplete webpage](https://what3words.com/swiftcomplete). ## 1. Overview Send the user's search text to Swiftcomplete and display the suggestions it returns. If the user picks an individual address, retrieve its full details. If they pick a container, such as a postcode or street, open it and let them choose an address from the results. A populated result includes address lines and a display label. It can also include structured address components and coordinates. ## 2. Base endpoint **Endpoint** ```http https://api.swiftcomplete.com/v1/swiftlookup/ ``` Use HTTPS `GET` requests with the parameters in the query string. ## 3. Request parameters | Query parameter | Description | | --- | --- | | `key` | Your Swiftcomplete API key. | | `text` | The search text entered by the user. | | `biasTowards` | Optional coordinates in `lat,lon` format. Favours results near that location. | | `populateIndex` | The selected item's zero-based index in the response array. Requests the full address for that item. | | `countries` | Comma-separated country codes that limit where the API searches. | | `container` | The value returned with a container suggestion. Send it to fetch the addresses it contains. | | `maxResults` | The maximum number of child results to return in a container request, up to 100. | | `pageFrom` | The offset at which to start the next page of child results. | ## 4. Standard autocomplete flow ### Search on every keystroke As the user types, send the current contents of the address field in `text`. **Request** ```http GET https://api.swiftcomplete.com/v1/swiftlookup/?key=INSERT_KEY_HERE&text=what3 ``` The example response below shows the first two suggestions. **Response** ```json [ { "primary": { "text": "What3words, Alfred Rd", "highlights": [0, 4] }, "secondary": { "text": "London", "highlights": [] }, "type": "address.business", "isContainer": false, "countryCode": "GB" }, { "primary": { "text": "Sew What, 34 Caledonian Rd", "highlights": [4, 7, 10, 10] }, "secondary": { "text": "Wishaw", "highlights": [] }, "type": "address.business", "isContainer": false, "countryCode": "GB" } ] ``` ### Display the suggestion list | Response field | How to use it | | --- | --- | | `primary.text` | Display as the main text for the suggestion. | | `secondary.text` | Display as supporting text. | | `primary.highlights`, `secondary.highlights` | Highlight the matching character ranges in each display string. | | `type` | Identify the kind of result. | | `isContainer` | Decide whether to open a container or populate the selected result directly. | | `countryCode` | Identify the country associated with the suggestion. | ### Populate a selected result When the user chooses a suggestion with `isContainer` set to `false`, repeat the exact request that returned it and add `populateIndex` with its position in the array. The first result has index `0`. **Request** ```http GET https://api.swiftcomplete.com/v1/swiftlookup/?key=INSERT_KEY_HERE&text=what3&populateIndex=0 ``` **Response** ```json [ { "primary": { "text": "What3words, Alfred Rd", "highlights": [0, 4] }, "secondary": { "text": "London", "highlights": [] }, "isContainer": false, "geometry": { "centre": { "lat": 51.521198, "lon": -0.196334 } }, "populatedRecord": { "lines": [ "What3words Ltd", "65 Alfred Road", "LONDON", "W2 5EU", "United Kingdom" ], "label": "What3words Ltd\n65 Alfred Road\nLONDON\nW2 5EU\nUnited Kingdom" } } ] ``` ### Use the populated record - Use `populatedRecord.lines` for the individual address lines. - Use `populatedRecord.label` for a display label with line breaks. - Read structured address components from `populatedRecord.data` when present. - Read latitude and longitude from `geometry.centre.lat` and `geometry.centre.lon` when available. ## 5. Container flow If a suggestion has `isContainer` set to `true`, open it first. Apply `populateIndex` to the request that returned the chosen child address. ### Search for a container In this example, a postcode search returns one suggestion with a `container` value. **Request** ```http GET https://api.swiftcomplete.com/v1/swiftlookup/?key=INSERT_KEY_HERE&text=ng97bs ``` **Response** ```json [ { "primary": { "text": "NG9 7BS", "highlights": [0, 2, 4, 6] }, "secondary": { "text": "Brookhill St", "highlights": [] }, "type": "place.area.postcode", "isContainer": true, "container": "V1;NG9 7BS;52.923435;-1.279735", "countryCode": "GB" } ] ``` ### Open the container Start a new request using the returned `container` value. This example uses `maxResults=100` and encodes the space in the postcode as `%20`. **Request** ```http GET https://api.swiftcomplete.com/v1/swiftlookup/?key=INSERT_KEY_HERE&container=V1;NG9%207BS;52.923435;-1.279735&maxResults=100 ``` The example response below shows the first two child results. **Response** ```json [ { "primary": { "text": "2 Brookhill St" }, "secondary": { "text": "Stapleford, NG9 7BS" }, "isContainer": false }, { "primary": { "text": "2a Brookhill St" }, "secondary": { "text": "Stapleford, NG9 7BS" }, "isContainer": false } ] ``` ### Let the user choose a child result Display the child addresses as a second list of suggestions. ### Populate the selected child result Repeat the container request that returned the chosen address. Keep its existing parameters, including `pageFrom` if the result came from a later page, and add `populateIndex` with the child's index in that response. ## 6. Container pagination If the response contains exactly `maxResults` items, another page may be available. Use `pageFrom` to fetch it. For example, to fetch the next page after the first 10 results, set `pageFrom=10`. **Request** ```http GET https://api.swiftcomplete.com/v1/swiftlookup/?key=INSERT_KEY_HERE&container=V1;NG9%207BS;52.923435;-1.279735&maxResults=10&pageFrom=10 ``` Advance `pageFrom` by the page size after each full page. Stop when the response contains fewer items than `maxResults`. ## 7. Recommended UI flow ### Typing Call `swiftlookup` with the current `text` after each keystroke and display the results as suggestions. ### Selecting a non-container result Repeat the search request with the selected index in `populateIndex`. Use the returned `populatedRecord` to fill the address fields. ### Selecting a container result Open the container and show its child addresses. When the user picks one, repeat the request for that list or page with the chosen index in `populateIndex`. ## 8. Important implementation rules - Send the current search text after each keystroke. - For a population request, keep the original query parameters and add only `populateIndex`. - Open a container before populating any of its child addresses. - Use `pageFrom` for container pagination and stop after a response with fewer than `maxResults` items. ## 9. Integration logic **Pseudocode** ``` suggestions = lookup(key, text) When the user selects a suggestion: If isContainer is false: Repeat the search request with populateIndex set to the selected index Use populatedRecord If isContainer is true: Request the child results with key, container and maxResults If a page is full, fetch the next page with pageFrom as needed When the user selects a child, repeat the request for its page with populateIndex set to the child's index on that page Use populatedRecord ``` ## 10. Response fields to store | Field | Value | | --- | --- | | `populatedRecord.label` | Address formatted as a multiline label. | | `populatedRecord.lines` | Individual address lines in an array. | | `populatedRecord.data` | Structured address components, when present. | | `geometry.centre.lat` | Latitude, when available. | | `geometry.centre.lon` | Longitude, when available. | | `countryCode` | Country code. | ## 11. Summary Search with `text` as the user types. To retrieve a direct address, repeat the search with `populateIndex`. For a container, fetch its child results, page through them with `pageFrom` if needed, and use `populateIndex` on the request that returned the chosen child. ### 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). --- # 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). --- # Swiftcomplete Validate API Section: [Postal Addresses via Swiftcomplete](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete.md) > [Address Validation](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete/address-validation.md) Source: https://developer.what3words.com/tutorial/swiftcomplete-validate Updated: 2026-11-27 ## 1. Overview The Validate API matches addresses against official address records, normalises formatting, and suggests corrections when the input contains meaningful errors. Detects and validates what3words addresses. If invalid, returns the most likely candidate using proximity to the rest of the address, where available. The response contains three top-level parts: | Part | Description | | --- | --- | | validation | Describes whether the input matched an underlying source record and at which resolution. | | address | The normalised address to use, provided as a single string and split into multiple lines. | | associatedRecords | A list of any records associated with the returned address, such as apartments, suites, departments, or business names. | ## 2. Authentication All requests require an API key passed in the `X-API-Key` header. [Get an API key here](https://www.swiftcomplete.com/account/register/) **Header** ```http X-API-Key: your_api_key_here ``` ## 3. Endpoint **Request** ```http POST https://api.swiftcomplete.com/v1/validate-address/ Content-Type: application/json ``` Request and response bodies are UTF-8 encoded JSON. ## 4. Request Each field is optional, but the request must contain at least one non-empty value in `singleLine`, `companyName`, `line1`, `line2`, `line3`, `tertiaryLocality`, `secondaryLocality`, `primaryLocality`, or `postalCode`. `state`, `stateCode`, `countryName`, and `countryCode` do not satisfy this minimum-input requirement by themselves, but may be included with another qualifying field. If your address data is unstructured, pass the whole address in `singleLine`. If your address data is already structured, pass the components into their respective fields. Do not combine `singleLine` with the structured address fields. When `singleLine` is provided, it takes precedence and the structured fields are ignored. You may still provide `countryCode` to restrict matching to one or more markets. Providing one or more supported country codes restricts matching to those markets and improves accuracy. Separate multiple country codes with commas. It is strongly recommended whenever the relevant market is known. | Field | Type | Description | | --- | --- | --- | | singleLine | string | Freeform, unstructured address string. Example: 10 downing st london sw1a2aa. | | companyName | string | Business or organisation name associated with the address. | | line1 | string | Primary address line. | | line2 | string | Secondary address line. | | line3 | string | Tertiary address line. | | tertiaryLocality | string | Sub-locality, neighbourhood, or village within a larger locality. | | secondaryLocality | string | District, borough, or suburb. | | primaryLocality | string | City or town. | | state | string | State, province, county, region, or other principal administrative area, where applicable. | | stateCode | string | State abbreviation, where applicable. | | postalCode | string | Postal or ZIP code. | | countryName | string | Country name. | | countryCode | string | One or more supported ISO 3166-1 alpha-2 country codes. Separate multiple codes with commas, for example GB,DE. | | what3words | string | A what3words address, eg. ///filled.count.soap | ## 5. Response A response contains validation, address, and associatedRecords. | Field | Type | Description | | --- | --- | --- | | validation | object | The result of matching the input to the underlying source data. | | address | object or null | The normalised address to use. Returned for match and suggestion; null for none. | | associatedRecords | array or null | Records associated with the returned address. null when none exist. | ### `validation` #### `validation.result` `validation.result` is the core result of the operation. Read it first when deciding whether to accept the returned address, ask the user to confirm a suggestion, or ask the user to re-enter the address. | Result | Description | | --- | --- | | match | The input was successfully matched to an official record. | | suggestion | The input matched the underlying source data but changes are large enough to justify seeking user confirmation. | | none | The input could not be matched to an address in the underlying source data. address and validation.resolution will be null. | #### `validation.resolution` `validation.resolution` describes the highest address level matched against the underlying source data. See [**Input preservation**](#input) for how this relates to values returned in `address`. | Resolution | Description | Example of matched source data | | --- | --- | --- | | subPremise | The input matched a specific unit, flat, suite, floor, department, organisation, or other source record within or associated with a building. | HSBC Holdings plc, 8 Canada Square, London, E14 5HQ | | premise | The input matched a specific building or premise. | 10 Downing Street, London, SW1A 2AA | | street | The input matched a street or thoroughfare, but not a specific premise. | Great Russell Street, London, WC1B 3DG | | city | The input matched only a city, town, or locality. | London, United Kingdom | | null | No address level could be matched, or resolution is not applicable. | Returned with validation.result: none. | ### `address` `address` is the normalised address to use when `validation.result` is `match` or `suggestion`. | Field | Type | Description | | --- | --- | --- | | address.singleLine | string | The complete normalised address, formatted as a single display line. | | address.multiLine | object | The same address broken into structured components. | `address.multiLine` contains `companyName`, `line1`, `line2`, `line3`, `tertiaryLocality`, `secondaryLocality`, `primaryLocality`, `state`, `stateCode`, `postalCode`, `countryName`, `countryCode`, and `what3words`. Each field contains the value returned by Swiftcomplete, or `null` where the component does not apply. When `validation.result` is `none`, `address` is `null`. ### `associatedRecords` `associatedRecords` provides a list of any address records associated with the returned address, such as companies, flats, suites, departments. These records can be presented to the end user as optional refinements to the default `address`; they do not change the core validation result. When records are returned, show their `picklistDisplay` values to the user after the base address has been validated or accepted. | Field | Type | Description | | --- | --- | --- | | associatedRecords\[\].picklistDisplay | string | Consumer-facing text to display in a pick list. Do not use this value directly as an address field. | | associatedRecords\[\].overrides | object | The replacement values to apply to the default address if this record is selected. | | associatedRecords\[\].overrides.singleLine | string | The value that should replace address.singleLine if the integration uses the single-line format. | | associatedRecords\[\].overrides.multiLine | object | A partial address object containing each structured field that should replace the corresponding field in address.multiLine. It can contain any multi-line address field. | #### Applying an associated record Do not change the default `address` unless the user selects an associated record. When a record is selected: 1. If your integration uses `address.singleLine`, replace it with `associatedRecords[n].overrides.singleLine`. 2. If your integration uses `address.multiLine`, replace each field present in `associatedRecords[n].overrides.multiLine` with the returned value. 3. Leave every address field not included in `overrides.multiLine` unchanged. When no associated records are available, `associatedRecords` is `null`. ## 6. Input preservation Swiftcomplete validates submitted address data against underlying source records. It may also preserve important input that is not present in the matched record but is still useful for delivery or recipient identification. Examples include: - recipient or attention details, such as `FAO Reception Desk`; - department names; - informal or newly registered business names; and - delivery or entrance instructions, such as `Use side entrance` or `Deliver to loading bay`. Swiftcomplete determines whether input should be preserved and where it should appear in the returned address. Integrations should use `address.singleLine` or `address.multiLine` as returned and should not attempt to identify or reposition preserved input. ### Relationship with `validation.resolution` `validation.resolution` describes the highest address level matched against the underlying source data. It does not describe the resolution of `address`. Preserved input can therefore make the returned address more detailed than the matched source record. A populated field is not evidence that the field itself was validated. Always use: - `validation.resolution` to assess match precision; and - `address` as the normalised address to display, store, or submit. ### Worked example The request and response below show Swiftcomplete matching the university at `subPremise` level while preserving an unvalidated department name: **JSON** ```json { "singleLine": "Department of Geospatial Engineering, King's College London, Strand, London, WC2R 2LS, United Kingdom", "countryCode": "GB" } ``` **Response** ```json { "validation": { "result": "match", "resolution": "subPremise" }, "address": { "singleLine": "Department Of Geospatial Engineering, Kings College London, Strand, London, WC2R 2LS, United Kingdom", "multiLine": { "companyName": "Kings College London", "line1": "Department Of Geospatial Engineering", "line2": "Strand", "line3": null, "tertiaryLocality": null, "secondaryLocality": null, "primaryLocality": "London", "state": "Greater London", "stateCode": null, "postalCode": "WC2R 2LS", "countryName": "United Kingdom", "countryCode": "GB" } }, "associatedRecords": null } ``` `Kings College London` is matched against the underlying source data and returned in `companyName`. `Department Of Geospatial Engineering` is not part of the matched source record, but is preserved in `line1`. The authoritative match level remains `subPremise`. ## 7. Response handling guidance | Result | Associated records | Recommended handling | | --- | --- | --- | | match | null | Use address as the normalised address, subject to your required validation.resolution. | | match | Array | Use address as the default. Optionally show each picklistDisplay as a more specific choice and apply its overrides if selected. | | suggestion | null | Present address as the corrected address and ask the user to confirm it before replacing their original address. | | suggestion | Array | Present address as the corrected default. If accepted, optionally show associated records and apply an override only if selected. | | none | null | Ask the user to review, edit, or re-enter the address. | ## 8. Markets The Validate API currently supports the following markets: | Market | Country code | | --- | --- | | United Kingdom | GB | | Germany | DE | ## 9. Examples ### `match` **JSON** ```json { "singleLine": "40 Sisters Avenue, London, SW11 5SQ, United Kingdom", "countryCode": "GB" } ``` **Response** ```json { "validation": { "result": "match", "resolution": "premise" }, "address": { "singleLine": "40 Sisters Avenue, London, SW11 5SQ, United Kingdom", "multiLine": { "companyName": null, "line1": "40 Sisters Avenue", "line2": null, "line3": null, "tertiaryLocality": null, "secondaryLocality": null, "primaryLocality": "London", "state": "Greater London", "stateCode": null, "postalCode": "SW11 5SQ", "countryName": "United Kingdom", "countryCode": "GB" } }, "associatedRecords": null } ``` ### `match` with `associatedRecords` **JSON** ```json { "singleLine": "242 acklam road w105jj", "countryCode": "GB" } ``` **Response** ```json { "validation": { "result": "match", "resolution": "premise" }, "address": { "singleLine": "242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": null, "line1": "242 Acklam Road", "line2": null, "line3": null, "tertiaryLocality": null, "secondaryLocality": null, "primaryLocality": "London", "state": "Greater London", "stateCode": null, "postalCode": "W10 5JJ", "countryName": "United Kingdom", "countryCode": "GB" } }, "associatedRecords": [ { "picklistDisplay": "A P D A London Ltd", "overrides": { "singleLine": "A P D A London Ltd, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "A P D A London Ltd" } } }, { "picklistDisplay": "Barton Engineers", "overrides": { "singleLine": "Barton Engineers, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Barton Engineers" } } }, { "picklistDisplay": "Bloobloom", "overrides": { "singleLine": "Bloobloom, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Bloobloom" } } }, { "picklistDisplay": "Buchanan Advertising (UK) Ltd", "overrides": { "singleLine": "Buchanan Advertising (UK) Ltd, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Buchanan Advertising (UK) Ltd" } } }, { "picklistDisplay": "Frescobol", "overrides": { "singleLine": "Frescobol, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Frescobol" } } }, { "picklistDisplay": "Fusion One International Ltd", "overrides": { "singleLine": "Fusion One International Ltd, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Fusion One International Ltd" } } }, { "picklistDisplay": "Goodwood Contractors Ltd", "overrides": { "singleLine": "Goodwood Contractors Ltd, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Goodwood Contractors Ltd" } } }, { "picklistDisplay": "Indie Bay Snacks", "overrides": { "singleLine": "Indie Bay Snacks, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Indie Bay Snacks" } } }, { "picklistDisplay": "Intelligent Imaging Innovations Ltd", "overrides": { "singleLine": "Intelligent Imaging Innovations Ltd, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Intelligent Imaging Innovations Ltd" } } }, { "picklistDisplay": "Ottoman Hands Ltd", "overrides": { "singleLine": "Ottoman Hands Ltd, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Ottoman Hands Ltd" } } }, { "picklistDisplay": "Paymentsense", "overrides": { "singleLine": "Paymentsense, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Paymentsense" } } }, { "picklistDisplay": "Perfect Storm Media Ltd", "overrides": { "singleLine": "Perfect Storm Media Ltd, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Perfect Storm Media Ltd" } } }, { "picklistDisplay": "Phycobloom Ltd", "overrides": { "singleLine": "Phycobloom Ltd, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Phycobloom Ltd" } } }, { "picklistDisplay": "Powder Bowl Trading Ltd", "overrides": { "singleLine": "Powder Bowl Trading Ltd, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Powder Bowl Trading Ltd" } } }, { "picklistDisplay": "Rachel Nevin Communications", "overrides": { "singleLine": "Rachel Nevin Communications, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Rachel Nevin Communications" } } }, { "picklistDisplay": "Rigby & Marchant Ltd", "overrides": { "singleLine": "Rigby & Marchant Ltd, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Rigby & Marchant Ltd" } } }, { "picklistDisplay": "Sophie Harley London", "overrides": { "singleLine": "Sophie Harley London, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Sophie Harley London" } } }, { "picklistDisplay": "Twotwentyseven", "overrides": { "singleLine": "Twotwentyseven, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Twotwentyseven" } } }, { "picklistDisplay": "V M V Studio", "overrides": { "singleLine": "V M V Studio, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "V M V Studio" } } }, { "picklistDisplay": "Westbourne Studios", "overrides": { "singleLine": "Westbourne Studios, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Westbourne Studios" } } }, { "picklistDisplay": "Workspace Management", "overrides": { "singleLine": "Workspace Management, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Workspace Management" } } }, { "picklistDisplay": "Yousoft Ltd", "overrides": { "singleLine": "Yousoft Ltd, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Yousoft Ltd" } } }, { "picklistDisplay": "Zalacain Wayfinding", "overrides": { "singleLine": "Zalacain Wayfinding, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Zalacain Wayfinding" } } } ] } ``` ### `suggestion` with `associatedRecords` and an attention line The attention line is preserved in `line1`. Each associated-record override adds the selected company while leaving the attention line in place. **JSON** ```json { "singleLine": "FAO Accounts Payable, 65 Alfred Rod, London, W2 5EU, United Kingdom", "countryCode": "GB" } ``` **Response** ```json { "validation": { "result": "suggestion", "resolution": "premise" }, "address": { "singleLine": "FAO Accounts Payable, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": null, "line1": "FAO Accounts Payable", "line2": "65 Alfred Road", "line3": null, "tertiaryLocality": null, "secondaryLocality": null, "primaryLocality": "London", "state": "Greater London", "stateCode": null, "postalCode": "W2 5EU", "countryName": "United Kingdom", "countryCode": "GB" } }, "associatedRecords": [ { "picklistDisplay": "Blaiz Ltd", "overrides": { "singleLine": "FAO Accounts Payable, Blaiz Ltd, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Blaiz Ltd" } } }, { "picklistDisplay": "Carnot Ltd", "overrides": { "singleLine": "FAO Accounts Payable, Carnot Ltd, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Carnot Ltd" } } }, { "picklistDisplay": "Craster Ltd", "overrides": { "singleLine": "FAO Accounts Payable, Craster Ltd, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Craster Ltd" } } }, { "picklistDisplay": "Daisy Global Ltd", "overrides": { "singleLine": "FAO Accounts Payable, Daisy Global Ltd, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Daisy Global Ltd" } } }, { "picklistDisplay": "Davina Combe Ltd", "overrides": { "singleLine": "FAO Accounts Payable, Davina Combe Ltd, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Davina Combe Ltd" } } }, { "picklistDisplay": "Great Western Studios", "overrides": { "singleLine": "FAO Accounts Payable, Great Western Studios, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Great Western Studios" } } }, { "picklistDisplay": "Italspirits Ltd", "overrides": { "singleLine": "FAO Accounts Payable, Italspirits Ltd, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Italspirits Ltd" } } }, { "picklistDisplay": "Moxon Architects Ltd", "overrides": { "singleLine": "FAO Accounts Payable, Moxon Architects Ltd, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Moxon Architects Ltd" } } }, { "picklistDisplay": "Nishura Ltd", "overrides": { "singleLine": "FAO Accounts Payable, Nishura Ltd, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Nishura Ltd" } } }, { "picklistDisplay": "Obatan Llc", "overrides": { "singleLine": "FAO Accounts Payable, Obatan Llc, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Obatan Llc" } } }, { "picklistDisplay": "R F Gill & Associates", "overrides": { "singleLine": "FAO Accounts Payable, R F Gill & Associates, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "R F Gill & Associates" } } }, { "picklistDisplay": "Run For The Hills", "overrides": { "singleLine": "FAO Accounts Payable, Run For The Hills, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Run For The Hills" } } }, { "picklistDisplay": "Solid Floor Ltd", "overrides": { "singleLine": "FAO Accounts Payable, Solid Floor Ltd, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Solid Floor Ltd" } } }, { "picklistDisplay": "Stephen Fletcher Architects", "overrides": { "singleLine": "FAO Accounts Payable, Stephen Fletcher Architects, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Stephen Fletcher Architects" } } }, { "picklistDisplay": "What3words Ltd", "overrides": { "singleLine": "FAO Accounts Payable, What3words Ltd, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "What3words Ltd" } } } ] } ``` ### `none` **JSON** ```json { "singleLine": "This is not a real address", "countryCode": "GB" } ``` **Response** ```json { "validation": { "result": "none", "resolution": null }, "address": null, "associatedRecords": null } ``` ## 10. Errors | HTTP code | Meaning | What to do | | --- | --- | --- | | 400 | The request contains malformed JSON or fails request validation, such as when no non-empty address component is provided. | Correct the request. Do not retry it unchanged. | | 401 | The X-API-Key header is missing or contains an invalid key. | Check the key and header name. | | 429 | Too many requests. | Back off and retry after the period indicated in Retry-After. | | 500 | An unexpected error occurred on the server. | Retry with backoff. If the problem persists, contact support. | --- # Swiftcomplete Shopify Integration: Address Validation Topics: SwiftComplete, E-Commerce Section: [Postal Addresses via Swiftcomplete](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete.md) > [Address Validation](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete/address-validation.md) Source: https://developer.what3words.com/tutorial/swiftcomplete-address-validation-shopify Updated: 2026-11-27 Help customers confirm or correct their shipping address after purchase with [Swiftcomplete](https://what3words.com/swiftcomplete) for Shopify, available on all Shopify plans. On the Thank you page, customers can confirm a validated address or choose from suggested matches. Their confirmed selection automatically updates the order’s shipping address, with no action needed from the merchant. Shopify Plus merchants can also [enable address autocomplete at checkout](https://developer.what3words.com/tutorial/swiftcomplete-address-autocomplete-shopify#add-swiftcomplete-to-your-shopify-plus-store), helping customers find a validated address using an address, postcode or what3words address. ## What you need - A Shopify Basic store or higher. - Access to the Shopify admin and checkout editor. ## 1. Add Swiftcomplete to your Shopify Store Install the Swiftcomplete app on your Shopify store by clicking the button below [INSTALL](https://apps.shopify.com/swiftcomplete) ## 2. Add Address Validation to the post-purchase page ### Step 2 – Complete the onboarding flow - Go to **Admin > Apps > Swiftcomplete** - Click **Enable** button in **Post Purchase** section to navigate to **Post Purchase Editor** page ![](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/9d32e8f8d82a15f2ed54d15de9db798a665068ba4cf5524a65393423986b44eb.w1600.webp) ### Step 3 – Add App Block - Under **Main,** select **Add App Block** - Choose **Swiftcomplete** - Click **Save** ![Add Address validation app block to Post purchase page](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/1dc0a9753d973f9888a59a409595965c20d8b648b064d246a4094e837afcf615.w1600.webp) ### Step 4 – Test It Out - Place a test order using a delivery address. - Open the Thank you/post-purchase page shown after the order is placed. - Test both a valid address and one that needs correcting to check that confirmation and suggested matches appear as expected. ![Address validation suggested a better match](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/4ba5bb6d6d09d2d10da6fdc653d77237c571f3706738d532f872465d9fa48367.w1600.webp) - Also confirm if the optional ‘what3words address’ field is correctly displayed to allow customers to enter a what3words address for additional precision ![what3words address field in address validation](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/937c749905665d6752ed7fbc4a7dea83c6eddd358250a8ec0908dfbd8c0ace24.w1600.webp) - Confirm that any accepted correction is reflected in the order’s delivery details before fulfillment. ## 3. Troubleshooting If you are stuck with the installation of our plugin or are using a custom theme, you can give our support team collaborator access to your Shopify admin directly through your own Partner Dashboard or using the Shopify app. These collaborator permissions give our support team access to only the sections of your store that you want us to see. Only the store owner or staff with **Manage collaborator requests** permission can view collaborator access requests or grant collaborator access to a store. Otherwise, contact our [support team](mailto:support@swiftcomplete.com), and they will be able to submit a request to access your store, and you will receive an email about the request and a notification on your Shopify Home. Please make sure you mentioned your store website. Alternatively, if you have a collaborator request code enabled, then you need to provide the collaborator request code to our [support team](mailto:support@swiftcomplete.com). --- # AI Voice Address Capture: Resolve Recorded Addresses with Swiftcomplete Resolve recorded UK addresses into validated postal addresses with Swiftcomplete’s voice address API using a single HTTPS request. Topics: SwiftComplete Section: [Postal Addresses via Swiftcomplete](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete.md) > [Voice](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete/voice.md) Source: https://developer.what3words.com/tutorial/swiftcomplete-ai-voice-capture-recorded-addresses Updated: 2026-11-24 ## 1. Overview Use Swiftcomplete’s recorded address API to resolve a spoken postal address from a voicemail, recorded call or voice message. Send a recording containing one spoken address in a single HTTPS `POST`. If the API identifies an address, the `response` field contains the validated postal address in single-line and multiline formats. The API returns postcode-level coordinates by default, or property-level coordinates if you request them and they’re available. If the API can’t identify the address confidently, it returns a result with `type` set to `not_resolved`. For live calls, use the [streaming API](https://developer.what3words.com/tutorial/swiftcomplete-ai-voice-address-capture) to send audio and receive transcripts as the caller speaks. Both APIs use the same format for the final result. ## 2. How it works 1. Your server sends one recording, holding one spoken address, in a single HTTPS `POST`. 2. We transcribe the recording and identify the address. 3. The response holds exactly one result: the validated address, `not_resolved` or an error. There’s no job to poll and no callback: the result is in the response. The response holds only the result, with no transcripts. To resolve another address, send another request. ## 3. Authentication All requests require an API key passed in the `x-api-key` header. [Get an API key here](https://www.swiftcomplete.com/account/register/) Keep your key on your server. Always send recordings from your backend, never from a web page or mobile app, where your key could be read. If you record the caller in a browser or app, upload the recording through your server. ## 4. Prepare your recording Send a WAV file, or raw audio with its format in the query string (step 5). Send the audio at its original sample rate. There’s no need to resample it. | Audio | encoding | sampleRateHz | Typical source | | --- | --- | --- | --- | | 16-bit PCM | pcm\_s16le | 48000 | Browser and app microphones | | 16-bit PCM | pcm\_s16le | 16000 | Wideband (HD) voice and many voice AI platforms | | 16-bit PCM | pcm\_s16le | 8000 | Telephone audio decoded to 16-bit PCM | | G.711 μ-law | mulaw | 8000 | Telephone recordings, common in North America and Japan | | G.711 A-law | alaw | 8000 | Telephone recordings, common in Europe | The audio must be mono. `pcm_s16le` is signed 16-bit little-endian PCM. `mulaw` and `alaw` are G.711, one byte per sample. - **WAV files** declare their own format, so there’s nothing else to send. Standard and extensible WAV files both work. - **Raw audio** has no header, so you must tell us its format with `encoding` and `sampleRateHz` (step 5). Without them, the request ends with `protocol_error`. - **Compressed formats,** such as MP3, M4A, Ogg or Opus, aren’t accepted. Convert them first. Each recording can hold up to 60 seconds of audio. It works best when it holds just the caller saying their address. To convert a recording, you can use [FFmpeg](https://ffmpeg.org/): **Shell** ```shellscript ffmpeg -i input.m4a -ac 1 -ar 16000 -c:a pcm_s16le address.wav ``` If your call recordings are stereo, with the caller on one channel, send only the caller’s channel. For example, `-af "pan=mono|c0=c1"` in place of `-ac 1` keeps the right-hand channel. ## 5. Send the recording Send the recording as the body of a `POST` to: **Endpoint** ``` https://voice.swiftcomplete.com/v1/address/recording ``` | Header | Required | Description | | --- | --- | --- | | x-api-key | Yes | Your Swiftcomplete API key. | | Content-Type | No | audio/wav for a WAV file. A body that starts with a WAV header is read as a WAV file whatever its Content-Type. | | Idempotency-Key | No | Identifies this address across retries, for example a UUID: 1 to 128 printable ASCII characters, without spaces. See Retries in step 7. | For example, with [curl](https://curl.se/): **Shell** ```shellscript curl https://voice.swiftcomplete.com/v1/address/recording \ -H "x-api-key: $SWIFTCOMPLETE_API_KEY" \ -H "Content-Type: audio/wav" \ -H "Idempotency-Key: $(uuidgen)" \ --data-binary @address.wav ``` For raw audio, add its format to the query string: **Shell** ```shellscript curl "https://voice.swiftcomplete.com/v1/address/recording?encoding=mulaw&sampleRateHz=8000" \ -H "x-api-key: $SWIFTCOMPLETE_API_KEY" \ -H "Content-Type: application/octet-stream" \ --data-binary @address.ulaw ``` | Query parameter | Required | Description | | --- | --- | --- | | encoding | For raw audio | pcm\_s16le, mulaw or alaw, as in step 4. | | sampleRateHz | For raw audio | 8000, 16000 or 48000, as in step 4. | | channels | No | 1, the default. | | coordinateResolution | No | postcode, the default, or premise for coordinates at the property, for any recording. Any other value is refused with 400 and protocol\_error. See Coordinates in step 6. | | clipToCountry | No | Return only addresses in these countries: comma-separated codes, GB, GG, IM or JE. See Limit the area below. | | clipToCircle | No | Return only addresses within a circle: lat,lng,km, for example 51.520847,-0.195521,1. | | clipToBoundingBox | No | Return only addresses within a box: south\_lat,west\_lng,north\_lat,east\_lng. | | clipToPolygon | No | Return only addresses within a polygon: 4 to 25 lat,lng pairs, the last the same as the first. | | language | No | The language the caller speaks: en-GB, the default, or en for the same. | | mode | No | The level of confidence required to return an address: strict, flexible (the default) or top\_rank. See Choose a mode below. | For a WAV file, we ignore the query string’s format and read the file’s own. We ignore parameters we don’t recognise, so a client that sends extra ones keeps working. The whole recording must arrive within 30 seconds. We recommend a client timeout of 60 seconds after your upload completes. ### Limit the area If you know where the address should be, for example within your delivery area, you can limit the addresses we return with the same clip options as the [what3words AutoSuggest API](https://developer.what3words.com/public-api/docs#autosuggest), in the query string. Commas may be sent as they are or as %2C: **Shell** ```shellscript curl "https://voice.swiftcomplete.com/v1/address/recording?clipToCountry=GB&clipToCircle=51.520847,-0.195521,20" \ -H "x-api-key: $SWIFTCOMPLETE_API_KEY" \ -H "Content-Type: audio/wav" \ --data-binary @address.wav ``` - **Inside means the postcode.** An address is inside an area when its postcode’s location is, so an address near the edge may fall on either side of it. - **Countries are alternatives, options must all hold.** `GB,JE` returns addresses in either country. With `clipToCountry` and `clipToCircle`, an address must be in one of the countries and inside the circle. - **GB is the United Kingdom without the Crown Dependencies.** For Jersey, Guernsey or the Isle of Man, add JE, GG or IM. Use GB, not UK, and GG, not GY. Without `clipToCountry`, all four are included. - **We return only addresses inside the area, in every mode.** We choose the best match among the addresses inside it. If none of them can be returned under your mode and the address we identify is outside it, you receive `not_resolved` with the reason `outside_clip` (step 6). - **Each option can be given once.** An option that can’t be read, a country we don’t cover, or an option given twice is refused with 400 and `invalid_parameter` before any work is done (step 6). `language` is the language the caller speaks. We currently support English as spoken in the UK, `en-GB`, which is the default; `en` means the same. It doesn’t change the address returned or its format. ### Choose a mode `mode` determines the level of confidence required to return an address. The result looks the same in every mode, and every address returned is charged once. | mode | An address is returned when it is | | --- | --- | | strict (most strict) | identified with confidence and the speaker included a locality or postcode that is confidently matched to the rest of the address. | | flexible (default - medium strictness) | identified with confidence, without requiring the strong confidence level for the locality or postcode that is required in strict mode. | | top\_rank (least strict) | the top ranked address that matches what was heard. The best match is returned even when confidence isn’t high; it is still possible to have no result returned (although in almost all cases a result is expected to be returned). | - **Any other value,** or `mode` given twice, is refused with 400 and `invalid_parameter` before any work is done (step 6). - Note: `top_rank` may be helpful when using a narrow clipping area and it is desirable to return results based on partial addresses. For example, in the use case of a local taxi service in a village (which doesn’t contain duplicate street names), a speaker may omit locality and postcode from the address in the belief that they are not required. For any cases for which clipping is not applied or is only applied at country level, flexible or strict modes are strongly recommended. ## 6. Handle the response ### Refused before processing If we can’t accept the request, you receive an HTTP status without a result: | Status | Meaning | What to do | | --- | --- | --- | | 401 | The key is missing or malformed, or Swiftcomplete doesn't recognise it. | Check that the key is copied exactly and sent in x-api-key. | | 403 | Swiftcomplete recognises the key but won't accept it, for example because its free trial has ended or it is restricted to URLs or IP addresses. | Read the description, then check your account or use an unrestricted key. | | 429 | The key already has four requests or streaming connections open, or the service has too many requests waiting to start. | Retry after the number of seconds in Retry-After. | | 503 | The service is temporarily unavailable. | Retry with backoff. | A `401` or `403` for a key in the right format comes with a JSON body from Swiftcomplete that explains why, the same as the Validate API’s: **JSON** ```json { "parameter": "key", "description": "Your credits have expired. Please sign in to your account and purchase credits to continue using the service.", "resolutionExamples": [] } ``` Show or log the `description`. Its wording comes from Swiftcomplete and may change, so don’t match on it. A missing or malformed key gets a `401` with no body. Otherwise, the response body is one of the three results below, as JSON. Read its `type`, and use the HTTP status only to tell success from failure. ### `validation_completed`: an address was found HTTP `200`: **JSON** ```json { "type": "validation_completed", "turnId": "9fb7c1e2-4d0a-4c55-a0f3-2b8e6d1f7a90", "appliedOptions": { "clipToCountry": "GB,GG,IM,JE", "language": "en-GB", "mode": "flexible" }, "response": { "validation": { "result": "match", "resolution": "premise" }, "address": { "singleLine": "65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "line1": "65 Alfred Road", "primaryLocality": "London", "postalCode": "W2 5EU" } }, "associatedRecords": null } } ``` `response` is exactly what the Swiftcomplete Validate API returns for this address, so you can handle it with the same code. - `validation.result` is `match`, `suggestion` or `none`. - `validation.resolution` is the level the address was matched to, for example `premise` or `street`. - `address` holds the formatted address, both on a single line and split into lines. `turnId` identifies this request. Include it if you contact support. `appliedOptions` lists the clip, language and mode options the request used, including the defaults, so you can confirm they were applied. ### Coordinates By default, coordinates are returned at postcode level. To request property-level coordinates, set the `coordinateResolution` query parameter to `premise`. If property-level coordinates are unavailable, postcode coordinates are returned instead. See the [Validate API documentation](https://developer.what3words.com/tutorial/swiftcomplete-validate) for the response format. Each address is charged once, based on the coordinates returned. Premise coordinates are charged at the premise price; postcode coordinates, including when premise coordinates were requested but unavailable, are charged at the standard price. ### `not_resolved`: no address could be identified HTTP `200`: **JSON** ```json {"type":"not_resolved","turnId":"9fb7c1e2-4d0a-4c55-a0f3-2b8e6d1f7a90"} ``` We couldn’t identify an address that your mode returns (see Choose a mode in step 5), so we don’t return a guess. With `top_rank`, this means we found no address at all. Ask the caller again if you can, for example asking them to say the postcode clearly. If you limited the area and we could only identify an address outside it, the result says so, with HTTP `200`, and isn’t charged: **JSON** ```json {"type":"not_resolved","turnId":"9fb7c1e2-4d0a-4c55-a0f3-2b8e6d1f7a90","reason":"outside_clip","appliedOptions":{"clipToCountry":"GB,GG,IM,JE","clipToCircle":"51.520847,-0.195521,20","language":"en-GB","mode":"flexible"}} ``` ### `error`: the request failed **JSON** ```json {"type":"error","turnId":"9fb7c1e2-4d0a-4c55-a0f3-2b8e6d1f7a90","code":"service_busy","retryAfterMs":1000} ``` | HTTP | code | Meaning | What to do | | --- | --- | --- | --- | | 400 | invalid\_audio | The recording isn't in a supported format (step 4) or holds no audio, or the Content-Type says WAV but the body isn't a WAV file. | Check your recording against step 4. | | 400 | protocol\_error | The request couldn't be read, for example raw audio without encoding and sampleRateHz, an invalid Idempotency-Key or query parameter, or an upload that took more than 30 seconds. | Fix your request. | | 400 | invalid\_parameter | A clip, language or mode option couldn't be read or isn't supported, or was given twice. parameter names it and message says why. No work was done. | Fix the option. | | 403 | api\_key\_rejected | Swiftcomplete stopped accepting your key during the request, for example because your credits ran out or your free trial ended. The address isn't returned. | Read the description and check your account. Retrying won't help until it's fixed. | | 413 | utterance\_limit\_exceeded | The recording holds more than 60 seconds of audio, or the request is too large. | Send only the address. | | 422 | no\_speech | We heard no speech. | Ask the caller to say their address again. | | 429 | service\_busy | The service is at capacity, or a request with the same Idempotency-Key is still in progress. This request was not processed. | Retry after retryAfterMs milliseconds. The Retry-After header gives the same wait in seconds. | | 503 or 500 | service\_unavailable | A temporary failure on our side. | Retry once (see below). If it keeps happening, contact us with the turnId and errorRef. | An `api_key_rejected` error also has a `description` from Swiftcomplete, for example: **JSON** ```json {"type":"error","turnId":"9fb7c1e2-4d0a-4c55-a0f3-2b8e6d1f7a90","code":"api_key_rejected","description":"Your free trial has expired. Please sign in to your account and purchase credits to continue using the service."} ``` An `invalid_parameter` error names the option and says what’s wrong, for example: **JSON** ```json {"type":"error","turnId":"9fb7c1e2-4d0a-4c55-a0f3-2b8e6d1f7a90","code":"invalid_parameter","parameter":"clipToPolygon","message":"clipToPolygon must be closed: repeat the first lat,lng pair as the last"} ``` A `service_unavailable` error also has an `errorRef`, such as `"errorRef":"E954"`, which helps our support team find the cause. New values may be added, so don’t write code that depends on particular ones. ## 7. Retries If a network failure or timeout prevents you from receiving a result, retry with the same recording and `Idempotency-Key`. For 120 seconds after a result, the same key returns the original result and `turnId` without reprocessing the audio. Keys for requests that end in an error aren’t retained, so retries are processed again. Retries while the original request is still processing return `service_busy`. Use a new key for each recording. Within the 120-second window, reusing a key returns the original result, even if the audio or valid query parameters have changed. ## 8. Limits | Limit | Value | | --- | --- | | Addresses per request | 1 | | Audio per recording | 60 seconds | | Request size | 5.8 MB, enough for 60 seconds of 48 kHz audio | | Time to upload the recording | 30 seconds | | Simultaneous requests per key | 4, shared with streaming connections. Contact us if you need more. | ## 9. Coverage The API resolves postal addresses in the United Kingdom (GB), Guernsey (GG), the Isle of Man (IM) and Jersey (JE), spoken in English, one address per recording. To check what's supported from your code, send a `GET` with your key in the `x-api-key` header to: - `https://voice.swiftcomplete.com/v1/address/available-countries` - `https://voice.swiftcomplete.com/v1/address/available-languages` **JSON** ```json {"countries":[{"code":"GB","languages":["en-GB"],"name":"United Kingdom"},{"code":"GG","languages":["en-GB"],"name":"Guernsey"},{"code":"IM","languages":["en-GB"],"name":"Isle of Man"},{"code":"JE","languages":["en-GB"],"name":"Jersey"}]} {"languages":[{"code":"en-GB","name":"English (UK)","nativeName":"English (UK)"}]} ``` These requests aren't charged. ## 10. Example code Both examples send a WAV file, retry with the same `Idempotency-Key` after a network failure or a `429`, and print the result. ### Python **Python** ```python """Resolve a recorded UK address with Swiftcomplete. Usage: pip install requests export SWIFTCOMPLETE_API_KEY=your-key python resolve_recording.py address.wav """ import os import sys import time import uuid import requests URL = "https://voice.swiftcomplete.com/v1/address/recording" ATTEMPTS = 3 TIMEOUT_S = (10, 90) # To connect, then for the upload and the result. def post(audio, idempotency_key): return requests.post( URL, data=audio, headers={ "x-api-key": os.environ["SWIFTCOMPLETE_API_KEY"], "Content-Type": "audio/wav", "Idempotency-Key": idempotency_key, }, timeout=TIMEOUT_S, ) def describe(response): try: body = response.json() except ValueError: body = {} if body.get("type") == "validation_completed": result = body["response"] address = (result.get("address") or {}).get("singleLine") return f"{result['validation']['result']}: {address}" if body.get("type") == "not_resolved": return "No address identified; ask the caller again" if body.get("type") == "error": detail = "" if "retryAfterMs" in body: detail += f", retry after {body['retryAfterMs']} ms" if "errorRef" in body: detail += f", ref {body['errorRef']}" if "description" in body: detail += f": {body['description']}" return f"Error: {body['code']}{detail} (turn {body['turnId']})" # Refused before processing, with Swiftcomplete's description when it gave one. description = body.get("description") return f"Refused: HTTP {response.status_code}" + (f": {description}" if description else "") def main(): with open(sys.argv[1], "rb") as file: audio = file.read() idempotency_key = str(uuid.uuid4()) # One key for this address, reused if we retry. for attempt in range(1, ATTEMPTS + 1): try: response = post(audio, idempotency_key) except requests.RequestException as error: print(f"Request failed ({error})") continue if response.status_code == 429 and attempt < ATTEMPTS: time.sleep(float(response.headers.get("Retry-After", 1))) continue print(describe(response)) return sys.exit("No result") if __name__ == "__main__": main() ``` ### Node.js **JavaScript** ```javascript // Resolve a recorded UK address with Swiftcomplete. // // Usage (Node.js 18 or later): // SWIFTCOMPLETE_API_KEY=your-key node resolve-recording.mjs address.wav import { randomUUID } from "node:crypto"; import { readFileSync } from "node:fs"; import { setTimeout as sleep } from "node:timers/promises"; const URL = "https://voice.swiftcomplete.com/v1/address/recording"; const ATTEMPTS = 3; const TIMEOUT_MS = 90000; // For the upload and the result. function post(audio, idempotencyKey) { return fetch(URL, { method: "POST", headers: { "x-api-key": process.env.SWIFTCOMPLETE_API_KEY, "Content-Type": "audio/wav", "Idempotency-Key": idempotencyKey, }, body: audio, signal: AbortSignal.timeout(TIMEOUT_MS), }); } function describe(status, body) { if (body.type === "validation_completed") { const { validation, address } = body.response; return `${validation.result}: ${address?.singleLine}`; } if (body.type === "not_resolved") return "No address identified; ask the caller again"; if (body.type === "error") { const retry = body.retryAfterMs ? `, retry after ${body.retryAfterMs} ms` : ""; const ref = body.errorRef ? `, ref ${body.errorRef}` : ""; const why = body.description ? `: ${body.description}` : ""; return `Error: ${body.code}${retry}${ref}${why} (turn ${body.turnId})`; } // Refused before processing, with Swiftcomplete's description when it gave one. return `Refused: HTTP ${status}${body.description ? `: ${body.description}` : ""}`; } async function resolve(audio) { const idempotencyKey = randomUUID(); // One key for this address, reused if we retry. for (let attempt = 1; attempt <= ATTEMPTS; attempt++) { let response; try { response = await post(audio, idempotencyKey); } catch (error) { console.error(`Request failed (${error.message})`); continue; } const text = await response.text(); if (response.status === 429 && attempt < ATTEMPTS) { await sleep(Number(response.headers.get("retry-after") ?? 1) * 1000); continue; } let body = {}; try { body = JSON.parse(text); } catch { /* no JSON body */ } return describe(response.status, body); } return null; } const result = await resolve(readFileSync(process.argv[2])); if (result) { console.log(result); } else { console.error("No result"); process.exitCode = 1; } ``` ## 11. Best practices - **Ask for the whole address at once,** including the postcode, for example: “Please tell me your full address, including the postcode.” - **Record only the caller’s answer,** on the caller’s channel alone if your recordings have one channel per speaker. - **Send the original audio.** Don’t resample telephone audio up to a higher rate, and don’t compress it on the way. - **Read the address back** to the caller to confirm it when you can. - **If the address isn’t resolved,** ask again if you can, for example asking for the postcode first. - **Keep your API key on your server.** ## 12. Troubleshooting - **`401`:** check that the key is copied exactly and is sent in the `x-api-key` header. - **`403` without a `type`:** read the `description`. Check that your account has credits and that the key has no URL or IP address restrictions. - **`api_key_rejected`:** your key stopped being accepted during the request. Read the `description` and check your account. - **`protocol_error` for raw audio:** check that the query string has `encoding` and `sampleRateHz`, or send a WAV file instead. - **`invalid_parameter`:** read the `message`. Check the option’s format against step 5, and use GB, GG, IM or JE as country codes. - **`invalid_audio`:** check that the recording is mono, in a format and sample rate from step 4, and not compressed. For raw audio, check that the query string matches the audio. - **`utterance_limit_exceeded`:** trim the recording to the caller saying their address. - **Frequent `not_resolved` or `no_speech`:** check that the recording is the caller’s voice at its original sample rate, isn’t clipped or very quiet, and contains the full address. - **Timeouts:** allow 60 seconds after your upload completes. If you need help, contact us at [support@swiftcomplete.com](mailto:support@swiftcomplete.com) and include the `turnId`, and the `errorRef` if you received one. #### How your business might benefit from Swiftcomplete - **Voicemail:** turn an address left in a voicemail into a validated address. - **Recorded calls:** pick up a caller’s address after the call, without listening back. - **Voice messages:** take addresses that customers send as voice notes in your app or messaging channel. - **Deliveries and bookings:** collect a delivery or appointment address recorded over the phone. - **Insurance and claims:** record the address of a property or incident accurately. - **Utilities and telecoms:** check addresses recorded during sign-up, moves and engineer bookings. --- # AI Voice Address Capture: Resolve Spoken Addresses with Swiftcomplete Resolve spoken UK addresses into validated postal addresses using Swiftcomplete’s voice address API over a WebSocket. Topics: SwiftComplete Section: [Postal Addresses via Swiftcomplete](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete.md) > [Voice](https://developer.what3words.com/docs/postal-addresses-via-swiftcomplete/voice.md) Source: https://developer.what3words.com/tutorial/swiftcomplete-ai-voice-address-capture Updated: 2026-11-24 ## 1. Overview Use Swiftcomplete’s streaming address API to resolve a spoken postal address during a live call. It’s designed for voice agents, contact centres and IVR systems. Stream audio for one spoken address over a WebSocket. You receive interim transcripts as the caller speaks. When the caller finishes, send `commit_utterance` to get the final result. If the API identifies an address, the `response` field contains the validated postal address in single-line and multiline formats. The API returns postcode-level coordinates by default, or property-level coordinates if you request them and they’re available. If the API can’t identify the address confidently, it returns a result with `type` set to `not_resolved`. If you already have a recording, use the [recorded address API](https://developer.what3words.com/tutorial/swiftcomplete-ai-voice-capture-recorded-addresses). Both APIs use the same format for the final result. #### See it in action Try the voice demo at [demo.what3words.com](https://demo.what3words.com/). ## 2. How it works 1. Your server opens a WebSocket for one address and sends `start_utterance`. 2. You stream the caller’s audio as it arrives. Transcripts of what we hear come back while the caller speaks. 3. When the caller has finished, you send `commit_utterance`. 4. You receive exactly one result, and the connection closes. Each connection handles one address. To capture another address, or to try again, open a new connection. ## 3. Authentication All requests require an API key passed in the `x-api-key` header. [Get an API key here](https://www.swiftcomplete.com/account/register/) Keep your key on your server. Browsers can’t add custom headers to a WebSocket connection, so always connect from your backend, never from a web page or mobile app. If you capture the caller’s audio in a browser or app, relay it through your server. ## 4. Prepare your audio Send raw mono audio (no file header or container) in one of these formats, at its original sample rate. There’s no need to resample it. | encoding | sampleRateHz | Typical source | | --- | --- | --- | | pcm\_s16le | 48000 | Browser and app microphones | | pcm\_s16le | 16000 | Wideband (HD) voice and many voice AI platforms | | pcm\_s16le | 8000 | Telephone audio decoded to 16-bit PCM | | mulaw | 8000 | Telephone audio (G.711 μ-law), common in North America and Japan | | alaw | 8000 | Telephone audio (G.711 A-law), common in Europe | `pcm_s16le` is signed 16-bit little-endian PCM. `mulaw` and `alaw` are G.711, one byte per sample. Always tell us which format you’re sending, in `start_utterance` (step 6). Send frames of up to four seconds of audio. We recommend 20 ms per frame, for example 160 bytes of 8 kHz `mulaw`, 640 bytes of 16 kHz `pcm_s16le` or 1,920 bytes of 48 kHz `pcm_s16le`. To convert a recording for testing, you can use [FFmpeg](https://ffmpeg.org/): **Shell** ```shellscript ffmpeg -i input.wav -ac 1 -ar 16000 -c:a pcm_s16le address.wav ``` ## 5. Connect Open a WebSocket to: **Endpoint** ``` wss://voice.swiftcomplete.com/v1/address/stream ``` Send your key in the `x-api-key` header: **Header** ```http x-api-key: YOUR_API_KEY ``` You can open the connection before the caller starts speaking, for example while your agent asks for their address. You must send `start_utterance` within 15 seconds of connecting. If we can’t accept the connection, the WebSocket upgrade fails with an HTTP status: | Status | Meaning | What to do | | --- | --- | --- | | 401 | The key is missing or malformed, or Swiftcomplete doesn't recognise it. | Check that the key is copied exactly and sent in x-api-key. | | 403 | Swiftcomplete recognises the key but won't accept it, for example because its free trial has ended or it is restricted to URLs or IP addresses. | Read the description, then check your account or use an unrestricted key. | | 429 | The key already has four connections open, or the service has too many connections waiting to start. | Retry after the number of seconds in Retry-After. | | 503 | The service is temporarily unavailable. | Retry with backoff. | A `401` or `403` for a key in the right format comes with a JSON body from Swiftcomplete that explains why, the same as the Validate API’s: **JSON** ```json { "parameter": "key", "description": "Your credits have expired. Please sign in to your account and purchase credits to continue using the service.", "resolutionExamples": [] } ``` Show or log the `description`. Its wording comes from Swiftcomplete and may change, so don’t match on it. A missing or malformed key gets a `401` with no body. ## 6. Stream the address ### Start Send one `start_utterance` message as JSON text: **JSON** ```json { "type": "start_utterance", "audioFormat": { "encoding": "mulaw", "sampleRateHz": 8000 }, "idempotencyKey": "5f0c2a8e-7d1b-4c3e-9a2f-1b6d8e4c0a7f" } ``` | Field | Type | Required | Description | | --- | --- | --- | --- | | type | string | Yes | "start\_utterance" | | audioFormat | object | Yes | The format you'll send: encoding and sampleRateHz, as in step 4. Without it, the request ends with protocol\_error. | | idempotencyKey | string | No | Identifies this address across retries, for example a UUID: 1 to 128 printable ASCII characters, without spaces. See Retries in step 8. | | coordinateResolution | string | No | "postcode", the default, or "premise" for coordinates at the property. Any other value ends the request with protocol\_error. See Coordinates in step 7. | | clipToCountry | string | No | Return only addresses in these countries: comma-separated ISO 3166-1 alpha-2 codes, GB, GG, IM or JE. See Limit the area below. | | clipToCircle | string | No | Return only addresses within a circle: "lat,lng,km", for example "51.520847,-0.195521,1". | | clipToBoundingBox | string | No | Return only addresses within a box: "south\_lat,west\_lng,north\_lat,east\_lng", for example "51.52,-0.2,51.53,-0.19". | | clipToPolygon | string | No | Return only addresses within a polygon: 4 to 25 "lat,lng" pairs, the last the same as the first. | | language | string | No | The language the caller speaks, as a BCP 47 tag. "en-GB", the default, or "en" for the same. See Language below. | | mode | string | No | The level of confidence required to return an address: "strict", "flexible" (the default) or "top\_rank". See Choose a mode below. | We ignore fields we don’t recognise, so a client that sends extra fields keeps working. ### Limit the area If you know where the address should be, for example within your delivery area, you can limit the addresses we return with the same clip options as the [what3words AutoSuggest API](https://developer.what3words.com/public-api/docs#autosuggest), sent as fields of `start_utterance`: **JSON** ```json { "type": "start_utterance", "audioFormat": { "encoding": "mulaw", "sampleRateHz": 8000 }, "clipToCountry": "GB", "clipToCircle": "51.520847,-0.195521,20" } ``` - **Inside means the postcode.** An address is inside an area when its postcode’s location is, so an address near the edge may fall on either side of it. - **Countries are alternatives, options must all hold.** `"GB,JE"` returns addresses in either country. With `clipToCountry` and `clipToCircle`, an address must be in one of the countries and inside the circle. - **GB is the United Kingdom without the Crown Dependencies.** For Jersey, Guernsey or the Isle of Man, add JE, GG or IM. Use GB, not UK, and GG, not GY. Without `clipToCountry`, all four are included. - **We return only addresses inside the area, in every mode.** We choose the best match among the addresses inside it. If none of them can be returned under your mode and the address we identify is outside it, you receive `not_resolved` with the reason `outside_clip` (step 7). - **Each option can be given once.** An option that can’t be read, a country we don’t cover, or an option given twice ends the request with `invalid_parameter` before any work is done (step 7). ### Language `language` is the language the caller speaks. We currently support English as spoken in the UK, `en-GB`, which is the default; `en` means the same. It doesn’t change the address returned or its format. Other languages are refused with `invalid_parameter`. To see what’s supported, see Coverage (step 10). ### Choose a mode `mode` determines the level of confidence required to return an address. The result looks the same in every mode, and every address returned is charged once. | mode | An address is returned when it is | | --- | --- | | strict (most strict) | identified with confidence and the speaker included a locality or postcode that is confidently matched to the rest of the address. | | flexible (default - medium strictness) | identified with confidence, without requiring the strong confidence level for the locality or postcode that is required in strict mode. | | top\_rank (least strict) | the top ranked address that matches what was heard. The best match is returned even when confidence isn’t high; it is still possible to have no result returned (although in almost all cases a result is expected to be returned). | - **Any other value** ends the request with `invalid_parameter` before any work is done (step 7). - Note: `top_rank` may be helpful when using a narrow clipping area and it is desirable to return results based on partial addresses. For example, in the use case of a local taxi service in a village (which doesn’t contain duplicate street names), a speaker may omit locality and postcode from the address in the belief that they are not required. For any cases for which clipping is not applied or is only applied at country level, flexible or strict modes are strongly recommended. ### Send audio Send the caller’s audio as binary WebSocket messages, in order, as it arrives. Each address can be up to 60 seconds of audio. ### Commit When the caller has finished saying their address, send: **JSON** ```json { "type": "commit_utterance" } ``` Commit as soon as you’re confident the caller has finished, for example when your voice activity detection hears them stop. Callers often pause part-way through an address, for example before the postcode, so don’t commit at the first short pause: anything said after the commit is lost. This matters most on phone audio, where pauses are harder to tell from quiet speech. The result follows the commit. Don’t send any more audio afterwards. ### Transcripts You receive transcripts while the caller speaks: **JSON** ```json {"type":"transcript_interim","transcript":"ten downing"} {"type":"transcript_interim","transcript":"ten downing street"} {"type":"transcript_final","transcript":"ten downing street london"} ``` - Each interim transcript holds everything heard so far and replaces the one before it. - There is at most one final transcript, sent after you commit. Don’t rely on receiving it. - They are raw speech-to-text output, unformatted and possibly with recognition errors. Use them for display, such as live captions or context for your agent, or ignore them. Never use them as the address: the result carries the address. ## 7. Handle the result After you commit, you receive exactly one of these three events, and then the connection closes. We recommend a client timeout of 15 seconds after the commit. ### `validation_completed`: an address was found **JSON** ```json { "type": "validation_completed", "turnId": "9fb7c1e2-4d0a-4c55-a0f3-2b8e6d1f7a90", "appliedOptions": { "clipToCountry": "GB,GG,IM,JE", "language": "en-GB", "mode": "flexible" }, "response": { "validation": { "result": "match", "resolution": "premise" }, "address": { "singleLine": "65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "line1": "65 Alfred Road", "primaryLocality": "London", "postalCode": "W2 5EU" } }, "associatedRecords": null } } ``` `response` is exactly what the Swiftcomplete Validate API returns for this address, so you can handle it with the same code. - `validation.result` is `match`, `suggestion` or `none`. - `validation.resolution` is the level the address was matched to, for example `premise` or `street`. - `address` holds the formatted address, both on a single line and split into lines. `turnId` identifies this request. Include it if you contact support. `appliedOptions` lists the clip, language and mode options the request used, including the defaults, so you can confirm they were applied. ### Coordinates By default, an address’s coordinates are its postcode’s. To ask for coordinates at the property itself, send `coordinateResolution` set to `premise` in `start_utterance`. `response` is still exactly what the Validate API returns when asked for premise coordinates: where Swiftcomplete has no point for the property, the coordinates stay at the postcode. See the [Validate API documentation](https://developer.what3words.com/tutorial/swiftcomplete-validate) for how coordinates are returned. Each address is charged once, after you receive it, at Validate’s price for the coordinates it returns: an address returned with premise coordinates is charged at the premise price, and one with postcode coordinates at the standard price. ### `not_resolved`: no address could be identified **JSON** ```json {"type":"not_resolved","turnId":"9fb7c1e2-4d0a-4c55-a0f3-2b8e6d1f7a90"} ``` We couldn’t identify an address that your mode returns (see Choose a mode in step 6), so we don’t return a guess. With `top_rank`, this means we found no address at all. Ask the caller again on a new connection, for example asking them to say the postcode clearly. If you limited the area and we could only identify an address outside it, the result says so, and isn’t charged: **JSON** ```json {"type":"not_resolved","turnId":"9fb7c1e2-4d0a-4c55-a0f3-2b8e6d1f7a90","reason":"outside_clip","appliedOptions":{"clipToCountry":"GB,GG,IM,JE","clipToCircle":"51.520847,-0.195521,20","language":"en-GB","mode":"flexible"}} ``` Tell the caller you can’t accept that address, rather than asking them to repeat it. ### `error`: the request failed **JSON** ```json {"type":"error","turnId":"9fb7c1e2-4d0a-4c55-a0f3-2b8e6d1f7a90","code":"service_busy","retryAfterMs":1000} ``` | code | Meaning | What to do | | --- | --- | --- | | invalid\_audio | The audio wasn't in the required format, or you committed without sending any. | Check your audio against step 4. | | utterance\_limit\_exceeded | A frame held more than 4 seconds of audio, or the address more than 60 seconds. | Send smaller frames, and capture only the address. | | no\_speech | We heard no speech. | Ask the caller to say their address again. | | protocol\_error | Messages arrived out of order or couldn't be read, for example audio before start\_utterance, a second start\_utterance or an unknown coordinateResolution. | Fix your client. | | invalid\_parameter | A clip, language or mode option couldn't be read or isn't supported, or was given twice. parameter names it and message says why. No work was done. | Fix the option. | | service\_busy | The service is at capacity. No work was done. | Retry after retryAfterMs milliseconds. | | api\_key\_rejected | Swiftcomplete stopped accepting your key during the request, for example because your credits ran out or your free trial ended. The address isn't returned. | Read the description and check your account. Retrying won't help until it's fixed. | | service\_unavailable | A temporary failure on our side. | Retry once (see below). If it keeps happening, contact us with the turnId and errorRef. | An `api_key_rejected` error also has a `description` from Swiftcomplete, for example: **JSON** ```json {"type":"error","turnId":"9fb7c1e2-4d0a-4c55-a0f3-2b8e6d1f7a90","code":"api_key_rejected","description":"Your free trial has expired. Please sign in to your account and purchase credits to continue using the service."} ``` An `invalid_parameter` error names the option and says what’s wrong, for example: **JSON** ```json {"type":"error","turnId":"9fb7c1e2-4d0a-4c55-a0f3-2b8e6d1f7a90","code":"invalid_parameter","parameter":"clipToCountry","message":"UK is not an ISO 3166-1 country code: use GB for England, Scotland, Wales and Northern Ireland. Supported: GB, GG, IM, JE"} ``` A `service_unavailable` error also has an `errorRef`, such as `"errorRef":"E954"`, which helps our support team find the cause. New values may be added, so don’t write code that depends on particular ones. ## 8. Retries If a network failure or timeout prevents you from receiving a result, you can ask the caller to repeat their address or open a new connection and resend the captured audio at its original pace. Use a new `idempotencyKey` if the caller repeats their address, or reuse the original key if resending the same audio. For 120 seconds after a result, the same key returns the original result and `turnId` without reprocessing the audio. Keys for requests that end in an error aren’t retained, so retries are processed again. Retries while the original request is still processing return `service_busy`. Use a new key for each address capture. Within the 120-second window, reusing a key returns the original result, even if the audio or other fields in `start_utterance` have changed. ## 9. Limits | Limit | Value | | --- | --- | | Addresses per connection | 1 | | Time to send start\_utterance after connecting | 15 seconds | | Audio per address | 60 seconds | | Time from start\_utterance to commit\_utterance | 120 seconds | | Frame size | 4 seconds of audio | | Simultaneous connections per key | 4\. Contact us if you need more. | While a request is active, the server sends a WebSocket ping every 20 seconds. Standard WebSocket libraries answer automatically. ## 10. Coverage The API resolves postal addresses in the United Kingdom (GB), Guernsey (GG), the Isle of Man (IM) and Jersey (JE), spoken in English, one address per connection. To check what's supported from your code, send a `GET` with your key in the `x-api-key` header to: - `https://voice.swiftcomplete.com/v1/address/available-countries` - `https://voice.swiftcomplete.com/v1/address/available-languages` **JSON** ```json {"countries":[{"code":"GB","languages":["en-GB"],"name":"United Kingdom"},{"code":"GG","languages":["en-GB"],"name":"Guernsey"},{"code":"IM","languages":["en-GB"],"name":"Isle of Man"},{"code":"JE","languages":["en-GB"],"name":"Jersey"}]} {"languages":[{"code":"en-GB","name":"English (UK)","nativeName":"English (UK)"}]} ``` These requests aren't charged. ## 11. Example code Both examples stream a WAV file at real-time pace, as a live call would, and print the result. The WAV file must be 16-bit mono PCM at 8, 16 or 48 kHz (see step 4). ### Python **Python** ```python """Resolve a spoken UK address from a WAV file with Swiftcomplete. Usage: pip install "websockets>=14" export SWIFTCOMPLETE_API_KEY=your-key python resolve_address.py address.wav """ import asyncio import json import os import sys import uuid import wave import websockets URL = "wss://voice.swiftcomplete.com/v1/address/stream" SAMPLE_RATES = (8_000, 16_000, 48_000) FRAME_MS = 20 RESULT_TIMEOUT_S = 15 def read_pcm(path): with wave.open(path, "rb") as wav: rate = wav.getframerate() if wav.getnchannels() != 1 or wav.getsampwidth() != 2 or rate not in SAMPLE_RATES: sys.exit("The WAV file must be 16-bit mono PCM at 8, 16 or 48 kHz") return wav.readframes(wav.getnframes()), rate async def stream_audio(ws, pcm, rate): """Send the audio at real-time pace, as a live call would, then commit.""" frame_bytes = rate * 2 * FRAME_MS // 1000 # 20 ms of 16-bit mono audio try: for offset in range(0, len(pcm), frame_bytes): await ws.send(pcm[offset:offset + frame_bytes]) await asyncio.sleep(FRAME_MS / 1000) await ws.send(json.dumps({"type": "commit_utterance"})) except websockets.ConnectionClosed: pass # The server ended the request early; its result explains why. async def resolve(pcm, rate): headers = {"x-api-key": os.environ["SWIFTCOMPLETE_API_KEY"]} async with websockets.connect(URL, additional_headers=headers) as ws: await ws.send(json.dumps({ "type": "start_utterance", "idempotencyKey": str(uuid.uuid4()), "audioFormat": {"encoding": "pcm_s16le", "sampleRateHz": rate}, })) sender = asyncio.create_task(stream_audio(ws, pcm, rate)) try: async for message in ws: event = json.loads(message) if event["type"] == "transcript_interim": print("Heard so far:", event["transcript"]) elif event["type"] == "transcript_final": print("Heard:", event["transcript"]) else: return event # The one result; the server then closes the connection. finally: sender.cancel() return None def describe(result): if result is None: return "The connection closed without a result" if result["type"] == "validation_completed": response = result["response"] address = (response.get("address") or {}).get("singleLine") return f"{response['validation']['result']}: {address}" if result["type"] == "not_resolved": return "No address identified; ask the caller again" detail = "" if "retryAfterMs" in result: detail += f", retry after {result['retryAfterMs']} ms" if "errorRef" in result: detail += f", ref {result['errorRef']}" if "description" in result: detail += f": {result['description']}" return f"Error: {result['code']}{detail} (turn {result['turnId']})" def refusal(error): """Why the connection was refused, with Swiftcomplete's description when it gave one.""" try: description = json.loads(error.response.body)["description"] except (TypeError, ValueError, KeyError): description = None status = error.response.status_code return f"Connection refused: HTTP {status}" + (f": {description}" if description else "") def main(): pcm, rate = read_pcm(sys.argv[1]) audio_seconds = len(pcm) / (rate * 2) try: result = asyncio.run(asyncio.wait_for(resolve(pcm, rate), audio_seconds + RESULT_TIMEOUT_S)) except websockets.InvalidStatus as error: sys.exit(refusal(error)) except asyncio.TimeoutError: sys.exit("No result in time") print(describe(result)) if __name__ == "__main__": main() ``` ### Node.js **JavaScript** ```javascript // Resolve a spoken UK address from a WAV file with Swiftcomplete. // // Usage (Node.js 18 or later): // npm install ws // SWIFTCOMPLETE_API_KEY=your-key node resolve-address.mjs address.wav import { randomUUID } from "node:crypto"; import { readFileSync } from "node:fs"; import { setTimeout as sleep } from "node:timers/promises"; import WebSocket from "ws"; const URL = "wss://voice.swiftcomplete.com/v1/address/stream"; const SAMPLE_RATES = [8000, 16000, 48000]; const FRAME_MS = 20; const RESULT_TIMEOUT_MS = 15000; function readPcm(path) { const wav = readFileSync(path); if (wav.toString("ascii", 0, 4) !== "RIFF" || wav.toString("ascii", 8, 12) !== "WAVE") { throw new Error("Not a WAV file"); } let format; for (let offset = 12; offset + 8 <= wav.length; ) { const id = wav.toString("ascii", offset, offset + 4); const size = wav.readUInt32LE(offset + 4); const body = wav.subarray(offset + 8, offset + 8 + size); if (id === "fmt ") { format = { encoding: body.readUInt16LE(0), channels: body.readUInt16LE(2), sampleRate: body.readUInt32LE(4), bits: body.readUInt16LE(14), }; } else if (id === "data") { const ok = format?.encoding === 1 && format.channels === 1 && SAMPLE_RATES.includes(format.sampleRate) && format.bits === 16; if (!ok) throw new Error("The WAV file must be 16-bit mono PCM at 8, 16 or 48 kHz"); return { pcm: body, rate: format.sampleRate }; } offset += 8 + size + (size % 2); } throw new Error("The WAV file has no audio data"); } function describe(result) { if (!result) return "The connection closed without a result"; if (result.type === "validation_completed") { const { validation, address } = result.response; return `${validation.result}: ${address?.singleLine}`; } if (result.type === "not_resolved") return "No address identified; ask the caller again"; const retry = result.retryAfterMs ? `, retry after ${result.retryAfterMs} ms` : ""; const ref = result.errorRef ? `, ref ${result.errorRef}` : ""; const why = result.description ? `: ${result.description}` : ""; return `Error: ${result.code}${retry}${ref}${why} (turn ${result.turnId})`; } const { pcm, rate } = readPcm(process.argv[2]); const frameBytes = (rate * 2 * FRAME_MS) / 1000; // 20 ms of 16-bit mono audio const audioMs = (pcm.length / (rate * 2)) * 1000; const ws = new WebSocket(URL, { headers: { "x-api-key": process.env.SWIFTCOMPLETE_API_KEY } }); const timer = setTimeout(() => ws.terminate(), audioMs + RESULT_TIMEOUT_MS); let result; ws.on("open", async () => { ws.send(JSON.stringify({ type: "start_utterance", idempotencyKey: randomUUID(), audioFormat: { encoding: "pcm_s16le", sampleRateHz: rate }, })); // Send the audio at real-time pace, as a live call would, then commit. for (let offset = 0; offset < pcm.length; offset += frameBytes) { if (ws.readyState !== WebSocket.OPEN) return; // The server ended the request early. ws.send(pcm.subarray(offset, offset + frameBytes)); await sleep(FRAME_MS); } if (ws.readyState === WebSocket.OPEN) ws.send(JSON.stringify({ type: "commit_utterance" })); }); ws.on("message", (data, isBinary) => { if (isBinary) return; const event = JSON.parse(data.toString()); if (event.type === "transcript_interim") console.log("Heard so far:", event.transcript); else if (event.type === "transcript_final") console.log("Heard:", event.transcript); else result = event; // The one result; the server then closes the connection. }); // A refused connection: the HTTP status, with Swiftcomplete's description when it gave one. ws.on("unexpected-response", (_request, response) => { let body = ""; response.on("data", (chunk) => { body += chunk; }); response.on("end", () => { let description; try { description = JSON.parse(body).description; } catch { /* no JSON body */ } console.error(`Connection refused: HTTP ${response.statusCode}${description ? `: ${description}` : ""}`); clearTimeout(timer); process.exit(1); }); }); ws.on("error", (error) => console.error(error.message)); ws.on("close", () => { clearTimeout(timer); console.log(describe(result)); }); ``` ## 12. Best practices - **Ask for the whole address at once,** including the postcode, for example: “Please tell me your full address, including the postcode.” - **Open the connection early,** while your agent is still asking the question, so it’s ready when the caller starts speaking. - **Commit promptly** once the caller has finished. - **Read the address back** to the caller to confirm it when you can. - **If the address isn’t resolved,** ask again on a new connection, for example asking for the postcode first. - **Keep your API key on your server.** ## 13. Troubleshooting - **`401` when connecting:** check that the key is copied exactly and is sent in the `x-api-key` header. - **`403` when connecting:** read the `description`. Check that your account has credits and that the key has no URL or IP address restrictions. - **`api_key_rejected`:** your key stopped being accepted during the request. Read the `description` and check your account. - **`protocol_error` straight after `start_utterance`:** check that you sent `audioFormat`. - **`invalid_parameter`:** read the `message`. Check the option’s format against step 6, and use GB, GG, IM or JE as country codes. - **`invalid_audio`:** check that `audioFormat` matches the audio you send (step 4). Raw audio must have no WAV header. - **Frequent `not_resolved` or `no_speech`:** check that the audio is the caller’s voice at the right sample rate, isn’t clipped or very quiet, and contains the full address. If you need help, contact us at [support@swiftcomplete.com](mailto:support@swiftcomplete.com) and include the `turnId`, and the `errorRef` if you received one. #### How your voice agent might benefit from Swiftcomplete - **Contact centres:** capture a caller’s address without spelling it out letter by letter. - **Voice AI agents:** give your agent a validated address it can confirm and act on. - **IVR systems:** take addresses in self-service flows without an agent. - **Deliveries and bookings:** collect a delivery or appointment address over the phone. - **Insurance and claims:** record the address of a property or incident accurately. - **Utilities and telecoms:** check addresses during sign-up, moves and engineer bookings. --- # MCP Address Validation: Integrate Swiftcomplete with Your AI Agent Learn how to connect your AI agent to Swiftcomplete’s MCP API using OpenAPI, enabling real-time address validation with just an API key and a single endpoint. Topics: .NET, Android, Dart, Flutter, Go, Java, JavaScript, NodeJS, PHP, Python, Ruby, Rust, Swift, 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-address-autocomplete-mcp Updated: 2026-11-27 [Swiftcomplete](https://what3words.com/swiftcomplete/)’s **Model Context Protocol (MCP) server** lets any LLM-powered agent call one endpoint and return a verified, fully-formatted address in milliseconds. This tutorial shows you how to plug it in with just an API key and a couple of lines of code. #### See it in action Watch **Jen** from the what3words team demonstrate how an AI customer service agent uses the Swiftcomplete MCP to instantly validate an address. [Watch this walkthrough on YouTube](https://www.youtube.com/watch?v=FlhekJFJuBI) ## 1. Get a Swiftcomplete API key Create a Swiftcomplete account (or sign in) if you’re already registered. [GET API KEY](https://www.swiftcomplete.com/account/register) ## 2. Access the MCP server The Swiftcomplete MCP base URL is: https://mcp.swiftcomplete.com/sse You can import it into Postman, Swagger UI, or your favourite client for auto-generated docs and test calls. ## 3. Add MCP server to your AI agent You can use the OpenAPI spec directly to integrate the Swiftcomplete MCP endpoint into any AI agent framework that supports OpenAPI tool definitions. **Example request and response** - **********Initialisation (Agent connects to our MCP)********** **Request** `{"jsonrpc": "2.0","id": 1,"method": "server/initialize","params": {}}` **Response** `{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-06-18","serverInfo":{"name":"Swiftcomplete MCP Server","version":"0.1.0"},"capabilities":{"tools":{"listChanged":false}}}}` - ******Tools/List (Agent finds out what our MCP can do)****** ****Request**** `{"jsonrpc": "2.0","id": 2,"method": "tools/list","params": {}}` **Response** ```json { "jsonrpc": "2.0", "id": 2, "result": { "tools": [ { "name": "validate_address_lines", "title": "Validate Address Lines", "description": "Validates and standardises an address provided as structured fields: addressLine1, locality, postalCode, country. Use this when the address is split into fields. If you only have a single free-form string, use validate_full_address instead.", "inputSchema": { "type": "object", "properties": { "key": { "type": "string", "description": "Swiftcomplete API key." }, "company": { "type": "string", "description": "Optional company name (e.g. 'Tesco Ltd')." }, "addressLine1": { "type": "string", "description": "Building and street (e.g. '10 Downing Street')." }, "addressLine2": { "type": "string", "description": "Optional flat/suite/apartment (e.g. 'Flat 2')." }, "city": { "type": "string", "description": "All locality information (e.g. suburb, town, city, district), separated by commas. (e.g. 'Westminster, London')." }, "postalCode": { "type": "string", "description": "Postal/ZIP code (e.g. 'SW1A 1AA')." }, "administrativeArea": { "type": "string", "description": "Optional state/province/county (e.g. 'Nottinghamshire')." }, "country": { "type": "string", "description": "ISO 3166-1 alpha-2 country code (e.g. 'GB')." } }, "required": ["key", "addressLine1", "country"] }, "outputSchema": { "type": "object", "description": "Validation result for a postal address.", "properties": { "nextStep": { "type": "string", "description": "Recommended handling step for the result.", "enum": ["AUTO_ACCEPT", "AUTO_ACCEPT_WITH_CHANGES", "MANUAL_REVIEW", "REJECT"] }, "type": { "type": "string", "description": "Result classification (e.g., 'MATCH' for a valid match, 'NONE' when no match was found)." }, "address": { "type": ["string", "null"], "description": "Standardised, formatted address, split into address lines by newline characters (\\n). Null when not available." }, "latitude": { "type": "number", "description": "Latitude in decimal degrees." }, "longitude": { "type": "number", "description": "Longitude in decimal degrees." }, "coordinateGranularity": { "type": "string", "description": "Coordinate granularity (e.g. 'postcode', 'building')." } }, "required": ["nextStep"] } }, { "name": "validate_full_address", "title": "Validate Full Address", "description": "Validates and standardises a full free-form address string. Use this if you only have a single string (e.g. '10 Downing Street London SW1A'). If your address is already split into structured components, use validate_address_lines instead for more accurate results.", "inputSchema": { "type": "object", "properties": { "key": { "type": "string", "description": "Swiftcomplete API key." }, "address": { "type": "string", "description": "Full address to validate (e.g. '10 Downing Street London SW1A')." }, "country": { "type": "string", "description": "ISO 3166-1 alpha-2 country code (e.g. 'GB')." } }, "required": ["key", "address", "country"] }, "outputSchema": { "type": "object", "description": "Validation result for a postal address.", "properties": { "nextStep": { "type": "string", "description": "Recommended handling step for the result.", "enum": ["AUTO_ACCEPT", "AUTO_ACCEPT_WITH_CHANGES", "MANUAL_REVIEW", "REJECT"] }, "type": { "type": "string", "description": "Result classification (e.g., 'MATCH' for a valid match, 'NONE' when no match was found)." }, "address": { "type": ["string", "null"], "description": "Standardised, formatted address, split into address lines by newline characters (\\n). Null when not available." }, "latitude": { "type": "number", "description": "Latitude in decimal degrees." }, "longitude": { "type": "number", "description": "Longitude in decimal degrees." }, "coordinateGranularity": { "type": "string", "description": "Coordinate granularity (e.g., 'postcode', 'building')." } }, "required": ["nextStep"] } } ] } } ``` - **Tools/Call (Agent picks one of our available tools, and calls it)** **Recommended approach** **Request** (address already split into individual fields) `{"jsonrpc": "2.0","id": 3,"method": "tools/call","params": {"name": "validate_address_lines","arguments": {"key": "Swiftcomplete API key","addressLine1": "10 downing st","city": "london","postalCode": "sw1a","country": "GB"}}}` **Response** ```json { "jsonrpc": "2.0", "id": 3, "result": { "content": [ { "type": "text", "text": "{\"nextStep\":\"AUTO_ACCEPT_WITH_CHANGES\",\"type\":\"MATCH\",\"address\":\"10 Downing Street\\nLONDON\\nSW1A 2AA\\nUnited Kingdom\",\"latitude\":51.491318,\"longitude\":-0.14165,\"coordinateGranularity\":\"postcode\"}" } ], "structuredContent": { "nextStep": "AUTO_ACCEPT_WITH_CHANGES", "type": "MATCH", "address": "10 Downing Street\nLONDON\nSW1A 2AA\nUnited Kingdom", "latitude": 51.491318, "longitude": -0.14165, "coordinateGranularity": "postcode" } } } ``` **Request** (full address on one line) `{"jsonrpc": "2.0","id": 3,"method": "tools/call","params": {"name": "validate_full_address","arguments": {"key": "Swiftcomplete API key","address": "what3words alfred road london","country": "GB"}}}` **Response** ```json { "jsonrpc": "2.0", "id": 3, "result": { "content": [ { "type": "text", "text": "{\"nextStep\":\"AUTO_ACCEPT_WITH_CHANGES\",\"type\":\"MATCH\",\"address\":\"What3words Ltd\\n65 Alfred Road\\nLONDON\\nW2 5EU\\nUnited Kingdom\",\"latitude\":51.521198,\"longitude\":-0.196334,\"coordinateGranularity\":\"postcode\"}" } ], "structuredContent": { "nextStep": "AUTO_ACCEPT_WITH_CHANGES", "type": "MATCH", "address": "What3words Ltd\n65 Alfred Road\nLONDON\nW2 5EU\nUnited Kingdom", "latitude": 51.521198, "longitude": -0.196334, "coordinateGranularity": "postcode" } } } ``` **Response:** Validated address: Great Western Studios 65 Alfred Road LONDON W2 5EU United Kingdom > **Note:** Make sure you replace “`YOUR-SWIFTCOMPLETE-API-KEY`” with your Swiftcomplete API key #### How your AI agent might benefit from Swiftcomplete: - **Customer service assistants:** Ensuring address info in chats is accurate before updating CRMs - **Travel planners:** Validating pick-up/drop-off points for smoother journeys - **e-Commerce agents:** Confirming customer shipping info at checkout in real-time - **Voice-based assistants:** Transcribing and resolving spoken address input into verified location data - **CRM assistants:** Sales and support teams can rely on AI agents to maintain clean, validated address data across customer records - **Personal shopping assistants:** validating delivery addresses to prevent fulfilment issues ![mcp-integration](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/568dff88f41d4fe81a45811fdffc257d9ab761c280c6ee57bc8b4869cce971a1.w1600.webp) > **Note:** To find out more our the benefits of our MCP server, you can [read our blog](https://what3words.com/news/blog/make-sure-your-ai-agent-can-validate-addresses-with-swiftcompletes-mcp-server) and to learn about Swiftcomplete, [visit our webpage](https://what3words.com/swiftcomplete). ## 4. Troubleshooting **Need help, or have any questions?** If your AI agents handle addresses, don’t leave accuracy to chance. Swiftcomplete’s MCP server makes it effortless to deliver reliable, instant validation, all with a single, powerful integration. If you need any help getting started or to learn more about Swiftcomplete and our MCP, reach out to our customer support team at [support@swiftcomplete.com](mailto:support@swiftcomplete.com).