# Enterprise Suite
The Enterprise Suite offers all the functionality of the what3words API and can also be embedded within apps or local infrastructure, offering:
Section: [Enterprise Suite](https://developer.what3words.com/enterprise-suite.md)
Source: https://developer.what3words.com/enterprise-suite
Updated: 2026-11-27
- Offline functionality for under 5MB
- Reduced latency
- Ability to run on your own infrastructure
[Watch the Enterprise Suite video](https://vimeo.com/364830963/e66bdd5a5d)
- [Mobile SDKs](https://developer.what3words.com/enterprise-suite/mobile-offline-sdk): iOS and Android SDKs with offline functionality and reduced latency.
- [C++ and Java SDKs](https://developer.what3words.com/enterprise-suite/cpp-java-sdk): A C++ library optimised for speed and memory, with a Java wrapper.
- [API Server](https://developer.what3words.com/enterprise-suite/api-server): The what3words API as a Docker image, hosted on your own servers.
## Pricing
The API Server and SDKs are charged via annual licence, or on a per-device basis, for example, car, phone or UAV.
## Get started
To find out more or to get started with the Enterprise Suite, get in touch using the form below.
> The enquiry form (first name, last name, email, company, industry and details) is on the web page given as Source above. It has a reCAPTCHA check, so it can only be sent from a browser.
For information on how we will handle your contact details, please refer to our [privacy policy](https://what3words.com/privacy/).
---
# API Server
The API Server contains all the functionality of the what3words API, with the benefit of being hosted on local servers.
Section: [Enterprise Suite](https://developer.what3words.com/enterprise-suite.md)
Source: https://developer.what3words.com/enterprise-suite/api-server
Updated: 2026-11-27
The API Server is provided as a Docker image, providing a quick and simple way of getting up and running and is then accessible from any programming language. The core features are:
- Conversion of 3 word addresses to coordinates
- Conversion of coordinates to 3 word addresses
- Autosuggest
- 60+ languages
The easiest way to get started is to build using our Public API first before switching to the API Server, as this is licensed as part of the Enterprise Suite, for which businesses pay a monthly or annual fee.
[Watch the Enterprise Suite video](https://vimeo.com/364830963/e66bdd5a5d)
## Get started
To find out more or to get started with the Enterprise Suite, get in touch using the form below.
> The enquiry form (first name, last name, email, company, industry and details) is on the web page given as Source above. It has a reCAPTCHA check, so it can only be sent from a browser.
For information on how we will handle your contact details, please refer to our [privacy policy](https://what3words.com/privacy/).
---
# C++ and Java SDKs
The C++ and Java SDKs contain all the functionality of the what3words API, while offering offline functionality and lower latency.
Section: [Enterprise Suite](https://developer.what3words.com/enterprise-suite.md)
Source: https://developer.what3words.com/enterprise-suite/cpp-java-sdk
Updated: 2026-11-27
The C++ library is highly optimised for speed and memory (RAM) footprint while the Java SDK provides a simple Java wrapper for the C++ SDK. Some of the key features:
- Conversion of 3 word addresses to coordinates
- Conversion of coordinates to 3 word addresses
- Autosuggest
- 60+ languages
[Watch the Enterprise Suite video](https://vimeo.com/364830963/e66bdd5a5d)
## Get started
To find out more or to get started with the Enterprise Suite, get in touch using the form below.
> The enquiry form (first name, last name, email, company, industry and details) is on the web page given as Source above. It has a reCAPTCHA check, so it can only be sent from a browser.
For information on how we will handle your contact details, please refer to our [privacy policy](https://what3words.com/privacy/).
---
# Mobile SDKs
The iOS and Android SDKs contain all the functionality of the what3words API, while also offering offline functionality and reduced latency.
Section: [Enterprise Suite](https://developer.what3words.com/enterprise-suite.md)
Source: https://developer.what3words.com/enterprise-suite/mobile-offline-sdk
Updated: 2026-11-27
The code makes use of our C++ code, which is highly optimised for speed and memory (RAM) footprint. Core features:
- Conversion of 3 word addresses to coordinates
- Conversion of coordinates to 3 word addresses
- Autosuggest
- 60+ languages
[Watch the Enterprise Suite video](https://vimeo.com/364830963/e66bdd5a5d)
## Get started
To find out more or to get started with the Enterprise Suite, get in touch using the form below.
> The enquiry form (first name, last name, email, company, industry and details) is on the web page given as Source above. It has a reCAPTCHA check, so it can only be sent from a browser.
For information on how we will handle your contact details, please refer to our [privacy policy](https://what3words.com/privacy/).
---
# Get started with the what3words API
New to what3words? Use our step by step guide to find out how to tailor what3words to your needs.
Section: [Get Started](https://developer.what3words.com/public-api.md)
Source: https://developer.what3words.com/public-api
Updated: 2026-11-27
[Get an API Key](https://accounts.what3words.com/select-plan?referrer=/public-api) · [Speak to the team](https://share.hsforms.com/1XLGKuKLPSBe8uNy5-5fukQ1p3ix)
## what3words API
The what3words API is a fast and simple interface that allows you to convert 3 word addresses to coordinates and vice versa. It features a powerful AutoSuggest function, which can validate user input and limit it to certain geographic areas. We offer a variety of libraries, including Java, JavaScript, Swift, Python, Node.js, PHP and more to make our API easy to integrate for your business.
[Reference docs](https://developer.what3words.com/public-api/docs)
## API wrappers
- [.NET](https://developer.what3words.com/tutorial/dotnet)
- [Android](https://developer.what3words.com/tutorial/android)
- [C++](https://developer.what3words.com/tutorial/cpp)
- [Dart](https://developer.what3words.com/tutorial/dart)
- [Flutter](https://developer.what3words.com/tutorial/flutter)
- [Go](https://developer.what3words.com/tutorial/go)
- [Java](https://developer.what3words.com/tutorial/java)
- [JavaScript](https://developer.what3words.com/tutorial/javascript)
- [Objective-C](https://developer.what3words.com/tutorial/objective-c)
- [PHP](https://developer.what3words.com/tutorial/php)
- [Python](https://developer.what3words.com/tutorial/python)
- [Ruby](https://developer.what3words.com/tutorial/ruby)
- [Rust](https://developer.what3words.com/tutorial/rust)
- [Swift](https://developer.what3words.com/tutorial/swift)
---
# Help & support
View our support pages for answers to common questions. Alternatively, contact us at [support@what3words.com](mailto:support@what3words.com).
Section: [Guidelines & Support](https://developer.what3words.com/docs/guidelines-support.md)
Source: https://developer.what3words.com/support
Updated: 2026-11-27
[Go to support pages](https://support.what3words.com) · [Speak to the team](https://share.hsforms.com/1XLGKuKLPSBe8uNy5-5fukQ1p3ix)
## FAQs
### Does the what3words API provide speech recognition technology?
Our API is designed to work with the speech recognition technology of your current voice supplier. If your voice supplier needs help recognising 3 word addresses, don't hesitate to get in touch.
### Does the what3words API provide online or offline maps, navigation or route optimisation?
The what3words API translates 3 word addresses to GPS coordinates. It does not provide map or routing data.
However, our API does provide a layer that can be used with any mapping software, meaning it can work well as part of your existing mapping, addressing and route optimisation solutions.
### How can I display part of the what3words grid on a map?
The what3words API has a grid-section function (learn more in the [grid section of the API reference](https://developer.what3words.com/public-api/docs#grid-section)). This returns grid lines for the area supplied in GeoJSON format, which can be directly added to a web map or desktop GIS such as QGIS.
To add the what3words grid to a Google Map, read this short tutorial: [Displaying the what3words grid on a Google Map](https://developer.what3words.com/tutorial/displaying-the-what3words-grid-on-a-google-map).
### I have an Excel file of 3 word addresses. How can I add coordinates to them?
Adding coordinates to a spreadsheet is easy using the what3words Excel Add-in. Once installed, you can use a formula to call the API and display a column of coordinates.
To install our Excel Add-in, read our simple tutorial: [Using the what3words for Excel add-in](https://developer.what3words.com/tutorial/using-the-what3words-for-excel-add-on).
### How can I plot a file of 3 word addresses on a map?
Adding a file of 3 word addresses is easy using the what3words ArcGIS Locator. Simply add the Locator to ArcGIS Online or Desktop and then drag and drop onto the map. Read the tutorial, [Plot what3words addresses on ArcGIS Online](https://developer.what3words.com/tutorial/how-to-plot-a-file-of-3-word-addresses-in-arcgis-online), for full details on how to add a CSV to ArcGIS Online.
### What languages does the what3words API support?
The what3words API supports 60+ languages with more being added all the time (see the full, live list of languages [here](https://support.what3words.com/en/articles/1520194)). You can call the what3words API to find out the available languages programmatically using the available-languages function. Learn how in the [API reference](https://developer.what3words.com/public-api/docs#available-languages).
### I'm building a mobile app that uses the what3words API. Do you have any libraries to help me integrate?
We have a range of API wrappers for easy integration into a mobile app. Find out more in the tutorials below:
- [Swift](https://developer.what3words.com/tutorial/swift)
- [Objective-C](https://developer.what3words.com/tutorial/objective-c)
- [Android](https://developer.what3words.com/tutorial/android)
### I'm building a website that uses the what3words API. Do you have any libraries to help me integrate?
Our range of API wrappers make it easy to integrate what3words into any website. Find out how to use them by reading the relevant tutorial:
- [JavaScript and Node.js](https://developer.what3words.com/tutorial/javascript)
- [PHP](https://developer.what3words.com/tutorial/php)
- [Java](https://developer.what3words.com/tutorial/java)
### Do you have guidelines for how to display a 3 word address on my website?
It's easy to add a 3 word address to a website by using the [embed code generator](https://what3words.com/products/embed-code-generator/).
Check out our [UX guidelines](https://developer.what3words.com/tutorial/ux-guidelines).
### Do you have guidelines for how to display 3 word address search results on my website?
For information on how to display search results, read our [UX guidelines](https://developer.what3words.com/tutorial/ux-guidelines).
We recommend displaying the country flag and nearest region to give users context.
### Is it possible to restrict results that appear on my checkout page to only suggest 3 word addresses in my country?
The results are automatically restricted to the delivery country field for all of our ecommerce plugins. For example, if a user selects a delivery country of the United Kingdom, all 3 word addresses suggested will be in the United Kingdom.
### I can't find a plugin to add a checkout page input field to my platform. Can I still add what3words to my checkout page?
As long as your platform allows for customisation of your checkout page, you can add a 3 word address input field to the page. We recommend using our JavaScript Autosuggest Component, which just involves adding a script and an HTML element to the page. Read this quick tutorial to find out more: [Web Search Box](https://developer.what3words.com/tutorial/javascript-autosuggest-component).
### Is it possible for my website / app to open the what3words app at a specific 3 word address?
You can open the what3words app at a specific 3 word address from your app using our Android intents or iOS Custom URL scheme `w3w://show?threewords=index.home.raft`.
For examples of how to do this on Android and in Swift/Objective-C on iOS, read the following tutorial: [Mobile linking to the what3words app](https://developer.what3words.com/tutorial/mobile-linking-to-the-what3words-app).
### Do you have instructions for how to set up the what3words ArcGIS Locator in ArcGIS Desktop and Online?
Adding the what3words ArcGIS Locator to ArcGIS Online is straightforward. Read the following tutorial for step-by-step instructions: [ArcGIS Online set up](https://developer.what3words.com/tutorial/how-to-setup-the-what3words-locator-for-arcgis-online).
### Can I make the what3words ArcGIS Locator available to the whole of my organisation in ArcGIS Online?
You can add the locator as Content in ArcGIS Online and then make it available to your whole organisation as a Utility Service from within the Organization settings. Read the following tutorial for a step-by-step guide: [ArcGIS Online set up](https://developer.what3words.com/tutorial/how-to-setup-the-what3words-locator-for-arcgis-online).
### Is POI data provided with the what3words API?
Our API returns GPS coordinates when a 3 word address is entered. It does not provide additional information about buildings, addresses or points of interest nearby.
### Does the what3words ArcGIS Locator work with the ArcGIS apps?
The what3words ArcGIS Locator works within apps that connect to ArcGIS Online and accept a custom locator. The locator works with Survey123 and can be used to search and discover 3 word addresses, and add them as a survey question.
Read a step-by-step tutorial here: [Survey123](https://developer.what3words.com/tutorial/how-to-setup-the-what3words-locator-for-arcgis-online-and-survey123).
### Is there a QGIS plugin available for the what3words API?
Yes. The QGIS plugin was developed by Planet Federal and is compatible with QGIS 2. It allows for searching and discovering 3 word addresses, and can be downloaded from GitHub and added to QGIS as a plugin. To get started, read the tutorial: [Adding the Planet Federal what3words plugin to QGIS](https://developer.what3words.com/tutorial/adding-the-planet-federal-what3words-plugin-to-qgis).
### I can't find a plugin for my GIS platform. Can I still add the what3words API to my GIS?
There are other third-party plugins available for many GIS tools, for example, FME and Cadcorp: [what3words map tools](https://what3words.com/products/?category=Map%20tools).
Our Python wrapper makes it straightforward to build a new plugin or build a bespoke workflow. Get started by reading our tutorial for the Python wrapper: [Python](https://developer.what3words.com/tutorial/python).
### Can I download a GIS file of 3 word addresses and grid?
Yes. The what3words API has a GeoJSON response parameter (find out more in the [grid section of the API reference](https://developer.what3words.com/public-api/docs#grid-section)). This function returns the grid lines for the area, or the 3 word address supplied in GeoJSON format, which can then be directly added to a web map or desktop GIS such as QGIS. The steps to add to QGIS for a small area are as follows:
1. Put the grid section URL into your internet browser specifying the bounding box and GeoJSON response type
2. Copy the GeoJSON response to a shapefile
3. Load the shapefile into QGIS
### Does the what3words ArcGIS Locator work offline?
The public what3words ArcGIS Locator is available for online applications only. In order to set up an offline version of the Locator you can set up a local version of the Locator alongside our API Server or C++ SDK. Find out more in the [Enterprise Suite](https://developer.what3words.com/enterprise-suite) section.
### Is it possible to use what3words within an offline app?
You can use what3words offline with the what3words mobile SDKs for Android and iOS. For more information see the [Enterprise Suite](https://developer.what3words.com/enterprise-suite) section.
### Is there a guide to how to migrate from what3words API V2 to API V3?
Migrating from what3words API V2 to V3 is straightforward with a simplified interface.
Read our tutorial to learn the differences between versions and how to migrate: [Migrating an application from API V2 to API V3](https://developer.what3words.com/tutorial/migrating-an-application-from-api-v2-to-api-v3).
### Do you have a regular expression for a 3 word address?
We have a RegEx for partial 3 word addresses (to recognise when a 3 word address is being typed) as well as for full 3 word addresses.
To learn more, read our tutorial on the RegEx expression: [Regex](https://developer.what3words.com/tutorial/detecting-if-text-is-in-the-format-of-a-3-word-address).
### Does ArcGIS support China?
Yes. Our ArcGIS locator provides the same response as our API does for a record in China.
You will need to make sure you display the 3 word address in the correct coordinate system that matches your other datasets. If you display the 3 word address on a map, make sure the map is a licensed Chinese map using the correct coordinate system. The standard ArcGIS Online map will work for this purpose.
---
# Tools
Our tools provide an easy way to use the what3words API within other products without needing to do any development.
Source: https://developer.what3words.com/tools
Updated: 2026-11-27
To use what3words with one of our tools, first sign up for a developer account and create an API key. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
[Watch the what3words tools video](https://vimeo.com/1125865557/e66bdd5a5d)
## Tools and resources
- [E-commerce](https://developer.what3words.com/tools/e-commerce): It’s easy to add a 3 word address field to your storefront with one of the what3words e-commerce plugins.
- [Excel Add-in](https://developer.what3words.com/tools/excel-addin): Access the what3words API functionality easily within Microsoft Excel by downloading the what3words Excel Add-in.
- [GIS extensions](https://developer.what3words.com/tools/gis-extension): Display the 3 word address for any location or search for a 3 word address, either individually or via batch conversion to and from GPS coordinates, using what3words GIS extensions.
---
# E-commerce plugins
It’s easy to add a 3 word address field to your online checkout. what3words plugins are available for all major e-commerce platforms.
Source: https://developer.what3words.com/tools/e-commerce
Updated: 2026-11-27
[Watch the what3words e-commerce plugins video](https://vimeo.com/1125865557/e66bdd5a5d)
- [Adobe Commerce (formerly Magento)](https://developer.what3words.com/tools/e-commerce/adobe-commerce)
- [WooCommerce](https://developer.what3words.com/tools/e-commerce/woocommerce)
- [WordPress](https://developer.what3words.com/tools/e-commerce/wordpress)
- [OpenCart](https://developer.what3words.com/tools/e-commerce/opencart)
- [Shopify](https://developer.what3words.com/tools/e-commerce/shopify)
- [AeroCommerce](https://developer.what3words.com/tutorial/installing-the-what3words-aerocommerce-extension)
- [CubeCart](https://developer.what3words.com/tutorial/installing-the-what3words-cubecart-extension)
- [BigCommerce](https://developer.what3words.com/tutorial/installing-the-what3words-bigcommerce-app)
- [Ecwid](https://developer.what3words.com/tutorial/installing-the-what3words-ecwid-app)
- [Haravan](https://developer.what3words.com/tutorial/adding-what3words-field-to-your-haravan-store)
- [Shopware](https://developer.what3words.com/tutorial/installing-the-what3words-shopware-plugin)
- [NopCommerce](https://www.nopcommerce.com/en/what3words-plugin)
- [Wix](https://developer.what3words.com/tutorial/adding-your-what3words-ecwid-app-to-your-wix-site)
- [Swiftcomplete](https://developer.what3words.com/tutorial/adding-swiftcomplete-address-autocomplete-to-ecommerce-checkout)
## E-commerce FAQs
### Is it possible to restrict results that appear on my checkout page to only suggest 3 word addresses in my country?
The results are automatically restricted to the delivery country field for all of our ecommerce plugins. For example, if a user selects a delivery country of the United Kingdom, all 3 word addresses suggested will be in the United Kingdom.
### I can't find a plugin to add a checkout page input field to my platform. Can I still add what3words to my checkout page?
As long as your platform allows for customisation of your checkout page, you can add a 3 word address input field to the page. We recommend using our JavaScript Autosuggest Component, which just involves adding a script and an HTML element to the page. Read this quick tutorial to find out more: [Web Search Box](https://developer.what3words.com/tutorial/javascript-autosuggest-component).
[View all FAQs](https://developer.what3words.com/support)
---
# Installing the Adobe Commerce (formerly Magento 2) extension
Adding and configuring the what3words Adobe Commerce (formerly Magento 2) extension.
Topics: Adobe Commerce (formerly Magento), E-Commerce
Source: https://developer.what3words.com/tools/e-commerce/adobe-commerce
Updated: 2026-11-27
### Step by step
The what3words Adobe Commerce (formerly Magento 2) extension allows you to add a 3 word address field to a checkout page. Store users can then add a 3 word address to orders and are provided 3 word address suggestions as they type. The user can also save 3 word addresses to their account for future use.
**Magento 2 Minimum Supported Version:** 2.3, 2.4, 2.4.4, 2.4.5, 2.4.6
## 1. Get an API Key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Installation
The Adobe Commerce (formerly Magento 2) extension can be installed in 2 ways:
1. Follow this [installation guide](https://experienceleague.adobe.com/docs/commerce-operations/installation-guide/tutorials/extensions.html);
2. Use `Composer` and `Packagist` to ensure that all dependencies are installed along with the extension.
To add the extension to a store using `composer` and `packagist`, first, connect to your server and start the command line interface.
From the CLI run the composer command to install the files and dependencies required by the extension, it will pull the latest release of this plugin from this [what3words GitHub page](https://github.com/what3words/magento2-w3w-plugin/releases)
**PHP**
```php
composer config repositories.what3words git https://github.com/what3words/magento2-w3w-plugin.git
composer require what3words/module-what3words
```
Next, to compile the site to ensure it includes the new extension run the following commands (as with any other Magento module):
**PHP**
```php
php bin/magento deploy:mode:set --skip-compilation production
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy # here set the themes to be compiled and the language
php bin/magento maintenance:enable
php bin/magento setup:upgrade --keep-generated
php bin/magento maintenance:disable
```
We also recommend running `php bin/magento cache:clean` and `php bin/magento cache:flush` to ensure the site cache is cleared.
## 3. Enable module

Select the store settings and a new category `what3words` will be available.
Within the configuration page add the API Key.
We also recommend using a `placeholder` text with an example of the what3words address to demonstrate to users the correct format they should follow to enter their own what3words. For example, `eg. ///filled.count.soap`.
Find out how can you customise your extension in the [**Additional Settings**](https://developer.what3words.com/tutorial/installing-the-magento-2-extension#additional-settings) section below.

A new field will then be available on the site’s checkout page.
## 4. Add to Address template

For the what3words address to appear on invoices, delivery labels, and packaging slips you will need to add the following attributes to the Customer Address Templates:
`w3w` → the chosen 3 words address returned by the address validation and saved in the database;
`w3w_nearest` → the value of the nearest place of the chosen 3 words address saved in the database. This value will be available only if the option *Save nearest place* is set to yes in the settings page of the what3words plugin.
`w3w_coordinates` → the coordinates of the chosen 3 word address saved in the database. This value will be available only if the option *Save coordinates* is set to yes in the settings page of the what3words plugin.
To get to the Customer Address Templates of your Store:
`“Stores” > “Configuration”> “Customers” > “Customer Configuration” > “Address Templates”`
Add the following to each of the templates:
**PHP**
```php
Text:
{{if w3w}}{{var w3w}}{{/if}}
{{if w3w_nearest}}{{var w3w_nearest}}{{/if}}
{{if w3w_coordinates}}{{var w3w_coordinates}}{{/if}}
Text One Line:
{{var w3w}},
{{var w3w_nearest}},
{{var w3w_coordinates}},
HTML:
{{if w3w}}{{var w3w}}{{/if}}
{{if w3w_nearest}}{{var w3w_nearest}}{{/if}}
{{if w3w_coordinates}}{{var w3w_coordinates}}{{/if}}
PDF:
{{if w3w}}{{var w3w}}{{/if}}|
{{if w3w_nearest}}{{var w3w_nearest}}{{/if}}|
{{if w3w_coordinates}}{{var w3w_coordinates}}{{/if}}|
```
## 5. Obtain what3words via Stores API
In Magento, the what3words address attributes are stored in the customers’ shipping addresses of the Magento Customers and Orders REST APIs.
1\. The API request to make to the Magento Customers REST API should be: `GET {{magento_base_url}}/rest/V1/customers/{{customer_id}}`
The API response should be:
**JavaScript**
```javascript
"addresses": [
{
"id": 3,
"customer_id": 4,
...
"custom_attributes":
[
{
"attribute_code": "w3w",
"value": "filled.count.soap"
},
{
"attribute_code": "w3w_coordinates",
"value": "-0.195521 ,51.520847"
},
{
"attribute_code": "w3w_nearest",
"value": "Bayswater, London"
}
]
},
...
]
```
2\. The API request to make to the Magento Orders REST API should be: `GET {{magento_base_url}}/rest/V1/orders?searchCriteria[currentPage]=0`
The API response should be:
**JavaScript**
```javascript
"extension_attributes": {
"shipping_assignments": [
{"shipping": {
"address": {
"address_type": "shipping",
...
"extension_attributes": {
"w3w": "///filled.count.soap"
}
},
...
```
## 6. Localising strings
The what3words extension allows you to modify default strings in your custom theme to load and use [translation dictionaries](https://developer.adobe.com/commerce/frontend-core/guide/translations/dictionary#terms). Learn more about locales, modifying strings, and how the application searches and applies translations in this [tutorial page](https://developer.adobe.com/commerce/frontend-core/guide/translations/dictionary).
In case you are using a PWA (progressive app) in Magento. The way to translate the strings of our plugin is mentioned in this [developer guide](https://developer.adobe.com/commerce/pwa-studio/guides/general-concepts/internationalization/).
## 7. Upgrade module
To update or upgrade the what3words module:
1. Download the updated file from [Marketplace](https://marketplace.magento.com/what3words-module-what3words.html) or another extension developer. Take note of the module name and version.
2. Export the contents to your application root directory.
3. Since the Composer package exists for this module, run one of the following.
Update per module name:
**PHP**
```php
composer update what3words/module-what3words
```
Update per version:
**PHP**
```php
composer update what3words/module-what3words ^x.x.x
```
Run the following commands to upgrade, deploy, and clean the cache.
**PHP**
```php
bin/magento setup:upgrade --keep-generated
bin/magento setup:static-content:deploy
bin/magento cache:clean
```
## 8. Uninstall
In case you wish to uninstall the what3words Magento plugin that has been installed by composer, you can use the following command:
**PHP**
```php
php bin/magento module:uninstall What3Words_What3Words --remove-data
```
## 9. Troubleshooting
If you are using the Free plan and have enabled the `save coordinates` feature in your plugin settings, you are making convert-to-coordinate requests, which are not supported under the Free plan. You might encounter the following errors:
- You should see an error similar to `Transport error` under the what3words address field at the checkout page.
- In the network panel, look for `Error 402: Payment Required`. The response to this error is:
**JSON**
```json
{
"error": {
"code": "QuotaExceeded",
"message": "Quota Exceeded. Please upgrade your usage plan, or contact support@what3words.com"
}
}
```
We are actively working on updating our plugins to prevent this error by disabling the `save coordinates` feature when the API key is registered under a Free plan.
For more information, visit our [API plans page](https://accounts.what3words.com/select-plan). If you need further assistance, contact [support@what3words.com](mailto:support@what3words.com).
## 10. Additional settings
### Saving coordinates
If you need to capture the coordinates for a three word address to help with delivery information, for example, you should check the *Save coordinates* checkbox.
The coordinates will added to your order and visible in your Sales page on Magento.
**Note** this uses an additional what3words API call to convert the what3words address to coordinates. Please ensure the tier you have signed up to covers the amount of usage you intend to do to avoid interruption of service.
### Save nearest place
If you need to capture the nearest place information for a three word address to help with delivery information, for example, you should check the *Save nearest place* checkbox.
The nearest place info will added to your order and visible in your Sales page on Magento.
### Custom Label
You can override the default label for the address field by selecting this option and specifying the placeholder text. We recommend you use the default label value, as it provides your customers with an example of how to use the what3words Address Field.
### Custom Placeholder
You can override the default placeholder for the address field by selecting this option and specifying the placeholder text. We recommend you use the default placeholder value, as it provides your customers with an example of how to use the what3words Address Field.
### Tooltip
In order to provide guidance to the customer, you can display a tooltip explainer and its question mark icon next to the what3words field. This message will be displayed on the tooltip explainer:
> *what3words addresses help our delivery partners find you first time. Find yours at [what3words.com](https://delivery.w3w.co/).*
### Custom Tooltip message
You can override the default Tooltip explainer text that you can see when you click on the question mark icon next to the what3words field.
### Custom Error message
You can override the default Error message when you enter an invalid what3words address in the input field.
### Support of RTL language
You can set the HTML direction of your site using a right-to-left language on the configuration page.
### Restricting search results
We provide a number of options for clipping the autosuggest results, limiting the addresses that can be validated and captured. You can clip suggestions to a number of countries by providing comma separated 2 digit ISO codes for each country you wish to clip to. This will ensure suggestions provided are clipped within the countries specified. You can also clip within a circle, a bounding box or a polygon.
**N.B. – When providing multiple clippings the intersection of each polygon is what forms the suggestions provided when using the what3words Address Field.**
For most checkouts we recommend skipping these options as the clip to country is automatically set when a user selects a country for their billing and/or shipping information as they select a country from the dropdown menu options in the checkout form.
### AutoSuggest Focus
In addition to country clipping, it is also possible to add focus to your what3words address suggestions by selecting the Autosuggest Focus feature. The AutoSuggest Focus feature uses the users’ location as focus for AutoSuggest to provide better suggestions if the store has the users’ location permission.
## 11. Support
**Have any questions?**
We’re here to support you! If you have any questions while using what3words, get in touch with us by writing us an email at [support@what3words.com](mailto:support@what3words.com)
---
# Installing the what3words OpenCart Extension
Adding and configuring the what3words OpenCart plugin.
Topics: OpenCart, E-Commerce
Source: https://developer.what3words.com/tools/e-commerce/opencart
Updated: 2026-11-27
### Step by step
The OpenCart Extension enables you to add a field to your checkout page that can accept 3 word addresses and provide autosuggest results as a user type.
**OpenCart Minimum Supported Version**: > 2.3.x up to 3.0.x, and 3.0.x up to 4.0.x
## 1. Get an API Key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Installation

Add a what3words address field to your checkout page on OpenCart by clicking this button below
[DOWNLOAD](https://www.opencart.com/index.php?route=marketplace/extension/info&extension_id=31868)
Upload the file to your store within the OpenCart admin portal using the Extension Installer.
## 3. Enable plugin

Once installed, go to the admin panel section `Extensions > Extensions`, and from the drop-down select `Modules`, where you should see the `what3words` extension appear. Click on the `Edit` button, then to enable the module you need to change the status of the `what3words` module to `Enabled`.
## 4. Add your API Key

You will need a what3words API key to use this plugin, as it authenticates and interacts with the [what3words API](https://developer.what3words.com/public-api). If you don’t have a what3words API key yet, you can quickly and easily [sign up and register](https://accounts.what3words.com/create-api-key) for one.
Once you have a what3words API key:
1. Enter your API Key into the API key field.
2. Click *Save*
## 5. Check if the field is appearing

A new field should now be appearing on your checkout under Billing and Shipping. When a what3words address is captured in this field, it will be saved alongside your order details and will be visible in order preview and shipping label screens.
## 6. How to obtain the what3words field using Stores API
In OpenCart, the what3words address attributes are stored in the customers’ orders of the OpenCart Orders REST APIs as:
- `shipping_three_word_address`
- `shipping_w3w_coordinatesLng` when the `save coordinates` option is enabled
- `shipping_w3w_coordinatesLat` when the `save coordinates` option is enabled
- `shipping_w3w_nearestPlace` when the `save nearest place` option is enabled
The API request to make to the OpenCart Orders REST API should be: `GET {{your-opencart-site}}/index.php?route=api/order/info&api_token={{api_token}}&order_id={{order_id}}`
The API response should be:
**JavaScript**
```javascript
{
"order": {
"order_id": "3",
...
"shipping_three_word_address": "///filled.count.soap",
"shipping_w3w_coordinatesLng": -0.195521,
"shipping_w3w_coordinatesLat": 51.520847,
"shipping_w3w_nearestPlace": Bayswater, London,
...
"comment": "ship to w3w address ///filled.count.soap",
...
}
```
## 7. Troubleshooting
If you are using the Free plan and have enabled the `save coordinates` feature in your plugin settings, you are making convert-to-coordinate requests, which are not supported under the Free plan. You might encounter the following errors:
- You should see an error message: `Transport error` under the what3words address field at the checkout page.
- In the network panel, look for `Error 402: Payment Required`. The response to this error is:
**JSON**
```json
{
"error": {
"code": "QuotaExceeded",
"message": "Quota Exceeded. Please upgrade your usage plan, or contact support@what3words.com"
}
}
```
We are actively working on updating our plugins to prevent this error by disabling the `save coordinates` feature when the API key is registered under a Free plan.
For more information, visit our [API plans page](https://accounts.what3words.com/select-plan). If you need further assistance, contact [support@what3words.com](mailto:support@what3words.com).
### Additional settings
### Saving coordinates
If you need to capture the coordinates for a three word address to help with delivery information, for example, you should check the *Save coordinates* checkbox.
The coordinates will added to your order and visible in your Sales page on Opencart.
**Note** this uses an additional what3words API call to convert the what3words address to coordinates. Please ensure the tier you have signed up to covers the amount of usage you intend to do to avoid interruption of service.
### Save nearest place
If you need to capture the nearest place information for a three word address to help with delivery information, for example, you should check the *Save nearest place* checkbox.
The nearest place info will added to your order and visible in your Sales page on Opencart.
### Custom Label
You can override the default label for the address field by selecting this option and specifying the placeholder text. We recommend you use the default label value, as it provides your customers with an example of how to use the what3words Address Field.
### Custom Placeholder
You can override the default placeholder for the address field by selecting this option and specifying the placeholder text. We recommend you use the default placeholder value, as it provides your customers with an example of how to use the what3words Address Field.
### Tooltip
In order to provide guidance to the customer, you can display a tooltip explainer and its question mark icon next to the what3words field. This message will be displayed on the tooltip explainer:
> *By entering your 3 word address you make it much easier for our delivery partners to find you first time. To discover your 3 word address, visit [what3words.com](https://delivery.w3w.co/).*
### Restricting search results
We provide a number of options for clipping the autosuggest results, limiting the addresses that can be validated and captured. You can clip suggestions to a number of countries by providing comma separated 2 digit ISO codes for each country you wish to clip to. This will ensure suggestions provided are clipped within the countries specified. You can also clip within a circle, a bounding box or a polygon.
**N.B. – When providing multiple clippings the intersection of each polygon is what forms the suggestions provided when using the what3words Address Field.**
For most checkouts we recommend skipping these options as the clip to country is automatically set when a user selects a country for their billing and/or shipping information as they select a country from the dropdown menu options in the checkout form.
### AutoSuggest Focus
In addition to country clipping, it is also possible to add focus to your what3words address suggestions by selecting the Autosuggest Focus feature. The AutoSuggest Focus feature uses the users’ location as focus for AutoSuggest to provide better suggestions if the store has the users’ location permission.
---
# Adding the what3words Shopify app
Adding and configuring the what3words Shopify Plus and Shopify Basic apps.
Topics: Shopify, E-Commerce
Source: https://developer.what3words.com/tools/e-commerce/shopify
Updated: 2026-11-27
The what3words Shopify app allows a what3words address field to be added to a Shopify store. Customers can then provide a what3words address with orders for faster and more reliable deliveries.
## 1. Add app to your Store
Add a what3words address field to your checkout page on Shopify by clicking this button below
[Install](https://apps.shopify.com/what3words-address-field)
## 2. Select your theme (instructions will show based on theme selected)
### Basic Theme OS 2.0
For a quick walkthrough, please watch [this tutorial](https://youtu.be/VAheKz1ryn8)
### Installation process
1\. Go to the what3words app on the Shopify app store and click on **Install**
2\. From your Shopify admin, go to **Online Store > Themes**
3\. Click **Customize**
4\. Navigate to the **Cart** page
5\. Under **Apps**, select **Add Block > what3words Widget**
6\. Drag the what3words app block so it’s above the checkout button on the Cart page
7\. Click the **I have completed the steps** button to finalise the installation.
**Note:** You can now add the what3words address to your cart drawer page instead of your cart page by following these easy steps:
1\. From your Shopify admin, go to **Online Store > Themes**
2\. Click **… > Edit code**
3\. In the **Templates** directory, click **cart-drawer.liquid**. Find a suitable place in your theme where you want to use the widget and insert the following code shown below. We recommend placing it above the **customer** **note** or **checkout** button:
{% endif %}
### Adding what3words to your order invoice
1. Go to the **Dashboard** of the plugin.
2. From your Shopify admin, go to **Settings > Notifications > Order** confirmation.
3. Find the Liquid variable `{{ shipping_address | format_address }}` that references the shipping address.
4. Insert this code immediately below:
{% if attributes\["what3words address"\] %}
{% endif %}
### Adding what3words to your order invoice
1. Go to the **Dashboard** of the plugin.
2. From your Shopify admin, go to **Settings > Notifications > Order** confirmation.
3. Find the Liquid variable `{{ shipping_address | format_address }}` that references the shipping address.
4. Insert this code immediately below:
{% if attributes\["what3words address"\] %}
what3words address
{{ attributes\["what3words address"\] }}
{% endif %}
### Sharing the what3words address with Order Management Systems
**Note:** This section is for customers that would like to share the what3words address of each order with Order Management Systems.
In Shopify, the what3words address attributes are stored in the customers’ orders of the Shopify Orders REST API as `note_attributes` and also as `note`.
For more information on how endpoints and requests to the Shopify REST ADMIN API, please [follow this guide](https://shopify.dev/api/admin-rest#endpoints).
The API request to make to the Shopify Orders REST API should be: `GET {{your-shopify-site}}/admin/api/2022-07/orders/{{your-order-number}}.json`
The API response should be:
"note": "what3words address: ///filled.count.soap"
"note\_attributes": \[{
"name": "what3words address",
"value": "filled.count.soap"
}\]
Another way to display easily what you can retrieve from the Shopify REST ADMIN API is by going to the `Admin page > Orders > (number of order)` and adding at the end of this path `.json`.
For example: `https://.myshopify.com/admin/orders/4253206970468.json`.
Search for `note` and `note_attributes`, your what3words address will be stored within this parameter.
**Note:** By attaching what3words address to the `note` the store owner can now print shipping labels and packaging slips with the what3words address as a note of the order.

### 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@what3words.com) 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@what3words.com).
---
# Adding what3words field to your Haravan store (Thêm trường what3words vào cửa hàng Haravan)
Adding and configuring the what3words AutoSuggest component to the checkout page of your Haravan store.
(Cách thêm và định cấu hình thành tố Tự động gợi ý vào trang thanh toán của cửa hàng Haravan.)
Topics: Haravan, E-Commerce
Section: [Search Box](https://developer.what3words.com/docs/search-box.md) > [E-commerce plugins](https://developer.what3words.com/docs/search-box/e-commerce-plugins.md)
Source: https://developer.what3words.com/tutorial/adding-what3words-field-to-your-haravan-store
Updated: 2026-11-27
### Tiếng Việt
Hướng dẫn chi tiết cách thêm trường địa chỉ what3words vào trang giỏ hàng của cửa hàng Haravan, giúp khách hàng nhập và xác minh địa chỉ what3words mỗi khi đặt đơn hàng.
Cách dễ nhất để thêm trường địa chỉ what3words vào cửa hàng Haravan là sử dụng thành tố Tự động gợi ý. Thành tố này cho phép người dùng nhập nhanh và đúng địa chỉ what3words trên trang thanh toán bằng cách đưa ra các gợi ý khi người dùng gõ địa chỉ, nhằm đảm bảo giá trị đầu vào là địa chỉ what3words hợp lệ.
**Chú ý:** Phương pháp tích hợp này đã được thử nghiệm trong các giao diện: **Evo watch, Luxe Mode,** và **Fresh Organic Food**.
## 1. yêu cầu
Bạn sẽ cần tạo khóa API miễn phí để bắt đầu. Chọn khóa API what3words để tích hợp Thành phần tự động đề xuất. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Thêm thành tố Tự động gợi ý vào trang Giỏ hàng

1\. Sau khi đăng nhập vào Haravan, chọn mục **Website > Giao diện**
2\. Nhấp vào biểu tượng ba dấu chấm (**…**) **> Chỉnh sửa code**

3\. Mở thư mục **Layouts**
4\. Tìm **file Giao diện chính**. Trong ví dụ này, các file đó được gọi là **theme.liquid** và **en.liquid** (phiên bản tiếng Anh của file giao diện gốc).
5\. Sao chép hai đoạn script sau rồi dán vào giữa tag **** như bên dưới trong **file Giao diện chính**.
**Lưu ý:** Hai đoạn script này sẽ cho phép bạn sử dụng thành tố Tự động gợi ý.
**HTML**
```html
```

6\. Mở thư mục **Snippets**
7\. Nhấp vào **Thêm mới một snippet**
8\. Tạo snippet mới, đặt tên là **w3w-autosuggest**
9\. Sau đó nhấp vào **Thêm**
10\. Một file mới có tên **w3w-autosuggest.liquid** sẽ được tạo trong thư mục **Snippets**
11\. Sao chép code snippet dưới đây rồi dán vào file **w3w-autosuggest.liquid**
**JavaScript**
```javascript
```
**Lưu ý:** Đoạn script này sẽ hiển thị địa chỉ what3words trong:
- thuộc tính **note\_attributes**, xuất hiện ở endpoint của API Đơn hàng tại `https:///cart/update.js`, nhớ thay `` bằng URL cửa hàng của bạn
- và phần **Ghi chú đơn hàng** trên trang đơn hàng cụ thể (sau khi nhấp vào mã đơn hàng).

12\. Mở thư mục **Giao diện**
13\. Mở file **cart.liquid** và **cart.en.liquid** (nếu có phiên bản tiếng Anh của file **cart.liquid**)
14\. Thêm đoạn script sau vào phần dưới cùng của file **cart.liquid** và **cart.en.liquid**
15\. Thay YOUR-API-KEY bằng khóa API what3words của bạn
16\. Nếu trang **Giỏ hàng** của bạn có hai chế độ xem khác nhau dành cho máy tính và thiết bị di động, vui lòng thay `desktopParentSelector` và `mobileParentSelector` bằng selector `.class` hoặc `#id` của code snippet cho máy tính và thiết bị di động tương ứng ở ngay trước nút thanh toán. Nếu bạn chỉ có một chế độ xem duy nhất, bạn có thể dùng chung selector `.class` hoặc `#id` của code snippet cho máy tính hoặc thiết bị di động.
**Lưu ý:** Code snippet này hiển thị trường địa chỉ what3words trên trang Giỏ hàng của cửa hàng.
**Liquid**
```liquid
{% assign apiKey = 'YOUR-API-KEY' %}
{% assign desktopParentSelector = 'REPLACE WITH YOUR CLASS OR ID SELECTORS' %}
{% assign mobileParentSelector = 'REPLACE WITH YOUR CLASS OR SELECTORS' %}
{% include 'w3w-autosuggest' %}
```
Trong ví dụ sau, đối với chế độ xem **Máy tính**, hãy dùng lớp `summary-total` làm selector lớp.
Trong giao diện **Luxe Mode**, hai chế độ xem máy tính và thiết bị di động đều giống nhau nên bạn có thể dùng chung một lớp cho cả hai:
`{% assign apiKey = 'YOUR-API-KEY' %}`
`{% assign desktopParentSelector = 'summary-total' %}`
`{% assign mobileParentSelector = 'summary-total' %}`
`{% include 'w3w-autosuggest' %}`


Sau khi khách hàng gửi đơn hàng, địa chỉ what3words sẽ được lưu theo đơn đó, trong phần **Ghi chú đơn hàng** trên trang đơn hàng tương ứng.
Bạn có thể in địa chỉ này cùng với các thông tin khác của đơn hàng hoặc xuất ra cùng với đơn hàng để chuyển cho công ty giao vận.
## 3. Tùy chỉnh cài đặt
Thêm ngôn ngữ dự phòng ưu tiên dưới dạng `setAttribute` vào thành tố Tự động gợi ý như minh họa dưới đây:
**JavaScript**
```javascript
```
Tùy chỉnh placeholder dưới dạng `setAttribute` cho dữ liệu đầu vào, như minh họa dưới đây. Bạn nên dùng **địa chỉ what3words** làm placeholder.
**JavaScript**
```javascript
```
Giới hạn các kết quả gợi ý trong phạm vi một quốc gia hoặc một danh sách quốc gia nhất định được phân tách bằng dấu phẩy. Ví dụ: `clip_to_country="VN"`. Để tìm hiểu các phương án giới hạn khác, vui lòng tham khảo hướng dẫn [tại đây](https://developer.what3words.com/tutorial/javascript-autosuggest-component#component-attributes).
**JavaScript**
```javascript
```
Bên cạnh việc giới hạn quốc gia, bạn cũng có thể cung cấp thêm phạm vi tập trung của kết quả bằng thuộc tính `autosuggest_focus`. Phạm vi này phải được cung cấp dưới dạng kinh độ và vĩ độ, thường là vị trí của người dùng lấy từ chức năng GPS trên thiết bị của họ. Việc cung cấp phạm vi tập trung sẽ đảm bảo rằng những gợi ý hiển thị cho người dùng phù hợp hơn với vị trí của họ.
**JavaScript**
```javascript
```
Bạn có thể ghi đè thông báo lỗi bằng một giá trị tùy chỉnh. Ví dụ: `invalid_address_error_message="Không tìm thấy địa chỉ what3words cho tổ hợp này"`.
**JavaScript**
```javascript
```
## 4. Thêm địa chỉ what3words vào email xác nhận đơn hàng
- Sau khi đăng nhập vào Haravan, truy cập **Cấu hình > Thông báo > Xác nhận đơn hàng**.
- Tìm biến `Liquid {% if requires_shipping and shipping_address %}` gắn với địa chỉ giao hàng.
- Nhập đoạn mã này vào bên dưới địa chỉ giao hàng:
**Liquid**
```liquid
{% if attributes["what3words_address"] != blank %}
what3words address
{{ attributes["what3words_address"] }}
{% endif %}
```
## 5. Thêm trường what3words vào hóa đơn
Sau khi đăng nhập vào Haravan, truy cập **Cấu hình > Thông báo > Gửi hóa đơn đề nghị thanh toán**.
Tìm biến `Liquid {% if requires_shipping and shipping_address %}` gắn với địa chỉ giao hàng.
Nhập đoạn mã này vào bên dưới địa chỉ giao hàng:
**Liquid**
```liquid
{% if attributes["what3words_address"] != blank %}
what3words address
{{ attributes["what3words_address"] }}
{% endif %}
```
## 6. Chia sẻ địa chỉ what3words với Hệ thống quản lý đơn hàng
**Lưu ý**: Phần này dành cho những khách hàng muốn chia sẻ địa chỉ what3words trên từng đơn hàng với Hệ thống quản lý đơn hàng.
Trong Haravan, thuộc tính địa chỉ what3words được lưu trong đơn hàng của khách hàng tại REST API Đơn hàng Haravan bằng `note_attributes`.
Để biết thêm thông tin về các endpoint và yêu cầu gửi tới `Haravan REST ADMIN API`, vui lòng [**tham khảo hướng dẫn này**](https://docs.haravan.com/docs/get-started/overview/). (Chỉ có tiếng Anh).
Cú pháp cho yêu cầu API gửi tới REST API Đơn hàng Haravan là: `GET https://apis.haravan.com/com/orders/{{order_id}}.json`
**Lưu ý**: Thay `order_id` bằng số/mã đơn hàng.
Cú pháp phản hồi API là:
**JSON**
```json
"note_attributes": [{
"name": "what3words_address",
"value": "///filled.count.soap"
}]
```
## 7. Liên hệ hỗ trợ
### Bạn có thắc mắc?
Chúng tôi luôn sẵn lòng hỗ trợ! Nếu bạn có bất kỳ câu hỏi nào liên quan đến việc sử dụng what3words cho Excel, vui lòng liên hệ với chúng tôi qua email [support@what3words.com](mailto:support@what3words.com).
### In English
A step-by-step guide to show you how to add what3words address field to your Haravan store’s cart page, allowing your customers to easily enter and validate a what3words address when placing an order.
The easiest way to add the what3words address field to your Haravan store is to use our AutoSuggest Component. It allows users to quickly and correctly input a what3words address to a form input on the checkout page by providing suggestions as a user types, to ensure the input value is a valid what3words address.
**Note:** This integration has been tested in the themes: **Evo watch****, Luxe Mode**, and **Fresh Organic Food.**
## 1. Requirements
You will need to create a free API key to get started. Choose a what3words API key to integrate the AutoSuggest Component. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Add the AutoSuggest Component to the Cart page

1\. From your Haravan Admin, go to **Website > Themes**
2\. Click on the **…** (3 dots button) **\> Edit Code**

3\. Go to the **Layouts** directory
4\. Search for the **main Theme file.** In this example, the files are called **theme.liquid** and **en.liquid** (the English version of your original theme file).
5\. Copy the following 2 scripts and paste them within the **** tag as shown below in your **main Theme file.**
**Note:** These scripts allow you to use the what3words AutoSuggest Component.
**HTML**
```html
```

6\. Go to the **Snippets** directory
7\. Click on **Add a new snippet**
8\. Create a new snippet called **w3w-autosuggest**
9\. Then click on **Create snippet**
10\. A new file called **w3w-autosuggest.liquid** would be created in the **Snippets** folder
11\. Copy the following code snippet in this file **w3w-autosuggest.liquid**
**JavaScript**
```javascript
```
**Note:** This script allows you to display the what3words address to:
- the **note\_attributes** which is visible in the endpoint of the Orders API at `https:///cart/update.js`, replace the `` with your store URL
- and the **Additional Information** on the Orders Admin page.

12\. Go to the **Templates** directory
13\. Open the **cart.liquid** and **cart.en.liquid** files (if you have an English version of the **cart.liquid** file)
14\. Add the following scripts at the bottom of the **cart.liquid** and **cart.en.liquid** files
15\. Replace `YOUR-API-KEY` to your what3words API key
16\. If you have separate desktop and mobile views for your **Cart** page in your theme please replace the `desktopParentSelector` and the `mobileParentSelector` with the `.class` or `#id` selectors of your desktop and mobile code snippet that sits just before the checkout button. Otherwise, if you only have one view you can apply the same `.class` or `#id`selectors of your desktop or mobile code snippet
**Note:** This code snippet allows you to display the what3words address field in the Cart page of your store.
**Liquid**
```liquid
{% assign apiKey = 'YOUR-API-KEY' %}
{% assign desktopParentSelector = 'REPLACE WITH YOUR CLASS OR ID SELECTORS' %}
{% assign mobileParentSelector = 'REPLACE WITH YOUR CLASS OR SELECTORS' %}
{% include 'w3w-autosuggest' %}
```
In the following example, for the **Desktop** view, use the class `summary-total` as a class selector.
In this theme **Luxe Mode**, the desktop and mobile view are the same so we can use the same class for both:
`{% assign apiKey = 'YOUR-API-KEY' %}`
`{% assign desktopParentSelector = 'summary-total' %}`
`{% assign mobileParentSelector = 'summary-total' %}`
`{% include 'w3w-autosuggest' %}`


After customers submit an order, the what3words address will be saved against an order within the **Additional Information** section of the order page.
This can then be printed on order summaries or exported with orders to pass on to delivery companies.
## 3. Customisable settings
Add preferred fallback language as a `setAttribute` to the AutoSuggest element as shown below:
**JavaScript**
```javascript
```
Customise the placeholder as a `setAttribute` to the input, as shown below. We recommend keeping the placeholder as a **what3words address**.
**JavaScript**
```javascript
```
Restrict suggestions to a given country or comma separated list of countries. Example: `clip_to_country="VN"`. For more clipping options please check this [guide](https://developer.what3words.com/tutorial/javascript-autosuggest-component#component-attributes).
**JavaScript**
```javascript
```
In addition to country clipping, it is also possible to add focus to results using the `autosuggest_focus` attribute. The focus should be supplied as a lat and long, usually the user’s location from the GPS on their device. Supplying focus will ensure that suggestions displayed to the user are biassed to their location.
**JavaScript**
```javascript
```
You can overwrite the error message with a custom value. Example value: `invalid_address_error_message="No valid what3words address found"`.
**JavaScript**
```javascript
```
## 4. Add what3words to your order confirmation email
- From your Haravan admin, go to **Settings > Notifications > Order** **Confirmation**.
- Find the Liquid variable `{% if requires_shipping and shipping_address %}` that references the shipping address.
- Insert this code below the shipping address:
**Liquid**
```liquid
{% if attributes["what3words_address"] != blank %}
what3words address
{{ attributes["what3words_address"] }}
{% endif %}
```
## 5. Add what3words to your order invoice
- From your Haravan admin, go to **Settings > Notifications > Order** **invoice**.
- Find the Liquid variable `{% if requires_shipping and shipping_address %}` that references the shipping address.
- Insert this code below the shipping address:
**Liquid**
```liquid
{% if attributes["what3words_address"] != blank %}
what3words address
{{ attributes["what3words_address"] }}
{% endif %}
```
## 6. Sharing what3words address with Order Management Systems
**Note:** This section is for customers that would like to share the what3words address of each order with Order Management Systems.
In Haravan, the what3words address attributes are stored in the customers’ orders of the Haravan Orders REST API as `note_attributes`.
For more information on endpoints and requests to the Haravan REST ADMIN API, please **[follow this guide](https://docs.haravan.com/docs/get-started/overview/)**.
The API request to make to the Haravan Orders REST API should be: `GET https://apis.haravan.com/com/orders/{{order_id}}.json`
**Note:** Substitute `order_id` with your order number/id
The API response should be:
**JSON**
```json
"note_attributes": [{
"name": "what3words_address",
"value": "///filled.count.soap"
}]
```
## 7. Contact Support
### Have any questions****?
We’re here to support you! If you have any questions while using what3words for Excel, get in touch with us by writing us an email at [support@what3words.com](mailto:support@what3words.com).
---
# Adding what3words to Cadcorp SIS Desktop and Cadcorp SIS WebMap
what3words can be integrated with Cadcorp SIS Desktop and Cadcorp SIS WebMap.
Topics: Cadcorp, GIS
Section: [GIS & Spreadsheet Tools](https://developer.what3words.com/docs/gis-spreadsheet-tools.md)
Source: https://developer.what3words.com/tutorial/adding-what3words-to-cadcorp-sis
Updated: 2026-11-27
what3words can be integrated with Cadcorp SIS Desktop and Cadcorp SIS WebMap.
## Adding what3words to Cadcorp SIS Desktop
SIS Desktop search options support what3words, so users can search a what3words address or click on the map to learn the what3words address for that location.
## 1. Get an API key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Search what3words addresses
1\. In SIS Desktop, you can enable what3words searching by first including it in the `Ribbon.json` file (`C:\Program Files\Cadcorp SIS Desktop 9.1\Options\Desktop`) by adding `“what3words”: true` parameter within a text editor.

2\. Open SIS Desktop and start typing in the Search field to see the included list;

3\. Click `Configure` to enter the API key, and all searches will now include results from what3words;
4\. **Search**: Type the full what3words address, such as `filled.count.soap`, select from the dropdown confirmation, and the map zooms to the 3m square;

5\. **Click-to-identify**: `View ▸ Status Bar ▸ what3words` to see live what3words cursor tracking.

### Advanced Analyst Tools & Bulk Operations
1\. **Bulk geocode**: Use the Geocode Process Operation on a table with a w3w column to create a layer of points created by geocoding the w3w addresses;
2\. **View geometry**: Use Add `Overlay → View Geometry` and select any table containing what3words addresses. This allows users to take, for example, a spreadsheet or database table containing what3words addresses and display the locations in SIS Desktop as a map overlay. Make sure you select what3words as the BLOB configuration format.

## Adding what3words to Cadcorp SIS WebMap
what3words can be integrated with [Cadcorp SIS WebMap](https://www.cadcorp.com/products/web-mapping/cadcorp-sis-webmap/) and accessed via a button on the map’s interface. The user can either click on the map to return the what3words address for that location, or input three words to zoom to the location. When the user types in the first two words and any letter from the third, they’re offered suggestions for the final word.
## 3. Get an API key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 4. Contact Cadcorp
Send the API key to [sales@cadcorp.com.](mailto:sales@cadcorp.com) Your Cadcorp account manager will then contact you to send you terms of use and to arrange for the resource to be added.
## 5. Search what3words addresses
1\. In SIS WebMap Manager, select the what3words configuration section and add an API key. Then, restart SIS WebMap; 2. In SIS WebMap, clicking on the map returns the what3words address for that location. The address can be copied as text;

3\. Typing in the what3words address zooms to the location and places a pin on the map.

## 6. Troubleshooting
If you encounter errors or issues related to convert-to-coordinate, convert-to-3wa and grid-section requests while using the Free plan, please check the network panel for the following error message `Error 402 payment required` and its response, indicating the need to upgrade to a higher plan:
**JSON**
```json
{
"error": {
"code": "QuotaExceeded",
"message": "Quota exceeded or API plan does not have access to this feature. Please change your plan at https://accounts.what3words.com/select-plan, or contact support@what3words.com"
}
}
```
For more information, visit our [API plans page](https://accounts.what3words.com/select-plan). If you need further assistance, contact [support@what3words.com](mailto:support@what3words.com).
---
# Adding what3words to e-commerce checkout
The tutorial explains how e-commerce businesses can integrate what3words to enhance delivery accuracy and reduce costs by allowing customers to specify precise locations at checkout.
Topics: Adobe Commerce (formerly Magento), BigCommerce, Ecwid, Haravan, OpenCart, Shopify, Shopware 6, SwiftComplete, Wix, WooCommerce, WordPress, E-Commerce
Section: [Search Box](https://developer.what3words.com/docs/search-box.md) > [E-commerce plugins](https://developer.what3words.com/docs/search-box/e-commerce-plugins.md)
Source: https://developer.what3words.com/tutorial/adding-what3words-to-e-commerce-checkout
Updated: 2026-11-27
Every checkout experience differs, so we’ve created three ways to integrate what3words into your checkout pages. This tutorial explains how e-commerce businesses can integrate what3words at checkout to enhance delivery accuracy.
[Watch this walkthrough on YouTube](https://www.youtube.com/watch?v=Up2v77LujeY)
## Why use what3words for e-commerce?
A quarter of street addresses don’t lead to a front door. When orders don’t reach customers, time is wasted dealing with extra delivery admin and delays also affect customer satisfaction.
E-commerce businesses can offer customers the option to share a precise what3words address at checkout, alongside their traditional address information. This gives customers more confidence in placing their order, knowing it will arrive in exactly the right place.
By making it easy for your customers to enter an exact delivery location at checkout, you’ll be able to reduce lost parcels, improve customer experience and avoid delivery admin – therefore reducing the costs associated with failed deliveries.
## How do I start using what3words? (2 Steps)
## 1. Capture what3words address at checkout
There are three ways you can capture what3words addresses at checkout. Which is best for you depends on your site architecture. It is also possible to capture what3words addresses in multiple locations e.g. a Dedicated Field and Delivery Notes.
**Please choose your option below:**
### Option 1 - Dedicated field

### Add a dedicated field to your checkout page
This integration adds a dedicated what3words address field to your checkout, alongside the traditional address information you already collect. The field is entirely optional, so customers can choose to fill it in or leave it blank. This field can be added via a plugin or a what3words component.
For instructions on how to add the dedicated field to your checkout, please choose the appropriate option below.
### If you use an e-commerce platform...
#### Solution: Use a what3words plugin for your platform
Convenient what3words plugins are available for many popular e-commerce platforms. See this guide:
- [E-commerce Plugins](https://developer.what3words.com/tools/e-commerce)
If you cannot find your e-commerce platform, please get in touch with us at [technology.partnerships@what3words.com](mailto:technology.partnerships@what3words.com) and our solutions team will explore options with you.
[

](https://developer.what3words.com/tools/e-commerce/shopify)
[

](https://developer.what3words.com/tutorial/installing-the-what3words-bigcommerce-app)
[

](https://developer.what3words.com/tutorial/installing-the-woocommerce-plugin)
[

](https://developer.what3words.com/tutorial/installing-the-what3words-cubecart-extension/)
[

](https://developer.what3words.com/tutorial/installing-the-magento-2-extension/)
[

](https://developer.what3words.com/tutorial/adding-the-what3words-shopify-app/)
[

](https://what3wordsnotion.notion.site/nopCommerce-Integration-ab7a1f21923b4a5f83e9a8160f74d4db)
[

](https://developer.what3words.com/tutorial/installing-the-what3words-ecwid-app)
[

](https://developer.what3words.com/tutorial/installing-the-what3words-opencart-plugin/)
[

](https://developer.what3words.com/tutorial/adding-your-what3words-ecwid-app-to-your-wix-site)
[

](https://developer.what3words.com/tutorial/installing-the-what3words-shopware-plugin)
[

](https://what3wordsnotion.notion.site/Experian-what3words-Integration-Guide-374fbc6522be440ba84ff333feaaeb54)
[

](https://what3wordsnotion.notion.site/Data8-Integration-Guide-e81f57b4314840f9b70d40d0197b01cd)
[

](https://developers.woosmap.com/products/w3w-api/how-to/what3words-to-address/)
[

](https://developer.what3words.com/tutorial/installing-the-what3words-aerocommerce-extension)
[

](https://developer.what3words.com/tools/e-commerce/wordpress)
[

](https://www.swiftcomplete.com/places/what3words/)
### If your e-commerce site is bespoke/self-built...
#### Solution: Implement the what3words component
A what3words component comprises a full what3words entry field, complete with AutoSuggest for validation. The components are fully localised and the style is easy to customise, enabling a native appearance within your existing checkout.
- [what3words JavaScript Component](https://developer.what3words.com/tutorial/javascript-autosuggest-component)
### Option 2 - Address Validation

### Upgrade your address validation field on your checkout page
This integration upgrades your existing address validation field to accept what3words. what3words can be switched on in compatible address validation software including:
[](https://what3wordsnotion.notion.site/Experian-what3words-Integration-Guide-374fbc6522be440ba84ff333feaaeb54?pvs=4)  [](https://developer.what3words.com/tutorial/adding-swiftcomplete-address-autocomplete-to-ecommerce-checkout) [](https://what3wordsnotion.notion.site/Data8-Integration-Guide-e81f57b4314840f9b70d40d0197b01cd) [](https://what3wordsnotion.notion.site/AFD-what3words-Integration-Guide-7d9ed120a8b54b86a91e759368813971?pvs=4)
If you use address validation on your checkout page, please contact us at t[echnology.partnerships@what3words.com](mailto:echnology.partnerships@what3words.com) and our solutions team can explore options with you.
### Option 3 - Delivery Notes

### Upgrade your delivery notes to accept what3words addresses
This integration upgrades your existing delivery notes free text box, enabling it to detect and validate a what3words address. As normal, customers can enter any extra delivery details as free text but if they start typing a what3words address this is automatically detected and Autosuggest is triggered to help them quickly enter and validate the what3words address. This means what3words addresses ingested from the free text field are pre-validated for onward use by couriers.
To upgrade your delivery notes field to accept what3words address, you can read our Notes component tutorial linked below:
- [what3words Notes component tutorial](https://developer.what3words.com/tutorial/using-the-notes-component)
## 2. Pass on what3words address for deliveries
Now that you’re able to capture what3words addresses on your checkout page, the next step is to ensure these what3words addresses are passed onto your carrier or delivery drivers.
### 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, click the link below and select the e-commerce platform you use.
- [Logistics software integration guide](https://docs.google.com/document/d/15H1S-yWY9witpffrecySE7UEK6huVZD-OQ_D7Flpl2w/edit?usp=sharing)
- **Bespoke/Self-built e-commerce sites:** See the following guide, which describes how you can use what3words API wrapper functions such as “**IsPossible3wa**”, “**FindPossible3wa**”, “**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 it and pass it 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 what3words addresses to be sent, 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).
---
# Adding your what3words Ecwid app to your Wix site
Adding your what3words Ecwid app to your Wix site.
Topics: Ecwid, Wix, E-Commerce
Section: [Search Box](https://developer.what3words.com/docs/search-box.md) > [E-commerce plugins](https://developer.what3words.com/docs/search-box/e-commerce-plugins.md)
Source: https://developer.what3words.com/tutorial/adding-your-what3words-ecwid-app-to-your-wix-site
Updated: 2026-11-27
### Step by step
If you have already an Ecwid store and you have installed the [what3words Ecwid app](https://developer.what3words.com/tutorial/installing-the-what3words-ecwid-app), you can now add your Ecwid store to a Wix website following just a few easy steps.
The what3words Ecwid app adds a what3words address field to your store’s checkout page allowing your customers to easily enter and validate a what3words address when placing an order.
## 1. Requirements
To add the Ecwid store to your Wix site, you will need to:
1. Have already an [Ecwid Store](https://my.ecwid.com/cp/) and the [what3words Ecwid app](https://www.ecwid.com/apps/featured/what3words) installed;
2. Log in to your [Wix account;](https://www.wix.com)
3. Add the [Ecwid App](https://www.wix.com/app-market/online-store) (also called Online Store) to your Wix site.
## 2. Adding the Ecwid app

1. Log in to your Wix account;
2. Select the site you would like to add a store to;
3. Open [Ecwid App](https://www.wix.com/app-market/online-store). Otherwise, you can find it manually as shown here;
4. Click **Edit site;**
5. Click **Add Apps** on the sidebar;
6. Type “Ecwid” in the search bar, then click on **Online Store** by Ecwid;
7. Click **Add to Site** → **Agree and Add;**
8. Next, you will prompt to head over to the Editor or manage the store from the Dashboard, click **Go to Dashboard**;
9. Then log in to your Ecwid account. Click on **I already have an Ecwid account** link;
10. Click **Connect**. It will Connect your Ecwid store to your Wix site;
11. Grant the app permissions by clicking **Accept**.

That’s it! Your Ecwid store is now connected to your Wix website.
And if you have already installed the [what3words Ecwid app](https://developer.what3words.com/tutorial/installing-the-what3words-ecwid-app#requirements) you will see it within your Ecwid **Apps → My Apps**.

Make sure you can see your Ecwid store on your Wix site.
Go to your Wix site and check if you can see a new menu item, **Online Store** added to your menu bar.
The Online Store is your Ecwid Store displayed on your Wix site.
## 3. Check if the what3words is appearing

*checkout page*
If you have installed the what3words Ecwid app to your Ecwid store correctly a what3words address field should be appearing on your checkout under the shipping address.
When a what3words address is captured in this field, it will be saved alongside your order details and will be visible on the order preview and shipping label screens.
---
# Android
Getting started with the what3words Android API wrapper.
Topics: Android, Mobile App, Server and Scripting
Section: [API & SDK Reference](https://developer.what3words.com/docs/api-sdk-reference.md) > [API Wrappers](https://developer.what3words.com/docs/api-sdk-reference/api-wrappers.md)
Source: https://developer.what3words.com/tutorial/android
Updated: 2026-11-27
### Step by step
> #### If you are migrating from version 3.x of the Android API Wrapper library, please refer to the [Migration Guide from Version 3.x to 4.x](https://developer.what3words.com/tutorial/migrating-android-api-wrapper-from-version-3-x-to-4-x) for detailed instructions.
The Android API wrapper helps developers easily integrate the [what3words API](https://docs.what3words.com/api/v3/) into their Android applications, avoiding the complexity of managing low-level API calls.
The what3words API allows conversion between what3words addresses (e.g., ///index.home.raft) and coordinates (e.g., -0.203586, 51.521251). It features powerful autosuggest functions to validate and autocorrect user input, restrict suggestions to specific areas, request sections of the what3words grid as GeoJSON, and list all supported languages. Advanced users can also post-process voice output with autosuggest.
All coordinates are in latitude, longitude pairs using the WGS-84 standard, with latitudes ranging from -90 to 90.
Full sample app for the wrapper can be found in our Github repo
[Android Sample Apps](https://github.com/what3words/w3w-android-samples)
## 1. Get an API Key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Installation
The library is available through [Maven Central](https://search.maven.org/search?q=g:com.what3words). Please add the following to your `gradle.build:`
**Android**
```java
android {
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
mavenCentral()
}
dependencies {
implementation("com.what3words:w3w-android-wrapper:$latest_version")
}
```
## 3. Setup
#### Android Manifest
Add to `AndroidManifest.xml`:
**Android**
```java
```
## 4. Usage
This step-by-step guide demonstrates the usage of the new Android API Wrapper library using Kotlin Coroutines. For a cleaner architecture or a Java example, refer to the [sample app](https://github.com/what3words/w3w-android-samples/tree/main/wrappers-sample).
We’ve restructured What3WordsV3 into two distinct classes, each serving specific functions:
1. **W3WApiTextDataSource**: Handles text-based tasks like address searching and conversions.
2. **W3WApiVoiceDataSource**: Specialises in voice-based address suggestions.
## 5. W3WApiTextDataSource
The `W3WApiTextDataSource` class facilitates the conversion of coordinates to what3words addresses and vice versa, as well as providing suggestions for slightly incomplete what3words addresses.
Create an instance of W3WApiTextDataSource via the factory method:
**Android**
```kotlin
val textDataSource = W3WApiTextDataSource.create(context, "YOUR_API_KEY")
```
If you are running your own Enterprise Suite API Server, specify the URL to your server:
**Android**
```kotlin
val textDataSource = W3WApiTextDataSource.create(context, "YOUR_API_KEY", "YOUR_SERVER_ENPOINT")
```
### Convert Coordinates to what3words Address
This function converts coordinates (expressed as latitude and longitude) to a what3words address.
More information about `convertTo3wa`, including returned results, is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#convert-to-3wa).
Find the words for (lat:`51.222011`, long: `0.152311`):
**Android**
```kotlin
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
...
val coordinates = W3WCoordinates("51.222011", "0.152311")
val language = W3WRFC5646Language.EN_GB
CoroutineScope(Dispatchers.IO).launch {
// Run to convert method in Dispatchers.IO
val result = textDataSource.convertTo3wa(coordinates, language)
//Switch to Dispatcher.Main to update your views with the results if needed
withContext(Dispatchers.Main) {
when (result) {
is W3WResult.Failure -> {
Log.e("MainActivity", "Error: ${result.message}")
}
is W3WResult.Success -> {
Log.d("MainActivity", "what3words address: ${result.value.address}")
}
}
}
}
}
}
```
### Convert what3words Address to Coordinates
This function converts a 3 word address to a position, expressed as coordinates of latitude and longitude.
This function takes the words parameter as a string of what3words address e.g.`filled.count.soap`
More information about `convertToCoordinates`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#convert-to-coordinates).
Find the coordinates for `///filled.count.soap`:
**Android**
```kotlin
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
...
val w3wAddress = "filled.count.soap"
CoroutineScope(Dispatchers.IO).launch {
val result = textDataSource.convertToCoordinates(w3wAddress)
withContext(Dispatchers.Main) {
when (result) {
is W3WResult.Failure -> {
Log.e("MainActivity", "Error: ${result.message}")
}
is W3WResult.Success -> {
Log.d("MainActivity", "Coordinates: ${result.value.center.lat}, ${result.value.center.lng}")
}
}
}
}
}
}
```
### AutoSuggest
When presented with a what3words address that may be incorrectly entered, AutoSuggest returns a list of potential correct what3wordsaddresses. It needs the first two words plus at least the first character of the third word to produce suggestions.
This method provides corrections for mis-typed words (including plural vs singular), and words being in the wrong order.
Optionally, clipping can narrow down the possibilities, and limit results to:
- One or more countries
- A geographic area (a circle, box or polygon)
This dramatically improves results, so we recommend that you use clipping if possible.
To improve results even further, set the `focus` to user’s current location. This will make `autosuggest` return results which are closer to the user.
More information about `autosuggest`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#autosuggest).
**Example:** Basic AutoSuggest call
**Android**
```kotlin
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
...
val incompletedW3WAddress = "filled.count.so"
CoroutineScope(Dispatchers.IO).launch {
// Run to auto suggest method in Dispatchers.IO
val result = textDataSource.autosuggest(incompletedW3WAddress)
//Switch to Dispatcher.Main to update your views with the results if needed
withContext(Dispatchers.Main) {
when (result) {
is W3WResult.Failure -> {
Log.e("MainActivity", "Error: ${result.message}")
}
is W3WResult.Success -> {
if (result.value.isNotEmpty()) {
Log.d("MainActivity", "Suggestions: ${result.value.joinToString { it.w3wAddress.address }}")
} else {
Log.d("MainActivity", "No suggestions found")
}
}
}
}
}
}
}
```
### Get Grid Section
Grid Section returns a section of the what3words 3m x 3m grid as a set of horizontal and vertical lines covering the requested area, which can then be drawn onto a map.
The requested box must not exceed 4km from corner to corner, or a `BadBoundingBoxTooBig` error will be returned.
More information about `gridSection`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#grid-section).
Get a grid for (`51.222609, 0.152898`) in the south-west, and (`51.222011, 0.152311`) in the north-east:
**Android**
```kotlin
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
...
CoroutineScope(Dispatchers.IO).launch {
// Run to gridSection method in Dispatchers.IO
val result = w3WApiTextDataSource.gridSection(
W3WRectangle(W3WCoordinates(51.222609, 0.152898), W3WCoordinates(51.222011, 0.152311)))
//Switch to Dispatcher.Main to update your views with the results if needed
withContext(Dispatchers.Main) {
when (result) {
is W3WResult.Failure -> {
Log.e("MainActivity", "Error: ${result.message}")
}
is W3WResult.Success -> {
val gridSection = result.value
// Convert to GeoJSON
val geoJsonString = gridSection.toGeoJSON()
}
}
}
}
}
}
```
### Get Available Languages
This function returns the currently supported languages. It will return the two letter code, and the name of the language both in that language and in English.
More information about `availableLanguages`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#available-languages).
**Android**
```kotlin
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
...
CoroutineScope(Dispatchers.IO).launch {
// Run to availableLanguages method in Dispatchers.IO
val result = textDataSource.availableLanguages()
//Switch to Dispatcher.Main to update your views with the results if needed
withContext(Dispatchers.Main) {
when (result) {
is W3WResult.Failure -> {
Log.e("MainActivity", "Error: ${result.message}")
}
is W3WResult.Success -> {
result.value.forEach {
Log.d("MainActivity", "languageCode: ${it.code} - locale: ${it.locale}")
}
}
}
}
}
}
}
```
## 6. W3WApiVoiceDataSource
The `W3WApiVoiceDataSource` class allows searching for what3words addresses using voice input. Ensure you have a Voice API plan enabled in your account to use this feature.
Create a W3WApiVoiceDataSource Instance:
**Android**
```kotlin
val voiceDataSource = W3WApiVoiceDataSource("YOUR_API_KEY")
```
If you are running your own Enterprise Suite API Server, you can specify the URL to your server:
**Android**
```kotlin
val voiceDataSource = W3WApiVoiceDataSource("YOUR_API_KEY", "YOUR_SERVER_ENDPOINT")
```
Create a W3WMicrophone instance to handle voice recording:
**Android**
```kotlin
val microphone = W3WMicrophone()
```
You can set up callbacks to receive information about the recording progress:
**Android**
```kotlin
microphone.setEventsListener(object : W3WAudioStream.EventsListener {
override fun onVolumeChange(volume: Float) {
}
override fun onError(error: W3WError) {
}
override fun onAudioStreamStateChange(state: W3WAudioStreamState) {
}
})
```
### Perform Voice AutoSuggest
The Voice API AutoSuggest allows the user to say what3words and using speech recognition technology displays what3words address suggestions to the user.
Before enabling Voice AutoSuggest you will need to add a Voice API plan in [your account](https://accounts.what3words.com/billing).
For a full working example with voice and `AUDIO_RECORD` permission, request check our [sample app](https://github.com/what3words/w3w-android-samples/tree/main/wrappers-sample).
**Note:** Please bear in mind that the Android Emulator cannot record audio. Therefore, you will need to test on a real device that can record.
**Android**
```kotlin
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
...
val voiceLanguage = W3WRFC5646Language.EN_GB
CoroutineScope(Dispatchers.IO).launch {
// Perform the Voice AutoSuggest in Dispatchers.IO
voiceDataSource.autosuggest(
microphone,
voiceLanguage,
null, // W3WAutosuggestOptions
null, // onSpeechDetected
) { result ->
//Switch to Dispatcher.Main to update your views with the results if needed
withContext(Dispatchers.IO) {
is W3WResult.Failure -> {
Log.e("MainActivity", "Error: ${result.message}")
}
is W3WResult.Success -> {
if (result.value.isNotEmpty()) {
Log.d("MainActivity", "Suggestions: ${result.value.joinToString { it.w3wAddress.address }}")
} else {
Log.d("MainActivity", "No suggestions found")
}
}
}
}
}
}
}
```
## 7. Using AutosuggestHelper Class
### Add what3words AutoSuggest to an existing text field
Add the API and helper wherever you make your class variables and be sure to use your [API key](https://what3words.com/select-plan):
**Android**
```kotlin
val dataSource = W3WApiTextDataSource.create(context, "YOUR_API_KEY_HERE")
val autosuggestOptions = W3WAutosuggestOptions.Builder().
.focus(...)
.clipToCountry(...)
// others options as well
.build()
val autosuggestHelper = AutosuggestHelper(dataSource).options(autosuggestOptions)
```
Next step is to use a `TextWatcher` (or `doOnTextChanged EditText` extension) and let **AutoSuggestHelper** know about the changed text and add what3words suggestion data to your existing RecyclerView/Adapter. (check sample for complete working example with [custom data model and RecyclerView adapter](https://github.com/what3words/w3w-android-wrapper/blob/master/sample-multi-autosuggest-providers/src/main/java/com/what3words/sample_multi_autosuggest_providers/SuggestionsAdapter.kt) to show different autosuggest sources and [EditText and RecyclerView](https://github.com/what3words/w3w-android-wrapper/blob/master/sample-multi-autosuggest-providers/src/main/java/com/what3words/sample_multi_autosuggest_providers/MainActivity.kt) setup.
**Android**
```java
editText.doOnTextChanged { text, _, _, _ ->
// update options in case of new clippings applying/changing dynamically i.e: Location.
autosuggestHelper.options(autosuggestOptions).update(
text.toString(),
onSuccessListener = { suggestionResults ->
suggestionResults.forEach { suggestion ->
//Add suggestion to existing RecyclerView adapter
list.add(suggestion)
Log.i("MainActivity", suggestion.w3wAddress.address)
}
//notify adapter that there's changes on the data.
adapter.notifyDataSetChanged()
},
onFailureListener = {
//log any errors returned by what3words API.
Log.e("MainActivity", it.message)
}
)
}
```
### Get the full what3words address once the user has selected a row
When user selects a row from the RecyclerView `*autosuggestHelper.selected()*` or `*autosuggestHelper.selectedWithCoordinates()*` should be called to retrieve the full what3words address with or without coordinates.
**Note:** that `selectedWithCoordinates()` will convert the what3words address to a lat/lng which will count against your plan’s quota.
**Android**
```java
autosuggestHelper.selectedWithCoordinates(
query.text.toString(),
selectedSuggestion,
onSuccessListener = { suggestion ->
Log.d("MainActivity", "suggestion selected from what3words: ${suggesstion.w3wAddress.address}, lat=${suggestion.w3wAddress.center?.lat} lng=${suggestion.w3wAddress.center?.lng}")
},
onFailureListener = {
Log.e("MainActivity", it.message)
}
)
```
## 8. RegEx Functions
This section introduces RegEx functions that can assist with checking and finding possible what3words addresses in strings. The three main functions covered are:
- `isPossible3wa` – Match what3words address format;
- `isValid3wa` – Verify a what3words address with the API;
### isPossible3wa
Our API wrapper RegEx function “`isPossible3wa`” can be used used to detect if a text string (like “`filled.count.soap`“) in the format of a what3words address without having to ask the API. This functionality checks if a given string could be a what3words address. It returns **true** if it could be, otherwise **false**.
**Note**: This function checks the text format but not the validity of a what3words address. Use `isValid3wa` to verify validity.
**Android**
```java
com.what3words.javawrapper.What3WordsV3.isPossible3wa("filled.count.soap") returns true
com.what3words.javawrapper.What3WordsV3.isPossible3wa("not a 3wa") returns false
com.what3words.javawrapper.What3WordsV3.isPossible3wa("not.3wa address") returns false
```
### isValid3wa
Our API wrapper RegEx function “`isValid3wa`” can be used to determine if a string is a valid what3words address by checking it against the what3words RegEx filter and verifying it with the what3words API.
**Android**
```kotlin
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
...
CoroutineScope(Dispatchers.IO).launch {
// Run to gridSection method in Dispatchers.IO
val result = w3WApiTextDataSource.isValid3wa("filled.count.soap")
//Switch to Dispatcher.Main to update your views with the results if needed
withContext(Dispatchers.Main) {
when (result) {
is W3WResult.Failure -> {
Log.e("MainActivity", "Error: ${result.message}")
}
is W3WResult.Success -> {
Log.d("MainActivity", "isValid: ${result.value}")
}
}
}
}
}
}
```
## 9. Troubleshooting
If you encounter errors or issues related to convert-to-coordinate, convert-to-3wa and grid-section requests while using the Free plan, please check the network panel for the following error message `Error 402 payment required` and its response, indicating the need to upgrade to a higher plan:
**JSON**
```json
{
"error": {
"code": "QuotaExceeded",
"message": "Quota exceeded or API plan does not have access to this feature. Please change your plan at https://accounts.what3words.com/select-plan, or contact support@what3words.com"
}
}
```
For more information, visit our [API plans page](https://accounts.what3words.com/select-plan). If you need further assistance, contact [support@what3words.com](mailto:support@what3words.com).
---
# Combining the what3words.js AutoSuggest Component with a Google Map
Adding a what3words address to your website with a Google Map.
Topics: JavaScript, Website
Section: [Display Map](https://developer.what3words.com/docs/display-map.md) > [Other Map Types](https://developer.what3words.com/docs/display-map/other-map-types.md)
Source: https://developer.what3words.com/tutorial/combining-the-what3words-js-autosuggest-component-with-a-google-map
Updated: 2026-11-27
### Step by step
The what3words JavaScript API wrapper provides components to make using the what3words API even easier. In this tutorial, we will go through using the autosuggest component in combination with a Google Map. We will add the search field using the component and then respond to its select event to place a pin on the map at the inputted location.
You will also need to sign up for a Google Maps developer account and be able to view other Google Maps tutorials at [https://developers.google.com/maps/documentation/javascript/tutorial](https://developers.google.com/maps/documentation/javascript/tutorial).
We also have tutorials demonstrating its use with both [Mapbox](https://developer.what3words.com/tutorial/combining-the-what3words-js-autosuggest-component-with-a-mapbox-map) and [LeafletJS](https://developer.what3words.com/tutorial/combining-the-what3words-js-autosuggest-component-with-a-leafletjs-map).
## 1. Get API key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Create an HTML page
Define an HTML page to create a map that is the full width and height of the web browser window.
Add HTML and CSS to create a page with a map element. The `#map` is the element that displays the map and its CSS resets any browser settings, so it can take the full width and height of the browser. The `` tag is not required in CodeSandbox. If you are using a different editor or running the page on a local server, be sure to add this tag to the top of your HTML page.
**HTML**
```html
Autosuggest Component (Google Map)
```
## 3. Reference the APIs
In the `` tag, add references to the JS library for the Google Maps API and the JavaScript library for what3words API. You’ll need access to the Google Maps API using your own Google Maps API key.
You can also attach the what3words API to the window, which is accessible via `window.what3words`, and set a callback function for it, using `script` tags like the ones in the following example. Don’t forget to set your what3words API key.
**Note:** We prefer to use a fixed version for the Production version of your integrations. A specific version can also be specified within the script to ensure a predictable version of the component is loaded, for example`@5.0.0`. A log of versions can be found [here.](https://developer.what3words.com/tutorial/javascript-autosuggest-component#versioning)
**HTML**
```html
...
// google js library (replace Google API Key)
// what3words js library
...
...
```
## 4. Loading a map using Google Maps
Now you can place the map on the page, centered at a location of your choosing. The `#map` in the `` tag will render the map.
**JavaScript**
```javascript
```
## 5. Position the component on the map
Determine the position of the component on the map.
**CSS**
```css
```
Tie the component to the styling. Ensure you include `` within the wrapper to display the map.
**HTML**
```html
...
```
In a few lines of code, you can have an input box that will call the what3words AutoSuggest API endpoint.
The `api_key` parameter contains your application’s API key. Replace `YOUR-API-KEY` with your what3words API key to get started.
[Sign up](https://accounts.what3words.com) to obtain your free API key.
**HTML**
```html
```
There are a number of ways you can configure the AutoSuggest component to better suit your use case, including clipping to country and custom validation errors.
For more on the AutoSuggest component see the [what3words Autosuggest JavaScript Component](https://developer.what3words.com/tutorial/javascript-autosuggest-component).
## 6. Listen for the select event
The code snippet below shows how to use an event listener to detect when a user selects a what3words address from the listed suggestions for their input. For debug purposes, it has been added a console log to show how to retrieve the words of the suggestions:
**JavaScript**
```javascript
function initW3w(what3words) {
...
let words;
const autosuggest = document.getElementById("autosuggest");
autosuggest.addEventListener("selected_suggestion", (value) => {
let words = value.detail.suggestion.words;
// console.log(words);
});
...
}
```
## 7. Convert what3words address to coordinates
To convert a what3words address to coordinates, users will need to call the what3words API as shown below. They will need to add this code snippet to the `autosuggest` event listener.
**JavaScript**
```javascript
function initW3w(what3words) {
...
let words;
const autosuggest = document.getElementById("autosuggest");
autosuggest.addEventListener("selected_suggestion", (value) => {
let words = value.detail.suggestion.words;
// what3words api call request
what3words.api
.convertToCoordinates({ words: words, format: "geojson" })
.then(function (response) {
console.log("[convertToCoordinates]", response);
});
});
}
```
## 8. Place a map marker
Now that the coordinates of the what3words address are retrieved from the above call to the what3words API, users can place a simple map marker on the map and centre the map on its location.
**JavaScript**
```javascript
```
## 9. Full Example
The example below takes the concepts described above and turns some of them into a complete example. Here we have an AutoSuggest component place on a map, where we are listening for the select event. We are then using the what3words JavaScript Wrapper’s convert to coordinates functionality to get the coordinates for that address. With those coordinates we then refocus the map and drop a pin on the location selected.
**HTML**
```html
Autosuggest Component (Google Maps)
```
In a few lines of code, you can have an input box that will call the what3words AutoSuggest API endpoint.
The `api_key` parameter contains your application’s API key. Replace `YOUR-API-KEY` with your what3words API key to get started.
[Sign up](https://accounts.what3words.com) to obtain your free API key.
**HTML**
```html
```
There are a number of ways you can configure the AutoSuggest component to better suit your use case, including clipping to country and custom validation errors.
For more on the AutoSuggest component see the [what3words AutoSuggest JavaScript Component](https://developer.what3words.com/tutorial/javascript-autosuggest-component).
## 6. Listen for the select event
On the code snippet below, it is shown how to use an event listener to detect when a user selects a what3words address from the listed suggestions for their input. For debug purposes, it has been added a console log to show how to retrieve the words of the suggestions:
**JavaScript**
```javascript
function initW3w(what3words) {
...
let words;
const autosuggest = document.getElementById("autosuggest");
autosuggest.addEventListener("selected_suggestion", (value) => {
let words = value.detail.suggestion.words;
// console.log(words);
});
...
}
```
## 7. Convert what3words address to coordinates
To convert a what3words address to coordinates, users will need to call the what3words API as shown below. They will need to add this code snippet within the `autosuggest` event listener.
**JavaScript**
```javascript
function initW3w(what3words) {
...
let words;
const autosuggest = document.getElementById("autosuggest");
autosuggest.addEventListener("selected_suggestion", (value) => {
let words = value.detail.suggestion.words;
// what3words api call request
what3words.api
.convertToCoordinates({ words })
.then(function (response) {
console.log("[convertToCoordinates]", response);
});
});
}
```
## 8. Place a map marker
Now we have our coordinates we can place a what3words custom marker for our selected what3words address on our map and focus the map on this location.
**JavaScript**
```javascript
```
## 9. Full example
The example below takes the concepts described in the step by step guide and turns some of them into a complete example. Here we have an AutoSuggest component place on a map, where we are listening for the select event. We are then using the what3words JavaScript Wrapper’s convert to coordinates functionality to get the coordinates for that address. With those coordinates we then refocus the map and drop a pin on the location selected.
**HTML**
```html
Autosuggest Component (Leaflet)
```
---
# Combining the what3words.js AutoSuggest Component with a Mapbox Map
Adding a what3words address to your website with a Mapbox Map.
Topics: JavaScript, Mapbox, Website
Section: [Display Map](https://developer.what3words.com/docs/display-map.md) > [Other Map Types](https://developer.what3words.com/docs/display-map/other-map-types.md)
Source: https://developer.what3words.com/tutorial/combining-the-what3words-js-autosuggest-component-with-a-mapbox-map
Updated: 2026-11-27
### Step by step
The easiest way to add what3words to your technology is to use one of the what3words components. The following tutorial will demonstrate how to integrate the what3words JavaScript component with Mapbox API.
The AutoSuggest Component allows users to quickly and correctly input a what3words address to a form input or search field by providing suggestions as a user types and validation to ensure the input value is a valid what3words address. The component by default uses the what3words API, or can be configured to use a privately hosted instance of the what3words API.
Please refer to this tutorial to get more information on how to use the [what3words JavaScript AutoSuggest Component](https://developer.what3words.com/tutorial/javascript-autosuggest-component).
To access the Mapbox API, users will need to sign up for a Mapbox developer account and create an API key. If you are new to Mapbox API, start with the [MapBox GL JS API documentation](https://docs.mapbox.com/mapbox-gl-js/api/).
We also have tutorials demonstrating its use with both [LeafletJS](https://developer.what3words.com/tutorial/combining-the-what3words-js-autosuggest-component-with-a-leafletjs-map) and [Google Map](https://developer.what3words.com/tutorial/combining-the-what3words-js-autosuggest-component-with-a-google-map).
[Autosuggest Component (Mapbox)](https://codesandbox.io/s/autosuggest-component-mapbox-sdh68) (interactive example)
## 1. Get API key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Create an HTML page
Define an HTML page to create a map that is the full width and height of the web browser window.
Add HTML and CSS to create a page with a map element. The `#map` is the element that displays the map and its CSS resets any browser settings, so it can take the full width and height of the browser. The `` tag is not required in CodeSandbox. If you are using a different editor or running the page on a local server, be sure to add this tag to the top of your HTML page.
**HTML**
```html
Autosuggest Component (Mapbox)
```
## 3. Reference the APIs
In the `` tag, add references to the CSS file and JS library for the Mapbox API and the JavaScript library for what3words API. The CSS file is required to display the map and make elements like Popups and Markers work.
You can also attach the what3words API to the window, which is accessible via `window.what3words`, and set a callback function for it, using `script` tags like the ones in the following example. Don’t forget to set your what3words API key.
**Note:** We prefer to use a fixed version for the Production version of your integrations. A specific version can also be specified within the script to ensure a predictable version of the component is loaded, for example`@5.0.0`. A log of versions can be found [here.](https://developer.what3words.com/tutorial/javascript-autosuggest-component#versioning)
**HTML**
```html
...
// mapbox js library
// what3words js library
// mapbox css file
...
...
```
## 4. Loading a map using Mapbox
Now you can place the map on the page, centered at a location of your choosing. The `#map` in the `` tag will render the map.
**JavaScript**
```javascript
function initW3w(what3words) {
...
mapboxgl.accessToken = YOUR_MAPBOX_ACCESS_TOKEN;
const map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/streets-v9',
center: [-0.195499, 51.52086],
zoom: 12
});
...
}
```
To Display map navigation controls on the Mapbox map, use `addControl` to add zoom and rotation controls to the map.
**JavaScript**
```javascript
const nav = new mapboxgl.NavigationControl();
map.addControl(nav, 'bottom-right');
```
## 5. Position the component on the map
Determine the position of the component on the map.
**CSS**
```css
html,
body,
#map {
position: absolute;
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
#autosuggest {
position: absolute;
top: 10px;
left: 10px;
z-index: 100;
}
#wrapper {
position: relative;
height: 100%;
}
```
Tie the component to the styling. Ensure you include `` within the wrapper to display the map.
**HTML**
```html
...
```
In a few lines of code, you can have an input box that will call the what3words AutoSuggest API endpoint.
The `api_key` parameter contains your application’s API key. Replace `YOUR-API-KEY` with your what3words API key to get started.
[Sign up](https://accounts.what3words.com) to obtain your free API key.
**HTML**
```html
```
## 6. Listen for the select event
The code snippet below shows how to use an event listener to detect when a user selects a what3words address from the listed suggestions for their input. For debug purposes, it has been added a console log to show how to retrieve the words of the suggestions:
**JavaScript**
```javascript
function initW3w(what3words) {
...
let words;
const autosuggest = document.getElementById("autosuggest");
autosuggest.addEventListener("selected_suggestion", (value) => {
let words = value.detail.suggestion.words;
// console.log(words);
});
...
}
```
## 7. Convert what3words address to coordinates
To convert a what3words address to coordinates, users will need to call the what3words API as shown below. They will need to add this code snippet within the `autosuggest` event listener.
**JavaScript**
```javascript
function initW3w(what3words) {
...
let words;
const autosuggest = document.getElementById("autosuggest");
autosuggest.addEventListener("selected_suggestion", (value) => {
let words = value.detail.suggestion.words;
// what3words api call request
what3words.api
.convertToCoordinates({ words: words, format: "geojson" })
.then(function (response) {
console.log("[convertToCoordinates]", response);
});
});
}
```
## 8. Place a map marker
Now that the coordinates of the 3 words address are retrieved from the above call to the what3words API, users can place a simple map marker on the map and centre the map on its location.
**JavaScript**
```javascript
```
Add a marker element to the CSS code snippet within the ``.
**CSS**
```css
.marker {
background-image: url("https://what3words.com/map/marker.png");
background-size: cover;
width: 64px;
height: 64px;
cursor: pointer;
}
```
## 9. Full example
The example below takes the concepts described in the step by step guide and turns some of them into a complete example. Here we have an AutoSuggest component place on a map, where we are listening for the select event. We are then using the what3words JavaScript Wrapper’s convert to coordinates functionality to get the coordinates for that address. With those coordinates we then refocus the map and drop a pin on the location selected.
**HTML**
```html
Autosuggest Component (Mapbox)
```
---
# Configuring Geocortex Essentials to use what3words
Adding the what3words service to Geocortex Essentials.
Topics: Geocortex, GIS
Section: [GIS & Spreadsheet Tools](https://developer.what3words.com/docs/gis-spreadsheet-tools.md)
Source: https://developer.what3words.com/tutorial/configuring-geocortex-essentials-to-use-what3words
Updated: 2026-11-27
what3words can be integrated as a geocoding service within [Geocortex Essentials](https://www.geocortex.com/products/geocortex-essentials/). Adding the what3words ArcGIS Locator functions just as any other geocode service within the Geocortex Essentials application allowing you to discover what3words addresses or search for a what3words address.
## 1. Get an API key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Open Geocortex Essentials Manager

Open your Site in Geocortex Essentials Manager and navigate to the Geocoding tab of GIS Services
## 3. Add a Geocoding Service

Select the ArcGIS Geocoding Service type

Enter an appropriate display name for the service

Enter an appropriate display name for the service
Populate the service URL, Username, and Password field.
**URL:** `https://arcgis.what3words.com/v2/arcgis/rest/services`
**Username:** Email address you used to create a what3words API key
**Password:** your what3words API key.

Select the service name from the list with the language required.

You can now configure your new what3words geocode service to be the default geocode service.

Click “Include in Global Search:” to use within the Global Search
## 4. Using the service

Find out the what3words address for a location through the right-click context window.

Find a what3words address through the search
## 5. Troubleshooting
If you encounter errors or issues related to convert-to-coordinate, convert-to-3wa and grid-section requests while using the Free plan, please check the network panel for the following error message `Error 402 payment required` and its response, indicating the need to upgrade to a higher plan:
**JSON**
```json
{
"error": {
"code": "QuotaExceeded",
"message": "Quota exceeded or API plan does not have access to this feature. Please change your plan at https://accounts.what3words.com/select-plan, or contact support@what3words.com"
}
}
```
For more information, visit our [API plans page](https://accounts.what3words.com/select-plan). If you need further assistance, contact [support@what3words.com](mailto:support@what3words.com).
If you have an issue with displaying the what3words geocoding system on GeoCortex Essentials, it could be that the token of the what3words ArcGIS geocoding service has expired since, by default, GeoCortex Essentials assumes the token duration of all your ArcGIS services is 60 minutes, which is the ArcGIS default. However, if the token duration of any of your ArcGIS services is shorter, you must specify the token duration in Essentials.
Here is a [tutorial](https://docs.vertigisstudio.com/essentials/latest/admin-help/Default.htm#ge/admin/geocoding-services.htm) in GeoCortex Essential that explains how to specify the token duration. You can also follow these steps to update the token duration of your what3words ArcGIS geocoding service:
1. Open the Essentials `web.config file`
2. In the `appSettings` element, add a new add element.
3. Add a key attribute to `appSettings` and set it to `ArcGisRestMapServiceBase.MaximumTokenDuration`.
4. Add a value attribute to `appSettings` and set it to the maximum token duration in minutes.
For example, to set the maximum token duration to 5 minutes: ``
**Note:** It was tested that reducing the `MaximumTokenDuration` to 5 minutes can help to retrieve the token faster and avoids any interruptions in your current workflow.
---
# C++
The C++ API wrapper provides a synchronous, type-safe way to use the [what3words Public API](https://developer.what3words.com/public-api/docs) from C++17 applications, without managing HTTPS requests or response parsing yourself.
Topics: C++, Server and Scripting
Section: [API & SDK Reference](https://developer.what3words.com/docs/api-sdk-reference.md) > [API Wrappers](https://developer.what3words.com/docs/api-sdk-reference/api-wrappers.md)
Source: https://developer.what3words.com/tutorial/cpp
Updated: 2026-11-27
This wrapper calls the hosted Public API. It is separate from the offline C++ Core SDK and does not require an Enterprise Suite installation.
A full example of how to integrate the what3words C++ wrapper is available in our
[C++ Github repository](https://github.com/what3words/w3w-cpp-wrapper)
## 1. Requirements
Use a supported C++17 compiler and CMake to add the wrapper to your application.
| | |
| --- | --- |
| C++17 | MSVC 2019+, GCC 9+, Clang 10+, or supported Apple Clang |
| CMake | CMake 3.20 or newer |
| Git | Required for FetchContent and source builds |
| Dependencies | libcurl and nlohmann/json |
CMake can fetch missing dependencies for FetchContent and standalone source builds. The repository also provides a `vcpkg.json` manifest. An installable CMake package requires an installed libcurl. The fully system-resolved install recipe below disables dependency fetching, so it also requires nlohmann/json as an installed CMake dependency.
## 2. Installation
### CMake FetchContent
Add the wrapper directly to an application with CMake `FetchContent`:
**CMake**
```cmake
include(FetchContent)
FetchContent_Declare(
what3words_api
GIT_REPOSITORY https://github.com/what3words/w3w-cpp-wrapper
GIT_TAG v1.0.0
)
FetchContent_MakeAvailable(what3words_api)
target_compile_features(your-target PRIVATE cxx_std_17)
target_link_libraries(your-target PRIVATE what3words::api)
```
Use an immutable released version so that later wrapper changes cannot break an existing application build. The wrapper also exports its C++17 requirement, but declaring the application target’s requirement makes the project contract explicit.
### Build the wrapper source
Clone the released source before using the standalone build commands:
**Shell**
```shellscript
git clone https://github.com/what3words/w3w-cpp-wrapper what3words-api-cpp
cd what3words-api-cpp
```
Static libraries are built by default. Add `-DBUILD_SHARED_LIBS=ON` for a shared library. On Windows, place the wrapper and libcurl DLLs beside the consuming executable or on `PATH`.
#### Windows with vcpkg
Configure with the vcpkg toolchain so that the manifest supplies libcurl and nlohmann/json:
**PowerShell**
```powershell
cmake -S . -B build `
-A x64 `
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" `
-DW3W_BUILD_TESTS=OFF `
-DW3W_BUILD_EXAMPLES=ON
cmake --build build --config Release
```
#### Linux and macOS
Use GCC, Clang or Apple Clang with a single-configuration CMake build. On Linux, install the distribution’s TLS development package first if CMake will fetch libcurl.
**Shell**
```shellscript
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DW3W_BUILD_TESTS=OFF \
-DW3W_BUILD_EXAMPLES=ON
cmake --build build
```
### Install and consume the CMake package
Only fetching libcurl disables installation; fetching nlohmann/json alone is compatible with the install rules. The fully system-resolved recipe below is for Linux and macOS. It disables dependency fetching, chooses an installation prefix, then installs the wrapper:
**Shell**
```shellscript
cmake -S . -B build-install \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/your/prefix \
-DW3W_FETCH_DEPENDENCIES=OFF \
-DW3W_BUILD_TESTS=OFF \
-DW3W_BUILD_EXAMPLES=OFF
cmake --build build-install
cmake --install build-install
```
On Windows, use the vcpkg toolchain from the earlier build and pass the Release configuration to both build and install:
**PowerShell**
```powershell
cmake -S . -B build-install `
-A x64 `
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" `
-DCMAKE_INSTALL_PREFIX="$PWD/stage" `
-DW3W_FETCH_DEPENDENCIES=OFF `
-DW3W_BUILD_TESTS=OFF `
-DW3W_BUILD_EXAMPLES=OFF
cmake --build build-install --config Release
cmake --install build-install --config Release
```
The consuming build must also be able to resolve CURL. Add the installed wrapper to the application with:
**CMake**
```cmake
find_package(what3words-api 1.0 CONFIG REQUIRED)
target_compile_features(your-target PRIVATE cxx_std_17)
target_link_libraries(your-target PRIVATE what3words::api)
```
When using a custom installation prefix, configure the consuming application with `-DCMAKE_PREFIX_PATH=/your/prefix` on Linux/macOS or `-DCMAKE_PREFIX_PATH="$PWD/stage"` on Windows. Alternatively, set `what3words-api_DIR` to the directory containing `what3words-api-config.cmake`. If libcurl is fetched during a standalone build, install rules are disabled because the resulting dependency graph cannot be exported as a relocatable package. `FetchContent` and `add_subdirectory` consumption continue to work normally.
## 3. Setup an API key
Create an API key through the [what3words developer portal](https://accounts.what3words.com/). In the examples below, replace `"your API key here"` with your API key.
> [!WARNING]
> **Keep API keys out of source control.** The inline value keeps the examples concise. Do not commit or distribute source containing a real production key. The wrapper sends the key in the X-Api-Key header and prevents additional headers from replacing it.
## 4. Quick start
The following complete program creates a client and converts a what3words address to latitude and longitude:
**C++**
```cpp
#include
#include
#include
#include
#include
int main() {
try {
const what3words::Client client("your API key here");
const auto result =
client.convert_to_coordinates("filled.count.soap");
std::cout << std::fixed << std::setprecision(6)
<< result.coordinates.lat << ", "
<< result.coordinates.lng << '\n';
return 0;
} catch (const what3words::ApiError& error) {
std::cerr << error.code() << ": "
<< error.api_message() << '\n';
} catch (const what3words::Error& error) {
std::cerr << error.what() << '\n';
}
return 2;
}
```
Expected output:
> 51.520847, -0.195521
The remaining C++ fragments assume the configured `client` and standard-library headers established by Quick start. `` and `` are included in the complete setup because later timeout and GeoJSON fragments use them.
### Configure timeouts and client identity
Defaults are 5 seconds for connection and 10 seconds for a request. Set non-default values before constructing the client.
**C++**
```cpp
what3words::ClientConfig config;
config.api_key = "your API key here";
config.connect_timeout = std::chrono::seconds{3};
config.request_timeout = std::chrono::seconds{15};
config.user_agent = "your-application/1.0";
const what3words::Client client(config);
```
> [!NOTE]
> **Thread safety.** The default client can be called concurrently: configuration is immutable and each request uses its own libcurl easy handle.
## 5. API operations
### convert_to_3wa / convert_to_3wa_geojson
### Convert coordinates to a what3words address
Find the what3words address for `51.520847, -0.195521`:
**C++**
```cpp
const auto address = client.convert_to_3wa(
{51.520847, -0.195521},
what3words::ConvertTo3waOptions{}.language("en")
);
std::cout << "///" << address.words << '\n';
```
### convert_to_coordinates / convert_to_coordinates_geojson
### GeoJSON
Use the dedicated type-safe GeoJSON methods for conversions and grid sections. GeoJSON point coordinates are ordered as `[longitude, latitude]`:
**C++**
```cpp
const auto geojson =
client.convert_to_coordinates_geojson(
"filled.count.soap"
);
const auto& point = std::get(
geojson.features.front().geometry.coordinates
);
std::cout << point[1] << ", " << point[0] << '\n'; // latitude, longitude
```
### autosuggest / autosuggest_with_coordinates
### AutoSuggest with country clipping
Improve results by clipping suggestions to relevant countries using two-letter country codes:
**C++**
```cpp
const auto options =
what3words::AutosuggestOptions{}
.clip_to_countries({"GB", "DE"})
.number_of_results(3);
const auto response =
client.autosuggest("filled.count.so", options);
for (const auto& suggestion : response.suggestions) {
std::cout << "///" << suggestion.words << '\n';
}
```
### AutoSuggest with coordinates
Use `autosuggest_with_coordinates` when each suggestion also needs coordinates, its three-metre square and its map URL:
**C++**
```cpp
const auto options =
what3words::AutosuggestOptions{}
.clip_to_countries({"GB"})
.number_of_results(3);
const auto response =
client.autosuggest_with_coordinates(
"filled.count.so",
options
);
for (const auto& suggestion : response.suggestions) {
std::cout << "///" << suggestion.words << ": "
<< suggestion.coordinates.lat << ", "
<< suggestion.coordinates.lng << '\n';
}
```
### grid_section / grid_section_geojson
### Grid section
Retrieve the what3words grid lines for a bounding box that is no more than 4 km from corner to corner:
**C++**
```cpp
const what3words::BoundingBox bounds{
{52.207988, 0.116126}, // southwest
{52.208867, 0.117540} // northeast
};
const auto grid = client.grid_section(bounds);
for (const auto& line : grid.lines) {
std::cout << line.start.lat << ","
<< line.start.lng << " -> "
<< line.end.lat << ","
<< line.end.lng << '\n';
}
```
### available_languages
### Available languages
List each currently supported language using its code, English name and native name:
**C++**
```cpp
const auto response = client.available_languages();
for (const auto& language : response.languages) {
std::cout << language.code << " - "
<< language.name << " - "
<< language.native_name << '\n';
}
```
## 6. RegEx functions
These helpers can detect text that looks like a what3words address before making an API request:
**C++**
```cpp
const bool possible =
what3words::is_possible_3wa("///filled.count.soap");
const auto matches =
what3words::find_possible_3wa(
"Meet at filled.count.soap"
);
const bool looks_mistyped =
what3words::did_you_mean("filled count soap");
// Makes an AutoSuggest API request to verify the address
const bool valid =
client.is_valid_3wa("filled.count.soap");
std::cout << std::boolalpha
<< "Possible format: " << possible << '\n'
<< "Matches found: " << matches.size() << '\n'
<< "Looks mistyped: " << looks_mistyped << '\n'
<< "Valid address: " << valid << '\n';
```
> [!NOTE]
> **Format is not validity.** `is_possible_3wa` runs locally and checks only the text format. Use `is_valid_3wa` to verify that an address exists.
See [Detecting if 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) for the C++ expressions.
## 7. Error handling
The wrapper exposes specific error types for configuration, transport, API, HTTP and response parsing failures.
| Error | When it is used |
| --- | --- |
| InvalidArgumentError | Locally invalid coordinates, options or configuration |
| TransportError | DNS, connection, timeout or TLS failure |
| ApiError | A structured what3words API error with HTTP status, code and message |
| HttpError | A non-success HTTP response without a structured API error |
| ParseError | A successful response that does not match the expected contract |
**C++**
```cpp
try {
const auto result =
client.convert_to_coordinates("filled.count.soap");
std::cout << "///" << result.words << '\n';
} catch (const what3words::ApiError& error) {
std::cerr << error.status_code() << " "
<< error.code() << ": "
<< error.api_message() << '\n';
} catch (const what3words::TransportError& error) {
std::cerr << "Network error: "
<< error.what() << '\n';
} catch (const what3words::Error& error) {
std::cerr << error.what() << '\n';
}
```
Endpoint availability and quotas depend on the API plan associated with the key.
> [!NOTE]
> **HTTP 402 responses.** An HTTP 402 response can indicate that a feature is unavailable on the current plan or that a plan quota has been exceeded. A structured response is surfaced as `ApiError`.
---
# Creating an Android AutoSuggest edittext field with the what3words AutoSuggest Component
Adding a 3 word address edittext field with AutoSuggest to an Android App
Topics: Android, Java, Mobile App
Section: [Search Box](https://developer.what3words.com/docs/search-box.md)
Source: https://developer.what3words.com/tutorial/creating-an-android-autosuggest-edittext-box-with-what3words-autosuggest-component
Updated: 2026-11-27
### Step by step
The what3words Android AutoSuggest Component provides an easy way of adding a what3words EditText field to an Android app. The component allows the user to enter a 3 word address, providing AutoSuggest suggestions whilst typing and error correction to ensure accurate entries.
The component is straightforward to use and can be configured using a range of properties. The component uses the what3words API or alternatively can be configured to use our [Enterprise Suite API Server](https://developer.what3words.com/enterprise-suite/api-server).
Full sample apps for the component can be found in our Github repo
[Android Sample Apps](https://github.com/what3words/w3w-android-samples)
Find out how else you can utilise the what3words API in your app by taking a look at the [what3words Android API Wrapper.](https://developer.what3words.com/tutorial/android/)
**Minimum supported OS version:** 6.0 (API level 23)

Getting started with Mani, what3words Head of Android Developer, on [How to create an AutoSuggest Edittext with Kotlin](http://youtu.be/xY-gac5Cur0)
## 1. Get API key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Installation
The artifact is available through [Maven Central](https://search.maven.org/artifact/com.what3words/w3w-android-components).
**Gradle**
```groovy
implementation 'com.what3words:w3w-android-components:3.1.3'
```
## 3. Usage
Take a look at this repository for samples of how to use the component and some of its more advanced features.
[Android Component](https://github.com/what3words/w3w-android-components)
The following should be included in AndroidManifest.xml:
**XML**
```xml
```
Add the following to build.gradle (app level):
**Gradle**
```groovy
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
```
The following should be included in activity\_main.xml:
**XML**
```xml
```
### Adding the component
Replace `YOUR_API_KEY_HERE` with your what3words API key.
For each `suggestion` it is possible to obtain the 3 word address (`words`) and other characteristics such as `country`, `latitude` and `longitude` (if `returnCoordinates` has been specified).
**Kotlin**
```kotlin
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
suggestionEditText.apiKey("YOUR_API_KEY_HERE")
.returnCoordinates(false)
.onSuggestionSelected { suggestion ->
if (suggestion != null) {
Log.i( "MainActivity","words: ${suggestion.words}, country: ${suggestion.country}, distance: ${suggestion.distanceToFocusKm}, near: ${suggestion.nearestPlace}, latitude: ${suggestion.coordinates?.lat}, longitude: ${suggestion.coordinates?.lng}")
} else {
Log.i("MainActivity", "invalid w3w address")
}
}
.onError { error ->
Log.e("MainActivity", "${error.key} - ${error.message}")
}
}
```
**Java**
```java
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
W3WAutoSuggestEditText autoSuggestEditText = findViewById(R.id.suggestionEditText);
autoSuggestEditText.apiKey("YOUR_API_KEY_HERE")
.returnCoordinates(false)
.onSuggestionSelected(null, null, (SuggestionWithCoordinates suggestion) -> {
if (suggestion != null) {
Log.i("MainActivity", String.format("words: %s, country: %s, near: %s", suggestion.getWords(), suggestion.getCountry(), suggestion.getNearestPlace()));
} else {
Log.i("MainActivity", "invalid w3w address");
}
})
.onError(null, (APIResponse.What3WordsError what3WordsError) -> Log.e("MainActivity", String.format("%s - %s", what3WordsError.getKey(), what3WordsError.getMessage())));
}
```
### Enterprise Suite API Server
If you run our Enterprise Suite API Server yourself, you may specify the URL to your own server like so:
**Kotlin**
```kotlin
autoSuggestEditText.apiKey("YOUR_API_KEY_HERE", "https://api.yourserver.com")
```
**Java**
```java
autoSuggestEditText.apiKey("YOUR_API_KEY_HERE", "https://api.yourserver.com")
```
### Enable voice autosuggest

The component also allows for voice input using the what3words Voice API. This feature allows the user to say 3 words and using speech recognition technology displays 3 word address suggestions to the user.
Before enabling Voice AutoSuggest you will need to add a Voice API plan in [your account](https://accounts.what3words.com/billing).
By default the voice language is set to English but this can be changed using the voiceLanguage property (for list of available languages please check the properties table below). Voice input respects the clipping and focus options applied within the general properties. We recommend applying clipping and focus where possible to display as accurate suggestions as possible. To enable voice you can do with programmatically or directly in the XML.
The following should be included in AndroidManifest.xml:
**XML**
```xml
...
```
The following should be included in activity\_main.xml:
**XML**
```xml
```
or MainActivity.kt / MainActivity.java
**Kotlin**
```kotlin
suggestionEditText.apiKey("YOUR_API_KEY_HERE")
.returnCoordinates(false)
.voiceEnabled(true)
...
```
### Advanced usage: properties
There are a range of customisation properties you can use to configure the AutoSuggest Component.
| Parameter | Default value | Type | Description | XML | Programatically |
| --- | --- | --- | --- | --- | --- |
| apiKey | N/A | string | Your what3words API key. (mandatory) | | Yes |
| hint | e.g. lock.spout.radar | String | Placeholder text to display in the input in its default empty state. | Yes | Yes |
| errorMessage | An error occurred. Please try again later | String | Overwrite the generic error message with a custom value. | Yes | Yes |
| invalidAddressMessage | No valid what3words address found | String | Overwrite the validation error message with a custom value. | Yes | Yes |
| focus | N/A | Coordinates | This is a location, specified as a latitude/longitude (often where the user making the query is). If specified, the results will be weighted to give preference to those near the \`focus\` | | Yes |
| clipToCountry | N/A | String | Clip results to a given country or comma separated list of countries. Example value:"GB,US". | | Yes |
| clipToCircle | N/A | Coordinates, Int | Clip results to a circle, specified by Coordinate(lat,lng) and kilometres, where kilometres in the radius of the circle. | | Yes |
| clipToBoundingBox | N/A | BoundingBox | Clip results to a bounding box specified using co-ordinates. | | Yes |
| clipToPolygon | N/A | List of Coordinates | Clip results to a bounding box specified using co-ordinates. | | Yes |
| allowInvalid3wa | false | Boolean | By default the EditText field will clear an inputted value if a valid 3 word address is not entered. Setting allowInvalid3wa to true stops this behaviour and the value is persisted in the EditText. | | Yes |
| returnCoordinates | false | Boolean | Calls the what3words API to obtain the coordinates for the selected 3 word address (to then use on a map or pass through to a logistic company, etc) | Yes | Yes |
| displayUnit | DisplayUnits.SYSTEM | DisplayUnits | Set end-user display unit, DisplayUnits.SYSTEM (default), DisplayUnits.METRIC, DisplayUnits.IMPERIAL | Yes | Yes |
| allowFlexibleDelimiters | false | Boolean | Allow EditText to accept different delimiters than the what3words standard full stop "index.home.raft", i.e "index home raft" or "index,home,raft". | Yes | Yes |
Voice properties:
| Property | Default value | Type | Description | XML | Programatically |
| --- | --- | --- | --- | --- | --- |
| voiceEnabled | false | Boolean | Enables voice suggestion to allow the user to say the three word address instead of writing it. | Yes | Yes |
| voiceLangauge | en | String | Available voice languages: ar for Arabic, cmn for Mandarin Chinese, de for German, en for Global English (default), es for Spanish, hi for Hindi, ja for Japanese and ko for Korean | Yes | Yes |
## 4. Styling
Use our base style as parent and you can set the custom properties available with XML on the table above and the normal EditText styling, i.e:
**XML**
```xml
```
## 5. Troubleshooting
If you encounter errors or issues related to convert-to-coordinate requests while using the Free plan, please check the network panel for the following error message `Error 402 payment required` and its response, indicating the need to upgrade to a higher plan:
**JSON**
```json
{
"error": {
"code": "QuotaExceeded",
"message": "Quota Exceeded. Please upgrade your usage plan, or contact support@what3words.com"
}
}
```
For more information, visit our [API plans page](https://accounts.what3words.com/select-plan). If you need further assistance, contact [support@what3words.com](mailto:support@what3words.com).
---
# Creating an AutoSuggest input box with what3words.js (v3.1 – deprecated)
Adding a 3 word address input box with AutoSuggest in just two lines of code (deprecated)
Topics: JavaScript, Website
Source: https://developer.what3words.com/tutorial/creating-an-autosuggest-input-box-with-what3words-js
Updated: 2026-11-27
### Step by step
**Please note this version of the component has been deprecated. The new version of the component can be found [here.](https://developer.what3words.com/tutorial/javascript-autosuggest-component)**
The what3words API JavaScript Wrapper provides components to make the what3words API even easier to use. These components can be added to any site using JavaScript and HTML. In this tutorial, you’ll learn how to use a component from the wrapper. This will allow a user to get a search input for their page, powered by the Autosuggest function of the what3words API. The wrapper is straightforward to use and you can configure it for your needs using a range of properties.
Find out how else you can utilise the what3words API using JavaScript by taking a look at the [**what3words JavaScript API Wrapper**](https://docs.what3words.com/wrapper/javascript/)
[AutoSuggest Component](https://codesandbox.io/s/autosuggest-component-gm3z2) (interactive example)
## 1. Get API key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Installation
**Please note this version of the component has been deprecated. The new version of the component can be found [here.](https://developer.what3words.com/tutorial/javascript-autosuggest-component)**
To load the what3words JavaScript API wrapper, use a `script` tag like the one in the following example:
**JavaScript**
```javascript
```
The URL in the `script` tag is the location of a JavaScript file that loads everything you need for using the what3words API in JavaScript.
The `key` parameter contains your application’s API key.
## 3. Usage
In one line, you can have an input box that will call the what3words API AutoSuggest endpoint.
Code example:
**HTML**
```html
```
### Available properties
There are a range of customisation properties you can use to configure the AutoSuggest component.
| Parameter | Type | Description |
| --- | --- | --- |
| placeholder | string | default text to display. Example value:"e.g lock.spout.radar" |
| autosuggest-focus | string | comma separated lat/lng of point to focus on. Example value:"51.521251,-0.203586" |
| n-focus-results | number | the number of results within what is returned to apply the focus to. Example value:"2" |
| clip-tp-country | string | confine results to a given country or comma separated list of countries. Example value:"GB,US" |
| clip-to-bounding-box | string | Confine results to a bounding box specified using co-ordinates. Example value:"51.521,-0.343,52.6,2.3324" |
| clip-to-circle | string | Restrict AutoSuggest results to a circle, specified by lat,lng,kilometres, where kilometres in the radius of the circle. For convenience, longitude is allowed to wrap around 180 degrees. For example 181 is equivalent to -179. |
| clip-to-polygon | string | Restrict AutoSuggest results to a polygon, specified by a comma-separated list of lat,lng pairs. The polygon should be closed, i.e. the first element should be repeated as the last element; also the list should contain at least 4 entries. The API is currently limited to accepting up to 25 pairs. Example value:"51.521,-0.343,52.6,2.3324,54.234,8.343,51.521,-0.343" |
| error-message | string | overwrite the validation error message with a custom value. Example value:"you have entered an invalid address" |
| return-coordinates | boolean | Calls the what3words API to obtain the coordinates for the selected 3 word address |
### placeholder
Set the default text appearing in the input box. We recommend adding e.g. in front of a 3 word address so the user can see the text is an example only.
**HTML**
```html
```
### autosuggest-focus / n-focus-results
These two properties work in combination. User `autosuggest-focus` to define a lat/lng around which to apply a focus to your results. `n-focus-results` then determines the number of results returned to which this focus get applied.
**HTML**
```html
```
### clip-to-country
Restrict results to a given country or comma separated list of countries
**HTML**
```html
```
### clip-to-bounding-box
Restrict results to a bounding box specified using co-ordinates
**HTML**
```html
```
### clip-to-circle
Restrict AutoSuggest results to a circle, specified by lat,lng,kilometres, where kilometres in the radius of the circle. For convenience, longitude is allowed to wrap around 180 degrees. For example, 181 is equivalent to -179.
**HTML**
```html
```
### clip-to-polygon
Restrict AutoSuggest results to a polygon, specified by a comma-separated list of lat,lng pairs. The polygon should be closed, i.e. the first element should be repeated as the last element; also the list should contain at least 4 entries. The API is currently limited to accepting up to 25 pairs.
**HTML**
```html
```
### validation
Turn off validation, it is on by default
**HTML**
```html
```
### Enterprise Suite API Server
If you run our Enterprise Suite API Server yourself, you may specify the URL to your own server by appending the `baseUrl` parameter to the `script`
**HTML**
```html
```
### debug
Turn on debug information to console, it is off by default
**HTML**
```html
```
### error-message
Return custom error message for 3 word address validation
**HTML**
```html
```
### Returning coordinates
If you would like to return coordinates for a 3 word address to plot on a map then you can request a call is made to the what3words API.
Add a listener to the select event to obtain the value and use within your application.
**HTML**
```html
```
**JavaScript**
```javascript
document.querySelector('what3words-autosuggest')
.addEventListener("select", ({target}) => {
console.log(target.coordinatesLng)
console.log(target.coordinatesLat)
})
```
### Listening for events
Listen for either the `change` or `valid` events
This requires debugging to be enabled and we are giving the component an id to reference when listening for the event
**HTML**
```html
```
**JavaScript**
```javascript
const input = document.getElementById("autosuggest");
input.addEventListener("select", (value) => {
console.log("[EVENT:select]", value.detail);
});
```
### Full example
Below, we’ve taken the concepts described and turned some into a complete example. This includes a placeholder, expanding results to five, clipping to Great Britain and the United States, outputting debug to console, using a custom error message for the validation and looking for the valid event and outputting that to the console.
**JavaScript**
```javascript
w3w JavaScript Autosuggest Tutorial
);
}
```
**Vue**
```vue
```
**Angular**
```typescript
import { NgModule } from "@angular/core";
import { Component } from "@angular/core";
import { ComponentsModule } from "@what3words/angular-components";
@Component({
selector: "app-component-autosuggest",
template: `
console.log(detail.value)}
onValue_valid={({ detail }) => console.log(detail.value)}
onValue_invalid={({ detail }) => console.log(detail.value)}
onSelected_suggestion={({ detail }) => console.log(detail.suggestion)}
onSuggestions_changed={({ detail }) => console.log(detail.suggestions)}
onCoordinates_changed={({ detail }) => console.log(detail.coordinates)}
>
`
})
export class W3WAutosuggestComponent { }
@NgModule({
imports: [ComponentsModule],
declarations: [W3WAutosuggestComponent],
exports: [W3WAutosuggestComponent],
bootstrap: [W3WAutosuggestComponent]
})
export class W3WAutosuggestModule { }
```
## 8. Migration Guide to Version 5
Generally speaking, this release should be a drop-in replacement for any standard application integrations that consume our components. The notes below largely apply if you’re using external builders like [vite](https://vite.dev/) or [esbuild](https://esbuild.github.io/).
### Vite
When using [vite](https://vite.dev/), make sure to exclude our imported component library (e.g. `@what3words/javascript-components`) from the dependency optimisation using the `optimizeDeps.exclude` option in your `vite.config.[js,ts]` file.
**TypeScript**
```typescript
import { defineConfig } from "vite";
export default defineConfig({
...
optimizeDeps: {
exclude: ["@what3words/javascript-components"],
},
});
```
### Angular
Angular generally requires more configuration for bespoke setups. The following sections should cover all integration patterns when using the `@what3words/angular-components` package.
The `@angular-devkit/build-angular:application` is currently unsupported as this is based on vite/esbuild with no mechanism to disable dependency optimizations as would typically be done to resolve this known bundler issue. As such, only the `"@angular-devkit/build-angular:browser` (based on [webpack](https://webpack.js.org/)) builder is supported. To apply this builder, set the `projects..architect.build.builder` option in your `angular.json` config to `@angular-devkit/build-angular:browser` as shown below.
**JSON**
```json
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"projects": {
"my-app": {
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
...
},
...
},
...
},
...
},
}
```
> **Note:** Your application requirements might conflict with this downgrade.
Additionally, Angular 19 is configured to use and support standalone components out-of-the-box whereas our libraries are currently built on the older NgModules pattern. They can however still be used in standalone components by using the `@angular/core`\-provided `importProvidersFrom` DI [utility method](https://angular.dev/api/core/importProvidersFrom?tab=api) to use it within the `bootstrapApplication` config and other standalone contexts. In your `main.ts`, update as follows:
**TypeScript**
```typescript
import {
ApplicationConfig,
importProvidersFrom,
} from "@angular/core";
import { ComponentsModule } from "@what3words/angular-components";
export const appConfig: ApplicationConfig = {
providers: [
importProvidersFrom(ComponentsModule),
....
],
};
```
The `@angular-devkit/build-angular:application` is currently unsupported as this is based on `vite/esbuild` with no mechanism to disable dependency optimisations as would typically be done to resolve this known bundler issue. As such, only the `@angular-devkit/build-angular:browser` (based on [webpack](https://webpack.js.org/)) builder is supported. To apply this builder, set the `projects..architect.build.builder` option in your angular.json config to `@angular-devkit/build-angular:browser` as shown below.
**JSON**
```json
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"projects": {
"my-app": {
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
...
},
...
},
...
},
...
},
}
```
> **Notes:** Your application requirements might conflict with this downgrade.
If the above doesn’t work for your use-case, it might be more useful to use our `@what3words/javascript-components` which is what this wrapper library is based on. To do so, follow the instructions below:
**Shell**
```shellscript
// Step 1 - Uninstall @what3words/angular-components
npm uninstall @what3words/angular-components
// Step 2 - Install @what3words/javascript-components
npm install @what3words/angular-components
```
Step 3 – Bind the custom element to the DOM in your main.ts file
**TypeScript**
```typescript
import {
applyPolyfills,
defineCustomElements,
} from '@what3words/javascript-components/loader';
bootstrapApplication(...);
// Add web component polyfills
defineCustomElements(window).then(applyPolyfills);
```
Step 4 – Instruct the angular compiler to allow the usage of custom elements using the `CUSTOM_ELEMENTS_SCHEMA` flag in your app.module.ts file
**TypeScript**
```typescript
import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
@NgModule({
...
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class AppModule {}
```
## 9. Troubleshooting
If you encounter errors or issues related to convert-to-coordinate, convert-to-3wa and grid-section requests while using the Free plan, please check the network panel for the following error message `Error 402 payment required` and its response, indicating the need to upgrade to a higher plan:
**JSON**
```json
{
"error": {
"code": "QuotaExceeded",
"message": "Quota exceeded or API plan does not have access to this feature. Please change your plan at https://accounts.what3words.com/select-plan, or contact support@what3words.com"
}
}
```
For more information, visit our [API plans page](https://accounts.what3words.com/select-plan). If you need further assistance, contact [support@what3words.com](mailto:support@what3words.com).
## Issues with Angular 17 Compatibility
If you are facing issues with installing the `@what3words/angular-components` library in your `Angular 17` project that is due to a change in how angular projects are [built](https://angular.io/guide/esbuild#esm-default-imports-vs-namespace-imports) (moving away from `babel` in v15 to `vite` in v17) and means the what3words Angular component isn’t successfully imported into `Angular 17` projects. We recommend to:
1. Update the `angular.json` file to downgrade the builder from `@angular-devkit/build-angular:application` to `@angular-devkit/build-angular:browser.`
2. Install the `@what3words/javascript-components` web component library (the `@what3words/angular-components` won’t work)
3. Run the `src/main.ts` file with the web component loader from the `@what3words/javascript-components` library
Reverting to the legacy angular builder shouldn’t have any downstream impact on your application, as it’s not a breaking change. For now, the `@what3words/angular-components` doesn’t work in either configuration and we’ll continue to look into this.
Please contact [support@what3words.com](mailto:support@what3words.com) for a working sample to still be able to use our what3words components in your Angular 17 projects.
## Vite Compatibility Issue
Our current components do not yet work with Vite due to a known issue with Stencil. A potential fix is expected in a future version upgrade, which we are currently working on. It may take some time before this fix is available and tested. For now, we advise against using Vite. For more details, refer to our [GitHub issue](https://github.com/ionic-team/stencil/issues/2827).
#### AI coding agents (like **Replit**, **Lovable and** **Cursor**) should follow the steps below when building with what3words.
**Markdown**
~~~~markdown
what3words - Agent Guide (CDN‑only)
Goal: Minimal POC where selecting a suggestion from the what3words autosuggest converts to `{lat,lng}` and displays it. No bundler edits, no extra packages.
Rules:
- Use CDN web‑component only. Do not install `@what3words/*` or edit Vite config.
- Convert only after a selection (`"selected_suggestion"` event), never while typing.
- Expose the API key as `VITE_W3W_API_KEY` (works with default Vite).
## 1) Set the what3words API key
- Key: `VITE_W3W_API_KEY`
## 2) Add the component (no npm)
Open `client/index.html` and paste these **two** lines just before ``:
```html
```
This defines the `` element at runtime — no Vite changes needed.
## 3) Minimal `client/src/App.tsx`
```tsx
import { useEffect, useRef, useState } from "react";
// allow the custom element without extra .d.ts files
declare global { namespace JSX { interface IntrinsicElements { "what3words-autosuggest": any } } }
const API_KEY = import.meta.env.VITE_W3W_API_KEY as string | undefined;
export default function App() {
const [coords, setCoords] = useState<{ lat: number; lng: number } | null>(null);
const ref = useRef(null);
if (!API_KEY) return
{coords ? \`\${coords.lat}, \${coords.lng}\` : "Pick a suggestion"}
>
);
}
```
~~~~
---
# 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('Clear');
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.
---
# JavaScript Component: Integrate Swiftcomplete into Web Forms – Old
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
Source: https://developer.what3words.com/tutorial/javascript-component-integrate-swiftcomplete-into-web-forms-old
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 script to load the Swiftcomplete JavaScript file
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.
Firstly, copy & paste the code snippet into the `` section of your HTML, before the closing `` tag.
> **Note:** Make sure you only copy the code snippet once, even if you have multiple address fields on your page.
**JavaScript**
```javascript
```
## 3. Add Swiftcomplete functionality to a text field
Now copy this script and paste it directly after the previous code snippet, before the closing `` tag.
To get the script running, replace `INSERT_KEY_HERE` with your Swiftcomplete API key, and replace `INSERT_TEXT_FIELD_ID_HERE` with the ID of an existing textbox on your page. To populate the address into your form, modify `populateLineFormat` to match the fields on your checkout page.
The script initialises Swiftcomplete on your existing textbox, restricts searching to Great Britain and logs the record and coordinates to the developer console when you select a result from the list of autocomplete suggestions.
**JavaScript**
```javascript
```
## 4. Test your integration
Refresh your page, and try searching in your existing text field. The record and coordinates are printed to the developer console when you click a result from the list of suggestions.
## 5. 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 JavaScript integration for the Swiftcomplete API.
---
# JavaScript SDK
Getting started with the what3words JavaScript SDK.
Topics: Angular, JavaScript, React, Vue, Website
Source: https://developer.what3words.com/tutorial/javascript-sdk
Updated: 2026-11-27
### Step by Step
The JavaScript SDK uses the [JavaScript API Wrapper](https://developer.what3words.com/tutorial/javascript) under the hood, and it supports native web components `@what3words/javascript-components` (which can also be loaded via CDN), Angular components – `@what3words/angular-components`, React components – `@what3words/react-components` and Vue components – `@what3words/vue-components`.
The components available for you to use are as follows:
– [AutoSuggest Component](https://developer.what3words.com/tutorial/javascript-autosuggest-component)
– [Map Component](https://developer.what3words.com/tutorial/using-the-web-map-component)
In case you are looking to seamlessly integrate the [what3words Public API](https://docs.what3words.com/api/v3/) into your Node.js/Browser-based environment applications, the [JavaScript API Wrapper](https://developer.what3words.com/tutorial/javascript) is the right technology for your application.
## 1. Get an API Key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Installation
This is the script that is at the core of the component libraries.
To add the core SDK natively to a web document you should add the what3words `script` tags within the `head` of your document.
**JavaScript**
```javascript
...
```
The URL contained in the script tags are the location of JavaScript files that load everything you need for using the [JavaScript API wrapper](https://developer.what3words.com/tutorial/javascript) for the what3words API.
**Note**: We prefer to use a fixed version of the production version of your integrations. A specific version can also be specified within the script to ensure a predictable version of the component is loaded, for example `@5.0.0`. A log of versions can be found [here](https://www.npmjs.com/package/@what3words/javascript-components).
It is recommended to set up a callback function to attach the what3words API to the window accessible via `window.what3words` in the script within your `head` HTML tag as mentioned below.
**JavaScript**
```javascript
...
```
To initiate this function pass a parameter e.g. `sdk` to the callback function `initW3w`.
Also, make sure to set up the what3words API key with the `setApiKey` function by replacing the `"YOUR-API-KEY"` with your application’s API key. [Sign up](https://accounts.what3words.com/create-api-key) to obtain your free API key.
Otherwise you can add our [AutoSuggest component](https://developer.what3words.com/tutorial/javascript-autosuggest-component) or [Map component](https://developer.what3words.com/tutorial/using-the-web-map-component) to your page with our component tags.
**JavaScript**
```javascript
function initW3w(sdk) {
// Set what3words API key
sdk.api.setApiKey('YOUR-API-KEY');
// OR you can also just use the global window object at this point
// window.what3words.api.setApiKey("YOUR-API-KEY");
sdk.api
.autosuggest({
input: 'freshen.overlook.clo',
nFocusResults: 1,
clipToCountry: ['FR'],
focus: { lat: 48.856618, lng: 2.3522411 },
nResults: 1,
language: 'en'
})
.then(function (response) {
console.log(response);
});
sdk.api
.convertToCoordinates({
words: 'filled.count.soap',
format: 'json' // or format: 'geojson'
})
.then(function (response) {
console.log(response);
});
sdk.api
.convertTo3wa ({
coordinates: { lat: 51.520847, lng: -0.195521 },
language: 'en',
format: 'json' // or format: 'geojson'
})
.then(function (response) {
console.log(response);
});
sdk.api
.gridSection({
boundingBox: {
southwest: {
lat: sw.lat,
lng: sw.lng
},
northeast: {
lat: ne.lat,
lng: ne.lng
}
},
format: "geojson" // or format: 'json'
})
.then(function (data) {
console.log(data)
})
.catch(console.error);
}
```
## 3. Usage
### Convert to 3 word address
Convert coordinates, expressed as latitude and longitude to a 3 word address.
More info about `convertTo3wa`, including returned results is available in the [what3words REST API documentation](https://developer.what3words.com/public-api/docs/#convert-to-3wa).
Return standard response:
**JavaScript**
```javascript
/**
* Converts a coordinate to a 3 word address
* @param {Object} coordinates - The coordinate object
* @param {number} coordinates.lat - The latitude
* @param {number} coordinates.lng - The longitude
* @param {string} [language= ‘en’] - The language to return the 3 word address in
* @param {string} [format= ‘json’ | format= ‘geojson’]
* @returns {Promise} Promise 3 word address response
*/
sdk.api
.convertTo3wa ({
coordinates: { lat: 51.520847, lng: -0.195521 },
language: 'en',
format: 'json' // or format: 'geojson'
})
.then(function (response) {
console.log(response);
});
```
### Convert to coordinates
This function converts a 3 word address to a position (expressed as coordinates of latitude and longitude).
It takes the words parameter as a string of 3 words `'table.book.chair'`
More info about `convertToCoordinates`, including returned results is available in the [what3words REST API documentation](https://developer.what3words.com/public-api/docs/#convert-to-coords).
Return standard response:
**JavaScript**
```javascript
/**
* Returns coordinates for a 3 word address
* @param {string} words - The 3 word address words to convert to coordinates
* @param {string} [format= ‘json’ | format= ‘geojson’]
* @returns {Promise} - Promise coordinates response
*/
sdk.api
.convertToCoordinates({
words: 'filled.count.soap',
format: 'json' // or format: 'geojson'
})
.then(function (response) {
console.log(response);
});
```
### AutoSuggest
When presented with a 3 words address which may be incorrectly entered, AutoSuggest returns a list of potential correct 3 word addresses. It needs the first two words plus at least the first character of the third word to produce suggestions.
This method provides corrections for mis-typed words (including plural VS singular), and words being in the wrong order.
Optionally, clipping can narrow down the possibilities, and limit results to:
- One or more countries
- A geographic area (a circle, box or polygon)
This dramatically improves results, so we recommend that you use clipping if possible.
To improve results even further, set the `focus` to user’s current location. This will make `autosuggest` return results which are closer to the user.
More information about `autosuggest`, including returned results is available in the [what3words REST API documentation](https://developer.what3words.com/public-api/docs/#autosuggest).
**Example:** Basic Autosuggest call.
**JavaScript**
```javascript
/**
* Returns autosuggest results for a search term
* @param {string} input - The input to search for autosuggests
* @param {Object} [options] - The result filter and clipping options
* @param {Object} [options.focus] - The coordinates for the focus of the search
* @param {number} [options.focus.lat] - The latitude of the focus
* @param {number} [options.focus.lng] - The longitude of the focu
* @param {string} [options.nFocusResults] - The number of focused results
* @param {string[]} [options.clipToCountry] - The countries to clip results to
* @param {Object} [options.clipToBoundingBox] - The bounding box to clip results within
* @param {Object} [options.clipToBoundingBox.southwest] - The coordinates of the southwest corner of the clipping box
* @param {Object} [options.clipToBoundingBox.southwest.lat] - The latitude of the southwest corner of the clipping box
* @param {Object} [options.clipToBoundingBox.southwest.lng] - The longitude of the southwest corner of the clipping box
* @param {Object} [options.clipToBoundingBox.northeast] - The coordinates of the northeast corner of the clipping box
* @param {Object} [options.clipToBoundingBox.northeast.lat] - The latitude of the northeast corner of the clipping bo
* @param {Object} [options.clipToBoundingBox.northeast.lng] - The longitude of the northeast corner of the clipping box
* @param {Object} [options.clipToCircle] - The circle to clip results within
* @param {Object} [options.clipToCircle.center] - The center of the circle to clip results within
* @param {number} [options.clipToCircle.center.lat] - The latitude of the center of the circle to clip results within
* @param {number} [options.clipToCircle.center.lng] - The longitude of the center of the circle to clip results within
* @param {number} [options.clipToCircle.radius] - The radius of the circle to clip results within
* @param {number[]} [options.clipToPolygon] - An array of polygon coordinates to clip results within
* @param {string} [options.inputType] - 'text' | 'vocon-hybrid' | 'nmdp-asr' | 'generic-voice'
* @param {string} [options.language] - The language to return autosuggest results in
* @param {boolean} [options.preferLand] - Whether to bias towards results that are over land vs over the sea.
* @returns {Promise} - Promise 3 word address autosuggestions response
*/
sdk.api
.autosuggest({
input: 'freshen.overlook.clo',
language: 'en'
})
.then(function (response) {
console.log(response);
});
```
> [!NOTE]
> **Example:** AutoSuggest, clipping the results returned to France and Germany.
**JavaScript**
```javascript
sdk.api
.autosuggest({
input: 'freshen.overlook.clo',
clipToCountry: ['FR', 'DE'],
language: 'en'
})
.then(function (response) {
console.log(response);
});
```
> [!NOTE]
> **Example:** AutoSuggest, clipping to a circle.
**JavaScript**
```javascript
sdk.api
.autosuggest({
input: 'freshen.overlook.clo',
clipToCircle: {center: {lat:51.4243877, lng:-0.34745}, radius:50},
language: 'en'
})
.then(function (response) {
console.log(response);
});
```
> [!NOTE]
> **Example:** AutoSuggest, clipping to a polygon.
**JavaScript**
```javascript
sdk.api
.autosuggest({
input: 'freshen.overlook.clo',
clipToPolygon: [{ lat: 51.421, lng: -0.343 }, { lat: 52.6, lng: 2.3324 }, { lat: 54.234, lng: 8.343 }, { lat: 51.421, lng: -0.343 }],
language: 'en'
})
.then(function (response) {
console.log(response);
});
```
> [!NOTE]
> **Example:** AutoSuggest, clipping to a bounding box.
**JavaScript**
```javascript
sdk.api
.autosuggest({
input: 'fun.with.code',
clipToBoundingBox:{
southwest: { lat: 51.521, lng: -0.343 },
northeast: { lat: 52.6, lng: 2.3324 }
},
language: 'en'
})
.then(function (response) {
console.log(response);
});
```
> [!NOTE]
> **Example:** AutoSuggest, Focus on (51.4243877,-0.34745).
**JavaScript**
```javascript
sdk.api
.autosuggest({
input: 'fun.with.code',
focus: {lat:51.4243877, lng:-0.34745},
language: 'en'
})
.then(function (response) {
console.log(response);
});
```
> [!NOTE]
> **Example:** AutoSuggest, Focus on (51.4243877,-0.34745) and then determine how many results within the response it applies to.
**JavaScript**
```javascript
sdk.api
.autosuggest({
input: 'fun.with.code',
focus: {lat:51.4243877, lng:-0.34745},
nFocusResults: 2,
language: 'en'
})
.then(function (response) {
console.log(response);
});
```
> [!NOTE]
> **Example:** AutoSuggest, with Generic Voice input type.
**JavaScript**
```javascript
sdk.api
.autosuggest({
input: 'fun.with.code',
inputType: 'generic-voice',
language: 'en'
})
.then(function (response) {
console.log(response);
});
```
### Grid section
Grid section returns a section of the what3words 3m x 3m grid as a set of horizontal and vertical lines covering the requested area, which can then be drawn onto a map.
The requested box must not exceed 4km from corner to corner, or a `BadBoundingBoxTooBig` error will be returned.
More information about `gridSection`, including returned results is available in the [what3words REST API documentation](https://developer.what3words.com/public-api/docs/#grid-section).
Return standard response:
**JavaScript**
```javascript
/**
* Returns a section of the what3words grid
* @param {Object} boundingBox - The bounding box for the grid to return
* @param {Object} [boundingBox.southwest] - The coordinates of the southwest corner of the bounding box
* @param {Object} [boundingBox.southwest.lat] - The latitude of the southwest corner of the bounding box
* @param {Object} [boundingBox.southwest.lng] - The longitude of the southwest corner of the bounding box
* @param {Object} [boundingBox.northeast] - The coordinates of the northeast corner of the bounding box
* @param {Object} [boundingBox.northeast.lat] - The latitude of the northeast corner of the bounding box
* @param {Object} [boundingBox.northeast.lng] - The longitude of the northeast corner of the bounding box
* @param {string} [format= ‘json’ | format= ‘geojson’]
* @return {Promise} - Promise the grid section
*/
sdk.api
.gridSection({
boundingBox: {
southwest: {
lat: sw.lat, //replace sw.lat with your south west latitude
lng: sw.lng //replace sw.lng with your south west longitude
},
northeast: {
lat: ne.lat, //replace ne.lat with your north east latitude
lng: ne.lng //replace ne.lat with your north east longitude
}
},
format: "json" // or format:"geojson"
})
.then(function (data) {
console.log(data
})
.catch(console.error);
```
### Available languages
This function returns the currently supported languages. It will return the two letter code, and the name of the language both in that language and in English.
More information about `availableLanguages`, including returned results is available in the [what3words REST API documentation](https://developer.what3words.com/public-api/docs/#available-languages).
**JavaScript**
```javascript
/**
* Returns the available languages supported by what3words API
* @returns {Promise} - Promise the available languages response
*/
sdk.api
.availableLanguages()
.then(function (n) {
console.log("[availableLanguages]", n)
});
```
### Handling errors
Errors returned from the API can be caught with the wrapper through the use of a `catch` function.
Within the `catch` function, `code` and `message` values which represent the error, are accessible from the `error` object parameter.
**JavaScript**
```javascript
sdk.api
.convertToCoordinates({
words: 'filled.count.soap',
format: 'json' // or format: 'geojson'
})
.then(function (response) {
console.log(response);
})
.catch(function(error) { // catch errors here
console.log("[code]", error.code);
console.log("[message]", error.message);
});
```
## 4. Troubleshooting
If you encounter errors or issues related to convert-to-coordinate, convert-to-3wa and grid-section requests while using the Free plan, please check the network panel for the following error message `Error 402 payment required` and its response, indicating the need to upgrade to a higher plan:
**JSON**
```json
{
"error": {
"code": "QuotaExceeded",
"message": "Quota exceeded or API plan does not have access to this feature. Please change your plan at https://accounts.what3words.com/select-plan, or contact support@what3words.com"
}
}
```
For more information, visit our [API plans page](https://accounts.what3words.com/select-plan). If you need further assistance, contact [support@what3words.com](mailto:support@what3words.com).
## 5. Full example
The example below takes the concepts described in the step-by-step and turns some of them into a complete example. Here we take a partial 3 word address and pass it into AutoSuggest – clipping the results to consider only addresses in France, setting a focus on Paris, and returning a single result. We also show how easy is to implement the AutoSuggest Component instead of using the JavaScript SDK. We then take the result convert the 3 word address to coordinates, and find the nearest place.
**JavaScript**
```javascript
what3words JavaScript SDK
Add what3words AutoSuggest Component to your page
Or programatically access the what3words API
Top 3 word address match:
WGS84 Coordinates:
Nearest Place:
```
---
# Legacy Android
Getting started with the what3words Android API wrapper
Topics: Android, Mobile App
Source: https://developer.what3words.com/tutorial/legacy-android
Updated: 2026-11-27
### Step by step
> #### **Note**: This library has been deprecated and will no longer receive support. To upgrade to the Version 4.x of the Android API Wrapper library, please refer to this [Version 4.x Tutorial](https://developer.what3words.com/tutorial/android) and this [Migration Guide](https://developer.what3words.com/tutorial/migrating-android-api-wrapper-from-version-3-x-to-4-x).
The Android API wrapper is useful for Android developers who wish to seamlessly integrate the [what3words API](https://docs.what3words.com/api/v3/) into their Android applications, without the hassle of having to manage the low level API calls themselves.
The what3words API allows conversion between 3-word addresses (e.g., ///index.home.raft) and coordinates (e.g., -0.203586, 51.521251). It features powerful autosuggest functions to validate and autocorrect user input, restrict suggestions to specific areas, request sections of the what3words grid as GeoJSON, and list all supported languages. Advanced users can also post-process voice output with autosuggest.
All coordinates are in latitude, longitude pairs using the WGS-84 standard, with latitudes ranging from -90 to 90.
Full sample app for the wrapper can be found in our Github repo
[Android Sample Apps](https://github.com/what3words/w3w-android-samples)
## 1. Get an API Key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Installation
The library is available through [Maven Central](https://search.maven.org/search?q=g:com.what3words). Please add the following to your `gradle.build:`
**Android**
```java
implementation 'com.what3words:w3w-android-wrapper:3.1.22'
```
## 3. Setup
Add to AndroidManifest.xml:
**Android**
```java
```
Add the following to build.gradle (app level):
**Android**
```java
android {
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
...
// we are going to use coroutines for kotlin examples, feel free to use any other library of your choice.
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.7"
// we are going to use rxjava for java examples, feel free to use any other library of your choice.
implementation 'io.reactivex.rxjava3:rxjava:3.0.7'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
}
```
## 4. Usage
### convertTo3wa example in kotlin with Coroutines.
Because it is not possible to perform a networking operation on the main application thread, API calls need to be made in a background thread, we used Coroutines in this example. *for more Kotlin examples try our [**sample app** in this repo](https://github.com/what3words/w3w-android-wrapper)*.
**Android**
```kotlin
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val wrapper = What3WordsV3("YOUR_API_KEY_HERE", this)
CoroutineScope(Dispatchers.IO).launch {
//use wrapper.convertTo3wa() with Dispatcher.IO - background thread
val result = wrapper.convertTo3wa(Coordinates("51.2305", "-0.24123")).execute()
CoroutineScope(Dispatchers.Main).launch {
//use Dispatcher.Main to update your views with the results if needed - Main thread
if (result.isSuccessful) {
Log.i("MainActivity", "3 word address: ${result.words}")
} else {
Log.e("MainActivity", result.error.message)
}
}
}
}
}
```
### convertTo3wa example in Java with RxJava
Because it is not possible to perform a networking operation on the main application thread, API calls need to be made in a background thread, we used RxJava in this example. for more Java examples try our sample-java app in this repo
**Java**
```java
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
What3WordsV3 wrapper = new What3WordsV3("YOUR_API_KEY_HERE", this);
Observable.fromCallable(() -> wrapper.convertTo3wa(new Coordinates(51.2423, -0.12423)).execute())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(result -> {
if (result.isSuccessful()) {
Log.i("MainActivity", String.format("3 word address: %s", result.getWords()));
} else {
Log.e("MainActivity", result.getError().getMessage());
}
});
}
}
```
### voice autosuggest example in Kotlin
The Voice API AutoSuggest allows the user to say 3 words and using speech recognition technology displays 3 word address suggestions to the user.
Before enabling Voice AutoSuggest you will need to add a Voice API plan in [your account](https://accounts.what3words.com/billing).
For a full working example with voice and AUDIO\_RECORD permission, request check our [sample](https://github.com/what3words/w3w-android-wrapper/blob/master/sample/src/main/java/com/what3words/androidwrappersample/MainActivity.kt) and [sample-java](https://github.com/what3words/w3w-android-wrapper/blob/master/sample-java/src/main/java/com/what3words/androidwrappersamplejava/MainActivity.java)
Note: Please bear in mind that the Android Emulator cannot record audio. Therefore, you will need to test on a real device that can record.
**Kotlin**
```kotlin
val microphone = VoiceBuilder.Microphone().onListening { volume ->
Log.i("VoiceSample","volume: $volume")
}
wrapper.autosuggest(microphone, "en")
.focus(51.423, -0.1245)
.onSuggestions { suggestions ->
Log.i("VoiceSample","Suggestions: ${suggestions.joinToString { it.words }}")
}.onError { error ->
Log.e("VoiceSample", error)
}.startListening()
```
### Other available wrapper calls and examples.
wrapper.convertToCoordinates() – Convert a 3 word address to a latitude and longitude
**Kotlin**
```kotlin
val result = wrapper.convertToCoordinates("index.home.raft").execute()
```
**wrapper.autosuggest()** – AutoSuggest can take a slightly incorrect 3 word address, and suggest a list of valid 3 word addresses. For more autosuggest proprieties similar to *focus* below go to our [documentation](https://developer.what3words.com/public-api/docs#autosuggest)
**Kotlin**
```kotlin
val result = wrapper.autosuggest("index.home.r").focus(51.502,-0.12345).execute()
```
**wrapper.gridSection()** – Returns a section of the 3m x 3m what3words grid for a bounding box.
**Kotlin**
```kotlin
val result = wrapper.gridSection(BoundingBox(
Coordinates(51.515900, -0.212517),
Coordinates(51.527649, -0.191746)
)).execute()
```
**wrapper.availableLanguages()** – Retrieves a list all available 3 word address languages.
**Kotlin**
```kotlin
val result = wrapper.availableLanguages().execute()
```
If you run our Enterprise Suite API Server yourself, you may specify the URL to your own server like so:
**Kotlin**
```kotlin
val wrapper = What3Words("YOUR_API_KEY_HERE", "https://api.yourserver.com")
```
> #### **Reminder**: To upgrade to the latest version (4.x) of the Android API Wrapper library, please refer to the [Migration Guide from Version 3.x to 4.x](https://developer.what3words.com/tutorial/migrating-android-api-wrapper-from-version-3-x-to-4-x).
---
# Migrating an application from API V2 to API V3
Moving applications that have previously used API V2 to API V3
Topics: Android, Java, JavaScript, NodeJS, Objective-C, PHP, Python, Swift, Mobile App, Server and Scripting, Website
Section: [Guidelines & Support](https://developer.what3words.com/docs/guidelines-support.md)
Source: https://developer.what3words.com/tutorial/migrating-an-application-from-api-v2-to-api-v3
Updated: 2026-11-27
### Differences V3
The what3words API has been updated to V3 with the benefits of a simplified interface and new functionality.
AutoSuggest has been greatly simplified and now features powerful new country clipping. Error handling has been improved for v3, making it easier and more robust to use v3.
With the release of V3 of the what3words API, V2 of the API is now officially *deprecated*, though V2 and V3 will continue to run in parallel for some time.
## 1. Resource names
To bring consistency to our function names across all our offline SDKs and our online API, the v2 API resource names have changed in v3, as follows:
- `forward` is now `convert-to-coordinates`
- `reverse` is now `convert-to-3wa`
- `grid` is now `grid-section`
- `languages` is now `available-languages`
- `autosuggest`, `voice-autosuggest`, `standardblend` and `voice-standardblend` has been greatly simplified and combined into one v3 function: `autosuggest`
In many cases, the parameters have changed. Please refer to [the v3 API Reference Docs.](https://developer.what3words.com/public-api/docs/)
## 2. Standardblend
The Standardblend resource has been removed but the functionality can be easily replicated within the unified autosuggest function.
To implement in v3 call `autosuggest` with `n-focus-results=1`. This replicates the V2 `standardblend` behaviour, which was to have one focussed result, and the rest unfocussed.
## 3. API response formats
By default, V2 of the API returns a payload in JSON; optional format types of GeoJSON is also supported. Due to low usage, JSONP and XML are no longer supported.
## 4. HTTP status codes and API error codes
V3 of the API now uses appropriate HTTP status code. It returns a `200` on success. For more details see [here](https://developer.what3words.com/public-api/docs/#error-handling).
---
# Migrating Android API Wrapper from version 3.x. to 4.x
This guide helps developers transition from version 3.x to 4.x with clear examples and detailed references.
Topics: Android, Server and Scripting
Section: [API & SDK Reference](https://developer.what3words.com/docs/api-sdk-reference.md) > [API Wrappers](https://developer.what3words.com/docs/api-sdk-reference/api-wrappers.md)
Source: https://developer.what3words.com/tutorial/migrating-android-api-wrapper-from-version-3-x-to-4-x
Updated: 2026-11-27
In version 4.0, the Android API Wrapper library changed significantly. This guide will help you gradually adapt your existing code to the new wrapper.
**Note**:
- For users still using version 3.x, you can access the legacy Android tutorial [here](https://developer.what3words.com/tutorial/legacy-android).
- For users using version 4.x, you can access the latest Android tutorial [here](https://developer.what3words.com/tutorial/android).
## 1. Introduction to the Core Library
The core library establishes essential models and interfaces that maintain consistency across various other libraries. Significant changes have been made by substituting existing models with those from the core library. It is imperative to update your code accordingly to utilise these new models.
**Android v4 Tutorial**: For a comprehensive guide on using the latest version 4.x, see its tutorial [here](https://developer.what3words.com/tutorial/android).
### Model Replacements
| Android v3 models | Android v4 models |
| --- | --- |
| com.what3words.javawrapper.response.SuggestionWithCoordinates | com.what3words.core.types.domain.W3WSuggestion |
| com.what3words.javawrapper.request.AutosuggestOptions | com.what3words.core.types.options.W3WAutosuggestOptions |
| com.what3words.javawrapper.response.Coordinates | com.what3words.core.types.geometry.W3WCoordinates |
| com.what3words.javawrapper.response.Square | com.what3words.core.types.geometry.W3WRectangle |
| com.what3words.core.domain.language.W3WLanguage | com.what3words.core.types.language.W3WLanguage |
| com.what3words.javawrapper.request.BoundingBox | com.what3words.core.types.geometry.W3WRectangle |
| com.what3words.androidwrapper.voice.Microphone | com.what3words.core.datasource.voice.audiostream.W3WMicrophone |
## 2. Transition to W3WApiTextDataSource and W3WApiVoiceDataSource
The Android API Wrapper version 3 What3WordsV3 has been restructured into two distinct classes:
- **W3WApiTextDataSource**: Handles text-based tasks like address searching and conversions.
- **W3WApiVoiceDataSource**: Specialises in voice-based address suggestions.
For more information on version 4.x usage, see the latest tutorial [here](https://developer.what3words.com/tutorial/android).
## 3. Method Changes List
### convertToCoordinates
Converts a what3words address to coordinates.
**Android v3**
```kotlin
val wrapper = What3WordsV3(API_KEY, activityContext)
val result = wrapper.convertToCoordinates(words).execute()
```
**Parameters**:
- `words`: String (the what3words address to convert)
**Return**: ConvertToCoordinates (coordinates corresponding to the what3words address)
**Android v4**
```kotlin
val textDataSource = W3WApiTextDataSource.create(context, API_KEY)
val result = textDataSource.convertToCoordinates(words) // Must run on background thread
```
**Parameters**:
- `words`: String (the what3words address to convert)
**Return**: W3WResult (result containing the coordinates)
For more details and instructions, see [Convert to Coordinates Example](https://github.com/what3words/w3w-android-wrapper?tab=readme-ov-file#converttocoordinates-example).
### convertTo3wa
Converts coordinates to a what3words address.
**Android v3**
```kotlin
val wrapper = What3WordsV3(API_KEY, activityContext)
val result = wrapper.convertTo3wa(coordinates).execute()
```
**Parameters**:
- `coordinates`: Coordinates (latitude and longitude to convert)
**Return**: ConvertTo3WA (the corresponding what3words address)
**Android v4**
```kotlin
val textDataSource = W3WApiTextDataSource.create(context, API_KEY)
val result = textDataSource.convertTo3wa(coordinates, language) // Must run on background thread
```
**Parameters**:
- `coordinates`: W3WCoordinates (latitude and longitude to convert)
- `language`: W3WLanguage (the language for the what3words address)
**Return**: W3WResult (result containing the what3words address)
For more details and instructions, see [Convert to what3words Address Example](https://github.com/what3words/w3w-android-wrapper?tab=readme-ov-file#converttocoordinates-example).
### AutoSuggest
Provides address suggestions based on a partial or full what3words address.
**Android v3**
```kotlin
val wrapper = What3WordsV3(API_KEY, activityContext)
val result = wrapper.autosuggest(word).execute()
```
**Parameters**:
- `word`: String (the partial or full what3words address to get suggestions for)
**Return**: Autosuggest (list of suggested addresses)
**Android v4**
```kotlin
val textDataSource = W3WApiTextDataSource.create(context, API_KEY)
val result = textDataSource.autosuggest(word, options) // Must run on background thread
```
**Parameters**:
- `word`: String (the partial or full what3words address to get suggestions for)
- `options`: W3WAutosuggestOptions? (optional parameters to refine suggestions)
**Return**: W3WResult> (result containing the list of suggestions)
For more details and instructions, see [Autosuggest Example](https://github.com/what3words/w3w-android-wrapper?tab=readme-ov-file#autosuggest-example).
### availableLanguages
Fetches the list of available languages for what3words addresses.
**Android v3**
```kotlin
val wrapper = What3WordsV3(API_KEY, activityContext)
val result = wrapper.availableLanguages().execute()
```
**Return**: AvailableLanguages (set of supported languages)
**Android v4**
```kotlin
val textDataSource = W3WApiTextDataSource.create(context, API_KEY)
val result = textDataSource.availableLanguages() // Must run on background thread
```
**Return**: W3WResult> (result containing the set of supported languages)
For more details and instructions, see [Get Available Languages Example](https://github.com/what3words/w3w-android-wrapper?tab=readme-ov-file#availablelanguages-example).
### gridSection
Retrieves a section of the what3words address grid for a specified bounding box.
**Android v3**
```kotlin
val wrapper = What3WordsV3(API_KEY, activityContext)
val result = wrapper.gridSection(boudingBox).execute()
```
**Parameters**:
- `boundingBox`: BoundingBox (the area to get the grid section for)
**Return**: GridSection (section of the grid)
**Android v4**
```kotlin
val textDataSource = W3WApiTextDataSource.create(context, API_KEY)
val result = textDataSource.gridSection(boundingBox) // Must run on background thread
```
- **Parameters**:
- `boundingBox`: W3WRectangle (the area to get the grid section for)
- **Return**: W3WResult (result containing the section of the grid)
For more details and instructions, see [Grid Section Example](https://github.com/what3words/w3w-android-wrapper?tab=readme-ov-file#gridsection-example).
### Voice AutoSuggest
Provides address suggestions based on voice input.
**Android v3**
```kotlin
val wrapper = What3WordsV3(API_KEY, activityContext)
val result = wrapper.autosuggest(microphone, voiceLanguage)
.onSuggstions { suggestions ->
// Handle the suggestions
}
.onError { error ->
// Handle the error
}
```
**Parameters**:
- `microphone`: Microphone (the audio input device)
- `voiceLanguage`: String (the language for voice recognition)
**Return**:
- `suggestions`: List (list of suggested addresses)
- `error`: APIResponse.What3WordsError (error information)
**Android v4**
```kotlin
val voiceDataSource = W3WApiVoiceDataSource.create(API_KEY)
val result = voiceDataSource.autosuggest(
audioStream,
voiceLanguage,
options,
onSpeechDetected,
) { result ->
// Handle result
}
```
**Parameters**:
- `input`: W3WAudioStream (the audio input stream)
- `voiceLanguage`: W3WLanguage (the language for voice recognition)
- `options`: W3WAutosuggestOptions? (optional parameters to refine suggestions)
- `onSpeechDetected`: ((String) -> Unit)? (callback for speech detection)
**Return**:
- `result`: W3WResult> (result containing the list of suggestions)
For more details and instructions, see [Voice Autosuggest Example](https://github.com/what3words/w3w-android-wrapper?tab=readme-ov-file#w3wapivoicedatasource).
## 4. AutosuggestHelper
In the previous version, AutosuggestHelper relied on the Android API Wrapper v3 (What3WordsV3). Now, it has transitioned to using `W3WApiTextDataSource`.
**Android v3**
```kotlin
val what3words = What3WordsV3("YOUR_API_KEY_HERE", this)
val autosuggestHelper = AutosuggestHelper(what3words)
```
**Android v4**
```kotlin
val dataSource = W3WApiTextDataSource.create(context, "YOUR_API_KEY_HERE")
val autosuggestHelper = AutosuggestHelper(dataSource)
```
For more details and instructions, see [AutoSuggestHelper](https://github.com/what3words/w3w-android-wrapper?tab=readme-ov-file#using-autosuggesthelper-class).
---
# Mobile linking to the what3words app
Using intents and the custom URL scheme to open the what3words app at a location
Topics: Android, Objective-C, Swift, Mobile App
Section: [Guidelines & Support](https://developer.what3words.com/docs/guidelines-support.md)
Source: https://developer.what3words.com/tutorial/mobile-linking-to-the-what3words-app
Updated: 2026-11-27
### Step by step
The what3words mobile apps on Android and on iOS support the ability to allow your mobile app to send the user to the what3words app. You can either open the what3words app at the user’s current location or navigate directly to a 3 word address.
## 1. Android intents
In your Android app, you can create a request to send the user to the what3words app using an [`Intent`](https://developer.android.com/training/basics/intents/sending.html) .
**Android**
```java
Intent intent = packageManager.getLaunchIntentForPackage("com.what3words.android");
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse("w3w://show?threewords=daring.lion.race"));
startActivity(intent);
```
## 2. iOS URL Schemes
In your iOS app, you can create a request to send the user to the what3words app using a [URL scheme for inter-app communication](https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Inter-AppCommunication/Inter-AppCommunication.html).
**Objective-C**
```objective-c
NSURL *myURL = [NSURL URLWithString:@"w3w://show?threewords=index.home.raft"];
[[UIApplication sharedApplication] openURL:myURL]
```
**Swift**
```swift
if let url = URL(string: "w3w://show?threewords=fancy.duck.cloud") {
UIApplication.shared.open(url, options: [:]) {
(success) in print("Opened: \(success)")
}
}
```
## 3. Supported URIs
- To open the what3words app at the user’s current location, use the URI `w3w://show?currentlocation`.
- To navigate to a 3 word address in the what3words app, use the URI `w3w://show?threewords=[word.word.word]`, replacing `[word.word.word]` with a 3 word address and omitting the square brackets.
---
# Navigation
How to add what3words to a navigation app
Topics: Android, Java, Objective-C, Swift, Mobile App
Section: [Search Box](https://developer.what3words.com/docs/search-box.md) > [Enable Existing Search Box](https://developer.what3words.com/docs/search-box/enable-existing-search-box.md)
Source: https://developer.what3words.com/tutorial/navigation
Updated: 2026-11-27
### Step by step
The easiest way to add what3words to your navigation applications is to use one of what3words API wrapper libraries in [**Java**](https://developer.what3words.com/tutorial/android#get-an-api-key) and [**Kotlin**](https://developer.what3words.com/tutorial/android#get-an-api-key) for your Android apps or in [**Swift**](https://developer.what3words.com/tutorial/swift) for your iOS apps.
Follow our [UX guidelines](https://developer.what3words.com/tutorial/ux-guidelines) and these easy self-explanatory steps on how to integrate what3words into a navigation app.
## 1. Get a what3words API Key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Install API wrapper
To utilise our wrappers, you will first need to download the packages, from either [**Maven Central**](https://central.sonatype.com/artifact/com.what3words/w3w-android-wrapper) (or this [**GitHub page**](https://github.com/what3words/w3w-android-wrapper)) or through the [**Swift Package Manager**](https://swift.org/package-manager).
For full details on how to install and initialise the what3words wrappers, see the [**Swift**](https://developer.what3words.com/tutorial/swift) and [**Android**](https://developer.what3words.com/tutorial/android) wrapper tutorials.
**Note:** For Android integrations, we recommend using exclusively—either the what3words Android wrapper or the what3words Java wrapper.
The what3words Android wrapper essentially encompasses the functionality of the Java wrapper, offering additional features such as **voice capabilities** and the ability to manage **API key restrictions**.
The code snippets that we have added in this tutorial assume that you will be using the [what3words Android wrapper](https://developer.what3words.com/tutorial/android).
## 3. Add suggestions to the search bar
To aid user education, it is useful to add placeholder text in your app’s address search bar indicating to users that what3words addresses can be searched for.

what3words address entry encompasses:
- copy and paste a what3words address into the search bar (with or without the preceding `///`)
- detect when a user is typing in a what3words address and display intelligent suggestions using the what3words API’s AutoSuggest functionality (this will be covered in more detail at a later step)
The latter case requires utilising the RegEx function of our wrappers, to identify the what3words address pattern.
what3words Address Detection Example:
**Java**
```java
import com.what3words.javawrapper.What3WordsV3
String text = "index.home.raft"
if(What3WordsV3.isPossible3wa(text)){
System.out.println("Input is in the form of a three word address")
} else {
System.out.println("Input is NOT in the form of a three word address")
}
```
**Kotlin**
```kotlin
import com.what3words.javawrapper.What3WordsV3
val text = "index.home.raft"
if(What3WordsV3.isPossible3wa(text)){
println("Input is in the form of a three word address")
} else {
println("Input is NOT in the form of a three word address")
}
```
**Swift**
```swift
import W3WSwiftApi
import CoreLocation
let api = What3WordsV3(apiKey: "YourApiKey")
let text = "index.home.raft"
let matches = api.findPossible3wa(text: text)
for match in matches {
print(" Found:", match)
}
```
## 4. Enable calls to the API for suggestions
Once the user has entered the first letter of the final word of a what3words address, your app should call the what3words API to provide intelligent what3words address suggestions, using our API’s AutoSuggest endpoint. These results will be updated as the user continues entering the what3words address.
A highly important step in optimising the user experience is in contextualising the address suggestions to where the user is located. This can be done by supplying the API with the user’s device location, enabling the returned suggestions to be tailored to the user’s current location using an API call parameter called `focus`.
Similarly, if your service operates in a fixed country, you can use the `clip-to-country` parameter to restrict the returned suggestions to geographically relevant results.
AutoSuggest API Call Example:
**Java**
```java
import com.what3words.javawrapper.request.Coordinates
// Create optional options to fine-tune the autosuggest request
AutosuggestOptions options = AutosuggestOptions()
Coordinates focus = Coordinates(/*latitude:*/51.502,/*longitude:*/-0.12345)
options.setFocus(focus)
Autosuggest result = wrapper.autosuggest("filled.count.so").options(options).execute()
if (result.isSuccessful) {
System.out.println(result.suggestions.size)
} else {
System.out.println(resut.error.message)
}
```
**Kotlin**
```kotlin
import com.what3words.javawrapper.request.Coordinates
// Create optional options to fine-tune the autosuggest request
val options = AutosuggestOptions()
options.focus = Coordinates(/*latitude:*/51.502,/*longitude:*/-0.12345)
val result: Autosuggest= wrapper.autosuggest("filled.count.so").options(options).execute()
if (result.isSuccessful) {
println(result.suggestions.size)
} else {
println(result.error.message)
}
```
**Swift**
```swift
import W3WSwiftApi
import CoreLocation
let api = What3WordsV3(apiKey: "YourApiKey")
let coords = CLLocationCoordinate2D(latitude: 51.4243877, longitude: -0.34745)
api.autosuggest(text: "index.raft.ho", options: W3WOptions().focus(coords)) { (suggestions, error) in
print(suggestions ?? [])
}
```
## 5. Displaying AutoSuggest results
As the user types the final word of the what3words address, you can show 3 AutoSuggest results with each keystroke; offering intelligent address suggestions to the user, and expediting the entry of the correct address.
There are three components to effectively displaying a what3words address suggestion:
- three slashes preceding the what3words address (e.g. `///filled.count.soap`)
- the nearest place listed alongside the address suggestion (given as `nearestPlace` in the API response)
- distance from the user to the suggested address location (this is given by the `distanceToFocusKm` result in the API AutoSuggest response)
Collectively, the final two points help provide the suggested address’ location context to the user, and the first signifies that the suggested address is a what3words address, not a traditional street address.

## 6. Validate what3words and get coordinates
Once the user has selected the desired what3words address from the list of suggestions, it needs to be converted into standard GPS coordinates to then plot the point on the map using your standard POI marker, enable route calculation, or display travel options.

To do this, use the `convertToCoordinates` wrapper function. An example of doing this using our mobile wrappers is given below:
**Java**
```java
String selectedSuggestion = "filled.count.soap"
ConvertToCoordinates result = wrapper.convertToCoordinates(selectedSuggestion)
if (result.isSuccessful) {
System.out.println("Coordinates: ${result.coordinates.lat}, ${result.coordinates.lng}")
} else {
System.out.println(result.error.message)
}
```
**Kotlin**
```kotlin
String selectedSuggestion = "filled.count.soap"
ConvertToCoordinates result = wrapper.convertToCoordinates(selectedSuggestion)
if (result.isSuccessful) {
System.out.println("Coordinates: ${result.coordinates.lat}, ${result.coordinates.lng}")
} else {
System.out.println(result.error.message)
}
```
**Swift**
```swift
val selectedSuggestion = "filled.count.soap"
val result: ConvertToCoordinates = wrapper.convertToCoordinates(selectedSuggestion).execute()
if (result.isSuccessful) {
println("Coordinates: ${result.coordinates.lat}, ${result.coordinates.lng}")
} else {
println(result.error.message)
}
```
### Development Checklist
### API Sign Up & Library Installation
- Created an API key for the what3words API;
- The packages have been loaded correctly, and the API initialised according to the relevant wrapper guidance.
### Address Search
- Placeholder text in the search bar educates the user on the ability to enter what3words addresses;
- The keyboard displays the full stop on the first screen shown to the user;
- Check if the keyboard supports all enabled languages;
- Up until the final word of the what3words address is entered, traditional destination options are returned;
- Once the final word begins to be entered, what3words results are shown.
### AutoSuggest
### API Parameters
- Focus is enabled;
- Other parameters, such as clipping, or language settings, are enabled (if applicable).
### Front End
- Results update live with each keystroke;
- Three what3words address suggestions are displayed per keystroke;
- Nearest place information (either ours or via an alternative source) is displayed alongside distance from the user;
- /// is affixed to the address (e.g. ///filled.count.soap vs. filled.count.soap);
- If there is use of what3words brand assets, they must be the current versions;
- Correct localisation of copy for non-English languages (e.g. distances stated in kilometers or miles).
### Contact Support
### Have any questions?
We’re here to support you! If you have any questions while using what3words for Excel, get in touch with us by writing us an email at [support@what3words.com](mailto:support@what3words.com).
---
# Objective-C
Getting started with the what3words Objective-C API wrapper.
Topics: Objective-C, Mobile App, Server and Scripting
Section: [API & SDK Reference](https://developer.what3words.com/docs/api-sdk-reference.md) > [API Wrappers](https://developer.what3words.com/docs/api-sdk-reference/api-wrappers.md)
Source: https://developer.what3words.com/tutorial/objective-c
Updated: 2026-11-27
The Objective-C wrapper is useful for Objective-C developers who wish to seamlessly integrate the [what3words Public API](https://docs.what3words.com/api/v3/) into their Objective-C applications, without the hassle of having to manage the low level API calls themselves.
Full sample apps for the wrapper can be found in our Github repo
[iOS Sample Apps](https://github.com/what3words/w3w-swift-samples)
## 1. Get API key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Installation
You can install the [what3Words API V3 Objective-C Wrapper](https://github.com/what3words/w3w-objectivec-wrapper) into your project using CocoaPods, or Carthage (see the package manager code below).
Find out more on this repository
[Objective-C Wrapper](https://github.com/what3words/w3w-objectivec-wrapper)
**Objective-C**
```objective-c
platform :ios, '9.0'
use_frameworks!
target 'MyApp' do
pod 'what3words', :git => 'https://github.com/what3words/w3w-objectivec-wrapper.git'
end
```
Carthage:
**Objective-C**
```objective-c
github "what3words/w3w-objectivec-wrapper"
```
For manual installation, `Drop the [W3wGeocoder.m](https://github.com/what3words/w3w-objectivec-wrapper/blob/master/Sources/W3wGeocoder.m) and [W3wGeocoder.h](https://github.com/what3words/w3w-objectivec-wrapper/blob/master/Sources/W3wGeocoder.h) file into your project.`
## 3. Setup
Use these header files:
**Objective-C**
```objective-c
#import "W3wGeocoder.h"
#import
```
Or, if you are using Carthage:
**Objective-C**
```objective-c
#import
#import
```
## 4. Initialise
First create a W3wGeocoder object:
**Objective-C**
```objective-c
W3wGeocoder *api = [[W3wGeocoder alloc] initWithApiKey:@""];
```
## 5. Usage
### Convert to what3words address
This function converts coordinates (expressed as latitude and longitude) to a what3words address. It takes the latitude and longitude as a [CLLocationCoordinate2D](https://developer.apple.com/documentation/corelocation/cllocationcoordinate2d?language=swift) object.
More information about `ConvertTo3wa`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#convert-to-3wa).
Find the words for (`51.520847, -0.195521`):
**Objective-C**
```objective-c
CLLocationCoordinate2D coordinates = CLLocationCoordinate2DMake(51.520847, -0.195521);
[api convertTo3wa:coordinates completion:^(W3wPlace *place, W3wError *error)
{
NSLog(@"%@", place.words);
}];
```
### Convert to coordinates
This function converts a what3words address to a position, expressed as coordinates of latitude and longitude.
It takes the words parameter as a string of a what3words `'table.book.chair'`
More information about `ConvertToCoordinates`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#convert-to-coordinates).
Find the words for `///filled.count.soap`:
**Objective-C**
```objective-c
[api convertToCoordinates:@"filled.count.soap" format:JSON completion:^(W3wPlace *place, W3wError *error)
{
NSLog(@"Coordinates are: (%f, %f)", place.coordinates.latitude, place.coordinates.longitude);
}];
```
### AutoSuggest
When presented with a what3words address which may be incorrectly entered, AutoSuggest returns a list of potential correct 3 word addresses. It needs the first two words plus at least the first character of the third word to produce suggestions.
This method provides corrections for mis-typed words (including plural VS singular), and words being in the wrong order.
Optionally, clipping can narrow down the possibilities, and limit results to:
- One or more countries
- A geographic area (a circle, box or polygon)
This dramatically improves results, so we recommend that you use clipping if possible.
To improve results even further, set the `Focus` to user’s current location. This returns an `Array?` of `W3wSuggestion` objects.
More information about `AutoSuggest`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#autosuggest).
**Code example** Simple basic call:
**Objective-C**
```objective-c
[api autosuggest:@"geschaft.planter.carciofi" completion:^(NSArray *suggestions, W3wError *error)
{
W3wSuggestion *first_match = suggestions[0];
NSLog(@"%@", first_match.words);
}];
```
**Code example** AutoSuggest, clipping the results returned to Germany:
**Objective-C**
```objective-c
[api autosuggest:@"geschaft.planter.carciofi" parameters:@[[AutoSuggestOption clipToCountry:@"DE"], [AutoSuggestOption numberResults:4]] completion:^(NSArray *suggestions, W3wError *error)
{
W3wSuggestion *first_match = suggestions[0];
NSLog(@"%@", first_match.words);
}];
```
**Code example** Focus on (51.4243877,-0.34745)
**Objective-C**
```objective-c
[api autosuggest:@"fun.with.code" parameters:@[[AutoSuggestOption focus:CLLocationCoordinate2DMake(51.4243877, -0.3474524)], [AutoSuggestOption numberResults:6]] completion:^(NSArray *suggestions, W3wError *error)
{
W3wSuggestion *first_match = suggestions[0];
NSLog(@"%@", first_match.words);
}];
```
**Code example** AutoSuggest, with Generic Voice input type.
**Objective-C**
```objective-c
[api autosuggest:@"fun with code" parameters:@[[AutoSuggestOption fallBackLanguage:@"EN"], [AutoSuggestOption inputType:GENERIC_VOICE]] completion:^(NSArray *suggestions, W3wError *error)
{
W3wSuggestion *first_match = suggestions[0];
NSLog(@"%@", first_match.words);
}];
```
### Grid section
Grid section returns a section of the what3words 3m x 3m grid as a set of horizontal and vertical lines covering the requested area, which can then be drawn onto a map.
The requested box must not exceed 4km from corner to corner, or a `BadBoundingBoxTooBig` error will be returned.
More information about `GridSection`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#grid-section).
Get a grid for `52.207988,0.116126`) in the south west, and `52.208867,0.117540` in the north east:
**Objective-C**
```objective-c
[api gridSection:52.208867 west_lng:0.117540 north_lat:52.207988 east_lng:0.116126 format:JSON completion:^(NSArray *grid, W3wError *error)
{
W3wLine *first_line = grid[0];
NSLog(@"First line goes from (%.5f,%.5f) to (%.5f,%.5f)", first_line.start.latitude, first_line.start.longitude, first_line.end.latitude, first_line.end.longitude);
}];
```
### Available languages
This function returns the currently supported languages. It will return the two letter code, and the name of the language both in that language and in English.
More information about `AvailableLanguages`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#available-languages).
**Objective-C**
```objective-c
[api availableLanguages:^(NSArray *languages, W3wError *error)
{
W3wLanguage *language = languages[0];
NSLog(@"First language returned: %@", language.name);
}];
```
### Handling errors
All functions call the completion block with error as the second parameter. Be sure to check it for possible problems.
**Objective-C**
```objective-c
[api convertToCoordinates:@"aaaa.bbbb.cccc" format:JSON completion:^(W3wPlace *result, W3wError *error)
{
if (error)
NSLog(@"There was an %@ error: %@", error.code, error.message);
}];
```
## 6. Troubleshooting
If you encounter errors or issues related to convert-to-coordinate, convert-to-3wa and grid-section requests while using the Free plan, please check the network panel for the following error message `Error 402 payment required` and its response, indicating the need to upgrade to a higher plan:
**JSON**
```json
{
"error": {
"code": "QuotaExceeded",
"message": "Quota exceeded or API plan does not have access to this feature. Please change your plan at https://accounts.what3words.com/select-plan, or contact support@what3words.com"
}
}
```
For more information, visit our [API plans page](https://accounts.what3words.com/select-plan). If you need further assistance, contact [support@what3words.com](mailto:support@what3words.com).
## 7. Full example
Complete example using AutoSuggest to find a location.
**Objective-C**
```objective-c
#import "W3wGeocoder.h"
#import
W3wGeocoder *api = [[W3wGeocoder alloc] initWithApiKey:@""];
AutoSuggestOption *france = [AutoSuggestOption clipToCountry:@"FR"];
AutoSuggestOption *place = [AutoSuggestOption focus:CLLocationCoordinate2DMake(48.856618, 2.3522411)];
AutoSuggestOption *count = [AutoSuggestOption numberResults:10];
[api autosuggest:@"hangry.selfie.x" parameters:@[france, place, count] completion:^(NSArray *suggestions, W3wError *error)
{
if (error)
NSLog(@"There was an %@ error: %@", error.code, error.message);
else
{
NSLog(@"Suggestions Returned:");
for (W3wSuggestion *suggestion in suggestions)
{
NSLog(@"%@ is near %@", suggestion.words, suggestion.nearestPlace);
}
}
}];
```
---
# Partner API Docs
The what3words Partner API allows Partners to create and manage what3words API keys programmatically.
Section: [API & SDK Reference](https://developer.what3words.com/docs/api-sdk-reference.md)
Source: https://developer.what3words.com/tutorial/partner-api-docs-what3words
Updated: 2025-11-14
The what3words Partner API allows Partners to create and manage what3words API keys programmatically. The following tasks can be performed using the Partner API
1. Create an API key
2. Get a list of all of an accounts API keys
3. Change status of an API key (disable/enable)
## 1. Get Started
- Create a what3words account by signing up to a plan
You will need a what3words API key to complete this tutorial [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
- Contact your account manager to request access to the Partner API
- Once enabled, obtain your Partner API key from your account manager
- Use your Partner API key in requests to the API
### Tips
1. Use HTTPS GET, POST and PATCH methods only
2. Remember to always URL encode your parameters
3. Always include a valid Partner API key in the key=\[YOUR\_API\_KEY\] parameter
### Authentication
The what3words Partner API uses [API keys](https://accounts.what3words.com/overview) to authenticate requests. Partner API Keys differ from keys for our main API with keys being 12 characters and prefixed “PK”.
All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Calls made over HTTP will fail. API requests without authentication will also fail.
### Error handling
If all went well, you will get a **200 HTTP** status code. If something went wrong, such as trying `application` POST without a key you will get the appropriate HTTP error status (403 in this case). Also, the body will contain a `message_code` which can be used programmatically so you can respond appropriately. `message` is intended as a helpful message to help you understand how to fix what went wrong.
### Response Codes
1. **200 OK**: The client application has been successfully linked with the partner application.
2. **400 Bad Request**: There was an issue with the request, typically due to:
- Missing partner api key `key` in the request query
- The provided `key` is not a partner application or it has been suspended
- Missing client api key `client_api_key` in the request body
- The provided `client_api_key` has already been linked.
**Response**
```json
{
"message_code": 894,
"message": "Client key not provided"
}
```
## 2. POST application
Create a what3words API key for use in an application. The key can then be used to make requests to the what3words Main API. A key can be created for each end client and can be used as a way to segment usage. When creating a new key the request must specify a name and description to identify the key.
**cURL**
```shellscript
curl --location --request POST 'https://accountsapi.what3words.com/partner/v1/application?key=PK2D3j230291' \
--header 'Content-Type: application/json' \
--data-raw '{"name": "name of app", "description": "description of app"}'
```
### Resource URL
[https://accountsapi.what3words.com/partner/v1/application](https://accountsapi.what3words.com/partner/v1/application)
### Parameters
| Parameters | Required/Optional | Description | Example |
| --- | --- | --- | --- |
| key | Required | Partner API key | key=PK2D3J230291 |
### Request body
| Request Body | Required/Optional | Description | Example |
| --- | --- | --- | --- |
| name | Required | Name of API key. Could be the account name or an ID. | "name": "My app" |
| description | Required | Description of API key. Could be the account name or an ID or type of account | "description": "My test app" |
### Example Request
#### POST
- [https://accountsapi.what3words.com/partner/v1/application?key=PK2D3J230291](https://accountsapi.what3words.com/partner/v1/application?key=PK2D3j230291)
- `{"name": "name of app", "description": "description of app"}`
### Example Result
**JSON**
```json
{
"api_key": "PG122LFC4W98",
"name": "name of app",
"description": "description of app",
"suspended": false
}
```
## 3. GET application
Obtain either one or all of the API keys connected to your partner account. Pass in a key to the request to return just a specific key details. The response will return the name and description of the key, along with it’s status (enabled/disabled).
**cURL**
```shellscript
curl --location --request GET 'https://accountsapi.what3words.com/partner/v1/application?key=PK2D3j230291&page=1&per_page=10'
```
### Resource URL
[https://accountsapi.what3words.com/partner/v1/application](https://accountsapi.what3words.com/partner/v1/application)
### Parameters
| Parameters | Required/Optional | Description | Example |
| --- | --- | --- | --- |
| key | Required | Partner API key | key=PK2D3J230291 |
| api\_key | Optional | API key | api\_key=LFC4W98R |
### Example Request
#### GET
- [https://accountsapi.what3words.com/partner/v1/application?key=PK2D3J230291&page=1&per\_page=10](https://accountsapi.what3words.com/partner/v1/application?key=PK2D3j230291&page=1&per_page=10)
### Example Result
**JSON**
```json
{
"message": "OK",
"page": 1,
"per_page": 10,
"total": 3,
"applications": [
{
"api_key": "D0O8DQAR",
"name": "app1",
"description": "desc1",
"suspended": false
},
{
"api_key": "U8KB3NZR",
"name": "app2",
"description": "desc2",
"suspended": false
},
{
"api_key": "LFC4W98R",
"name": "app3",
"description": "desc3",
"suspended": false
}
]
}
```
## 4. PATCH application
Enable or disable an API key. Disabling a key prevents the application from being able to make requests to the what3words Main API.
**cURL**
```shellscript
curl --location --request PATCH 'https://accountsapi.what3words.com/partner/v1/application?key=PK2D3j230291' \
--header 'Content-Type: application/json' \
--data-raw '{"suspended": false, "api_key": "PGLFC4W98R"}'
```
### Resource URL
[https://accountsapi.what3words.com/partner/v1/application](https://accountsapi.what3words.com/partner/v1/application)
### Parameters
| Parameters | Required/Optional | Description | Example |
| --- | --- | --- | --- |
| key | Required | Partner API key | key=PK2D3J230291 |
### Request body
| Request Body | Required/Optional | Description | Example |
| --- | --- | --- | --- |
| api\_key | Required | Key to be changed | "api\_key": "PGLFC4W98R" |
| suspended | Required | Suspended - true/false | "suspended": false |
### Example Request
#### PATCH
- https://accountsapi.what3words.com/partner/v1/application?key=PK2D3J230291
### Example Result
**JSON**
```json
{
"api_key": "PGLFC4W98R",
"name": "name of app",
"description": "description of app",
"suspended": false
}
```
## 5. POST application/link
Link an API key that was created “manually” (outside of the Partner API through accounts.what3words.com) to a Partner account for revenue share agreements.
**cURL**
```shellscript
curl --location --request POST 'https://accountsapi.what3words.com/partner/v1/application/link?key=PK2D3J230291' \
--header 'Content-Type: application/json' \
--data-raw '{"client_api_key": ""}'
```
### Resource URL
[https://accountsapi.what3words.com/partner/v1/application/link](https://accountsapi.what3words.com/partner/v1/application/link)
### Parameters
| Parameters | Required/Optional | Description | Example |
| --- | --- | --- | --- |
| key | Required | Partner API key | key=PK2D3J230291 |
### Request body
| Request Body | Required/Optional | Description | Example |
| --- | --- | --- | --- |
| client\_api\_key | Required | API key created through accounts.what3words.com | { "client\_api\_key": "" } |
### Example Request
#### POST
- https://accountsapi.what3words.com/partner/v1/application/link?key= Content-Type: application/json { “client\_api\_key”: “” }
---
# PHP
Getting started with the what3words PHP API wrapper.
Topics: PHP, Server and Scripting, Website
Section: [API & SDK Reference](https://developer.what3words.com/docs/api-sdk-reference.md) > [API Wrappers](https://developer.what3words.com/docs/api-sdk-reference/api-wrappers.md)
Source: https://developer.what3words.com/tutorial/php
Updated: 2026-11-27
The PHP wrapper is useful for PHP developers who wish to seamlessly integrate the [what3words Public API](https://docs.what3words.com/api/v3/) into their PHP applications, without the hassle of having to manage the low level API calls themselves.
A full example of how to integrate the what3words PHP wrapper is available in our
[PHP Github repository](https://github.com/what3words/w3w-php-wrapper)
## 1. Get API key
You will need this API key for your installation. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Installation
Use [Composer](https://getcomposer.org/) to integrate this library into your project, or do it manually.
Composer:
**PHP**
```php
{
“require”: {
“what3words/w3w-php-wrapper”: "3.*"
}
}
```
Manually:
Add this file to your project: `[Geocoder.php](https://github.com/what3words/w3w-php-wrapper/blob/master/src/Geocoder.php).`
## 3. Setup
If you manually dropped in the file then use `require_once("Geocoder.php")` instead of `require_once("vendor/autoload.php")`
**PHP**
```php
require_once("vendor/autoload.php");
use What3words\Geocoder\Geocoder;
use What3words\Geocoder\AutoSuggestOption;
```
## 4. Initialise
Initialise the what3words API client in your PHP script.
**PHP**
```php
require_once("vendor/autoload.php");
use What3words\Geocoder\Geocoder;
use What3words\Geocoder\AutoSuggestOption;
$api = new Geocoder("");
```
## 5. Usage
### Convert to what3words address
This function converts coordinates (expressed as latitude and longitude) to a what3words address.
More information about `ConvertTo3wa`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#convert-to-3wa).
Find the words for (`51.484463, -0.195405`):
**PHP**
```php
$result = $api->convertTo3wa(51.484463, -0.195405);
print_r($result);
```
### Convert to coordinates
This function converts a what3words address to a position, expressed as coordinates of latitude and longitude.
It takes the words parameter as a string of a what3words `'table.book.chair'`
More information about `ConvertToCoordinates`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#convert-to-coordinates).
Find the words for `///filled.count.soap`:
**PHP**
```php
$result = $api->convertToCoordinates("filled.count.soap");
print_r($result);
```
### AutoSuggest
When presented with a what3words address which may be incorrectly entered, AutoSuggest returns a list of potential correct 3 word addresses. It needs the first two words plus at least the first character of the third word to produce suggestions.
This method provides corrections for mis-typed words (including plural VS singular), and words being in the wrong order.
Optionally, clipping can narrow down the possibilities, and limit results to:
- One or more countries
- A geographic area (a circle, box or polygon)
This dramatically improves results, so we recommend that you use clipping if possible.
To improve results even further, set the `Focus` to user’s current location. This will make `AutoSuggest` return results which are closer to the user.
More information about `AutoSuggest`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#autosuggest).
**Code example** Simple basic call:
**PHP**
```php
$result = $api->autosuggest("fun.with.code");
print_r($result);
```
**Code example** AutoSuggest, clipping the results returned to the United Kingdom and Belgium:
**PHP**
```php
$result = $api->autosuggest("fun.with.code", [AutoSuggestOption::clipToCountry("GB","BE")]);
print_r($result);
```
**Code example** AutoSuggest, Focus on (`51.4243877,-0.34745`).
**PHP**
```php
$result = $api->autosuggest("fun.with.code", [AutoSuggestOption::focus(51.4243877,-0.34745));
print_r($result);
```
**Code example** AutoSuggest, with Generic Voice input type.
**PHP**
```php
$result = $api->autosuggest("fun.with.code", [AutoSuggestOption::fallbackLanguage("EN"), AutoSuggestOption::inputType("generic-voice")]);
print_r($result);
```
### Grid section
Grid section returns a section of the what3words 3m x 3m grid as a set of horizontal and vertical lines covering the requested area, which can then be drawn onto a map.
The requested box must not exceed 4km from corner to corner, or a `BadBoundingBoxTooBig` error will be returned.
More information about `GridSection`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#grid-section).
Get a grid for `52.207988,0.116126`) in the south west, and `52.208867,0.117540` in the north east:
**PHP**
```php
$result = $api->gridSection(52.207988,0.116126, 52.208867,0.117540);
print_r($result);
```
### Available languages
This function returns the currently supported languages. It will return the two letter code, and the name of the language both in that language and in English.
More information about `AvailableLanguages`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#available-languages).
**PHP**
```php
$result = $api->availableLanguages();
print_r($result);
```
### Handling errors
Errors returned from the API can be caught with the wrapper through the use of a `catch` function.
Within the `catch` function, `code` and `message` values which represent the error, are accessible from the `error` object parameter.
**PHP**
```php
$result = $api->convertToCoordinates("garbage.input");
if ($result == false)
{
$error = $api->getError();
print "Error with code " . $error["code"] . ": ";
print $error["message"] . ":\n";
exit();
}
```
## 6. RegEx Functions
This section introduces RegEx functions that can assist with checking and finding possible what3words addresses in strings. The three main functions covered are:
- `isPossible3wa` – Match what3words address format;
- `isValid3wa` – Verify a what3words address with the API;
### isPossible3wa
Our API wrapper RegEx function “`isPossible3wa`” can be used to detect if a text string (like “`filled.count.soap`“) in the format of a what3words address without having to ask the API. This functionality checks if a given string could be a what3words address. It returns **true** if it could be, otherwise **false**.
**Note**: This function checks the text format but not the validity of a what3words address. Use `isValid3wa` to verify validity.
**PHP**
```php
isPossible3wa($address);
echo "Is '{$address}' a possible what3words address? " . ($isPossible ? "true" : "false") . "\n";
}
}
main();
?>
```
#### Expected Output
- isPossible3wa(“filled.count.soap”) returns `true`
- isPossible3wa(“not a 3wa”) returns `false`
- isPossible3wa(“not.3wa address”)returns `false`
### isValid3wa
Our API wrapper RegEx function “`isValid3wa`” can be used to determine if a string is a valid what3words address by checking it against the what3words RegEx filter and verifying it with the what3words API.
**PHP**
```php
isValid3wa($address);
echo "Is '$address' a valid what3words address? " . ($isValid ? 'True' : 'False') . "\n";
}
}
main();
```
#### Expected Outputs
- isValid3wa(“filled.count.soap”) returns `True`
- isValid3wa(“filled.count.”) returns `False`
- isValid3wa(“coding.is.cool”) returns `False`
Also, make sure to replace `` with your actual API key. These functionalities provide different levels of validation for what3words addresses, from simply identifying potential addresses to verifying their existence on Earth.
## 7. Troubleshooting
If you encounter errors or issues related to convert-to-coordinate, convert-to-3wa and grid-section requests while using the Free plan, please check the network panel for the following error message `Error 402 payment required` and its response, indicating the need to upgrade to a higher plan:
**JSON**
```json
{
"error": {
"code": "QuotaExceeded",
"message": "Quota exceeded or API plan does not have access to this feature. Please change your plan at https://accounts.what3words.com/select-plan, or contact support@what3words.com"
}
}
```
For more information, visit our [API plans page](https://accounts.what3words.com/select-plan). If you need further assistance, contact [support@what3words.com](mailto:support@what3words.com).
## 8. Full example
Complete Composer convert to 3 word address example:
**PHP**
```php
");
$options = [
AutoSuggestOption::clipToCountry("FR"),
AutoSuggestOption::focus(48.856618, 2.3522411),
AutoSuggestOption::numberResults(1)
];
$result = $api->autosuggest("inder.dweii.coo", $options);
if ($result)
{
print "Top 3 word address match: " . $result["suggestions"][0]["words"];
print " in " . $result["suggestions"][0]["nearest-place"] . "\n";
}
else
print "Error with code " . $error["code"] . ": " . $error["message"] . ":\n";
?>
```
---
# Python
Getting started with the what3words Python API wrapper.
Topics: Python, Server and Scripting
Section: [API & SDK Reference](https://developer.what3words.com/docs/api-sdk-reference.md) > [API Wrappers](https://developer.what3words.com/docs/api-sdk-reference/api-wrappers.md)
Source: https://developer.what3words.com/tutorial/python
Updated: 2026-11-27
The Python wrapper is useful for Python developers who wish to seamlessly integrate the [what3words Public API](https://docs.what3words.com/api/v3/) into their Python applications, without the hassle of having to manage the low level API calls themselves.
A full example of how to integrate the what3words Python wrapper is available in our
[Python Github repository](https://github.com/what3words/w3w-python-wrapper)
## 1. Get API key
You will need this API key for your installation. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Installation
The library is available through [PyPi](https://pypi.org/project/what3words/). To install what3words, simply:
**Python**
```python
pip install what3words
```
## 3. Setup
You need to import the library
**Python**
```python
import what3words
```
## 4. Initialise
By default, the wrapper will point to the public version of the what3words API. However, if required, the wrapper can be configured to point to a custom endpoint, for example a locally running version of the API. In this case an optional `end_point` parameter can be passed to the `what3words.Geocoder` constructor.
**Python**
```python
# Using the Public API:
geocoder = what3words.Geocoder("what3words-api-key")
```
**Python**
```python
# Using the API Server:
geocoder = what3words.Geocoder("what3words-api-key", end_point='http://localhost:8080/v3')
```
## 5. Usage
### Convert to what3words address
This function converts coordinates (expressed as latitude and longitude) to a what3words address.
More information about `ConvertTo3wa`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#convert-to-3wa).
Find the words for (`51.484463, -0.195405`):
**Python**
```python
res = geocoder.convert_to_3wa(what3words.Coordinates(51.484463, -0.195405))
print(res)
```
### Convert to coordinates
This function converts a what3words address to a position, expressed as coordinates of latitude and longitude.
It takes the words parameter as a string of a what3words `'table.book.chair'`
More information about `ConvertToCoordinates`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#convert-to-coordinates).
Find the words for `///prom.cape.pump`:
**Python**
```python
res = geocoder.convert_to_coordinates('prom.cape.pump')
print(res)
```
### AutoSuggest
When presented with a what3words address which may be incorrectly entered, AutoSuggest returns a list of potential correct 3 word addresses. It needs the first two words plus at least the first character of the third word to produce suggestions.
This method provides corrections for mis-typed words (including plural VS singular), and words being in the wrong order.
Optionally, clipping can narrow down the possibilities, and limit results to:
- One or more countries
- A geographic area (a circle, box or polygon)
This dramatically improves results, so we recommend that you use clipping if possible.
To improve results even further, set the `Focus` to user’s current location. This will make `AutoSuggest` return results which are closer to the user.
More information about `AutoSuggest`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#autosuggest).
**Code example** Simple basic call:
**Python**
```python
res = geocoder.autosuggest('filled.count.soap')
print(res)
```
**Code example** AutoSuggest, clipping the results returned to the United Kingdom and Belgium:
**Python**
```python
res = geocoder.autosuggest('filled.count.soap', clip_to_country="GB,BE")
print(res)
```
**Code example** AutoSuggest, Focus on (`51.4243877,-0.34745`).
**Python**
```python
res = geocoder.autosuggest('filled.count.soap', \
focus=what3words.Coordinates(51.4243877,-0.34745))
print(res)
```
**Code example** AutoSuggest, with Generic Voice input type.
**Python**
```python
res = geocoder.autosuggest('fun with code', input_type='generic-voice', language='en')
print(res)
```
### Grid section
Grid section returns a section of the what3words 3m x 3m grid as a set of horizontal and vertical lines covering the requested area, which can then be drawn onto a map.
The requested box must not exceed 4km from corner to corner, or a `BadBoundingBoxTooBig` error will be returned.
More information about `GridSection`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#grid-section).
Get a grid for `52.207988,0.116126`) in the south west, and `52.208867,0.117540` in the north east:
**Python**
```python
sw = what3words.Coordinates(52.207988,0.116126)
ne = what3words.Coordinates(52.208867,0.117540)
bb = what3words.BoundingBox(sw, ne)
res = geocoder.grid_section(bb)
print(res)
```
### Available languages
This function returns the currently supported languages. It will return the two letter code, and the name of the language both in that language and in English.
More information about `AvailableLanguages`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#available-languages).
**Python**
```python
res = geocoder.available_languages()
print(res)
```
### Handling errors
Errors returned from the API can be caught with the wrapper through the use of a `catch` function.
Within the `catch` function, `code` and `message` values which represent the error, are accessible from the `error` object parameter
**Python**
```python
autosuggest = geocoder.autosuggest('freshen.overlook.clo', clip_to_country="FR")
if 'error' in autosuggest: # An error has been returned from the API
code = autosuggest['error']['code']
message = autosuggest['error']['message']
print (code, message)
```
## 6. RegEx Functions
This section introduces RegEx functions that can assist with checking and finding possible what3words addresses in strings. The three main functions covered are:
- `is_possible_3wa` – Match what3words address format;
- `is_valid_3wa` – Verify a what3words address with the API;
### is\_possible\_3wa
Our API wrapper RegEx function “`is_possible_3wa`” can be used to detect if a text string (like “`filled.count.soap`“) in the format of a what3words address without having to ask the API. This functionality checks if a given string could be a what3words address. It returns **true** if it could be, otherwise **false**.
**Note**: This function checks the text format but not the validity of a what3words address. Use `is_valid_3wa` to verify validity.
**Python**
```python
import what3words
def main():
# Initialize the What3Words API with your API key
api_key = 'YOUR_API_KEY'
w3w = what3words.Geocoder(api_key)
# Example what3words addresses
addresses = ["filled.count.soap", "not a 3wa", "not.3wa address"]
# Check if the addresses are possible what3words addresses
for address in addresses:
is_possible = w3w.is_possible_3wa(address)
print(f"Is '{address}' a possible what3words address? {is_possible}")
if __name__ == "__main__":
main()
```
#### Expected Output
- is\_possible\_3wa(“filled.count.soap”) returns `true`
- is\_possible\_3wa(“not a 3wa”) returns `false`
- is\_possible\_3wa(“not.3wa address”)returns `false`
### is\_valid\_3wa
Our API wrapper RegEx function “`is_valid_3wa`” can be used to determine if a string is a valid what3words address by checking it against the what3words RegEx filter and verifying it with the what3words API.
**Python**
```python
import what3words
def main():
# Initialize the what3words API with your API key
api_key = 'YOUR_API_KEY'
w3w = what3words.Geocoder(api_key)
# Example addresses
addresses = [
"filled.count.soap",
"filled.count.",
"coding.is.cool"
]
# Check if the addresses are valid what3words addresses
for address in addresses:
is_valid = w3w.is_valid_3wa(address)
print(f"Is '{address}' a valid what3words address? {is_valid}")
if __name__ == "__main__":
main()
```
#### Expected Outputs
- is\_valid\_3wa(“filled.count.soap”) returns `True`
- is\_valid\_3wa(“filled.count.”) returns `False`
- is\_valid\_3wa(“coding.is.cool”) returns `False`
Also, make sure to replace `` with your actual API key. These functionalities provide different levels of validation for what3words addresses, from simply identifying potential addresses to verifying their existence on Earth.
## 7. Troubleshooting
If you encounter errors or issues related to convert-to-coordinate, convert-to-3wa and grid-section requests while using the Free plan, please check the network panel for the following error message `Error 402 payment required` and its response, indicating the need to upgrade to a higher plan:
**JSON**
```json
{
"error": {
"code": "QuotaExceeded",
"message": "Quota exceeded or API plan does not have access to this feature. Please change your plan at https://accounts.what3words.com/select-plan, or contact support@what3words.com"
}
}
```
For more information, visit our [API plans page](https://accounts.what3words.com/select-plan). If you need further assistance, contact [support@what3words.com](mailto:support@what3words.com).
## 8. Full example
The example below takes the concepts described above, and turns some of them into a complete example. Here we take a partial 3 word address and pass it into AutoSuggest – clipping the results to consider only addresses in France, setting a focus of Paris, and returning a single result
We then take the result and convert the 3 word address to coordinates, and find the nearest place.
**Python**
```python
import what3words
from os import environ
geocoder = what3words.Geocoder("what3words-api-key")
autosuggest = geocoder.autosuggest('freshen.overlook.clo', \
clip_to_country="FR", \
focus=what3words.Coordinates(48.856618, 2.3522411), \
n_results=1, \
)
if 'error' in autosuggest: # An error has been returned from the API
code = autosuggest['error']['code']
message = autosuggest['error']['message']
print (code, message)
else:
# Obtains the one, and only result from the returned list of suggestions
words = autosuggest['suggestions'][0]['words']
print("Top 3 word address match: {}".format(words))
# Use the `convert_to_coordinates` API to convert the returned 3 word address into coordinates
convert_to_coordinates = geocoder.convert_to_coordinates(words)
print("WGS84 Coordinates: {}, {}".format( \
convert_to_coordinates['coordinates']['lat'], \
convert_to_coordinates['coordinates']['lng']))
print("Nearest Place: {}".format(convert_to_coordinates['nearestPlace']))
```
---
# Ride-hailing Integration
How to add what3words to a Ride-hailing integration.
Topics: Android, Java, Swift, Mobile App
Section: [Search Box](https://developer.what3words.com/docs/search-box.md) > [Enable Existing Search Box](https://developer.what3words.com/docs/search-box/enable-existing-search-box.md)
Source: https://developer.what3words.com/tutorial/ride-hailing
Updated: 2026-11-27
### Step by Step
The easiest way to add what3words to your ride-hailing, web booking, and call booking applications is to use one of what3words API wrapper libraries in [**Java**](https://developer.what3words.com/tutorial/android#get-an-api-key) and [**Kotlin**](https://developer.what3words.com/tutorial/android#get-an-api-key) for your Android apps or in [**Swift**](https://developer.what3words.com/tutorial/swift) for your iOS apps.
Follow our [UX guidelines](https://developer.what3words.com/tutorial/ux-guidelines) and these easy self-explanatory steps on how to integrate what3words into a ride-hailing app.
## 1. Get API Key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Install API wrapper
To utilise our wrappers, you will first need to download the packages, from either [**Maven Central**](https://central.sonatype.com/artifact/com.what3words/w3w-android-wrapper) (or this [**GitHub page**](https://github.com/what3words/w3w-android-wrapper)) or through the [**Swift Package Manager**](https://swift.org/package-manager).
For full details on how to install and initialise the what3words wrappers, see the [**Swift**](https://developer.what3words.com/tutorial/swift) and [**Android**](https://developer.what3words.com/tutorial/android) wrapper tutorials.
**Note:** For Android integrations, we recommend using exclusively—either the what3words Android wrapper or the what3words Java wrapper.
The What3words Android wrapper essentially encompasses the functionality of the Java wrapper, offering additional features such as **voice capabilities** and the ability to manage **API key restrictions**.
The code snippets that we have added in this tutorial assume that you will be using the [what3words Android wrapper](https://developer.what3words.com/tutorial/android).
## 3. Add suggestions to the search bar
To offer the best user experience, enable users to enter a what3words address into an existing address search bar. The ability to do this is best communicated by placeholder text in the search bar prompting a user to enter a what3words address.

what3words address entry encompasses:
- copy and paste a what3words address into the search bar (with or without the preceding `///`);
- detect when a user is typing in a what3words address and display intelligent suggestions to the user using the what3words API’s AutoSuggest functionality (this will be covered in more detail at a later step)
To add this functionality to an existing search bar, your app will first need to detect if a full or partial input string is in the format of a what3words address. This can be achieved using the RegEx function of the API wrapper.
what3words Address Detection Example:
**Java**
```java
import com.what3words.javawrapper.What3WordsV3
String text = "index.home.raft"
if(What3WordsV3.isPossible3wa(text)){
System.out.println("Input is in the form of a three word address")
} else {
System.out.println("Input is NOT in the form of a three word address")
}
```
**Kotlin**
```kotlin
import com.what3words.javawrapper.What3WordsV3
val text = "index.home.raft"
if(What3WordsV3.isPossible3wa(text)){
println("Input is in the form of a three word address")
} else {
println("Input is NOT in the form of a three word address")
}
```
**Swift**
```swift
import W3WSwiftApi
import CoreLocation
let text = "filled.count.s xxx.xxx.xxx index.home.raft"
let matches = api.findPossible3wa(text: text)
for match in matches {
print(" Found:", match)
}
```
## 4. Enable calls to the API for suggestions
Once the user has entered the first letter of the final word of a what3words address, your app should call the what3words API to provide intelligent what3words address suggestions to the user, using our API’s AutoSuggest endpoint. These results will be updated as the user continues entering the what3words address.
A highly important step in optimising the user experience is in contextualising the address suggestions to where the user is located. This can be done by supplying the API with the user’s device location, enabling the returned suggestions to be tailored to the user’s current location using an API call parameter called `focus`.
Similarly, if your service operates in a fixed country, you can use the `clip-to-country` parameter to restrict the returned suggestions to geographically relevant results.
AutoSuggest API Call Example:
**Java**
```java
import com.what3words.javawrapper.request.Coordinates
// Create optional options to fine-tune the autosuggest request
AutosuggestOptions options = AutosuggestOptions()
Coordinates focus = Coordinates(/*latitude:*/51.502,/*longitude:*/-0.12345)
options.setFocus(focus)
Autosuggest result = wrapper.autosuggest("filled.count.so").options(options).execute()
if (result.isSuccessful) {
System.out.println(result.suggestions.size)
} else {
System.out.println(resut.error.message)
}
```
**Kotlin**
```kotlin
import com.what3words.javawrapper.request.Coordinates
// Create optional options to fine-tune the autosuggest request
val options = AutosuggestOptions()
options.focus = Coordinates(/*latitude:*/51.502,/*longitude:*/-0.12345)
val result: Autosuggest= wrapper.autosuggest("filled.count.so").options(options).execute()
if (result.isSuccessful) {
println(result.suggestions.size)
} else {
println(result.error.message)
}
```
**Swift**
```swift
import W3WSwiftApi
import CoreLocation
let api = What3WordsV3(apiKey: "YourApiKey")
let coords = CLLocationCoordinate2D(latitude: 51.4243877, longitude: -0.34745)
api.autosuggest(text: "index.raft.ho", options: W3WOptions().focus(coords)) { (suggestions, error) in
print(suggestions ?? [])
}
```
## 5. Displaying AutoSuggest results
You can configure the number of AutoSuggest results using the n-focus-results parameter. To display the results, we recommend using our what3words address search component with the following key attributes:
1. 3 slashes (“///”) before each what3words address suggestion;
2. A nearest place;
3. Distance from the user to each of the what3words address suggestions (`distanceToFocusKm` for each suggestion in the API response).
Location context for eachwhat3words address suggestion (we return this as `nearestPlace` for each suggestion in the API response).

## 6. Validate what3words and get coordinates
Once the user has selected the desired what3words address from the list of suggestions, it needs to be converted into standard GPS coordinates to then enable route calculation and pricing.
To do this, use the `convertToCoordinates` wrapper function. An example of doing this using our mobile wrappers is given below:
**Java**
```java
String selectedSuggestion = "filled.count.soap"
ConvertToCoordinates result = wrapper.convertToCoordinates(selectedSuggestion)
if (result.isSuccessful) {
System.out.println("Coordinates: ${result.coordinates.lat}, ${result.coordinates.lng}")
} else {
System.out.println(result.error.message)
}
```
**Kotlin**
```kotlin
val selectedSuggestion = "filled.count.soap"
val result: ConvertToCoordinates = wrapper.convertToCoordinates(selectedSuggestion).execute()
if (result.isSuccessful) {
println("Coordinates: ${result.coordinates.lat}, ${result.coordinates.lng}")
} else {
println(result.error.message)
}
```
**Swift**
```swift
import W3WSwiftApi
import CoreLocation
let api = What3WordsV3(apiKey: "YourApiKey")
api.convertToCoordinates(words: "filled.count.soap") { square, error in
print(square?.coordinates ?? "")
}
```
## 7. Displaying the what3words on the map
Once the user has selected a what3words address from the AutoSuggest-generated list, the point should be displayed on the route by appending a label with the what3words address on it to the map marker, allowing the user to see the location of the what3words address before confirming the ride.

## 8. Full Example
The example below takes the concepts described earlier and demonstrates how a what3words integration could look on your ride-hailing apps.

### Development Checklist
### API Sign Up & Library Installation
- Created an API key for the what3words API;
- The packages have been loaded correctly, and the API initialised according to the relevant wrapper guidance.
### Address Search
- Placeholder text in the search bar educates the user on the ability to enter what3words addresses;
- The keyboard displays the full stop on the first screen shown to the user;
- Check if the keyboard supports all enabled languages;
- Up until the final word of the what3words address is entered, traditional destination options are returned;
- Once the final word begins to be entered, what3words results are shown.
### AutoSuggest
### API Parameters
- Focus is enabled;
- Other parameters, such as clipping, or language settings, are enabled (if applicable).
### Front End
- Results update live with each keystroke;
- Three what3words address suggestions are displayed per keystroke;
- Nearest place information (either ours or via an alternative source) is displayed alongside distance from the user;
- /// is affixed to the address (e.g. ///filled.count.soap vs. filled.count.soap);
- If there is use of what3words brand assets, they must be the current versions;
- Correct localisation of copy for non-English languages (e.g. distances stated in kilometers or miles).
### Ride Confirmation
- Upon selection of a suggested address, the selected option is highlighted to indicate it is chosen;
- The selected address is successfully converted to coordinates;
- The resulting coordinates are used to display the destination location on the map and sent for route/price calculation;
- The map destination marker has the correct what3words address attached via a label.
### Contact Support
### Have any questions****?
We’re here to support you! If you have any questions while using what3words for Excel, get in touch with us by writing us an email at [support@what3words.com](mailto:support@what3words.com).
---
# Ruby
Getting started with the what3words Ruby API wrapper.
Topics: Ruby, Server and Scripting
Section: [API & SDK Reference](https://developer.what3words.com/docs/api-sdk-reference.md) > [API Wrappers](https://developer.what3words.com/docs/api-sdk-reference/api-wrappers.md)
Source: https://developer.what3words.com/tutorial/ruby
Updated: 2026-11-27
The Ruby wrapper is useful for Ruby developers who wish to seamlessly integrate the [what3words Public API](https://developer.what3words.com/public-api) into their Ruby applications, without the hassle of having to manage the low level API calls themselves.
A full example of how to integrate the what3words Ruby wrapper is available in our **[GitHub repository](https://github.com/what3words/w3w-ruby-wrapper).**
## 1. Get API key
You will need this API key for your installation. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Installation
The library is available through [RubyGems](https://rubygems.org/gems/what3words).
You can simply add this line to your application’s Gemfile:
**Ruby**
```ruby
gem 'what3words', '~> 3.4'
```
And then execute:
**Ruby**
```ruby
bundle
```
Or install it yourself as:
**Ruby**
```ruby
gem install what3words
```
## 3. Setup
If not using Bundler, require it:
**Ruby**
```ruby
require 'what3words'
```
## 4. Initialise
The wrapper will point to the public version of the what3words API, to initialise it simply:
**Ruby**
```ruby
what3words = What3Words::API.new(:key => "YOURAPIKEY")
```
## 5. Usage
### Convert to what3words address
This function converts coordinates (expressed as latitude and longitude) to a what3words address.
More information about `ConvertTo3wa`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#convert-to-3wa).
Find the words for (`29.567041, 106.587875`):
**Ruby**
```ruby
what3words.convert_to_3wa [29.567041, 106.587875]
# Expected Output
# => {:country=>"CN", :square=>{:southwest=>{:lng=>106.58786, :lat=>29.567028}, :northeast=>{:lng=>106.587891, :lat=>29.567055}}, :nearestPlace=>"Chongqing", :coordinates=>{:lng=>106.587875, :lat=>29.567041}, :words=>"disclose.strain.redefined", :language=>"en", :map=>"https://w3w.co/disclose.strain.redefined"}
```
### Convert to coordinates
This function converts a what3words address to a position, expressed as coordinates of latitude and longitude.
It takes the words parameter as a string of a what3words `'table.book.chair'`
More information about `ConvertToCoordinates`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#convert-to-coordinates).
Find the words for `///prom.cape.pump`:
**Ruby**
```ruby
what3words.convert_to_coordinates "prom.cape.pump"
# Expected Output
# => {:country=>"GB", :square=>{:southwest=>{:lng=>-0.195426, :lat=>51.484449}, :northeast=>{:lng=>-0.195383, :lat=>51.484476}}, :nearestPlace=>"Kensington, London", :coordinates=>{:lng=>-0.195405, :lat=>51.484463}, :words=>"prom.cape.pump", :language=>"en", :map=>"https://w3w.co/prom.cape.pump"}
```
### AutoSuggest
When presented with a what3words address which may be incorrectly entered, AutoSuggest returns a list of potential correct 3 word addresses. It needs the first two words plus at least the first character of the third word to produce suggestions.
This method provides corrections for mis-typed words (including plural VS singular), and words being in the wrong order.
Optionally, clipping can narrow down the possibilities, and limit results to:
- One or more countries
- A geographic area (a circle, box or polygon)
This dramatically improves results, so we recommend that you use clipping if possible.
To improve results even further, set the `Focus` to user’s current location. This will make `AutoSuggest` return results which are closer to the user.
More information about `AutoSuggest`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#autosuggest).
**Code example** Simple basic call:
**Ruby**
```ruby
what3words.autosuggest 'trop.caler.perdre', language: 'fr'
# Expected Output
# => {:suggestions=>[{:country=>"FR", :nearestPlace=>"Saint-Lary-Soulan, Hautes-Pyrénées", :words=>"trier.caler.perdre", :rank=>1, :language=>"fr"}, {:country=>"ET", :nearestPlace=>"Asbe Teferi, Oromiya", :words=>"trôler.caler.perdre", :rank=>2, :language=>"fr"}, {:country=>"CN", :nearestPlace=>"Ulanhot, Inner Mongolia", :words=>"froc.caler.perdre", :rank=>3, :language=>"fr"}]}
```
**Code example** AutoSuggest, clipping the results returned to the United Kingdom and Belgium:
**Ruby**
```ruby
what3words.autosuggest 'disclose.strain.redefin', 'clip-to-country': 'GB,BE'
# Expected Output
# => {:suggestions=>[{:country=>"GB", :nearestPlace=>"Nether Stowey, Somerset", :words=>"disclose.retrain.redefined", :rank=>1, :language=>"en"}, {:country=>"BE", :nearestPlace=>"Zemst, Flanders", :words=>"disclose.strain.reckon", :rank=>2, :language=>"en"}, {:country=>"GB", :nearestPlace=>"Waddington, Lincolnshire", :words=>"discloses.trains.redefined", :rank=>3, :language=>"en"}]}
```
**Code example** AutoSuggest, Focus on (`51.4243877,-0.34745`).
**Ruby**
```ruby
what3words.autosuggest 'filled.count.soap', focus: [51.4243877,-0.34745]
# Expected Output
# => {:suggestions=>[{:country=>"GB", :nearestPlace=>"Bayswater, London", :words=>"filled.count.soap", :rank=>1, :distanceToFocusKm=>15, :language=>"en"}, {:country=>"GB", :nearestPlace=>"Orsett, Essex", :words=>"fills.count.slap", :rank=>2, :distanceToFocusKm=>48, :language=>"en"}, {:country=>"GB", :nearestPlace=>"Cobham, Surrey", :words=>"field.count.slap", :rank=>3, :distanceToFocusKm=>14, :language=>"en"}]}
```
**Code example** AutoSuggest, with Generic Voice input type.
**Ruby**
```ruby
what3words.autosuggest 'fun with code', 'input-type': 'generic-voice', language: 'en'
# Expected Output
# => {:suggestions=>[{:country=>"US", :nearestPlace=>"Homer, Alaska", :words=>"fund.with.code", :rank=>1, :language=>"en"}, {:country=>"AU", :nearestPlace=>"Kumpupintil, Western Australia", :words=>"funk.with.code", :rank=>2, :language=>"en"}, {:country=>"US", :nearestPlace=>"Charleston, West Virginia", :words=>"fund.with.cove", :rank=>3, :language=>"en"}]}
```
### Grid section
Grid section returns a section of the what3words 3m x 3m grid as a set of horizontal and vertical lines covering the requested area, which can then be drawn onto a map.
The requested box must not exceed 4km from corner to corner, or a `BadBoundingBoxTooBig` error will be returned.
More information about `GridSection`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#grid-section).
Get a grid for `52.207988,0.116126`) in the south west, and `52.208867,0.117540` in the north east:
**Ruby**
```ruby
what3words.grid_section '52.208867,0.117540,52.207988,0.116126'
# Expected Output
# => {:lines=>[{:start=>{:lng=>0.116126, :lat=>52.20801}, :end=>{:lng=>0.11754, :lat=>52.20801}}, {:start=>{:lng=>0.116126, :lat=>52.208037}, :end=>{:lng=>0.11754, :lat=>52.208037}}, {:start=>{:lng=>0.116126, :lat=>52.208064}, :end=>{:lng=>0.11754, :lat=>52.208064}}, ___...___ ]}
```
### Available languages
This function returns the currently supported languages. It will return the two letter code, and the name of the language both in that language and in English.
More information about `AvailableLanguages`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#available-languages).
**Ruby**
```ruby
what3words.available_languages
# Expected Output
# => {:languages=>[{:nativeName=>"Deutsch", :code=>"de", :name=>"German"}, {:nativeName=>"हिन्दी", :code=>"hi", :name=>"Hindi"}, {:nativeName=>"Português", :code=>"pt", :name=>"Portuguese"}, {:nativeName=>"Magyar", :code=>"hu", :name=>"Hungarian"}, {:nativeName=>"Українська", :code=>"uk", :name=>"Ukrainian"}, {:nativeName=>"Bahasa Indonesia", :code=>"id", :name=>"Bahasa Indonesia"}, {:nativeName=>"اردو", :code=>"ur", :name=>"Urdu"}, ___...___]}
```
### Handling errors
Errors returned from the API can be caught with the wrapper through the use of a `raise` function.
Within the `raise` function, `code` and `message` values which represent the error, are accessible from the `error` object parameter
**Ruby**
```ruby
if response['error'].to_s.strip != ''
raise ResponseError, "#{response['code']}: #{response['message']}"
end
```
## 6. RegEx Functions
This section introduces RegEx functions that can assist with checking and finding possible what3words addresses in strings. The three main functions covered are:
- `isPossible3wa` – Match what3words address format;
- `isValid3wa` – Verify a what3words address with the API;
### isPossible3wa
Our API wrapper RegEx function “`isPossible3wa`” can be used to detect if a text string (like “`filled.count.soap`“) in the format of a what3words address without having to ask the API. This functionality checks if a given string could be a what3words address. It returns **true** if it could be, otherwise **false**.
**Note**: This function checks the text format but not the validity of a what3words address. Use `isValid3wa` to verify validity.
**Ruby**
```ruby
require 'what3words'
def main
# Initialize the What3Words API with your API key
api_key = 'YOUR_API_KEY'
w3w = What3Words::API.new(:key => api_key)
# Example what3words addresses
addresses = ["filled.count.soap", "not a 3wa", "not.3wa address"]
# Check if the addresses are possible what3words addresses
addresses.each do |address|
is_possible = w3w.isPossible3wa(address)
puts "Is '#{address}' a possible what3words address? #{is_possible}"
end
end
if __FILE__ == $0
main
end
```
#### Expected Output
- isPossible3wa(“filled.count.soap”) returns `true`
- isPossible3wa(“not a 3wa”) returns `false`
- isPossible3wa(“not.3wa address”)returns `false`
### isValid3wa
Our API wrapper RegEx function “`isValid3wa`” can be used to determine if a string is a valid what3words address by checking it against the what3words RegEx filter and verifying it with the what3words API.
**Ruby**
```ruby
require 'what3words'
def main
# Initialize the what3words API with your API key
api_key = 'YOUR_API_KEY'
w3w = What3Words::API.new(:key => api_key)
# Example addresses
addresses = [
"filled.count.soap",
"filled.count.",
"coding.is.cool"
]
# Check if the addresses are valid what3words addresses
addresses.each do |address|
is_valid = w3w.isValid3wa(address)
puts "Is '#{address}' a valid what3words address? #{is_valid}"
end
end
if __FILE__ == $0
main
end
```
#### Expected Outputs
- isValid3wa(“filled.count.soap”) returns `True`
- isValid3wa(“filled.count.”) returns `False`
- isValid3wa(“coding.is.cool”) returns `False`
Also make sure to replace `` with your actual API key. These functionalities provide different levels of validation for what3words addresses, from simply identifying potential addresses to verifying their existence on Earth.
## 7. Troubleshooting
If you encounter errors or issues related to convert-to-coordinate, convert-to-3wa and grid-section requests while using the Free plan, please check the network panel for the following error message `Error 402 payment required` and its response, indicating the need to upgrade to a higher plan:
**JSON**
```json
{
"error": {
"code": "QuotaExceeded",
"message": "Quota exceeded or API plan does not have access to this feature. Please change your plan at https://accounts.what3words.com/select-plan, or contact support@what3words.com"
}
}
```
For more information, visit our [API plans page](https://accounts.what3words.com/select-plan). If you need further assistance, contact [support@what3words.com](mailto:support@what3words.com).
## 8. Full example
The example below takes the concepts described above, and turns some of them into a complete example. Here we take a partial 3 word address and pass it into AutoSuggest – clipping the results to consider only addresses in Great Britain and Belgium, setting a focus, and returning a single result
We then take the result and convert the 3 word address to coordinates, and vice-versa.
**Ruby**
```ruby
# frozen_string_literal: true
#!/usr/bin/env
require 'what3words'
require 'json'
api_key = ENV['W3W_API_KEY']
what3words = What3Words::API.new(:key => api_key, :format => 'json')
# ## convert_to_coordinates #########
res = what3words.convert_to_coordinates 'prom.cape.pump'
puts '######### convert_to_coordinate #########'
puts res
# ## convert_to_3wa #########
res = what3words.convert_to_3wa [29.567041, 106.587875]
puts '######### convert_to_3wa #########'
puts res
# ## grid_section #########
res = what3words.grid_section '52.208867,0.117540,52.207988,0.116126'
puts '######### grid_section #########'
puts res
# ## available_languages #########
res = what3words.available_languages
puts '######### available_languages #########'
puts res
# ## Vanilla autosuggest, limiting the number of results to three #########
res = what3words.autosuggest 'disclose.strain.redefin', language: 'en', 'n-results': 10
puts '######### autosuggest n-results #########'
puts res
# ## autosuggest demonstrating clipping to polygon, circle, bounding box, and country #########
res_polygon = what3words.autosuggest 'disclose.strain.redefin', 'clip-to-polygon': [51.521, -0.343, 52.6, 2.3324, 54.234, 8.343, 51.521, -0.343]
res_circle = what3words.autosuggest 'disclose.strain.redefin', 'clip-to-circle': [51.521, -0.343, 142]
res_bbox = what3words.autosuggest 'disclose.strain.redefin', 'clip-to-bounding-box': [51.521, -0.343, 52.6, 2.3324]
res_country = what3words.autosuggest 'disclose.strain.redefin', 'clip-to-country': 'GB,BE'
puts '######### autosuggest clipping options #########'
puts res_polygon
puts res_circle
puts res_bbox
puts res_country
# ## autosuggest with a focus, with that focus only applied to the first result #########
res = what3words.autosuggest 'filled.count.soap', focus: [51.4243877, -0.34745], 'n-focus-results': 3, 'n-results': 10
puts '######### autosuggest with a focus ######### '
puts res
# ## autosuggest with an input type of Generic Voice #########
res = what3words.autosuggest 'fun with code', 'input-type': 'generic-voice', language: 'en'
puts '######### autosuggest with Generic Voice as input type ######### '
puts res
# ## isPossible3wa #########
addresses = ["filled.count.soap", "not a 3wa", "not.3wa address"]
addresses.each do |address|
is_possible = what3words.isPossible3wa(address)
puts "Is '#{address}' a possible what3words address? #{is_possible}"
end
# ## isValid3wa #########
addresses = ["filled.count.soap", "filled.count.", "coding.is.cool"]
addresses.each do |address|
is_valid = what3words.isValid3wa(address)
puts "Is '#{address}' a valid what3words address? #{is_valid}"
end
```
---
# Rust
Getting started with the what3words Rust API wrapper.
Topics: Rust, Server and Scripting
Section: [API & SDK Reference](https://developer.what3words.com/docs/api-sdk-reference.md) > [API Wrappers](https://developer.what3words.com/docs/api-sdk-reference/api-wrappers.md)
Source: https://developer.what3words.com/tutorial/rust
Updated: 2026-11-27
The Rust wrapper is useful for Rust developers who wish to seamlessly integrate the [what3words Public API](https://docs.what3words.com/api/v3/) into their Rust applications, without the hassle of managing the low-level API calls themselves.
A full example of how to integrate the what3words Rust wrapper is available in our
[Rust Github repository](https://github.com/what3words/w3w-rust-wrapper)
## 1. Get API key
You will need this API key for your installation. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Installation
To install what3words, simply:
**Rust**
```rust
$ cargo add what3words-api
```
## 3. Setup
The functions are asynchronous by default, but this crate supports synchronous functions as well, simply enable `sync` feature when adding the crate to your project.
**Rust**
```rust
cargo add what3words-api --features=sync
```
> [!NOTE]
> **Note:** Ensure that you have an async runtime installed such as `tokio` except when `sync` feature is enabled.
## 4. Initialise
Once you have the API Key, you can initialise the wrapper like this:
**Rust**
```rust
let wrapper = what3words_api::What3words::new("YOUR_API_KEY_HERE");
```
You can also pass a different hostname if you have your own self-hosted what3words API.
**Rust**
```rust
let wrapper = what3words_api::What3words::new("YOUR_API_KEY_HERE").hostname("https://your.what3words.api/v3");
```
You can also set configure your own headers:
**Rust**
```rust
let wrapper = what3words_api::What3words::new("YOUR_API_KEY_HERE").header("X-Foo", "Bar");
```
## 5. Usage
### Convert to what3words address
This function converts coordinates (expressed as latitude and longitude) to a what3words address.
More information about `ConvertTo3wa`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#convert-to-3wa).
Find the words for (`51.520847, -0.195405`):
**Rust**
```rust
let convert_to_3wa = what3words_api::ConvertTo3wa::new(51.520847, -0.195521).language("oo").locale("oo_cy");
```
Here is an example:
**Rust**
```rust
use what3words_api::{Address, AddressGeoJson, ConvertTo3wa, What3words};
let w3w = What3words::new("YOUR_API_KEY_HERE");
let convert_to_3wa = ConvertTo3wa::new(51.520847, -0.195521).language("mn").locale("mn_la");
let address_json: Address = w3w.convert_to_3wa::(&convert_to_3wa);
println!("{:?}", address_json.words); // "seruuhen.zemseg.dagaldah"
let convert_to_3wa = ConvertTo3wa::new(51.520847, -0.195521);
let address_geojson: Address = w3w.convert_to_3wa::(&convert_to_3wa);
println!("{:?}", address_geojson.features); // [Feature { bbox: Some[-0.195543, 51.520833], ..., }]
```
> [!NOTE]
> **Note:** It is required to specify the type annotation for this function which will allow you to choose between `json` and `geojson` format. Using `Address` will use `json` (default) and `AddressGeoJson` will use `geojson`.
### Convert to coordinates
This function converts a what3words address to a position, expressed as coordinates of latitude and longitude.
It takes the words parameter as a string of a what3words `'table.book.chair'`
More information about `ConvertToCoordinates`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#convert-to-coordinates).
Find the words for `///filled.count.soap`:
**Rust**
```rust
let convert_to_coordinates = what3words_api::ConvertToCoordinates::new("filled.count.soap").locale("zh_tr");
```
Here is an example:
**Rust**
```rust
use what3words_api::{Address, AddressGeoJson, ConvertToCoordinates, What3words};
let w3w = What3words::new("YOUR_API_KEY_HERE");
let convert_to_coordinates = ConvertToCoordinates::new("產權.絕緣.墨鏡").locale("zh_tr");
let address_json: Address = w3w.convert_to_coordinates::(&convert_to_coordinates);
println!("{:?}", address_json.coordinates); // Coordinates { lat: 51.520847, lng: -0.195521 }
let convert_to_coordinates = ConvertToCoordinates::new("filled.count.soap");
let address_geojson: AddressGeoJson = w3w.convert_to_coordinates::(&convert_to_coordinates);
println!("{:?}", address_geojson.features); // [Feature { bbox: Some[-0.195543, 51.520833], ..., }]
```
> [!NOTE]
> **Note:** It is required to specify the type annotation for this function which will allow you to choose between `json` and `geojson` format. Using `Address` will use `json` (default) and `AddressGeoJson` will use `geojson`.
### AutoSuggest
When presented with a what3words address which may be incorrectly entered, AutoSuggest returns a list of potential correct 3 word addresses. It needs the first two words plus at least the first character of the third word to produce suggestions.
This method provides corrections for mis-typed words (including plural VS singular), and words being in the wrong order.
Optionally, clipping can narrow down the possibilities, and limit results to:
- One or more countries
- A geographic area (a circle, box or polygon)
This dramatically improves results, so we recommend that you use clipping if possible.
To improve results even further, set the `Focus` to user’s current location. This will make `AutoSuggest` return results which are closer to the user.
More information about `AutoSuggest`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#autosuggest).
**Code example** Simple basic call:
**Rust**
```rust
let autosuggest = what3words_api::Autosuggest::new("filled.count.so");
```
**Code example** AutoSuggest, clipping the results returned to the United Kingdom and Belgium:
**Rust**
```rust
let autosuggest = what3words_api::Autosuggest::new("filled.count.so").clip_to_country(&["GB","BE"])
```
**Code example** AutoSuggest, Focus on (`51.4243877,-0.34745`).
**Rust**
```rust
let autosuggest = what3words_api::Autosuggest::new("filled.count.so").focus(&Coordinates::new(51.4243877, -0.34745));
```
**Code example** AutoSuggest, with Generic Voice input type.
**Rust**
```rust
use std::env;
use what3words_api::{Autosuggest, What3words};
fn main() {
let api_key = env::var("W3W_API_KEY").expect(
"Please ensure that W3W_API_KEY is added to your environment variables.\nRun `W3W_API_KEY= cargo run --example wrapper-demo` from bash/zsh or `$Env:W3W_API_KEY=; cargo run --example wrapper-demo` from PowerShell.",
);
let w3w = What3words::new(&api_key);
let autosuggest_option = Autosuggest::new("filled.count.soa")
.input_type("generic-voice")
.language("en");
let result = w3w.autosuggest(&autosuggest_option);
print!("Result: {:?}", result);
}
```
Here is a full AutoSuggest example:
**Rust**
```rust
use what3words_api::{Autosuggest, AutosuggestResult, What3words};
let w3w = What3words::new("YOUR_API_KEY_HERE");
let autosuggest_option = Autosuggest::new("filled.count.so").focus(&Coordinates::new(51.520847, -0.195521));
let autosuggest: AutosuggestResult = w3w.autosuggest(&autosuggest_option);
println!("{:?}", autosuggest.suggestions); // [Suggestion { words: "filled.count.soap", ..., ... }, ..., ...]
```
### Grid section
Grid section returns a section of the what3words 3m x 3m grid as a set of horizontal and vertical lines covering the requested area, which can then be drawn onto a map.
The requested box must not exceed 4km from corner to corner, or a `BadBoundingBoxTooBig` error will be returned.
More information about `GridSection`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#grid-section).
Get a grid for `52.207988,0.116126`) in the south west, and `52.208867,0.117540` in the north east:
**Rust**
```rust
use what3words_api::{BoundingBox, GridSection, GridSectionGeoJson, What3words};
let w3w: What3words = What3words::new("YOUR_API_KEY_HERE");
// json format
let grid_section_json: GridSection = w3w.grid_section::(&BoundingBox::new(52.207988,0.116126,52.208867,0.117540));
println!("{:?}", &grid_section_json.lines[0]); // Line { start: Coordinates { lat: 52.20801, lng: 0.116126 }, end: Coordinates { lat: 52.20801, lng: 0.11754 } }
// geojson format
let grid_section_geojson: GridSectionGeoJson = w3w.grid_section::(&BoundingBox::new(52.207988,0.116126,52.208867,0.117540));
println!("{:?}", &grid_section_geojson.features); // [Features { geometry: ..., }, ..., ..., kind: "Feature"]
```
> [!NOTE]
> **Note:** It is required to specify the type annotation for this function which will allow you to choose between `json` and `geojson` format. Using `GridSection` will use `json` (default) and `GridSectionGeoJson` will use `geojson`.
### Available languages
This function returns the currently supported languages. It will return the two letter code, and the name of the language both in that language and in English.
More information about `AvailableLanguages`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#available-languages).
**Rust**
```rust
use what3words_api::{AvailableLanguages, What3words};
let w3w: What3words = What3words::new("YOUR_API_KEY_HERE");
let available_languages: AvailableLanguages = w3w.available_languages();
println!("{:?}", available_languages.languages); // [Language { code: "en", ..., ... }, ..., ... ]
```
### Handling errors
In Rust, error handling is managed using the Result and Option types, which encapsulate potential success (Ok or Some) and failure (Err or None) outcomes. The `what3words-api` Rust crate adheres to this convention, returning a Result type for operations that may fail.
To handle errors effectively using this crate, you can utilize pattern matching to differentiate between successful and erroneous outcomes. Here’s an example demonstrating how to handle errors when converting a what3words address to coordinates:
**Rust**
```rust
use what3words_api::What3words;
fn main() {
// Initialize the what3words API with your API key
let api_key = "YOUR_API_KEY_HERE";
let w3w = What3words::new(api_key);
// Example 3-word address
let address = "filled.count.soap";
// Attempt to convert the 3-word address to coordinates
match w3w.convert_to_coordinates(address) {
Ok(coordinates) => {
println!("Coordinates for '{}': {:?}", address, coordinates);
}
Err(e) => {
eprintln!("Error converting '{}': {}", address, e);
}
}
}
```
**Explanation:**
**Initialisation:** The what3words struct is initialised with your API key. Ensure you replace “YOUR\_API\_KEY\_HERE” with your actual what3words API key.
**Conversion Attempt:** The convert\_to\_coordinates method is called with the what3words address. This method returns a Result, which can be either:
- Ok(coordinates): Contains the coordinates if the conversion is successful.
- Err(e): Contains the error if the conversion fails.
**Error Handling:** The match statement is used to handle both success and error cases:
- On success, the coordinates are printed.
- On error, the error’s code and message are accessed and printed to the standard error output.
This approach ensures that your application can handle potential errors gracefully, such as network issues, invalid API keys, or incorrect what3words addresses.
For more detailed information on error handling in Rust, you can refer to the official Rust documentation on [Error Handling](https://doc.rust-lang.org/book/ch09-00-error-handling.html).
## 6. RegEx Functions
This section introduces RegEx functions that can assist with checking and finding possible what3words addresses in strings. The three main functions covered are:
- `is_possible_3wa` – Match what3words address format;
- `is_valid_3wa` – Verify a what3words address with the API;
### is\_possible\_3wa
Our API wrapper RegEx function “`is_possible_3wa`” can be used to detect if a text string (like “`filled.count.soap`“) in the format of a what3words address without having to ask the API. This functionality checks if a given string could be a what3words address. It returns **true** if it could be, otherwise **false**.
**Note**: This function checks the text format but not the validity of a what3words address. Use `is_valid_3wa` to verify validity.
**Rust**
```rust
use what3words_api::What3words;
fn main() {
// Initialize the what3words API with your API key
let api_key = "YOUR_API_KEY_HERE";
let w3w = What3words::new(api_key);
// Example what3words addresses
let addresses = [
"filled.count.soap",
"not a 3wa",
"not.3wa address",
];
// Check if the addresses are possible what3words addresses
for address in &addresses {
let is_possible = w3w.is_possible_3wa(address);
println!("Is '{}' a possible what3words address? {}", address, is_possible);
}
}
```
#### Expected Output
- `is_possible_3wa`(“filled.count.soap”) returns `true`
- `is_possible_3wa`(“not a 3wa”) returns `false`
- `is_possible_3wa`(“not.3wa address”) returns `false`
### is\_valid\_3wa
Our API wrapper RegEx function “`is_valid_3wa`” can be used to determine if a string is a valid what3words address by checking it against the what3words RegEx filter and verifying it with the what3words API.
**Rust**
```rust
use what3words_api::What3words;
fn main() {
// Initialize the what3words API with your API key
let api_key = "YOUR_API_KEY_HERE";
let w3w = What3words::new(api_key);
// Example addresses
let addresses = vec![
"filled.count.soap",
"filled.count.",
"coding.is.cool",
];
// Check if each address is a valid what3words address
for address in addresses {
let is_valid = w3w.is_valid_3wa(address);
println!("Is '{}' a valid what3words address? {}", address, is_valid);
}
}
```
#### Expected Outputs
- `is_valid_3wa`(“filled.count.soap”) returns `True`
- `is_valid_3wa`(“filled.count.”) returns `False`
- `is_valid_3wa`(“coding.is.cool”) returns `False`
Also, make sure to replace `` with your actual API key. These functionalities provide different levels of validation for what3words addresses, from simply identifying potential addresses to verifying their existence on Earth.
## 7. Troubleshooting
If you encounter errors or issues related to convert-to-coordinate, convert-to-3wa and grid-section requests while using the Free plan, please check the network panel for the following error message `Error 402 payment required` and its response, indicating the need to upgrade to a higher plan:
**JSON**
```json
{
"error": {
"code": "QuotaExceeded",
"message": "Quota exceeded or API plan does not have access to this feature. Please change your plan at https://accounts.what3words.com/select-plan, or contact support@what3words.com"
}
}
```
For more information, visit our [API plans page](https://accounts.what3words.com/select-plan). If you need further assistance, contact [support@what3words.com](mailto:support@what3words.com).
## 8. Full example
Examples can be found in `/examples` directory of our , simply run the following to try it out:
[Rust Github repository](https://github.com/what3words/w3w-rust-wrapper)
**Rust (sync)**
```rust
# Blocking
$ W3W_API_KEY= cargo run --example sync --features="sync"
```
**Rust (async)**
```rust
# Non-blocking
$ W3W_API_KEY= cargo run --example async --features="async"
```
**Rust (sync)**
```rust
use std::env;
use what3words_api::{
Address, AddressGeoJson, Autosuggest, AutosuggestSelection, BoundingBox, ConvertTo3wa,
ConvertToCoordinates, Coordinates, Error, GridSection, GridSectionGeoJson, What3words,
};
fn main() -> Result<(), Error> {
let api_key = env::var("W3W_API_KEY").expect(
"Please ensure that W3W_API_KEY is added to your environment variables.\nRun `W3W_API_KEY= cargo run --example wrapper-demo` from bash/zsh or `$Env:W3W_API_KEY=; cargo run --example wrapper-demo` from PowerShell.",
);
let w3w = What3words::new(&api_key).header("X-Foo", "Bar");
let words = "filled.count.soap";
// ------ CONVERT TO COORDINATES/3WA ------
// ------ Error ------
let address = w3w.convert_to_coordinates::(&ConvertToCoordinates::new("filled.count"));
match address {
Ok(address) => println!("Address {:?}", address),
Err(error) => println!("Error {:?}", error),
}
// -------------------
let convert_to_coordinates = ConvertToCoordinates::new(words);
let address: Address = w3w.convert_to_coordinates(&convert_to_coordinates)?;
println!("Convert to Coordinates Json Format");
println!("{:?}", address);
let convert_to_coordinates = ConvertToCoordinates::new(words);
let address: AddressGeoJson = w3w.convert_to_coordinates(&convert_to_coordinates)?;
println!("Convert to Coordinates GeoJson Format");
println!("{:?}", address);
let convert_to_3wa = ConvertTo3wa::new(51.520847, -0.195521);
let address: Address = w3w.convert_to_3wa(&convert_to_3wa)?;
println!("Convert to 3WA Json Format");
println!("{:?}", address);
let convert_to_3wa = ConvertTo3wa::new(51.520847, -0.195521);
let address: AddressGeoJson = w3w.convert_to_3wa(&convert_to_3wa)?;
println!("Convert to 3WA GeoJson Format");
println!("{:?}", address);
// ------ ALL AVAILABLE LANGUAGES ------
let languages = w3w.available_languages()?;
println!("Available Languages");
println!("{:?}", languages.languages);
// ------ GRID SECTION ------
let grid_section_json: GridSection =
w3w.grid_section(&BoundingBox::new(52.207988, 0.116126, 52.208867, 0.117540))?;
println!("Grid Section Json Format");
println!("{:?}", grid_section_json);
let grid_section_geojson: GridSectionGeoJson =
w3w.grid_section(&BoundingBox::new(52.207988, 0.116126, 52.208867, 0.117540))?;
println!("Grid Section GeoJson Format");
println!("{:?}", grid_section_geojson);
// ------ AUTOSUGGEST ------
let autosuggest_option =
Autosuggest::new("filled.count.so").focus(&Coordinates::new(51.520847, -0.195521));
let autosuggest = w3w.autosuggest(&autosuggest_option)?;
println!("Autosuggest");
println!("{:?} ", autosuggest);
// ------ AUTOSUGGEST WITH COORDINATES ------
let autosuggest_with_coordinates = w3w.autosuggest_with_coordinates(&autosuggest_option);
println!("Autosuggest with Coordinates");
match autosuggest_with_coordinates {
Ok(autosuggest_with_coordinates) => println!("{:?}", autosuggest_with_coordinates),
Err(err) => println!("{:?}", err),
}
// ------ AUTOSUGGEST SELECTION ------
let selected = autosuggest.suggestions.first().expect("Not found");
match w3w.autosuggest_selection(
&AutosuggestSelection::new("f.f.f", selected).options(&autosuggest_option),
) {
Ok(_) => println!("Suggested selection sent"),
Err(err) => println!("{:?}", err),
};
// ------ HELPER FUNCTIONS ------
let is_valid_3wa: bool = w3w.is_valid_3wa("filled.count.soap");
println!("is_valid_3wa [1]: {}", is_valid_3wa);
let is_valid_3wa: bool = w3w.is_valid_3wa("filled.count");
println!("is_valid_3wa [2]: {}", is_valid_3wa);
let is_valid_3wa: bool = w3w.is_valid_3wa("rust.is.cool");
println!("is_valid_3wa [3]: {}", is_valid_3wa);
let did_you_mean: bool = w3w.did_you_mean("filled count soap");
println!("did_you_mean [1]: {}", did_you_mean);
let did_you_mean: bool = w3w.did_you_mean("filled-count-soap");
println!("did_you_mean [2]: {}", did_you_mean);
let did_you_mean: bool = w3w.did_you_mean("filledcountsoap");
println!("did_you_mean [3]: {}", did_you_mean);
let is_possible_3wa: bool = w3w.is_possible_3wa("filled.count.soap");
println!("is_possible_3wa [1]: {}", is_possible_3wa);
let is_possible_3wa: bool = w3w.is_possible_3wa("not a 3wa");
println!("is_possible_3wa [2]: {}", is_possible_3wa);
let is_possible_3wa: bool = w3w.is_possible_3wa("not.a 3wa");
println!("is_possible_3wa [3]: {}", is_possible_3wa);
Ok(())
}
```
---
# Search for 3 word addresses in ArcGIS Online
Search for a 3 word address within ArcGIS Online and publish in a web application.
Topics: ArcGIS, GIS
Section: [GIS & Spreadsheet Tools](https://developer.what3words.com/docs/gis-spreadsheet-tools.md) > [ArcGIS](https://developer.what3words.com/docs/gis-spreadsheet-tools/arcgis.md)
Source: https://developer.what3words.com/tutorial/search-for-3-word-addresses-in-arcgis-online
Updated: 2026-11-27
This tutorial will take you through how to search for a 3 word address within ArcGIS Online and to publish in a web application.
## 1. Get API key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Add the what3words Locator to ArcGIS Online
Follow this [**tutorial**](https://developer.what3words.com/tutorial/how-to-setup-the-what3words-locator-for-arcgis-online) or watch this video to set up the what3words ArcGIS Locator within ArcGIS Online and add it as a Utility Service.
Getting started with Dazi, GIS Technical Account Manager at what3words, showing how to add the what3words ArcGIS Locator in ArcGIS Online in [this video](https://youtu.be/iYp4g9sWNhU)
## 3. Select the locator

On the ArcGIS Online Map Viewer, click on the search icon on the right-hand sidebar, and the search box should appear at the top right of the map. The what3words address search should appear in the search box within the ArcGIS Online Map.
Selecting “All” will allow a user to search for a 3 word address or a traditional address within the ArcGIS World Geocoding Service.
Selecting “what3words” searches only for 3 word addresses.
## 4. Search on ArcGIS Online Map Viewer Classic

On the ArcGIS Map Viewer, search for a 3 word address and hit enter.
The user will be shown suggestions using what3words AutoSuggest.
## 5. Publishing in a Web App

The Locator can be used within published web applications and configured to meet users needs.
An example of the search in action within a web application can be found here.
---
# Swift
Getting started with the what3words Swift API wrapper.
Topics: Swift, Mobile App, Server and Scripting
Section: [API & SDK Reference](https://developer.what3words.com/docs/api-sdk-reference.md) > [API Wrappers](https://developer.what3words.com/docs/api-sdk-reference/api-wrappers.md)
Source: https://developer.what3words.com/tutorial/swift
Updated: 2026-11-27
This what3words Swift wrapper gives you programmatic access to the what3Words public API v3.
The what3words API is a fast, simple interface which allows you to convert 3 word addresses such as ///filled.count.soap to latitude and longitude coordinates such as (`-0.203586, 51.521251`) and vice versa. It features a powerful AutoSuggest function, which can validate and autocorrect user input and limit it to certain geographic areas (this powers the search box on our map site). It allows you to request a section of the what3words grid (which can be requested as GeoJSON for easy display on online maps), and to request the list of all languages supported by what3words. For advanced users, AutoSuggest can be used to post-process voice output. See links on the left to navigate.
All coordinates are latitude,longitude pairs in standard WGS-84 (as commonly used worldwide in GPS systems). All latitudes must be in the range of -90 to 90 (inclusive).
Full sample apps for the wrapper can be found in our Github repo
[iOS Sample Apps](https://github.com/what3words/w3w-swift-samples)
## 1. Get API key
You will need this API key for your installation. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Installation
### Swift Package Manager
You can install this with [Swift Package Manager](https://swift.org/package-manager) by adding the URL below under **Swift Packages** under your project settings:
**Swift**
```swift
Swift Package Manager
```
### CocoaPods (iOS 9+, OS X 10.10+)
You can use CocoaPods to install w3w-swift-wrapper by adding it to the target in your Podfile:
**Swift**
```swift
pod 'what3words', :git => 'https://github.com/what3words/w3w-swift-wrapper.git'
```

Don’t forget, if you are running on a device you need to set the `App Transport Security Settings` in your `Info.plist` as you would any app communicating with a server

Also, if you are using the Voice API on device, you should include Microphone permissions
## 3. Setup
In any swift file you use the what3words API, import the following:
**Swift**
```swift
import W3WSwiftApi
import CoreLocation
```
## 4. Initialise
Use the following code with your API key to initialize the API:
**Swift**
```swift
# Using the Public API:
let api = What3WordsV4(apiKey: "YourApiKey")
```
**Swift**
```swift
# Using the API Server:
let api = What3WordsV4(apiKey: "YourApiKey", apiUrl: "https://api.yourserver.com")
```
Additionally, if you run the Enterprise Suite API Server there is another optional `setup()` parameter: `customHeaders`. Use this if you need to send custom headers to your own server:
**Swift**
```swift
let api = What3WordsV4(apiKey: "YourApiKey", apiUrl: "https://api.yourserver.com", customHeaders: ["x-header-1":"value-1", "x-header-2":"value-2"])
```
## 5. Usage
Each call takes a completion block as the last parameter. This allows Swift’s trailing closure syntax to be used. The closure’s parameters contain the results. If there is a problem with any call, it will be indicated by the [error object](https://github.com/what3words/w3w-swift-wrapper/tree/v4#errors).
### Convert to what3words address
This function converts coordinates (expressed as latitude and longitude) to a what3words address.
More information about `ConvertTo3wa`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#convert-to-3wa).
Find the words for (`51.484463, -0.195405`):
**Swift**
```swift
let coords = CLLocationCoordinate2D(latitude: 51.484463, longitude: -0.195405)
api.convertTo3wa(coordinates: coords, language: W3WApiLanguage(locale: "en")) { square, error in
print(square?.words ?? "")
}
```
### Convert to coordinates
This function converts a what3words address to a position, expressed as coordinates of latitude and longitude.
It takes the words parameter as a string of a what3words `'table.book.chair'`
More information about `ConvertToCoordinates`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#convert-to-coordinates).
Find the words for `///prom.cape.pump`:
**Swift**
```swift
api.convertToCoordinates(words: "prom.cape.pump") { square, error in
print(square?.coordinates ?? "")
}
```
### AutoSuggest
When presented with a what3words address which may be incorrectly entered, AutoSuggest returns a list of potential correct 3 word addresses. It needs the first two words plus at least the first character of the third word to produce suggestions.
This method provides corrections for mis-typed words (including plural VS singular), and words being in the wrong order.
Optionally, clipping can narrow down the possibilities, and limit results to:
- One or more countries
- A geographic area (a circle, box or polygon)
This dramatically improves results, so we recommend that you use clipping if possible.
To improve results even further, set the `Focus` to user’s current location. This will make `AutoSuggest` return results which are closer to the user.
More information about `AutoSuggest`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#autosuggest).
**Code example** for an AutoSuggest basic call, the first parameter is the partial three words, or voice data. The second optional parameter is the options for the autosuggest function. The last parameter is the completion block.
**Swift**
```swift
api.autosuggest(text: "filled.count.soa") { (suggestions, error) in
for suggestion in suggestions ?? [] {
print("\(suggestion.words ?? "") is near \(suggestion.nearestPlace ?? "")")
}
}
```
**Code example** an AutoSuggest Focus on one particular place:
**Swift**
```swift
let coords = CLLocationCoordinate2D(latitude: 51.4243877, longitude: -0.34745)
api.autosuggest(text: "flottons.annulons.garço", options: W3WOption.focus(coords)) { (suggestions, error) in
print(suggestions ?? "")
}
```
**Code example** AutoSuggest, Focus on (51.4243877,-0.34745) and ask for suggestions from a French three word fragment:
**Swift**
```swift
let coords = CLLocationCoordinate2D(latitude: 51.4243877, longitude: -0.34745)
let options = W3WOptions().focus(coords).clip(to: W3WApiCountry(code: "GB"))
api.autosuggest(text: "flottons.annulons.garço", options: options) { (suggestions, error) in
print(suggestions ?? "")
}
```
**Code example** AutoSuggest, Voice API example.
The what3words Voice API allows a user to say three words into any application or service, with it returning a configurable list of what3words address suggestions, all through a single API call.
For this to work, you must add a Voice API plan to [your account](https://accounts.what3words.com/billing).
This example instantiates a `W3WMicrophone` which provides an audio stream to `autosuggest(audio:)` which begins recording when `autosuggest` is called. For information on `W3WMicrophone` and customizing your own `W3WAudioStream` for `autosuggest(audio:)` see the [Voice API readme file](https://github.com/what3words/w3w-swift-wrapper/blob/v4/Documentation/README.voiceAPI.md).
**Swift**
```swift
// make a microphone
let microphone = W3WMicrophone()
// call autosuggest
api.autosuggest(audio: microphone, options: .voiceLanguage(W3WApiLanguage(locale: "en"))) { suggestions, error in
for suggestion in suggestions ?? [] {
print(suggestion.words ?? "no suggestions")
}
}
```
Also, `W3WMicrophone` has a callback closure `W3WMicrophone.volumeUpdate: (Double) -> ()` that provides amplitude information useful for animating user feedback. See the [Voice API example](https://github.com/what3words/w3w-swift-wrapper/blob/v4/Examples/VoiceAPI/VoiceAPI.xcodeproj), and more information is available in the [Voice API readme file](https://github.com/what3words/w3w-swift-wrapper/blob/v4/Documentation/README.voiceAPI.md).
### Grid section
Grid section returns a section of the what3words 3m x 3m grid as a set of horizontal and vertical lines covering the requested area, which can then be drawn onto a map.
The requested box must not exceed 4km from corner to corner, or a `BadBoundingBoxTooBig` error will be returned.
More information about `GridSection`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#grid-section).
Get a grid for `52.207988,0.116126`) in the south west, and `52.208867,0.117540` in the north east:
**Swift**
```swift
let southWest = CLLocationCoordinate2D(latitude: 52.208867, longitude: 0.117540)
let northEast = CLLocationCoordinate2D(latitude: 52.207988, longitude: 0.116126)
api.gridSection(southWest: southWest, northEast: northEast) { (lines, error) in
print("Line count: ", lines?.count ?? "zero")
}
```
### Available languages
This function returns the currently supported languages. It will return the two letter code, and the name of the language both in that language and in English.
More information about `AvailableLanguages`, including returned results is available in the [what3words REST API documentation](https://docs.what3words.com/api/v3/#available-languages).
**Swift**
```swift
api.availableLanguages() { (languages, error) in
for language in languages ?? [] {
print(language.code)
}
}
```
### Handling errors
All functions call the completion block with `error` as the second parameter. All Swift what3words `error` types are of `enum` type and conform to [CustomStringConvertible](https://developer.apple.com/documentation/swift/customstringconvertible), so they can be used with `String(describing: error)`:
**Swift**
```swift
api.convertTo3wa(coordinates: CLLocationCoordinate2D(latitude: 51.4243877, longitude: -0.34745)) { square, error in
if let e = error {
print(String(describing: e))
} else {
print(square?.words ?? "")
}
}
```
Api call errors are of type `W3WError` enum and the voice `autosuggest` call returns a `W3WVoiceError` enum.
## 6. RegEx Functions
This section introduces RegEx functions that can assist with checking and finding possible what3words addresses in strings. The three main functions covered are:
- `isPossible3wa` – Match what3words address format;
- `isValid3wa` – Verify a what3words address with the API;
### isPossible3wa
Our API wrapper RegEx function “`isPossible3wa`” can be used to detect if a text string (like “`filled.count.soap`“) in the format of a what3words address without having to ask the API. This functionality checks if a given string could be a what3words address. It returns **true** if it could be, otherwise **false**.
**Note**: This function checks the text format but not the validity of a what3words address. Use `isValid3wa` to verify validity.
**Swift**
```swift
import W3WSwiftApi
import CoreLocation
func main() {
// Initialize the What3Words API with your API key
let api = What3WordsV4(apiKey: "YOUR_API_KEY")
// Example what3words addresses
let addresses = ["filled.count.soap", "not a 3wa", "not.3wa address"]
// Check if the addresses are possible what3words addresses
for address in addresses {
let isPossible = api.isPossible3wa(text: address)
print("Is '\(address)' a possible what3words address? \(isPossible)")
}
}
main()
```
#### Expected Output
- isPossible3wa(“filled.count.soap”) returns `true`
- isPossible3wa(“not a 3wa”) returns `false`
- isPossible3wa(“not.3wa address”)returns `false`
### isValid3wa
Our API wrapper RegEx function “`isValid3wa`” can be used to determine if a string is a valid what3words address by checking it against the what3words RegEx filter and verifying it with the what3words API.
**Swift**
```swift
import W3WSwiftApi
import CoreLocation
func main() {
// Initialize the what3words API with your API key
let apiKey = "YOUR_API_KEY"
let api = What3WordsV4(apiKey: apiKey)
// Example addresses
let addresses = [
"filled.count.soap",
"filled.count.",
"coding.is.cool"
]
// Check if the addresses are valid what3words addresses
for address in addresses {
api.isValid3wa(words: address) { result in
if result == true {
print("'\(address)' is a valid what3words address")
} else {
print("'\(address)' is NOT a valid what3words address")
}
}
}
}
main()
```
#### Expected Outputs
- isValid3wa(“filled.count.soap”) returns `True`
- isValid3wa(“filled.count.”) returns `False`
- isValid3wa(“coding.is.cool”) returns `False`
Also make sure to replace `` with your actual API key. These functionalities provide different levels of validation for what3words addresses, from simply identifying potential addresses to verifying their existence on Earth.
## 7. Troubleshooting
If you encounter errors or issues related to convert-to-coordinate, convert-to-3wa and grid-section requests while using the Free plan, please check the network panel for the following error message `Error 402 payment required` and its response, indicating the need to upgrade to a higher plan:
**JSON**
```json
{
"error": {
"code": "QuotaExceeded",
"message": "Quota exceeded or API plan does not have access to this feature. Please change your plan at https://accounts.what3words.com/select-plan, or contact support@what3words.com"
}
}
```
For more information, visit our [API plans page](https://accounts.what3words.com/select-plan). If you need further assistance, contact [support@what3words.com](mailto:support@what3words.com).
## 8. Full example
A complete example using AutoSuggest to find a place and `convertToCoordinates` to get its coordinates:
**Swift**
```swift
W3wGeocoder.setup(with: "")
let france = ClipToCountry(country: "FR")
let place = Focus(focus: CLLocationCoordinate2D(latitude: 48.856618, longitude: 2.3522411))
let count = NumberResults(numberOfResults: 4)
// Find some suggestions for a partial address
W3wGeocoder.shared.autosuggest(input: "freshen.overlook.clo", options: france, place, count) { (suggestions, error) in
// if there was an error, print it
if let e = error {
print(e.code, e.message)
// on success print the results
} else {
for suggestion in suggestions ?? [] {
print("\(suggestion.words) is near \(suggestion.nearestPlace) - Country Code:\(suggestion.country)")
}
}
// Find coordinates for the first suggestion
if let suggestion = suggestions?.first {
print("\nFinding the coordinates for: \(suggestion.words)")
W3wGeocoder.shared.convertToCoordinates(words: suggestion.words) { (place, error) in
// if there was an error, print it
if let e = error {
print(e.code, e.message)
// on success print the result
} else if let p = place {
print("The coordinates for \(p.words) are (\(p.coordinates.latitude),\(p.coordinates.longitude))")
}
}
}
}
```
---
# 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 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.

### Step 2 – Create a Script
Once in this section you want to click on `Create a Script` :

### 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`

### 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.

## 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.

## 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');`

### 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*.

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.

## 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)

Displayed what3words in the orders, if it is searched in the Swiftcomplete:

## 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.
---
# 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

> **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).
---
# 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

### Step 2 – Add App Block
- Under **Main,** select **Add App Block**
- Choose **Swiftcomplete**
- Click **Save**

### 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.

### 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 
### 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 
- 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.

### 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.**

> **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**.

**Step 4:** Once the plugin has been installed, click **Activate Plugin**.

## 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.
---
# 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

### Step 3 – Add App Block
- Under **Main,** select **Add App Block**
- Choose **Swiftcomplete**
- Click **Save**

### 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.

- Also confirm if the optional ‘what3words address’ field is correctly displayed to allow customers to enter a what3words address for additional precision

- 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 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.
---
# 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.
---
# 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. |
---
# Using the Android Map Component
Displaying the what3words grid and marker on Google Maps or Mapbox new or existing map applications.
Topics: Android, Mobile App
Section: [Display Map](https://developer.what3words.com/docs/display-map.md)
Source: https://developer.what3words.com/tutorial/using-the-android-map-component
Updated: 2026-11-27
### Tutorial
### Introduction
The easiest way to add what3words to your technology is to use one of our components. We have several components available for JavaScript, iOS, and Android which require minimal development to integrate.
The what3words Android Map Component provides a straightforward way to add a what3words grid on top of Google Maps or Mapbox map, displaying the what3words address and marker on the map for a selected 3 word address.
This tutorial steps through how our Android Map Component can be added to a new project that requires creating a map from scratch or to an existing map:
- If you are creating a new map from scratch using our Map component then we recommend using our map fragments: [W3WGoogleMapFragment](https://github.com/what3words/w3w-android-map-components/tree/main?tab=readme-ov-file#enable-what3words-features-in-an-new-google-maps-app-using-w3wgooglemapfragment) or [W3WMapboxMapFragment](https://github.com/what3words/w3w-android-map-components/tree/main?tab=readme-ov-file#enable-what3words-features-in-an-new-mapbox-maps-app-using-w3wmapboxmapfragment) if the map provider is respectively Google Maps or MapBox;
- If you want to add what3words to an existing map then we recommend using our map wrappers: [W3WGoogleMapsWrapper](https://github.com/what3words/w3w-android-map-components/tree/main?tab=readme-ov-file#enable-what3words-features-in-an-existing-google-maps-app-using-W3WGoogleMapsWrapper) or [W3WMapBoxWrapper](https://github.com/what3words/w3w-android-map-components/tree/main?tab=readme-ov-file#enable-what3words-features-in-an-existing-mapbox-maps-app-using-w3wmapboxwrapper) if the map provider is respectively Google Maps or MapBox.
Follow the steps below to select your chosen way to integrate our what3words map component into your project.
GitHub repo: [https://github.com/what3words/w3w-android-map-components](https://github.com/what3words/w3w-android-map-components)
### Quickstart
The Android Map Component requires just a few lines of code to be added to an android application to create a map with what3words functionality.
- Replace `YOUR-API-KEY` with your what3words API key and any `map provider API key` that you would like to use on your project, e.g. GOOGLE MAPS or MAPBOX API keys.
- It is compatible with applications that are built using `Android SDK 23 or higher`.
Here are listed some sample apps that can be used:
- [Google Maps Sample App](https://github.com/what3words/w3w-android-samples/tree/main/maps-googlemaps-sample)
- [MapBox Sample App](https://github.com/what3words/w3w-android-samples/tree/main/mapbox-sample)

**Kotlin**
```kotlin
class MainActivity : AppCompatActivity(), W3WGoogleMapFragment.OnMapReadyCallback {
private lateinit var binding: ActivityMapsBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMapsBinding.inflate(layoutInflater)
setContentView(binding.root)
val mapFragment = supportFragmentManager
.findFragmentById(R.id.map) as W3WGoogleMapFragment
mapFragment.apiKey("YOUR_API_KEY_HERE", this)
// add AutoSuggest Component to the Map Component
binding.autosuggest.apiKey("YOUR_API_KEY_HERE")
.returnCoordinates(true)
.onSuggestionSelected { square ->
if (square != null) {
map.selectAtSquare(square)
} else {
map.unselect()
}
}
}
override fun onMapReady(map: W3WMap) {
// add this to integrate the AutoSuggest Component
this.map = map
map.addMarkerAtCoordinates(lat: 51.5209894, lng: -0.1956749, markerColor = W3WMarkerColor.YELLOW)
map.onSquareSelected(
onSuccess = { square, _, _ ->
// add this to bind the AutoSuggest Component to the Map Component
binding.autosuggest.display(square)
Snackbar.make(binding.root, square.words, Snackbar.LENGTH_INDEFINITE).show()
}
)
}
}
```
### Step by Step
## 1. Get API key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Get Google API key
You also will need to get a [Google API key](https://developers.google.com/maps/documentation/places/web-service/get-api-key#console) or [Mapbox API key](https://docs.mapbox.com/android/maps/guides/install/) for your chosen map provider.
## 3. Add the dependency
Open your project in Android Studio
Open up your module-level `build.gradle` file.
Make sure that your project’s `minSdkVersion` is at API 23 or higher.
**Kotlin**
```kotlin
android {
...
defaultConfig {
minSdkVersion 23
}
}
```
Under dependencies, add a new build rule for the latest what3words Android Map Component.
**Kotlin**
```kotlin
dependencies {
implementation 'com.what3words:w3w-android-map-components:1.0.1'
}
```
Add this snippet to the `build.gradle` file (app level)
**Kotlin**
```kotlin
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
```
Add also the following `proguard rules`
**Kotlin**
```kotlin
-keep class com.what3words.javawrapper.request.* { *; }
-keep class com.what3words.javawrapper.response.* { *; }
```
Because you’ve edited your Gradle files, Android Studio will ask you whether you want to sync the Gradle files. You can sync now.
To perform network operations in your application, your manifest `AndroidManifest.xml` file must include the following permissions:
**Kotlin**
```kotlin
...
```
## 4. New app with Google Maps
If you are starting a new project and you are creating a new app from scratch, we recommend using our `W3WGoogleMapFragment`. The main advantage is that all the required events to draw the grid are done under the hood, resulting in less boilerplate code and still having access to Google Maps to apply standard customisation (i.e. map types, etc.). To use the what3words Google Maps Fragment in your app, first, follow the quick start tutorial on the [Google developer portal here](https://developers.google.com/maps/documentation/android-sdk/start). This ensures that Google Maps can be used with the what3words Map Fragment.
After a successful Google Maps run, you can start using our `W3WGoogleMapFragment` following these steps.
Add the following line of code to your `activity_main.xml` file within the `res` folder of your application:
**Kotlin**
```kotlin
```
Add what3words Google Maps Fragment to your `MapsActivity.kt` file. You will need to add your [what3words API key](https://what3words.com/select-plan?referrer=/tutorial/using-the-web-map-component) here to display the Map Fragment.
**Note:** After adding this snippet run your application and you will display Google Maps with the what3words grid on top of it.
**Kotlin**
```kotlin
class MainActivity : AppCompatActivity(), W3WGoogleMapFragment.OnMapReadyCallback {
private lateinit var binding: ActivityMapsBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMapsBinding.inflate(layoutInflater)
setContentView(binding.root)
val mapFragment = supportFragmentManager
.findFragmentById(R.id.map) as W3WGoogleMapFragment
mapFragment.apiKey("YOUR_API_KEY_HERE", this)
}
override fun onMapReady(map: W3WMap) {
}
}
```
### Customise the Map Component
The Map Component can be customised using some what3words properties. Here is shown an example where you can add a simple market to your Map with a specified what3words address

**Kotlin**
```kotlin
class MainActivity : AppCompatActivity(), W3WGoogleMapFragment.OnMapReadyCallback {
private lateinit var binding: ActivityMapsBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMapsBinding.inflate(layoutInflater)
setContentView(binding.root)
val mapFragment = supportFragmentManager
.findFragmentById(R.id.map) as W3WGoogleMapFragment
mapFragment.apiKey("YOUR_API_KEY_HERE", this)
}
override fun onMapReady(map: W3WMap) {
// set a marker with a specified what3words address
map.addMarkerAtWords("filled.count.soap")
}
}
```
You can set a language to get all the 3wa in the desired language (default English) by adding this line of code within the `onMapReady` function:
**Kotlin**
```kotlin
class MainActivity : AppCompatActivity(), W3WGoogleMapFragment.OnMapReadyCallback {
private lateinit var binding: ActivityMapsBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMapsBinding.inflate(layoutInflater)
setContentView(binding.root)
val mapFragment = supportFragmentManager
.findFragmentById(R.id.map) as W3WGoogleMapFragment
mapFragment.apiKey("YOUR_API_KEY_HERE", this)
}
override fun onMapReady(map: W3WMap) {
//set language to get all the what3words addresses in the desired language (default english)
map.setLanguage("en")
map.addMarkerAtWords("filled.count.soap")
}
}
```
You can make the map marker change color or their zoom level or add a list of specified what3words addresses.
**Note:** the default colour of the marker is the brand’s red.

**Kotlin**
```kotlin
class MainActivity : AppCompatActivity(), W3WGoogleMapFragment.OnMapReadyCallback {
private lateinit var binding: ActivityMapsBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMapsBinding.inflate(layoutInflater)
setContentView(binding.root)
val mapFragment = supportFragmentManager
.findFragmentById(R.id.map) as W3WGoogleMapFragment
mapFragment.apiKey("YOUR_API_KEY_HERE", this)
}
override fun onMapReady(map: W3WMap) {
map.setLanguage("en")
// an example on how to add a blue marker on a valid 3 word address and move the map view(camera) to the added marker
map.addMarkerAtWords(
listOf("filled.count.soap","stop.vibrates.looked"),
markerColor = W3WMarkerColor.TURQUOISE,
zoomOption = W3WZoomOption.CENTER_AND_ZOOM
)
}
}
```
You can add a map marker using coordinates instead of the what3words address.
**Kotlin**
```kotlin
class MainActivity : AppCompatActivity(), W3WGoogleMapFragment.OnMapReadyCallback {
private lateinit var binding: ActivityMapsBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMapsBinding.inflate(layoutInflater)
setContentView(binding.root)
val mapFragment = supportFragmentManager
.findFragmentById(R.id.map) as W3WGoogleMapFragment
mapFragment.apiKey("YOUR_API_KEY_HERE", this)
}
override fun onMapReady(map: W3WMap) {
// set a marker using coordinates
map.addMarkerAtCoordinates(51.5209894, -0.1956749, markerColor = W3WMarkerColor.YELLOW)
}
}
```
### Access the map instance
To access the Google map instance inside the Google Map Fragment you will need to add this line of code to your application:
**Kotlin**
```kotlin
class MainActivity : AppCompatActivity(), W3WGoogleMapFragment.OnMapReadyCallback {
private lateinit var binding: ActivityMapsBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMapsBinding.inflate(layoutInflater)
setContentView(binding.root)
val mapFragment = supportFragmentManager
.findFragmentById(R.id.map) as W3WGoogleMapFragment
mapFragment.apiKey("YOUR_API_KEY_HERE", this)
}
override fun onMapReady(map: W3WMap) {
map.addMarkerAtCoordinates(51.5209894, -0.1956749, markerColor = W3WMarkerColor.YELLOW)
//if you want to access the google map instance inside W3WGoogleMapFragment do the following
(map as? W3WGoogleMapFragment.Map)?.googleMap()?.let { googleMap ->
googleMap.mapType = GoogleMap.MAP_TYPE_NORMAL
}
}
}
```
Here is what your application should look like:

### Listening for events
Now when you click on the map marker you can display the what3words address if you trigger the `onSquareSelected` event.
**Note:** Only one square can be selected at the same time, just like our core apps.
**Kotlin**
```kotlin
class MainActivity : AppCompatActivity(), W3WGoogleMapFragment.OnMapReadyCallback {
private lateinit var binding: ActivityMapsBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMapsBinding.inflate(layoutInflater)
setContentView(binding.root)
val mapFragment = supportFragmentManager
.findFragmentById(R.id.map) as W3WGoogleMapFragment
mapFragment.apiKey("YOUR_API_KEY_HERE", this)
}
override fun onMapReady(map: W3WMap) {
map.addMarkerAtCoordinates(51.5209894, -0.1956749, markerColor = W3WMarkerColor.YELLOW)
// set up a a callback for when an square in the map is selected
map.onSquareSelected(
onSuccess = { square, _, _ ->
Snackbar.make(binding.root, square.words, Snackbar.LENGTH_INDEFINITE).show()
}
)
}
}
```
### Use AutoSuggest Component in the Search field
If you want to add the AutoSuggest Component to the search box on top of the Map Fragment, you need to update the `activity_maps.xml` to both have the what3words components, the `W3WAutosuggestEditText` (for the AutoSuggest Component) and `W3WGoogleMapFragment` (for the Map Component).
**Kotlin**
```kotlin
```
Now you need to set up the what3words AutoSuggest component with your API KEY to return coordinates so you can integrate it into the Map component without extra API calls.
**Note:** As it is set up on our core app, you will be able to set that up when a suggestion is selected from the AutoSuggest Component it will select a what3words address on the map.
**Kotlin**
```kotlin
class MainActivity : AppCompatActivity(), W3WGoogleMapFragment.OnMapReadyCallback {
private lateinit var binding: ActivityMapsBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMapsBinding.inflate(layoutInflater)
setContentView(binding.root)
val mapFragment = supportFragmentManager
.findFragmentById(R.id.map) as W3WGoogleMapFragment
mapFragment.apiKey("YOUR_API_KEY_HERE", this)
// add AutoSuggest Component to the Map Component
binding.autosuggest.apiKey("YOUR_API_KEY_HERE")
.returnCoordinates(true)
.onSuggestionSelected { square ->
if (square != null) {
map.selectAtSquare(square)
} else {
map.unselect()
}
}
}
override fun onMapReady(map: W3WMap) {
// add this to integrate the AutoSuggest Component
this.map = map
map.addMarkerAtCoordinates(lat: 51.5209894, lng: -0.1956749, markerColor = W3WMarkerColor.YELLOW)
map.onSquareSelected(
onSuccess = { square, _, _ ->
// add this to bind the AutoSuggest Component to the Map Component
binding.autosuggest.display(square)
Snackbar.make(binding.root, square.words, Snackbar.LENGTH_INDEFINITE).show()
}
)
}
}
```
Here is what your application should look like:

### Select Map Provider
Our Map Component can support different map service providers, such as Google Maps and Mapbox. By simply replacing the Google Map fragment used in the examples above `W3WGoogleMapFragment` with the Mapbox Map Fragment `W3WMapboxMapFragment` in your `activity_main.xml` and `MapsActivity.kt` files.
**Note:** To use the what3words Mapbox Maps Fragment in your app, first follow the quick start tutorial on the [Mapbox developer portal here](https://docs.mapbox.com/android/navigation/guides/get-started/install/). This ensures that Mapbox Maps can be used with the what3words Fragment.
## 5. Existing app with Google Maps
If you already have an application we recommend using our what3words Google Map Wrapper in your app. To get started first follow the quick start tutorial on the [Google developer portal here](https://developers.google.com/maps/documentation/android-sdk/start). This ensures that Google Maps can be used with the what3words Map Wrapper. After a successful Google Maps run, you can start using our `W3WGoogleMapWrapper` following these steps: Add the following line of code to your `activity_main.xml` file within the `res` folder of your application:
**Kotlin**
```kotlin
```
Add what3words Google Maps Wrapper to your `MapsActivity.kt` file. You will need to add your what3words API key here to display the Map Wrapper.
**Kotlin**
```kotlin
class MainActivity : AppCompatActivity(), OnMapReadyCallback {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val mapFragment = supportFragmentManager
.findFragmentById(R.id.map) as SupportMapFragment
mapFragment.getMapAsync(this)
}
override fun onMapReady(map: GoogleMap) {
val apiWrapper = What3WordsV3("YOUR_API_KEY_HERE", this)
val googleMapsWrapper = W3WGoogleMapsWrapper(
this,
map,
apiWrapper
)
}
}
```
After adding this snippet run your application and you will display Google Maps with the what3words grid on top of it.
### Customise the Map Component
The Map Component can be customised using some what3words properties. Here is shown an example where you can
- add a simple market to your Map with a specified what3words address;
- set your own zoom level;
- set the language of the what3words addresses;
**Kotlin**
```kotlin
class MainActivity : AppCompatActivity(), OnMapReadyCallback {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val mapFragment = supportFragmentManager
.findFragmentById(R.id.map) as SupportMapFragment
mapFragment.getMapAsync(this)
}
override fun onMapReady(map: GoogleMap) {
val apiWrapper = What3WordsV3("YOUR_API_KEY_HERE", this)
val googleMapsWrapper = W3WGoogleMapsWrapper(
this,
map,
apiWrapper
).setLanguage("en") // set the language of the what3words addresses
//show an example on how to add a blue marker
//on a valid 3 word address and move the camera to the added marker.
googleMapsWrapper.addMarkerAtWords(
"filled.count.soap",
markerColor.BLUE,
{ marker ->
val cameraPosition = CameraPosition.Builder()
.target(LatLng(marker.coordinates.lat, marker.coordinates.lng))
.zoom(19f)
.build()
p0.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition))
}, { error ->
Log.e("MainActivity", "${error.message}")
}
)
}
}
```
### Listening for events
Using an event listener, it is possible to fire other functionality in an app when something changes in the Map Component. For example, it is possible to listen for when a square on the grid map has been selected by the users or to listen for when new coordinates have been returned and pan/zoom a map to the location.
**Kotlin**
```kotlin
class MainActivity : AppCompatActivity(), OnMapReadyCallback {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val mapFragment = supportFragmentManager
.findFragmentById(R.id.map) as SupportMapFragment
mapFragment.getMapAsync(this)
}
override fun onMapReady(map: GoogleMap) {
val apiWrapper = What3WordsV3("YOUR_API_KEY_HERE", this)
val googleMapsWrapper = W3WGoogleMapsWrapper(
this,
map,
apiWrapper
)
//example how to add a blue marker on a valid 3 word address and move camera to the added marker.
googleMapsWrapper.addMarkerAtWords(
"filled.count.soap",
markerColor.BLUE,
{ marker ->
val cameraPosition = CameraPosition.Builder()
.target(LatLng(marker.coordinates.lat, marker.coordinates.lng))
.zoom(19f)
.build()
p0.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition))
}, { error ->
Log.e("MainActivity", "${error.message}")
}
)
//Using an event listener → click on existing what3words markers on the map.
w3wMapsWrapper.onMarkerClicked { marker ->
Log.i("MainActivity", "clicked: ${marker.words}")
}
//REQUIRED
map.setOnCameraIdleListener {
//existing code here...
//needed to draw the 3x3m grid on the map
googleMapsWrapper.updateMap()
}
//REQUIRED
map.setOnCameraMoveListener {
//existing code here...
//needed to draw the 3x3m grid on the map
googleMapsWrapper.updateMove()
}
}
}
```
### Set coordinates per selected marker
Here is an example of how to select a 3x3m what3words square using coordinates:
**Kotlin**
```kotlin
class MainActivity : AppCompatActivity(), OnMapReadyCallback {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val mapFragment = supportFragmentManager
.findFragmentById(R.id.map) as SupportMapFragment
mapFragment.getMapAsync(this)
}
override fun onMapReady(map: GoogleMap) {
val apiWrapper = What3WordsV3("YOUR_API_KEY_HERE", this)
val googleMapsWrapper = W3WGoogleMapsWrapper(
this,
map,
apiWrapper
)
…
map.setOnMapClickListener { latLng ->
//existing code here...
//example of how to select a 3x3m what3words square using lat/lng
googleMapsWrapper.selectAtCoordinates(latLng.latitude, latLng.longitude)
}
}
}
```
## 6. Existing app with Mapbox
If you already have an application we recommend using our what3words Mapbox Wrapper in your app. To get started first follow the quick start tutorial on the [Mapbox developer portal here](https://docs.mapbox.com/android/navigation/guides/get-started/install/). This ensures that Mapbox can be used with the what3words Map Wrapper.
After a successful Google Maps run, you can start using our `W3WMapboxWrapper` following these steps.
Add the following line of code to your `activity_main.xml` file within the `res` folder of your application:
**Kotlin**
```kotlin
```
Add what3words Mapbox Wrapper to your `MapsActivity.kt` file. You will need to add your what3words API key here to display the Map Wrapper.
**Kotlin**
```kotlin
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
binding.mapView.getMapboxMap().loadStyleUri(Style.MAPBOX_STREETS)
setContentView(binding.root)
val wrapper = What3WordsV3("YOUR_API_KEY_HERE", this)
val mapboxWrapper = W3WMapBoxWrapper(
this,
binding.mapView.getMapboxMap(),
wrapper,
)
}
}
```
After adding this snippet run your application and you will display the Mapbox with the what3words grid on top of it.
### Customise the Map Component
The Map Component can be customised using some what3words properties. Here is shown an example where you can
- add a simple market to your Map with a specified what3words address;
- set your own zoom level;
- set the language of the what3words addresses;
**Kotlin**
```kotlin
class MainActivity: AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
binding.mapView.getMapboxMap().loadStyleUri(Style.MAPBOX_STREETS)
setContentView(binding.root)
val wrapper = What3WordsV3("YOUR_API_KEY_HERE", this)
val mapboxWrapper = W3WMapBoxWrapper(
this,
binding.mapView.getMapboxMap(),
wrapper,
).setLanguage("en") // set the language of the what3words addresses
//show an example on how to add a blue marker
//on a valid 3 word address and move the camera to the added marker.
mapboxWrapper.addMarkerAtWords(
"filled.count.soap",
markerColor.BLUE,
{ marker ->
}, { error ->
Log.e("MainActivity", "${error.message}")
}
)
}
}
```
### Listening for events
Using an event listener, it is possible to fire other functionality in an app when something changes in the Map Component. For example, it is possible to listen for when a square on the grid map has been selected by the users or to listen for when new coordinates have been returned and pan/zoom a map to the location.
**Kotlin**
```kotlin
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
binding.mapView.getMapboxMap().loadStyleUri(Style.MAPBOX_STREETS)
setContentView(binding.root)
val wrapper = What3WordsV3("YOUR_API_KEY_HERE", this)
val mapboxWrapper = W3WMapBoxWrapper(
this,
binding.mapView.getMapboxMap(),
wrapper,
).setLanguage("en") // set the language of the what3words addresses
//show an example on how to add a blue marker
//on a valid 3 word address and move the camera to the added marker.
mapboxWrapper.addMarkerAtWords(
"filled.count.soap",
markerColor.BLUE,
{ marker ->
}, { error ->
Log.e("MainActivity", "${error.message}")
}
)
//Using an event listener → click on existing what3words markers on the map.
mapboxWrapper.onMarkerClicked {
Log.i("MainActivity", "clicked: ${it.words}")
}
//REQUIRED
binding.mapView.getMapboxMap().addOnMapIdleListener {
//existing code here...
//needed to draw the 3x3m grid on the map
mapboxWrapper.updateMap()
}
//REQUIRED
binding.mapView.getMapboxMap().addOnCameraChangeListener {
//existing code here...
//needed to draw the 3x3m grid on the map
mapboxWrapper.updateMove()
}
}
}
```
### Set coordinates per selected marker
Here is an example of how to select a 3x3m what3words square using coordinates:
**Kotlin**
```kotlin
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
binding.mapView.getMapboxMap().loadStyleUri(Style.MAPBOX_STREETS)
setContentView(binding.root)
val wrapper = What3WordsV3("YOUR_API_KEY_HERE", this)
val mapboxWrapper = W3WMapBoxWrapper(
this,
binding.mapView.getMapboxMap(),
wrapper,
).setLanguage("en") // set the language of the what3words addresses
//show an example on how to add a blue marker
//on a valid 3 word address and move the camera to the added marker.
mapboxWrapper.addMarkerAtWords(
"filled.count.soap",
markerColor.BLUE,
{ marker ->
}, { error ->
Log.e("MainActivity", "${error.message}")
}
)
...
binding.mapView.getMapboxMap().addOnMapClickListener { latLng ->
//existing code here...
//example of how to select a 3x3m what3words square using lat/lng
mapboxWrapper.selectAtCoordinates(latLng.latitude(), latLng.longitude())
true
}
}
}
```
## 7. Configuring for use with API server
If you run our Enterprise Suite API Server yourself, you may specify the URL to your own server by adding this line of code to the Map Component:
**Kotlin**
```kotlin
val wrapper = What3WordsV3("YOUR_API_KEY_HERE", "https://api.yourserver.com", this)
```
## 8. Use library with Jetpack Compose
Both Google Maps and Mapbox Wrapper and Fragment work with Jetpack Compose using `AndroidView` and `AndroidViewBinding`, these modules are all available in our [GitHub repository](https://github.com/what3words/w3w-android-samples/) as examples of usage of our `w3w-android-map-components` library in a Jetpack Compose app.
## 9. Map Component Functions
| Method Name | Description | Example |
| --- | --- | --- |
| addMarkerAtCoordinates | This method allow you to add a marker/square to the map defined by the latitude and longitude provided. | addMarkerAtCoordinates(49.180803, -8.001330, { marker }, { error }) or add multiple Coordinates to the map: addMarkerAtCoordinates(listOf(Pair(49.180803, -8.001330), Pair(50.180803, -8.001330)), { markers }, { error }) Example: key=Your-API-Key |
| addMarkerAtSuggestion | This method allow you to add a marker/square to the map after getting the what3words suggestion from our W3WAutosuggestEditText allowing easy integration between both components autosuggest and maps. | addMarkerAtSuggestion(suggestion, markerColor.RED, { marker }, { error }) or add multiple suggestions to the map: addMarkerAtSuggestion(suggestions, markerColor.RED, { markers }, { error }) |
| addMarkerAtWords | This method allow you to add a marker/square to the map if the parameter is valid what3words address, e.g. filled.count.soap. If it's not valid, onError will be called returning APIResponse.What3WordsError.BAD\_WORDS. | addMarkerAtWords("filled.count.soap"), markerColor.RED, { marker }, { error }) or add multiple 3 word addresses to the map: addMarkerAtWords(listOf("filled.count.soap", "index.home.raft"), markerColor.RED, { markers }, { error }) |
| findMarkerByCoordinates | findMarkerByCoordinates This method allow you to find a marker added to the map (returns null if no marker is added on the specified coordinates). | val marker = findMarkerByCoordinates(50.180803, -8.001330) |
| getAllMarkers | This method allow you to get all added markers from the map. | val markers = getAllMarkers() |
| getSelectedMarker | This method allow you to return a selected marker from the map. | val selected\_markers = getSelectedMarker() |
| gridEnabled | This method allow you to enalbe the grid overlay over the map with all 3mx3m squares on the visible map bounds, enabled by default. | gridEnabled(true) |
| handleZoomOption | \| handleZoomOption \| This method allow you to define the zoom options. \| handleZoomOption(latLng: LatLng, zoomOption: W3WZoomOption) \| | handleZoomOption(latLng: LatLng, zoomOption: W3WZoomOption) |
| removeAllMarkers | This method allow you to remove all markers added to the map. | removeAllMarkers() |
| removeMarkerAtCoordinates | This method allow you to remove a marker defined by coordinates from the map. | removeMarkerAtCoordinates(50.180803, -8.001330) or remove multiple markers at coordinates from the map: removeMarkerAtCoordinates(listOf(Pair(49.180803, -8.001330), Pair(50.180803, -8.001330)) |
| removeMarkerAtSuggestion | removeMarkerAtSuggestion This method allow you to remove a marker defined by a what3words suggestion from the map. | removeMarkerAtSuggestion(suggestion) or remove multiple suggestions: removeMarkerAtSuggestion(suggestions) |
| removeMarkerAtWords | This method allow you to remove a marker at what3words address from the map. | removeMarkerAtWords("filled.count.soap") or remove multiple markers at 3 word adresses from the map: removeMarkerAtWords(listOf("filled.count.soap", "index.home.raft")) |
| selectAtCoordinates | This method allow you to set coordinates for a selected marker on the map. It can only have one selected marker at the time. | selectAtCoordinates(50.180803, -8.001330, { selectedMarker }, { error } |
| selectAtSquare | This method allow you to set square for a selected marker on the map. It can only have one selected marker at the time. | selectAtSquare(square: SuggestionWithCoordinates, zoomOption: W3WZoomOption, onSuccess: Consumer?, onError: Consumer?) {} |
| selectAtSuggestion | This method allow you to set suggestion for a selected marker on the map. It can only have one selected marker at the time. | selectAtSuggestion(suggestion, { selected marker }, { error }) |
| selectAtWords | This method allow you to set 3 word address for a selected marker on the map. It can only have one selected marker at the time. | selectAtWords("filled.count.soap", { selectedMarker }, { error }) |
| setGridColor | This method allow you to set a different color to the Grid when the background mode is dark or light. To be noted that map providers have different Dark/Light modes settings i.e: GoogleMaps sets dark mode using JSON styles but Mapbox has dark mode as a MapType. \[GridColor.AUTO\] - Will leave up to the library to decide which Grid color and selected square color to use to match some specific map types, i.e: use \[GridColor.DARK\] on normal map types, \[GridColor.LIGHT\] on Satellite and Traffic map types. \[GridColor.LIGHT\] - Will force grid and selected square color to be light. \[GridColor.DARK\] - Will force grid and selected square color to be dark. | setGridColor(gridColor: GridColor.LIGHT) |
| setLanguage | This method allow you to set the default language for all the calls that the map makes to the API. The parameter should be a supported what3words address language as an ISO 639-1 2 letter code. Defaults to en (English). | setLanguage("en") |
| unselect | This method allow you to remove the selected marker from the map. | unselect() |
| updateMap | This method allow you to refresh the grid bounds and draw the grid. This method should be called on GoogleMap.setOnCameraIdleListener or MapboxMap.addOnMapIdleListener. Enabled is set to true (default)\* | updateMap()\* |
| updateMove | This method allow you to swap from markers to squares and show/hide grid when zoom goes higher or lower than the zoom level threshold. This method should be called on GoogleMap.setOnCameraMoveListener or MapboxMap.addOnCameraChangeListener. Enabled is set to true (default)\* | updateMove()\* |
## 10. Events
| Event | Description | Example |
| --- | --- | --- |
| onMarkerClicked | This method allow you to set up a callback for when an existing marker is clicked on the map. | onMarkerClicked { marker } |
| onSquareSelected | This method allow you to set up a callback for when a square is selected either by clicking on the map or programmatically using any of \[selectAtWords\], \[selectAtCoordinates\], \[selectAtSuggestion\]. | map.onSquareSelected(onSuccess = { square, \_, \_ Snackbar.make(binding.root, square.words, Snackbar.LENGTH\_INDEFINITE).show()}) |
### Listening for events
Using an event listener, it is possible to fire other functionality in an app when something changes in the Map Component. For example, when you click on the map marker you can display the what3words address if you trigger the `onSquareSelected` event.
**Note:** Only one square can be selected at the same time, just like our core apps.
**Kotlin**
```kotlin
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
binding.mapView.getMapboxMap().loadStyleUri(Style.MAPBOX_STREETS)
setContentView(binding.root)
val wrapper = What3WordsV3("YOUR_API_KEY_HERE", this)
val mapboxWrapper = W3WMapBoxWrapper(
this,
binding.mapView.getMapboxMap(),
wrapper,
).setLanguage("en") // set the language of the what3words addresses
//show an example on how to add a blue marker
//on a valid 3 word address and move the camera to the added marker.
mapboxWrapper.addMarkerAtWords(
"filled.count.soap",
markerColor.BLUE,
{ marker ->
}, { error ->
Log.e("MainActivity", "${error.message}")
}
)
//Using an event listener → click on existing what3words markers on the map.
mapboxWrapper.onMarkerClicked {
Log.i("MainActivity", "clicked: ${it.words}")
}
//REQUIRED
binding.mapView.getMapboxMap().addOnMapIdleListener {
//existing code here...
//needed to draw the 3x3m grid on the map
mapboxWrapper.updateMap()
}
//REQUIRED
binding.mapView.getMapboxMap().addOnCameraChangeListener {
//existing code here...
//needed to draw the 3x3m grid on the map
mapboxWrapper.updateMove()
}
}
}
```
## 11. Troubleshooting
If you encounter errors or issues related to convert-to-coordinate, convert-to-3wa and grid-section requests while using the Free plan, please check the network panel for the following error message `Error 402 payment required` and its response, indicating the need to upgrade to a higher plan:
**JSON**
```json
{
"error": {
"code": "QuotaExceeded",
"message": "Quota exceeded or API plan does not have access to this feature. Please change your plan at https://accounts.what3words.com/select-plan, or contact support@what3words.com"
}
}
```
For more information, visit our [API plans page](https://accounts.what3words.com/select-plan). If you need further assistance, contact [support@what3words.com](mailto:support@what3words.com).
---
# Using the Android OCR Component
what3words OCR Components extract what3words addresses from images or live feeds.
Topics: Android, Mobile App
Section: [Scanning](https://developer.what3words.com/docs/scanning.md)
Source: https://developer.what3words.com/tutorial/using-the-android-ocr-component
Updated: 2026-11-27
This guide will help you integrate the what3words OCR Components into your Android application, enabling users to seamlessly scan and interpret what3words addresses from images.
The **what3words OCR Components** for Android simplify the process of scanning images to detect and extract what3words addresses using [MLKit V2](https://developers.google.com/ml-kit/vision/text-recognition/v2/android). This library supports multiple sources, including user-uploaded images and live camera feeds.
#### Android minimum SDK support
[](https://developer.android.com/about/versions/marshmallow/android-7.0/)
#### Features
- Detects and extracts what3words addresses from images.
- Supports both live and static image scanning.
- Flexible APIs to configure scanning preferences.
#### GitHub Repository
Access the library and detailed documentation on
.
[Android OCR Component](https://github.com/what3words/w3w-android-ocr-components)
#### Demo

## 1. Get API key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Installation
### Step 1: Add the Dependency
Include the library in your project’s `build.gradle` file:
**Gradle**
```groovy
dependencies {
// W3W API OCR Lib
implementation 'com.what3words.android:ocr-components:'
// mlkit
implementation "com.google.android.gms:play-services-mlkit-text-recognition:$mlkit_core_version"
implementation "com.google.android.gms:play-services-mlkit-text-recognition-chinese:$mlkit_languages_version"
implementation "com.google.android.gms:play-services-mlkit-text-recognition-devanagari:$mlkit_languages_version"
implementation "com.google.android.gms:play-services-mlkit-text-recognition-japanese:$mlkit_languages_version"
implementation "com.google.android.gms:play-services-mlkit-text-recognition-korean:$mlkit_languages_version"
}
```
Replace `` with the current version of the library, available in the [GitHub Repository](https://github.com/what3words/w3w-android-ocr-components).
### Step 2: Enable Camera Permissions
Update your `AndroidManifest.xml` to request the necessary permissions:
**XML**
```xml
```
## 3. Initialisation
Initialize OCR wrapper by MLKit Language
**Kotlin**
```kotlin
private lateinit var ocrWrapper: W3WOcrWrapper
private val dataProvider: What3WordsAndroidWrapper by lazy {
What3WordsV3(
BuildConfig.W3W_API_KEY,
this@ComposeOcrScanPopupSampleActivity
)
}
```
**Kotlin**
```kotlin
private fun getOcrWrapper(): W3WOcrWrapper {
return W3WOcrMLKitWrapper(
this,
viewModel.selectedMLKitLibrary
)
}
```
## 4. Usage
### Adding a W3WOcrScanner to Your App
Integrate the `W3WOcrScanner` component to enable OCR scanning in your app:
**Kotlin**
```kotlin
W3WOcrScanner(
ocrScanManager = ocrScanManager,
onDismiss = {
// Handle scanner dismissal
},
onSuggestionSelected = { suggestion ->
// Handle address selection
},
onError = { error ->
// Handle the error
},
)
```
### Creating an OcrScanManager
The `OcrScanManager` handles the scanner’s state and logic, utilizing `W3WImageDataSource` and `W3WTextDataSource` for scanning and validating addresses. Note: initialize the OCR component with your API key
**Kotlin**
```kotlin
val w3WImageDataSource = W3WMLKitImageDataSource.create(
context = context,
recognizerOptions = TextRecognizerOptionsInterface.LATIN
)
val w3WTextDataSource = W3WApiTextDataSource.create(context, W3W_API_KEY)
val ocrScanManager = rememberOcrScanManager(
w3wImageDataSource = w3WImageDataSource,
w3wTextDataSource = w3WTextDataSource,
)
```
### Setup Options
You can configure the OCR scanner with either **Online** or **Offline** setups depending on your app’s requirements:
1. **Online Setup**: Use `MLKit` for scanning and `W3WApiTextDataSource` for online validation.
2. **Offline Setup**: Use `W3WTesseractImageDataSource` for offline scanning and `W3WSdkTextDataSource` for offline validation. *(Offline setup requires additional licensing; contact us for details.)*
### Using OcrScannerState for Advanced Control
For more granular control, manage the scanner’s state externally with `OcrScannerState`:
**Kotlin**
```kotlin
val ocrScannerState = remember { OcrScannerState() }
W3WOcrScanner(
ocrScannerState = ocrScannerState,
onError = { error ->
// Handle the error
},
onDismiss = {
// Handle scanner dismissal
},
onFrameCaptured = { image ->
// Implement detection logic for what3words addresses
CompletableDeferred().apply {
complete(Unit) // Signal completion when processing is done
}
},
onSuggestionSelected = { suggestion ->
// Handle address selection
},
)
```
### Styling W3WOcrScanner
Customise the appearance of `W3WOcrScanner` by overriding its default strings, colours, and text styles:
**Kotlin**
```kotlin
W3WOcrScanner(
...
scannerStrings = W3WOcrScannerDefaults.defaultStrings(
scanStateFoundTitle = stringResource(id = R.string.scan_state_found),
),
scannerColors = W3WOcrScannerDefaults.defaultColors(
bottomDrawerBackground = W3WTheme.colors.background
),
scannerTextStyles = W3WOcrScannerDefaults.defaultTextStyles(
stateTextStyle = W3WTheme.typography.headline
),
suggestionColors = SuggestionWhat3wordsDefaults.defaultColors(
background = W3WTheme.colors.background
),
suggestionTextStyles = SuggestionWhat3wordsDefaults.defaultTextStyles(
wordsTextStyle = W3WTheme.typography.headline
)
)
```
### Camera Permission
Ensure your app requests camera permissions by adding the following to your `AndroidManifest.xml`:
**XML**
```xml
```
## 5. Migration to v2.0
Upgrading to v2.0 introduces streamlined APIs and integration with the Core Library.
### Breaking Changes
- **Core Library Models:** v1.x models replaced with Core Library equivalents; manual migration required.
- **W3WOcrMLKitWrapper** **Removed**: Replaced by OcrScanManager for simplified API.
- **MLKitOcrScanActivity** **Deprecated**: No longer supported; use Jetpack Compose for activity integration.
### New Features
- **OcrScanManager:** Encapsulates scanning logic and state for easier implementation.
- **Flexible Data Sources:** Support for online (MLKit + W3WApiTextDataSource) and offline setups.
- **Improved Modularity:** Enhanced customisation and integration options for Jetpack Compose.
### Migration Steps
1. Replace the old library version with the latest:
**Gradle**
```groovy
implementation 'com.what3words:w3w-android-ocr-components:$latest'
```
**Step 2: Replace Deprecated Models**
Manually update v1.x models with Core Library equivalents. Refer to the Core Library documentation for details.
**Step 3: Use OcrScanManager**
Replace W3WOcrMLKitWrapper with the new OcrScanManager for simplified state and logic management:
**Kotlin**
```kotlin
val ocrScanManager = rememberOcrScanManager(
w3wImageDataSource = W3WMLKitImageDataSource.create(context, TextRecognizerOptionsInterface.LATIN),
w3wTextDataSource = W3WApiTextDataSource.create(context, W3W_API_KEY),
)
W3WOcrScanner(ocrScanManager = ocrScanManager, ...)
```
**Step 4: Remove MLKitOcrScanActivity**
MLKitOcrScanActivity has been deprecated. Use Jetpack Compose for standalone scanning activities.
## 6. Sample App
The OCR component repository includes a [sample app](https://github.com/what3words/w3w-android-samples/tree/main/ocr-sample) demonstrating the usage of the what3words OCR component.
---
# Using the iOS Map Component
Displaying the what3words grid and marker on Apple Maps' new or existing map applications.
Topics: Swift, Mobile App
Section: [Display Map](https://developer.what3words.com/docs/display-map.md)
Source: https://developer.what3words.com/tutorial/using-the-ios-map-component
Updated: 2026-11-27
### Tutorial
### Introduction
The easiest way to add what3words to your technology is to use one of our components. We have several components available for JavaScript, iOS, and Android which require minimal development to integrate.
The what3words iOS Map Component provides a straightforward way to add what3words grid on top of your `MKMapView` or a full-featured map View Controller, displaying the what3words address and marker on the map for a selected 3 word address. This tutorial steps through how our iOS Map Component can be added to a new project that requires creating a map from scratch or to an existing map:
- If you are creating a new map from scratch using our Map component then we recommend using our Map Component: W3WMapViewController;
- If you want to add what3words to an existing map then we recommend using our Map Helper: W3WMapHelper;
- If you are looking for a quick and dirty way to get the what3words functionality into your app we recommend using our Map View: W3WMapView.
Follow the steps below to select your chosen way to integrate our what3words map component into your project.<
GitHub repo: [https://github.com/what3words/w3w-swift-components](https://github.com/what3words/w3w-swift-components).
### Quickstart
The iOS Map Component requires just a few lines of code to be added to an iOS application to create a map with what3words functionality.
- Replace YOUR-API-KEY with your what3words API key.
- It is compatible with applications that are built using iOS 9.0 or higher.
- If you are upgrading from any version 1.x.x, see [this upgrade guide](https://github.com/what3words/w3w-swift-components/blob/master/Documentation/PreviousVersions/UpgradeFromV1.md).
Here are listed some sample apps that can be used:
- [Map Component Sample](https://github.com/what3words/w3w-swift-samples/tree/main/MapComponent);
- [Map Helper Sample](https://github.com/what3words/w3w-swift-samples/tree/main/MapHelper);
- [Map Viewer Sample](https://github.com/what3words/w3w-swift-samples/tree/main/MapView)

**Swift**
```swift
class ViewController: W3WMapViewController {
override func viewDidLoad() {
super.viewDidLoad()
let api = What3WordsV3(apiKey: "Enter your what3words API key")
self.set(api)
self.set(language: "en")
let textField = W3WAutoSuggestTextField(api)
self.attach(textField: textField)
textField.onSuggestionSelected = { suggestion in
self.removeAllMarkers()
self.addMarker(at: suggestion, camera: .zoom)
}
self.onSquareSelected = { square in
self.removeAllMarkers()
self.addMarker(at: square, camera: .center)
testField.set(display: square)
}
let button = W3WMapTypeButton()
attach(view: button, position: .bottomRight)
// if there is an error then add it as an alert
onError = { error in self.showError(error: error) }
}
/// set here the showError() function
func showError(error: Error) {
DispatchQueue.main.async {
let alert = UIAlertController(title: "Error", message: String(describing: error), preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Dismiss", style: .cancel, handler: nil))
self.present(alert, animated: true)
}
}
}
```
### Step by Step
## 1. Get API key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Add the dependency
The iOS Map Component depends on the [what3words swift wrapper](https://github.com/what3words/w3w-swift-wrapper), make sure you will add it as a Package Dependency. Follow these easy steps to add this swift package to your project:
1. From Xcode’s File menu choose `Swift Packages` then `Add Package Dependancy`.
2. The Choose Package Repository window appears. Add [https://github.com/what3words/w3w-swift-components.git](https://github.com/what3words/w3w-swift-components.git) in the search box, and click on `Next`.
3. If you are satisfied with the selected version branch choices, click Next again.
4. You should then be shown as a “Package Product” `W3WSwiftComponents`. Choose `Add Package`.
Xcode should now automatically install `w3w-swift-components`, and `w3w-swift-wrapper`.
Go to your `ViewController.swift` file and add the following libraries:
**Swift**
```swift
import W3WSwiftApi
import W3WSwiftComponents
```
## 3. New app using W3WMapViewController
If you are starting a new project and you are creating a new app from scratch, we recommend using our W3WMapViewController which is a high-level component that has easy-to-use what3words functionality.
Add the following class `W3WMapViewController` to the `ViewController` of your project. You will just have a Map view, no what3words functionality has been added yet at this point.
**Swift**
```swift
import UIKit
import W3WSwiftApi
import W3WSwiftComponents
class ViewController: W3WMapViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
}
```
You will need to add your [what3words API key](https://what3words.com/select-plan) here to display the Map Component:
**Swift**
```swift
class ViewController: W3WMapViewController {
override func viewDidLoad() {
super.viewDidLoad()
let api = What3WordsV3(apiKey: "Enter your what3words API key")
}
}
```
To refer to the map add the following line of code to your `viewDidLoad()` function below the `api` variable:
**Swift**
```swift
class ViewController: W3WMapViewController {
override func viewDidLoad() {
super.viewDidLoad()
let api = What3WordsV3(apiKey: "Enter your what3words API key")
// set the map view --> self = map
self.set(api)
}
}
```
After adding this snippet run your application and you will display the Apple Maps with the what3words grid on top of it.

### Customise the Map Component
The Map Component can be customised using some what3words properties. Here is shown an example where you can add a simple market to your Map with a specified what3words address. It will place an annotation on the map, if the map is zoomed in, it will appear as a square, and if zoomed out it shows as a what3words annotation icon.

**Swift**
```swift
class ViewController: W3WMapViewController {
override func viewDidLoad() {
super.viewDidLoad()
let api = What3WordsV3(apiKey: "Enter your what3words API key")
self.set(api)
// add Marker with a specified what3words address
self.addMarker(at: "filled.count.soap")
}
}
```
You can set a language to get all the 3wa in the desired language (default english) by adding this line of code within the `viewDidLoad` function:
**Swift**
```swift
class ViewController: W3WMapViewController {
override func viewDidLoad() {
super.viewDidLoad()
let api = What3WordsV3(apiKey: "Enter your what3words API key")
self.set(api)
// set language to get all the what3words
self.set(language: "en")
self.addMarker(at: "filled.count.soap")
}
}
```
You can make the map marker change color or their position on the map or add a list of specified what3words addresses.
**Note:** the default colour of the marker is the brand’s red.

**Swift**
```swift
class ViewController: W3WMapViewController {
override func viewDidLoad() {
super.viewDidLoad()
let api = What3WordsV3(apiKey: "Enter your what3words API key")
self.set(api)
self.set(language: "en")
// an example on how to add a blue marker on a valid 3 word address and move the map view to the center with multiple markers on the map
self.addMarker(at:["filled.count.soap", "index.home.raft"], camera: .center, color: .blue)
}
}
```
You could also pass in a what3words suggestion to the `addMarker` property:

**Swift**
```swift
class ViewController: W3WMapViewController {
override func viewDidLoad() {
super.viewDidLoad()
let api = What3WordsV3(apiKey: "Enter your what3words API key")
self.set(api)
self.set(language: "en")
// an example on how to add a what3words suggestions to the marker
api.autosuggest(text: "filled.count.s") { suggestions, error in
self.addMarker(at: suggestions)
}
}
}
```
You could also restrict your what3words address suggestions to a desired country using `W3WOptions()` as shown here:

**Swift**
```swift
class ViewController: W3WMapViewController {
override func viewDidLoad() {
super.viewDidLoad()
let api = What3WordsV3(apiKey: "Enter your what3words API key")
self.set(api)
self.set(language: "en")
// an example on how to add a what3words suggestions to the marker clipped to a desired country
let options = W3WOptions().clipToCountry("GB")
api.autosuggest(text: "filled.count.s", options: options) { suggestions, error in
self.addMarker(at: suggestions)
}
}
}
```
### Access the map view
To access the Map View you can use an accessor variable called `w3wMapView` which is an `MKMapView`.
### Listening for events
Now when you click on the map marker you can display the what3words address if you trigger the `onSquareSelected` event.
**Note:** Only one square can be selected at the same time, just like our core apps.

**Swift**
```swift
class ViewController: W3WMapViewController {
override func viewDidLoad() {
super.viewDidLoad()
let api = What3WordsV3(apiKey: "Enter your what3words API key")
self.set(api)
self.set(language: "en")
// an example when a point is touched on the map and highlights its 3x3m what3words square,
self.onSquareSelected = { square in
// this clears previous what3words annotations and selected squares
self.removeAllMarkers()
self.addMarker(at: square, camera: .center)
}
}
}
```
### Use AutoSuggest Component in the Search field
If you want to add the AutoSuggest Component to the search box on top of the Map Component, you need to update your `viewDidLoad()` function to both have the what3words components, the `W3WAutoSuggestTextField` (for the AutoSuggest Component) and `W3WMapViewController` (for the Map Component).

**Swift**
```swift
class ViewController: W3WMapViewController {
override func viewDidLoad() {
super.viewDidLoad()
let api = What3WordsV3(apiKey: "Enter your what3words API key")
self.set(api)
self.set(language: "en")
// Add an AutoSuggest Component text field, and attach it to the view
let textField = W3WAutoSuggestTextField(api)
self.attach(textField: textField)
// when an AutoSuggest suggestion is selected from the text field, show it on the map and clear previous selections
textField.onSuggestionSelected = { suggestion in
self.removeAllMarkers()
self.addMarker(at: suggestion, camera: .zoom)
}
self.onSquareSelected = { square in
self.removeAllMarkers()
self.addMarker(at: square, camera: .center)
// this add the what3words address to the text field
textField.set(display: square)
}
}
}
```
If you want to add the voice functionality to the AutoSuggest Text Field Component you need to make sure to add the following line of code right after you declare the `textField` variable
**Swift**
```swift
let textField = W3WAutoSuggestTextField(api)
// Add an AutoSuggest text field component with the voice option, and attach it to the view (voice functionality requires API key permissions, contact what3words to enable this - https://accounts.what3words.com/overview)
textField.set(voice: true)
attach(textField: textField)
```
### Customise map type
If you are familiar with `MKMapView` you can set up different map types `MKMapType`, for example:
- `.standard` if you want to display street map
`mapView.mapType = .standard`
- `.satellite` if you want to displays satellite imagery
`mapView.mapType = .satellite`
Here is what your application should look like:

## 4. Existing app using W3WMapHelper
If you already have an application with a map we recommend using our Map Helper, `W3WMapHelper` in your app. It provides convenience functions to add to your `MKMapViewDelegate` functions for what3words grid and pin annotations to be displayed on your map.
An iOS UIKit example project can be out [here](https://github.com/what3words/w3w-swift-components/blob/master/Examples/MapHelper/MapHelper.xcodeproj). This example shows where you would place the calls, and how to instantiate the `W3WMapHelper`.
**Note:** the `W3WMapHelper` is conforms to the `W3WMapViewProtol`. A function reference is described below in the Map Component Functions.
**Swift**
```swift
let api = What3WordsV3(apiKey: "YourApiKey")
let mapHelper = W3WMapHelper(api, map: yourMKMapView)
```
## 5. Existing app using W3WMapView
If you are keen on using our Map View, `W3WMapView`, as a quick and dirty way to quickly get what3words functionality into your app, simply replace your `MKMapView` with `W3WMapView`, and your app should behave the same as before except it will draw what3words grid lines and have some new functions available, like `addMarker(at: "filled.count.soap")`.
The `W3WMapView` is derived from `MKMapView` but Apple does not recommend deriving new objects from `MKMapView` presumably, because its interface could change in the future.
A better approach to inserting our map component into your existing map would be to use our `W3WMapHelper` which is designed to fit nicely into your `MKMapViewDelegate` conforming class, presumably a `UIViewController`.
An iOS UIKit example project can be out [here](https://github.com/what3words/w3w-swift-samples/tree/main/MapView/MapView.xcodeproj).
**Note:** the `W3WMapHelper` is conforms to the `W3WMapViewProtol`. A function reference is described below in the Map Component Functions.
**Swift**
```swift
let api = What3WordsV3(apiKey: "YourApiKey")
let mapview = W3WMapView(api)
```
## 6. Configuring for use with API server
If you run our Enterprise Suite API Server yourself, you may specify the URL to your own server by adding this line of code to the Map Component:
**Swift**
```swift
val api = What3WordsV3(apiKey: "YOUR_API_KEY_HERE", apiUrl: "https://api.yourserver.com")
```
## 7. Map Component Functions
| Method Name | Description | Example |
| --- | --- | --- |
| addMarker(at: \_, camera: W3WCenterAndZoom, color: UIColor?, style: W3WMarkerStyle) | This parameter will place an annotation on the map, if the map is zoomed in, it will appear as a square, and if zoomed out it shows as a what3words annotation icon. addMarker(at:camera:color) takes one required parameter and two optional ones. The first is the location, this can be a what3words address as: - words: String, - suggestion: W3WSuggestion, - squares: W3WSquare, - coordinates: CLLocatioinCorrdinate2D, - or it can be an array of any of those. Note: if you pass in a String, or W3WSuggestion, a call to convertToCoordinates will be made automatically to get the coordinates, and this will count towards your account quota. The second and optional parameter is called camera and it indicates how to move the map view. The choices are: - .zoom - zooms the map into the location right around the square - .center - adjusts the map's center so that the location is in the center, but does not zoom in - .none - this leaves the mapView showing the same area it was showing before the call The third and optional parameter is color which takes a UIColor color for the annotation. The default colour is the what3words brand's red. | map.addMarker(at:square, camera: .zoom) map.addMarker(at:"filled.count.soap", style: .pin) map.addMarker(at:\["filled.count.soap", "index.home.raft"\], camera: .center) map.addMarker(at:\["filled.count.soap", "index.home.raft"\], color: .blue, camera: .center) |
| getMapAnnotationView(annotation: MKAnnotation) -> MKAnnotationView? | If the annotation is a what3words one, this parameter gets a renderer, otherwise, it returns nil. If you are using W3WMapHelper then this is typically called in your MKMapViewDelegate's call: mapView(\_, viewFor: MKAnnotation) | getMapAnnotationView(annotation: annotation) |
| mapRenderer(overlay: MKOverlay) -> MKOverlayRenderer?addMarkerAtWords | This parameter gets a renderer for the what3words grid if it is given a W3WMapGridLines or W3WMapSquareLines overlay, otherwise, it returns nil. If you are using W3WMapHelper then this is typically called in your MKMapViewDelegate's call: mapView(\_, rendererFor: MKOverlay) | mapRenderer(overlay: overlay) |
| removeAllMarkers() | This parameter will hide an annotation that was previously placed on the map. It takes one parameter and like addMarker(), it can be a what3words address as: - words: String, - suggestion: W3WSuggestion, - coordinates: CLLocatioinCorrdinate2D, - or it can be an array of any of those. | map.removeAllMarkers() |
| removeMarker(at:) | This method allow you to get all added markers from the map. | map.removeMarker(at: square) map.removeMarker(at: "filled.count.soap") map.removeMarker(at: \["filled.count.soap", "index.home.raft"\]) |
| set(language: String) | This parameter will set the default language for all the calls that the map makes to the API (or SDK if you use that instead). | map.set(language: "fr") // set default language to French |
| set(zoomInPointsPerSquare: CGFloat) | This parameter will set how near the addMarker(at: "filled.count.soap", camera: .zoom) calls will zoom. zoomInPointsPerSquare is the size of squares in points when .zoom is used in an addMarker() call. (points being 1x, 2x, 3x a pixel depending on which device you are using and if it has a "retina" display. | set(zoomInPointsPerSquare: x.x) |
| updateMap() | This parameter updates the map view with annotations and lines. If you are using W3WMapHelper then this is typically called in your MKMapViewDelegate's calls: mapViewDidChangeVisibleRegion() mapView(\_, regionWillChangeAnimated), and mapView(\_, regionDidChangeAnimated). | updateMap() |
## 8. Events
| Event | Description | Example |
| --- | --- | --- |
| onMarkerSelected | This parameter is called when the user taps a square that has a marker added to it. | self.onMarkerSelected = { square in self.addMarker(at: square, camera: .center)} |
| onSquareSelected | This parameter is called when the user taps a square on a map. | self.onSquareSelected = { square in self.addMarker(at: square, camera: .center)} |
| onError | This parameter returns the error enum for any error that occurs. | onError = { error in self.showError(error: error) } |
### Listening for events
Using an event listener, it is possible to fire other functionality in an app when something changes in the Map Component. For example, when you click on the map marker you can display the what3words address if you trigger the `onSquareSelected` event.
**Note:** Only one square can be selected at the same time, just like our core apps.
**Swift**
```swift
class ViewController: W3WMapViewController {
override func viewDidLoad() {
super.viewDidLoad()
let api = What3WordsV3(apiKey: "Enter your what3words API key")
self.set(api)
self.set(language: "en")
// an example when a point is touched on the map and highlights its 3x3m what3words square,
self.onSquareSelected = { square in
// this clears previous what3words annotations and selected squares
self.removeAllMarkers()
self.addMarker(at: square, camera: .center)
}
}
}
```
## 9. Troubleshooting
If you encounter errors or issues related to convert-to-coordinate, convert-to-3wa and grid-section requests while using the Free plan, please check the network panel for the following error message `Error 402 payment required` and its response, indicating the need to upgrade to a higher plan:
**JSON**
```json
{
"error": {
"code": "QuotaExceeded",
"message": "Quota exceeded or API plan does not have access to this feature. Please change your plan at https://accounts.what3words.com/select-plan, or contact support@what3words.com"
}
}
```
For more information, visit our [API plans page](https://accounts.what3words.com/select-plan). If you need further assistance, contact [support@what3words.com](mailto:support@what3words.com).
### Issue
*How to make the textfield suggest actual addresses (not w3w)?*
### Solution
Currently, it’s not possible with the iOS AutoSuggest Component. There is, however, an example of this in [w3w-swift-wrapper](https://github.com/what3words/w3w-swift-wrapper) called [AutosuggestPlusYourData](https://github.com/what3words/w3w-swift-samples/tree/main/AutosuggestPlusYourData). You can use this as a guide or even take some of the code from it for your use.
---
# Using the iOS OCR Component
what3words OCR Components extract what3words addresses from images or live feeds.
Topics: Swift, Mobile App
Section: [Scanning](https://developer.what3words.com/docs/scanning.md)
Source: https://developer.what3words.com/tutorial/using-the-ios-ocr-component
Updated: 2026-11-27
This guide will help you integrate the what3words OCR Components into your iOS application, enabling users to seamlessly scan and interpret what3words addresses from images, using iOS’ Vision Framework or the what3words OCR SDK.
#### Features
- Detects and extracts what3words addresses from images.
- Supports both live and static image scanning.
- Flexible APIs to configure scanning preferences.
#### GitHub Repository
Access the library and detailed documentation on
.
[iOS OCR Component](https://github.com/what3words/w3w-swift-components-ocr/)
#### Demo

## 1. Get API key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Installation
**Swift Package Manager**
1. Add the W3W OCR Swift Components to your project in Xcode, and navigate to **File > Add Packages**.
2. Enter the package URL: [https://github.com/what3words/w3w-swift-components-ocr.git](https://github.com/what3words/w3w-swift-components-ocr.git)
3. Select the latest version and integrate it into your project.
Import the library in your Swift files:
**Swift**
```swift
import W3WSwiftComponentsOcr
```
## 3. Initialisation
### Using iOS’ Vision Framework
To use the Vision Framework for OCR, initialize the `W3WOcrNative` class with the what3words API:
**Swift**
```swift
let api = What3WordsV4(apiKey: "YourApiKey")
let ocr = W3WOcrNative(api)
let ocrViewController = W3WOcrViewController(ocr: ocr)
```
### Using the what3words OCR SDK
For offline functionality, use the what3words OCR SDK by specifying the path to OCR data files and an optional language code:
**Swift**
```swift
let ocr = W3WOcr(dataPath: "/path/to/ocr/datafiles", language: "en")
let ocrViewController = W3WOcrViewController(ocr: ocr)
```
## 4. Usage
### Displaying the OCR Scanner
Use the following example to present the OCR scanner in a `UIViewController`:
**Swift**
```swift
@IBAction func scanButtonPressed(_ sender: Any) {
let ocrViewController = W3WOcrViewController(ocr: ocr, w3w: api)
// Present the scanner
present(ocrViewController, animated: true)
// Start scanning
ocrViewController.start()
// Handle address selection
ocrViewController.onSuggestionSelected = { suggestion in
print(suggestion)
ocrViewController.stop()
ocrViewController.dismiss(animated: true)
}
// Handle errors
ocrViewController.onError = { error in
print(error)
}
}
```
### Customisation
You can customise the appearance of the OCR scanner by applying themes through the `W3WThemes` framework:
**Swift**
```swift
import W3WThemes
let theme = W3WTheme.forOcr(
backgroundColor: UIColor.white.w3wColor,
cameraBackgroundColor: UIColor.darkGray.w3wColor,
headerTextColor: UIColor.red.w3wColor,
fonts: W3WFonts(font: UIFont(name: "Courier", size: 24.0))
)
let ocrViewController = W3WOcrViewController(ocr: ocr, theme: theme, w3w: api)
```
#### Customisable Properties:
- **Colours**: `backgroundColor`, `headerTextColor`, etc.
- **Fonts**: Customisable with `W3WFonts`.
- **Line Styles**: Modify `defaultLineColor`, `successLineColor`, and thickness options.
### Camera Permission
Ensure camera permissions are added to your app’s `Info.plist`:
**XML**
```xml
NSCameraUsageDescriptionWe need access to your camera to scan what3words addresses.
```
## 5. Sample App
The OCR component repository includes a [sample app](https://github.com/what3words/w3w-swift-samples) demonstrating the usage of the what3words OCR component.
---
# Using the Notes Component
Adding a what3words address to an existing textarea field with the Notes Component.
Topics: Angular, JavaScript, React, Vue, Website
Section: [Search Box](https://developer.what3words.com/docs/search-box.md)
Source: https://developer.what3words.com/tutorial/using-the-notes-component
Updated: 2026-11-27
### Tutorial
The easiest way to add what3words to your technology is to use one of our components. We have components available for JavaScript, iOS and Android which require minimal development to integrate. The JavaScript component can also be used in React.js, Vue.js and Angular.
The what3words Notes Component allows users to input a 3-word address in the delivery notes field alongside free text. It provides real-time suggestions and validation, ensuring accurate address input. By default, it uses the what3words API but can be configured to use a private instance.
This tutorial guides you through adding the JavaScript Notes Component to your website, whether you have static pages or use npm. It also covers customisation options to refine the 3-word address suggestions and how to style the component to match your site’s design.
If you aim to integrate the what3words Public API into your Node.js or browser-based applications, our [JavaScript API Wrapper](https://developer.what3words.com/tutorial/javascript) is ideal. You can also access the JavaScript API Wrapper via the window object using our [JavaScript SDK](https://developer.what3words.com/tutorial/javascript-sdk).
### Quickstart
The Notes Component requires just a few lines of code to be added to a form to create a what3words-powered textarea field.
**Note:**
- Replace `YOUR-API-KEY` with your actual what3words API key.
- Customise the `placeholder` and `label` text as needed.
#### Integrate within a Textarea Field
To add the what3words Notes Component to a textarea field in your checkout page, e.g. Delivery Notes, use the following code snippet:
**HTML**
```html
Checkout Page
```
**React**
```jsx
import { useState } from 'react';
import { What3wordsNotes } from '@what3words/react-components';
function MyFormElement() {
const [value, setValue] = useState('');
const onChange = e => setValue(e.target.value);
return (
);
}
export default MyFormElement;
```
**Vue**
```vue
```
**Angular**
```typescript
import { NgModule } from '@angular/core';
import { Component } from '@angular/core';
import { ComponentsModule } from '@what3words/angular-components';
@Component({
selector: 'app-component-notes',
template: `
`,
})
export class W3WNotesComponent {}
@NgModule({
imports: [ComponentsModule],
declarations: [W3WNotesComponent],
exports: [W3WNotesComponent],
bootstrap: [W3WNotesComponent],
})
export class W3WNotesModule {}
```
[Notes Component](https://codesandbox.io/s/s8twj6) (interactive example)
### Step by Step
## 1. Get API key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Add the UI Component
### Installation
The component can be added to static HTML pages by including the `what3words.js` script on each page of your site that you would like to use the component on. You could add the what3words API key as a parameter to `what3words.js` the script but we recommend adding the API key as an attribute to the component element instead.
Alternatively, if you are using NPM for your site, you can utilise one of our packages for your framework.
**HTML**
```html
```
**JavaScript**
```javascript
npm install @what3words/javascript-components
```
**React**
```jsx
npm install @what3words/react-components
```
**Vue**
```vue
npm install @what3words/vue-components
```
**Angular**
```typescript
npm install @what3words/angular-components
```
### Versioning
The Notes Component is versioned to allow for updates and bug fixes. When installing using HTML, we recommend using a fixed version for development versions of your integrations. This will ensure a predictable version of the component is loaded, such as `@5.0.0`. A log of versions can be found [here](https://www.npmjs.com/package/@what3words/javascript-components?activeTab=versions).
**HTML**
```html
```
**JavaScript**
```javascript
npm install @what3words/javascript-components@5.0.0
```
**React**
```jsx
npm install @what3words/react-components@5.0.0
```
**Vue**
```vue
npm install @what3words/vue-components@5.0.0
```
**Angular**
```typescript
npm install @what3words/angular-components@5.0.0
```
When using `NPM`, you will also need to add an `import` statement for our package. Additionally, you can wrap our component around the textarea or input element as shown in the following example:
**React**
```jsx
import { useState } from "react";
import { What3wordsNotes } from '@what3words/react-components';
function MyFormElement() {
const [value, setValue] = useState("");
const onChange = (e) => setValue(e.target.value);
return (
);
}
export default MyFormElement;
```
**Vue**
```vue
```
**Angular**
```typescript
import { NgModule } from '@angular/core';
import { Component } from '@angular/core';
import { ComponentsModule } from '@what3words/angular-components';
@Component({
selector: "app-component-notes",
template: `
`
})
export class W3WNotesComponent {}
@NgModule({
imports: [ComponentsModule],
declarations: [W3WNotesComponent],
exports: [W3WNotesComponent],
bootstrap: [W3WNotesComponent],
})
export class W3WNotesModule {}
```
### Configuring for use with Self-hosted API
If you run our Enterprise Suite API Server yourself, you may specify the URL to your server by appending the `baseUrl` parameter to the `script` loaded. Using the frameworks you can specify the `baseUrl` using `window.what3words.api.setOptions`.
Although we recommend adding the `base_url` parameter within the Notes Component container.
**HTML**
```html
```
**React**
```jsx
import { useState, useEffect } from "react";
useEffect(() => {
window.what3words.api.setConfig({ baseUrl: "https://example.com/v3" });
}, []);
```
**Vue**
```vue
window.what3words.api.setConfig({ baseUrl: 'https://example.com/v3' });
```
**Angular**
```typescript
window.what3words.api.setConfig({ baseUrl: 'https://example.com/v3' });
```
### Using Slots with the what3words Notes Component
The what3words Notes Component enhances `textarea` or `input` elements, allowing users to enter both free text and what3words addresses. It provides real-time suggestions and validation for what3words addresses, ensuring accurate and efficient input. To implement this, wrap your textarea or input field with the Notes Component and specify your what3words API key as an attribute in the Notes Component container. Replace `YOUR_API_KEY` with your actual what3words API key.
Slots are placeholders inside web components that allow you to define where certain elements should be inserted. The what3words Notes Component uses slots to let you customise various parts of the component, such as the `input` field, `label`and `tooltip`. Here we will explain what slots are and how to use them effectively.
**Note:** It is recommended to add a `label`, `placeholder`, and make the field `optional`, especially when integrating it as part of an input field for a checkout page.
### “input” Slot
- **Description**: The “input” slot is used for the `textarea` element where users can type and get suggestions.
- **Usage**: Insert a `textarea` element inside the Notes Component and assign it to the “input” slot.
**HTML**
```html
```
**React**
```jsx
```
**Vue**
```vue
```
**Angular**
```typescript
```
### “label” Slot
- **Description**: The “label” slot is used for the label element associated with the `textarea` field.
- **Usage**: Insert a label element inside the Notes Component and assign it to the “label” slot.
**HTML**
```html
```
**React**
```jsx
```
**Vue**
```vue
```
**Angular**
```typescript
```
### “tooltip” Slot
- **Description**: The “tooltip” slot is used for the content displayed when clicking the status icon.
- **Usage**: Insert a `div` element inside the Notes Component and assign it to the “tooltip” slot. You can customise the tooltip content as needed.
**HTML**
```html
Custom title
Custom content
```
**React**
```jsx
Custom title
Custom content
```
**Vue**
```vue
Custom title
Custom content
```
**Angular**
```typescript
Custom title
Custom content
```
## 3. Localise the Component
### Supported languages
The Notes Component will accept any 3-word address in any language supported by the what3words API. It can also be added to a site using a right-to-left language as long as the HTML direction has been set, for example:
**HTML**
```html
```
**React**
```jsx
```
**Vue**
```vue
```
**Angular**
```typescript
```
## 4. Configure Advanced Options
### Controlling the what3words Display Format
The `addressFormat` property is a flexible way to control how what3words addresses are displayed within the Notes Component. By setting the `address-format` attribute to either `"slashes"` (e.g. `///filled.count.soap`) or `"url"` (e.g. `https://w3w.co/filled.count.soap`), you can choose the format that best suits your application’s needs. The default values is the `"slashes"`.
Here is an example to display the what3words address in the `"url"` format:
**HTML**
```html
```
**React**
```jsx
```
**Vue**
```vue
```
**Angular**
```typescript
```
### Country clipping
To refine the suggestions supplied to a user we recommend using country clipping where appropriate. If, for example, the component is to be used on a checkout page then country clipping can be specified using the `clip-to-country` attribute for the delivery country to ensure that only suggestions are shown in that country and closer matches are displayed. Multiple countries can be specified as comma-separated.
**HTML**
```html
```
**React**
```jsx
```
**Vue**
```vue
```
**Angular**
```typescript
```
### Focus
In addition to country clipping, it is also possible to add focus to results using the `search-focus` attribute. The focus should be supplied as a lat, long, usually the user’s location from the GPS on their device. Supplying focus will ensure that suggestions displayed to the user are biased to their location.
**HTML**
```html
```
**React**
```jsx
```
**Vue**
```vue
```
**Angular**
```typescript
```
### Controlling Tooltip Display
The `showHintsTooltip` property of the what3words Notes Component allows you to control whether the what3words hint tooltip is displayed when the status icon is clicked.
By setting the `show-hints-tooltip` attribute to `true` or `false`, you can choose whether to display the tooltip based on your application’s requirements.
Here is an example where you decided to hide the tooltip by setting `show-hints-tooltip` attribute to `"false"`.
**HTML**
```html
```
**React**
```jsx
```
**Vue**
```vue
```
**Angular**
```typescript
```
## 5. Streamlining Delivery and Data Extraction
**1\. Ensuring Smooth Deliveries:**
For flawless fulfilment, getting the identified what3words address into the hands of everyone involved is crucial. This includes integrating it with your order management system and carrier partners. By doing so, you ensure addresses are processed accurately, leading to efficient deliveries.
**2\. Extracting what3words Addresses:**
Need to isolate what3words addresses from your existing order data? We’ve got you covered! Utilise the provided RegEx formula (included below with a cautionary note). This code helps detect potential what3words addresses within your data.
**Have further questions or require assistance?**
Feel free to contact our technology partner team at [technology.partnerships@what3words.com](mailto:technology.partnerships@what3words.com). We’re happy to help you navigate what3words integration and ensure a smooth user experience.
**Important Considerations:**
- While this approach simplifies integration, it’s crucial to note that the RegEx only validates the format, not the actual validity of the what3words address. Further verification might be necessary.
Please refer to this [tutorial](https://developer.what3words.com/tutorial/detecting-if-text-is-in-the-format-of-a-3-word-address) for more information on this RegEx and its variations.
Implementing these steps will allow you to leverage the power of what3words to streamline your deliveries and extract valuable location data from your existing system.
## 6. Attributes Table
### Component script parameters
| Property | Attribute | Type | Description |
| --- | --- | --- | --- |
| apikey | api-key | String | An API key is required for the component to function correctly. Example: `api-key=Your-API-Key` |
| apiVersion | api-version | ApiVersion.Version1 | The API version to use for the what3words API requests. Example: `'v3' as import('@what3words/api').ApiVersion` |
| baseUrl | base-url | String | The component can be used with an Enterprise Suite API Server instance by using baseUrl. Example: `baseUrl=https://example.com/v3` |
| callback | callback | String | Allows for a callback to be fired once the component has loaded. This should be the function name to be fired. Example: `callback=initMap` |
| headers | headers | String | Enterprise API Server only - Allows for custom headers to be passed through in requests. |
### Recommended textarea or input element attributes
| Attribute | Type | Description |
| --- | --- | --- |
| name | String | Standard CSS name. Example: name="what3words" |
| id | String | Standard CSS input ID. If not specified then one will be added by our component. Example: id="what3words" |
| class | String | Standard CSS class - use with the variant=inherit attribute to apply this class to the input element of the component. Example: class="input-field" |
| placeholder | String | Placeholder text to display. We recommend keeping the placeholder as a what3words address proceeded with "e.g." Example: placeholder="e.g ///filled.count.soap" |
### Slots
| Slot | Description |
| --- | --- |
| "input" | The textarea element to get suggestions from when typing. Example: textarea slot="input". |
| "label" | The label element for the input slot element. Example: label slot="label" |
| "tooltip" | The tooltip content to display when the status icon is clicked. Example div slot="tooltip |
### Component attributes
| Property | Attribute | Type | Description |
| --- | --- | --- | --- |
| addressFormat | address-format | "slashes" \| "url" | The format to display the what3words address in - slashes - e.g. ///filled.count.soap (default) - url - e.g. https://w3w.co/filled.count.soap. Example: address-format="url" |
| apiKey | api-key | String | Your what3words API Key can be specified as an attribute to the component. Example: api-key="Your-API-Key" |
| clipToBoundingBox | clip-to-bounding-box | String | Restrict suggestions to a bounding box specified using co-ordinates. Example: clip-to-bounding-box="51.521,-0.343,52.6,2.3324" |
| clipToCircle | clip-to-circle | String | Restrict suggestions to a circle, specified by lat,lng,kilometres, where kilometres is the radius of the circle. Example: clip-to-circle="51.521251,-0.203586,2" |
| clipToCountry | clip-to-country | String | Restrict suggestions to a given country or comma separated list of countries. Example: clip-to-country="GB,US" |
| clipToPolygon | clip-to-polygon | String | Restrict suggestions to a polygon, specified by a comma-separated list of lat,lng pairs. The polygon should be closed, i.e. the first element should be repeated as the last element; also the list should contain at least 4 entries. The API is currently limited to accepting up to 25 pairs. Example: clip-to-polygon="51.521,-0.343,52.6,2.3324,54.234,8.343,51.521,-0.343" |
| language | language | String | Allows you to add a preferred suggestion fallback language. Only used when input value language cannot be determined. Example: language="EN" |
| nFocusResults | n-focus-results | Number | The number of AutoSuggest results to apply the focus to. Example: n-focus-results="2" |
| searchFocus | search-focus | {number},${number} | The focus point to prioritise results around. If not provided, the user's current location is used. Example: search-focus="51.5,-020" |
| showHintsTooltip | show-hints-tooltip | Boolean | Show the what3words hints tooltip when clicking on the what3words status icon. Example: show-hints-tooltip="true" |
| typeaheadDelay | typeahead-delay | Number | The delay in milliseconds to wait after the user has finished typing before making an autosuggest request. Example: typeahead-delay="300" |
## 7. Events Table
| Event | Description |
| --- | --- |
| apiError | Emitted when an error occurs with the what3words API |
| suggestionsHover | Emitted when a suggestion is hovered over |
| suggestionsChanged | Emitted when the list of suggestions changes |
| suggestionSelected | Emitted when a suggestion is selected |
| valueChanged | Emitted when the input value changes |
| valueInvalid | Emitted when the input value is not a valid what3words address |
| valueValid | Emitted when the input value is a valid what3words address |
### Listening for events
Using an event listener, it is possible to fire other functionality in a site when something changes in the Notes Component. For example, it is possible to listen for when a valid what3words address has been entered and update another element in the page or to listen for when new coordinates have been returned and pan/zoom a map to the location.
**JavaScript**
```javascript
document.addEventListener('DOMContentLoaded', () => {
const notesComponent = document.querySelector('what3words-notes');
notesComponent.addEventListener('suggestionSelected', (event) => {
const selectedSuggestion = event.detail.suggestion;
console.log('Suggestion selected:', selectedSuggestion);
// You can add additional code here to handle the selected suggestion
});
});
```
**React**
```jsx
import { useState } from 'react';
import { What3wordsNotes } from '@what3words/react-components';
function MyFormElement() {
const [value, setValue] = useState('');
const onChange = e => setValue(e.target.value);
return (
console.log(detail.value)}
onValueValid={({ detail }) => console.log(detail.value)}
onValueInvalid={({ detail }) => console.log(detail.value)}
onSuggestionSelected={({ detail }) => console.log(detail.suggestion)}
onSuggestionsChanged={({ detail }) => console.log(detail.suggestions)}
>
);
}
export default MyFormElement;
```
**Vue**
```vue
```
**Angular**
```typescript
import { NgModule } from "@angular/core";
import { Component } from "@angular/core";
import { ComponentsModule } from "@what3words/angular-components";
@Component({
selector: "app-component-autosuggest",
template: `
console.log(detail.value)}
onValueValid={({ detail }) => console.log(detail.value)}
onValueInvalid={({ detail }) => console.log(detail.value)}
onSuggestionSelected={({ detail }) => console.log(detail.suggestion)}
onSuggestionsChanged={({ detail }) => console.log(detail.suggestions)}
>
`
})
export class W3WNotesComponent {}
@NgModule({
imports: [ComponentsModule],
declarations: [W3WNotesComponent],
exports: [W3WNotesComponent],
bootstrap: [W3WNotesComponent],
})
export class W3WNotesModule {}
```
## 8. Troubleshooting
### Vite Compatibility Issue
Our current components do not yet work with Vite due to a known issue with Stencil. A potential fix is expected in a future version upgrade, which we are currently working on. It may take some time before this fix is available and tested. For now, we advise against using Vite. For more details, refer to the [GitHub issue](https://github.com/ionic-team/stencil/issues/2827).
If you encounter errors or issues related to convert-to-coordinate, convert-to-3wa and grid-section requests while using the Free plan, please check the network panel for the following error message `Error 402 payment required` and its response, indicating the need to upgrade to a higher plan:
**JSON**
```json
{
"error": {
"code": "QuotaExceeded",
"message": "Quota exceeded or API plan does not have access to this feature. Please change your plan at https://accounts.what3words.com/select-plan, or contact support@what3words.com"
}
}
```
For more information, visit our [API plans page](https://accounts.what3words.com/select-plan). If you need further assistance, contact [support@what3words.com](mailto:support@what3words.com).
---
# Using the Web Map Component
Displaying the what3words grid and marker on Google Maps.
Topics: Angular, JavaScript, React, Vue, Website
Section: [Display Map](https://developer.what3words.com/docs/display-map.md)
Source: https://developer.what3words.com/tutorial/using-the-web-map-component
Updated: 2026-11-27
### Tutorial
### Introduction
The easiest way to add what3words to your technology is to use one of our components. We have several components available for JavaScript, iOS, and Android which require minimal development to integrate. They can also be used in Angular, React, or Vue projects as framework-native components. Find out how else you can utilise the what3words API using JavaScript by taking a look at the functions in the what3words [JavaScript API Wrapper](https://developer.what3words.com/tutorial/javascript). The web map component declares a custom DOM element that allows for a quick and simple way of adding the what3words grid on top of Google Maps, displaying the what3words address and marker on the map for a selected three word address.
You can optionally integrate the AutoSuggest Component with the map too and it will enable searching of 3 word addresses or traditional addresses and traverses the map to the selected three word address. The component by default uses the what3words API or can be configured to use a privately hosted instance of the what3words API. This tutorial steps through how our JavaScript Map Component can be added to a website either for static pages via our CDN or using NPM as part of your project dependencies.
Follow the steps below to select your chosen technology to find out how you can add the what3words map component to your project.
### Quickstart
The Web Map Component requires just a few lines of code to be added to a site to create a map with what3words functionality. Replace `YOUR-API-KEY` with your what3words API key and the `YOUR-GOOGLE-API-KEY` with your Google Maps API key.
**HTML**
```html
```
**Angular**
```typescript
import { NgModule } from "@angular/core";
import { Component } from "@angular/core";
import { ComponentsModule } from "@what3words/angular-components";
@Component({
selector: "app-component-map",
template: `
`,
styles: [`
html, body {
margin: 0px;
height: 100%;
}
#map-container {
width: 100vw;
height: 100vh;
}
#search-container {
margin: 10px 0 0 10px;
}
#search-input {
width: 300px;
}
#current-location-container {
margin: 0 10px 10px 0;
}
`]
})
export class W3WMapComponent { }
@NgModule({
imports: [ComponentsModule],
declarations: [W3WMapComponent],
exports: [W3WMapComponent],
bootstrap: [W3WMapComponent]
})
export class W3WMapModule { }
```
[Web Map Component](https://codesandbox.io/s/web-map-component-static-sample-nimy60) (interactive example)
### Step by Step
## 1. Get API key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Get Google API key
You also will need to get a [Google API key](https://developers.google.com/maps/documentation/places/web-service/get-api-key#console) for your chosen map provider (only Google is currently supported).
**Note:**
In [console.cloud.google.com](http://console.cloud.google.com/) you should select: `API and services` > `Enabled APIs and services`
Search for `places API` and then select and enable it.
## 3. Add Map Component
The component can be added to static HTML pages by including the `what3words.js` script on each page of your site that you would like to use the component on. A notable limitation imposed by Google Maps restricts the number of maps that can be rendered on any single page (details are provided in the `Troubleshooting` section).
You will need to replace `` with your what3words API key. This will attach the what3words API to the `window` accessible via `window.what3words`. This parameter is only required if you need the latter functionality. Alternatively, if you are using a package manager (e.g. `npm`) within your site you can consume one of our packages for your framework.
**HTML**
```html
```
**JavaScript**
```javascript
npm install @what3words/javascript-components@5.0.0
```
**React**
```jsx
npm install @what3words/react-components@5.0.0
```
**Vue**
```vue
npm install @what3words/vue-components@5.0.0
```
**Angular**
```typescript
$ npm install @what3words/angular-components@5.0.0
```
### Add Current Location Functionality (Optional)
To enable your customers to choose their current location and discover their three word address, you will need to add a `current-location-control` slot container with a child button as a sibling to the `search-control` slot. This can be styled using CSS with its position on the map canvas controlled by the `current_location_control_position` What3Words Map Component property. A simple implementation is shown below:
**HTML**
```html
...
...
```
**React**
```jsx
...
...
```
**Vue**
```vue
...
...
```
**Angular**
```typescript
...
...
```
### Insert Map Component
Then we will need to wrap the map container and the search box within the what3words Map Component as shown here to display the what3words grid and marker on Google Maps. Notice you will need to add your what3words API key to the `api_key` parameter and your Google Maps API key to `map_api_key` parameter.
**Note:** You will also need to add an `import` line to our package if you are using npm.
**HTML**
```html
```
**React**
```jsx
import {
What3wordsMap
} from "@what3words/react-components";
const API_KEY = "YOUR-API-KEY";
const MAP_API_KEY = "YOUR-GOOGLE-API-KEY"
export default function Map() {
return (
);
}
```
**Vue**
```vue
```
**Angular**
```typescript
import { NgModule } from "@angular/core";
import { Component } from "@angular/core";
import { ComponentsModule } from "@what3words/angular-components";
@Component({
selector: "app-component-map",
template: `
`,
styles: [`
...
`]
})
export class W3WMapComponent { }
@NgModule({
imports: [ComponentsModule],
declarations: [W3WMapComponent],
exports: [W3WMapComponent],
bootstrap: [W3WMapComponent]
})
export class W3WMapModule { }
```
### Define a map container
Add HTML and CSS to create a page with a `#map` element. The `#map` is the element that displays the map and its CSS resets any browser settings, so it can consume the full width and height of the browser. Note that we must specifically declare those percentages for <**body**\> and <**html**\> as well.
For the map to display on a web page, we must reserve a spot for it. Commonly, we do this by creating a named <**div**\> element and obtaining a reference to this element in the browser’s document object model (DOM).
**HTML**
```html
```
**React**
```jsx
import {
What3wordsMap
} from "@what3words/react-components";
const API_KEY = "YOUR-API-KEY";
const MAP_API_KEY = "YOUR-GOOGLE-API-KEY"
export default function Map() {
return (
);
}
```
**Vue**
```vue
```
**Angular**
```typescript
...
template: `
`,
...
```
**CSS**
```css
```
### Insert Search field
You could insert a seach box by simply adding a `search-control slot` within the Map Component. In the `search-control slot` you can specify your customised search box.
**HTML**
```html
`,
...
```
### Use AutoSuggest Component in the Search field (Optional)
You could also provide a type-ahead search box that includes the what3words Web AutoSuggest Component and the common address from Google Places, you will need to add the following code on your body below the `div` element that is used as a map container.
**Note:** This is completly optional. You will also need to add an `import` line to our AutoSuggest Component package if you are using `npm`.
**HTML**
```html
`,
...
```
### Customise the Map Component
The Map Component can be customised using common Google Maps options and other what3words properties. Here is shown an example of how to add these options and properties together.
**HTML**
```html
...
```
**React**
```jsx
...
```
**Vue**
```vue
...
```
**Angular**
```typescript
...
template: `
...
`
...
```
### Configuring for use with API server
If you run our Enterprise Suite API Server yourself, you may specify the URL to your own server by adding the `base_url` parameter to the Map Component.
**HTML**
```html
...
```
**React**
```jsx
...
```
**Vue**
```vue
...
```
**Angular**
```typescript
...
```
### Styling Map Component
By default, the Web Map Component will load with the what3words predefined map marker icon. You can choose your own icon by adding their URL path to the `marker_icon` attribute.
**HTML**
```html
...
```
**React**
```jsx
...
```
**Vue**
```vue
...
```
**Angular**
```typescript
...
```
### Select Map Provider
Our Map Component could support different map service providers, such as Google Maps, Mapbox, Apple Maps, and many more, by adding the property `provider` to the Map Component. Currently, the only map service provider accepted is Google Maps `provider = "google"` but in the future will be extended to support `mapbox` (for MapBox), `apple` (for Apple Maps) and other map providers.
**HTML**
```html
...
```
**React**
```jsx
...
```
**Vue**
```vue
...
```
**Angular**
```typescript
...
```
### Add Strict mode
You can now add `strict=false` or just `strict` if you want it to be true (which is the default) to the AutoSuggest Component which allows for non-3wa-like strings to be accepted and the component will not remove the value. It will emit the `value_invalid` event as it normally does, but the value is not removed and can be used to trigger another integration, such as Google Places API, which the map component does. This way you can now use the autosuggest component with an existing field rather than having to have a dedicated field on your form.
### Customise Suggestions (Optional)
If you are using our AutoSuggest Component in your Search box, with the new alpha build you can also push your own suggestions to the AutoSuggest Component using the `option` attribute or programmatically updating this with JavaScript as is shown in the example below. This is currently available through the React and Vue wrappers.
**React**
```jsx
import { What3wordsAutosuggest } from "@what3words/react-components";
import { createRef, useEffect } from "react";
import "./styles.css";
export default function App() {
const ref = createRef();
useEffect(() => {
ref.current.addEventListener("value_invalid", () => {
const options = [
{
value: "Street A",
id: "street-a",
description: "Some village",
distance: {
value: 10,
units: "km"
}
},
{
value: "Street B",
id: "street-b",
description: "Some town",
distance: {
value: 30,
units: "km"
}
},
{
value: "Street C",
id: "street-c",
description: "Some city",
distance: {
value: 90,
units: "metres"
}
}
];
ref.current.options = options;
});
return () =>
ref.current.removeEventListener("value_invalid", () => {
console.log("here");
});
}, [ref]);
return (
);
}
```
## 4. Attributes
### Component script parameters
| Parameter | Type | Description |
| --- | --- | --- |
| key | String | An API key is required for the component to function correctly. Example: key=Your-API-Key |
| baseUrl | String | The component can be used with an Enterprise Suite API Server instance by using baseUrl. Example: baseUrl=https://example.com/v3 |
| callback | String | Allows for a callback to be fired once the component has loaded. This should be the function name to be fired. Example: callback=initMap |
| headers | String | Enterprise API Server only - Allows for custom headers to be passed through in requests. |
### Component Attributes
| Parameter | Type | Description |
| --- | --- | --- |
| api\_key | String | Your what3words API Key can be specified as an attribute to the component. Example: api\_key="Your-API-Key" |
| api\_version | String | You can specify the what3words API version as an attribute to the component. Example: api\_version=”v1” |
| base\_url | String | The component can be used with an Enterprise Suite API Server instance by using base\_url. Example: base\_url =https://example.com/v3 |
| current\_location | Boolean | Enables/disables the current location. |
| current\_location\_control\_position | Number | Position id. Used to specify the position of the current location control on the map. |
| disable\_default\_ui | Boolean | Enables/disables all default UI buttons. May be overridden individually. Does not disable the keyboard controls or the gesture controls. |
| fullscreen\_control | Boolean | The enabled/disabled state of the Fullscreen control. |
| fullscreen\_control\_position | Number | Position Id. Used to specify the position of the control on the map. The default position is RIGHT\_TOP |
| headers | String | Enterprise API Server only - Allows for custom headers to be passed through in requests. |
| language | String | See https://developers.google.com/maps/faq#languagesupport Allows you to add a preferred suggestion fallback language for google maps. Example: language="EN" |
| lat | Number | It specifies the latitude of an initial position on the map. Example: lat=-34.397. |
| libraries | ("drawing" \| "geometry" \| "localContext" \| "places" \| "visualization") | It loads additional libraries by specifying a libraries parameter in the request, and supplying the name of the library or libraries. You can specify multiple libraries as a comma-separated list. See the full list here: https://developers.google.com/maps/documentation/javascript/libraries. |
| lng | Number | It specifies the longitude of an initial position on the map. Example: lng=150.644 |
| map\_api\_key | String | A Google Maps API key is required for the component to function correctly. |
| map\_type\_control | Boolean | The initial enabled/disabled state of the Map type control. |
| map\_type\_control\_position | Number | Position id. Used to specify the position of the map type control on the map. Default TOP\_RIGHT. |
| map\_type\_id | "hybrid" \| "roadmap" \| "satellite" \| "terrain" | IDs of map types to show in the control. |
| marker\_icon | String | You can use the default marker icon or use your own one \[MARKER\_SRC\]. Example: marker\_icon="logo\_sample.jpg". |
| provider | String | Map Service provider. Currently it accepts only "google". In the future will be extended to support "mapbox", "apple" and other map service providers. |
| region | String | A region code of the user's region. The region code accepts a ccTLD ("top-level domain") two-character value. Most ccTLD codes are identical to ISO 3166-1 codes, with some notable exceptions. For example, the United Kingdom's ccTLD is "uk" (.co.uk) while its ISO 3166-1 code is "gb" (technically for the entity of "The United Kingdom of Great Britain and Northern Ireland"). |
| rotate\_control | Boolean | The enabled/disabled state of the Rotate control. |
| rotate\_control\_position | Number | Position id. Used to specify the position of the rotate control on the map. The default position is TOP\_LEFT. |
| scale\_control | Boolean | The initial enabled/disabled state of the Scale control. |
| search\_control\_position | Number | Position id. Used to specify the position of the search control on the map. The default position is TOP\_LEFT. |
| selected\_zoom | Number | The initial what3words Grid zoom level. |
| street\_view\_control | Boolean | The initial enabled/disabled state of the Street View Pegman control. This control is part of the default UI, and should be set to false when displaying a map type on which the Street View road overlay should not appear (e.g. a non-Earth map type). |
| street\_view\_control\_position | Number | Position id. Used to specify the position of the street view control on the map. The default position is embedded within the navigation (zoom and pan) controls. If this position is empty or the same as that specified in the zoom\_control\_position, the Street View control will be displayed as part of the navigation controls. Otherwise, it will be displayed separately. |
| tilt | Number | For vector maps, sets the angle of incidence of the map. The allowed values are restricted depending on the zoom level of the map. For raster maps, controls the automatic switching behavior for the angle of incidence of the map. The only allowed values are 0 and 45. |
| version | String | Google Maps JavaScript API version loaded by the browser. See https://developers.google.com/maps/documentation/javascript/versions. |
| watch\_location | Boolean | It watches your location and the event listener will be triggered every time their location changes. |
| words | String | Iniital what3words address to be searched and displayed on the map. |
| zoom | Number | The initial Map zoom level. Valid zoom values are numbers from zero up to the supported maximum zoom level. Larger zoom values correspond to a higher resolution. |
| zoom\_control | Boolean | The enabled/disabled state of the Zoom control. |
| zoom\_control\_position | Number | Position id. Used to specify the position of the zoom control on the map. The default position is TOP\_LEFT. More on the ControlPosition constants on Google Maps:https://developers.google.com/maps/documentation/javascript/reference/control#ControlPosition. |
## 5. Events
| Event | Description |
| --- | --- |
| coordinates\_changed | Fires when coordinates change when a new valid 3 word address is selected. Returns the coordinates of the selected square on the map. |
| selected\_square | Fires when a square on the what3words grid has been selected. Returns all details of that selected square. |
### Listening for events
Using an event listener, it is possible to fire other functionality in a site when something changes in the Map Component. For example, it is possible to listen for when a square on the grid map has been selected by the users or to listen for when new coordinates have been returned and pan/zoom a map to the location.
**JavaScript**
```javascript
```
## 6. Methods
| Method Name | Results |
| --- | --- |
| clearGrid | clearGrid(); Parameters: None. Return Value: None. Reset the polilynes of the grid on the map. |
| getBounds | getBounds(); Parameters: None. Return Value: LatLngBounds\|undefined. Returns the lat/lng bounds of the current viewport \[south: number; west: number; north: number; east: number;\]. If the map is not yet initialized or center and zoom have not been set then the result is undefined. |
| getGrid | getGrid(); Parameters: None. Return Value: google.maps.Polyline\[\]. Returns the polylines of the grid on the map. |
| getLat | getLat(); Parameters: None. Return Value: number\|undefined. Returns the latitude of an initial position on the map. If the latitude has not been set then the result is undefined. |
| getLng | getLng(); Parameters: None. Return Value: number\|undefined. Returns the longitude of an initial position on the map. If the longitude has not been set then the result is undefined. |
| getMapTypeId | getMapTypeId(); Parameters: None. Return Value: MapTypeId\|string\|undefined. Returns the MapTypeId of the map. |
| getZoom | getZoom(); Parameters: None. Return Value: number\|undefined. Returns the zoom of the map. If the zoom has not been set then the result is undefined. |
| panTo | panTo(coordinates); Parameters: coordinates: LatLng\|LatLngLiteral. The new center latitude/longitude of the map. Return Value: None. Changes the center of the map to the given coordinates. If the change is less than both the width and height of the map, the transition will be smoothly animated. |
| setApiKey | setApiKey(key); Parameters: key: string. Return Value: None. |
| setApiVersion | setApiVersion(api\_version); Parameters: api\_version: ApiVersion. Return Value: None. |
| setBaseUrl | setBaseUrl(host); Parameters: host: string. Return Value: None |
| setGrid | setGrid(grid); Parameters: grid: any\[\]. Return Value: None. |
| setHeaders | setHeaders(value); Parameters: value: string. Enterprise API Server only - Allows for custom headers to be passed through in requests. Return Value: None. |
| setLat | setLat(lat); Parameters: lat: number. It specifies the latitude of an initial position on the map. Return Value: None. |
| setLng | setLng(lng); Parameters: lng: number. It specifies the longitude of an initial position on the map. Return Value: None. |
| setMapTypeId | setMapTypeId(mapTypeId); Parameters: mapTypeId: MapTypeId\|string. Return Value: None. |
| setOptions | setOptions(options); Parameters: options: MapOptions optional. Return Value: None. |
| setWords | setWords(words); Parameters: words: string. Initial what3words address to be searched and displayed on the map. Return Value: None. Sets the initial what3words address on the map. |
| setZoom | setZoom(zoom); Parameters: zoom: number. Larger zoom values correspond to a higher resolution. Return Value: None. Sets the zoom of the map. |
## 7. Full Example
The example below takes the concepts described earlier and demonstrates how our JavaScript Map Component can be added to a website as an HTML static page via our CDN.
[Map Component in an HTML Static Page](https://codesandbox.io/s/web-map-component-static-sample-nimy60) (interactive example)
## 8. Full Example in React
The example below takes the concepts described earlier and demonstrates how our JavaScript Map Component can be added to a website using NPM as part of your project dependencies and React as a framework.
[Map Component in React](https://codesandbox.io/s/web-map-component-in-react-r5k2s3) (interactive example)
## 9. Full Example in Vue
The example below takes the concepts described earlier and demonstrates how our JavaScript Map Component can be added to a website using NPM as part of your project dependencies and Vue as a framework.
[Map Component in Vue](https://codesandbox.io/s/web-map-component-in-vue-vgeecl) (interactive example)
## 10. Full Example in Angular
The example below takes the concepts described earlier and demonstrates how our JavaScript Map Component can be added to a website using NPM as part of your project dependencies and Angular as a framework.
[Map Component in Angular](https://codesandbox.io/s/web-map-component-in-angular-3e79gn) (interactive example)
## 11. Full Example in Angular with Routers
The example below takes the concepts described earlier and demonstrates how our JavaScript Map Component can be added to a website using NPM as part of your project dependencies and Angular as a framework.
If you are looking to build Single Page Applications with multiple views and allow navigation between these views you should use this code snippet to add the Angular Router.
[Map Component in Angular with Router](https://codesandbox.io/s/web-map-component-with-router-in-angular-1424qm) (interactive example)
## 12. Troubleshooting
If you encounter errors or issues related to convert-to-coordinate, convert-to-3wa and grid-section requests while using the Free plan, please check the network panel for the following error message `Error 402 payment required` and its response, indicating the need to upgrade to a higher plan:
**JSON**
```json
{
"error": {
"code": "QuotaExceeded",
"message": "Quota exceeded or API plan does not have access to this feature. Please change your plan at https://accounts.what3words.com/select-plan, or contact support@what3words.com"
}
}
```
For more information, visit our [API plans page](https://accounts.what3words.com/select-plan). If you need further assistance, contact [support@what3words.com](mailto:support@what3words.com).

## “For Development Purposes Only” on Google Maps
### Issue
If you see a “For development purposes only” text over your Google Maps and it’s not loading correctly, there’s an issue with your Google Maps API key. This typically occurs because [Google Cloud Billing](https://console.cloud.google.com/billing) is not enabled, or a Google Maps API key has not been generated for your organization.
### Solution
**1\. Enable Google Cloud Billing:**
- Go to your [Google Cloud Billing](https://console.cloud.google.com/billing) settings and ensure billing is enabled.
- Select your current project at the top left if necessary.
Google requires billing to be enabled if your free trial has ended or if you’ve exceeded the free monthly tier.
**2\. Generate a Google Maps API Key:**
- Follow the instructions in the guide: [How to add a Google Maps API key to your store locator](https://help.storerocket.io/en/articles/2126787-how-to-add-a-google-maps-api-key-to-your-storerocket-account).
For further assistance, contact Google Cloud support.

## Google Maps Loader Error
### Issue
If you encounter the following error in your console raised by the Google Maps loader package `js-api-loader`, it indicates an issue with creating multiple map instances. This error can occur due to:
- Multiple re-renders with missing/different props passed to the Map component.
- Attempting to load multiple maps on the same page with different properties.
### Solution
This is a known issue that we aim to resolve in future releases. In the meantime, if you need multiple map instances on a single page, ensure you maintain the following properties for every what3words Map component:
- `map_api_key`
- `language`
- `libraries`
- `region`
While this workaround is not officially supported, it may help mitigate the issue. For further assistance, please get in touch with [support@what3words.com](mailto:support@what3words.com).
## Vite Compatibility Issue
Our current components do not yet work with Vite due to a known issue with Stencil. A potential fix is expected in a future version upgrade, which we are currently working on. It may take some time before this fix is available and tested. For now, we advise against using Vite. For more details, refer to the [GitHub issue](https://github.com/ionic-team/stencil/issues/2827).
#### AI coding agents (like **Replit**, **Lovable and** **Cursor**) should follow the steps below when building with what3words.
**Markdown**
~~~~markdown
what3words — Map Component (Agent Guide, CDN‑only)
Goal: Minimal POC that shows a full‑viewport map and a what3words search. Picking a suggestion recentres the map to that 3‑word address. No bundler edits, no extra packages.
Rules (for humans & agents):
- Use CDN web‑components only. Do not install `@what3words/*` or edit Vite config.
- Secrets: `VITE_W3W_API_KEY` (what3words) and `VITE_GOOGLE_MAP_API_KEY` (Google Maps).
- Wire selection → map: listen for `"selected_suggestion"` and set the map’s `words` property. No manual API calls required.
---
## 1) Set the API keys
- `VITE_W3W_API_KEY` → what3words key
- `VITE_GOOGLE_MAP_API_KEY` → Google Maps JavaScript API key
---
## 2) Load the components (no npm)
Open `client/index.html` and paste these two lines just before ``:
```html
```
This defines `` and `` at runtime — no Vite changes needed.
---
## 3) Minimal `client/src/App.tsx`
```tsx
import { useEffect, useRef } from "react";
// allow the custom elements without extra .d.ts files
declare global {
namespace JSX {
interface IntrinsicElements {
"what3words-map": any;
"what3words-autosuggest": any;
}
}
}
const W3W_KEY = import.meta.env.VITE_W3W_API_KEY as string | undefined;
const GMAPS_KEY = import.meta.env.VITE_GOOGLE_MAP_API_KEY as string | undefined;
export default function App() {
const mapRef = useRef(null);
const autoRef = useRef(null);
if (!W3W_KEY || !GMAPS_KEY) {
return (
Set VITE_W3W_API_KEY and VITE_GOOGLE_MAP_API_KEY then rerun.
);
}
useEffect(() => {
const el = autoRef.current;
const onSelect = (e: any) => {
const words = e.detail?.suggestion?.words as string;
if (words && mapRef.current) mapRef.current.words = words; // recentre map
};
el?.addEventListener("selected_suggestion", onSelect);
return () => el?.removeEventListener("selected_suggestion", onSelect);
}, []);
return (
{/* map canvas fills the visible viewport */}
{/* centred search bar overlay */}
);
}
```
~~~~
---
# Using the what3words ArcGIS Locator within ArcGIS Pro
Adding and using the what3words Locator within ArcGIS Pro.
Topics: ArcGIS, GIS
Section: [GIS & Spreadsheet Tools](https://developer.what3words.com/docs/gis-spreadsheet-tools.md) > [ArcGIS](https://developer.what3words.com/docs/gis-spreadsheet-tools/arcgis.md)
Source: https://developer.what3words.com/tutorial/using-the-what3words-arcgis-locator-in-arcgis-pro
Updated: 2026-11-27
The what3words ArcGIS Locator brings the functionality of the what3words API to the ArcGIS platform. You can use the Locator throughout the ArcGIS product suite wherever a custom locator can be added. This includes ArcGIS Desktop – ArcCatalog and ArcMap as well as ArcGIS Pro.
This tutorial goes through the different steps to use each of the tools ArcGIS Pro provides to search for 3 word address, discover 3 word address and carry out batch conversions.
## 1. Get API key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Add the what3words Locator to ArcGIS Online
Follow this [**tutorial**](https://developer.what3words.com/tutorial/how-to-setup-the-what3words-locator-for-arcgis-online) or watch this video to set up the what3words ArcGIS Locator within ArcGIS Online and add it as a Utility Service.
Getting started with Dazi, GIS Technical Account Manager at what3words, showing how to add the what3words ArcGIS Locator in ArcGIS Online in [this video](https://youtu.be/iYp4g9sWNhU)
## 3. Search 3 word addresses

Click on the *Map* tab on the ArcGIS Ribbon. The *Locate* button will then be available to search for locations.
If you click on the button next to the search you will be able to see the locators available – the what3words Locator should be present.

You can then search for a 3 word address in the input field.
Suggestions for the 3 word address using our AutoSuggest functionality will appear after you begin typing the third word.
Click a result to zoom to the 3 word address.
## 4. Discovering 3 word addresses

Right-click on the map and click on the *What’s Here?* option. This will then display all addresses from the available locators.

Select the what3words result to view the 3 word address and coordinates.
## 5. Geocoding Tools
The what3words Locator can be used in any of the geocoding geoprocessing tools you have access to that accept a custom locator.

Click on the *Analysis* tab on the ArcGIS ribbon and the *Tools* button which will open the geoprocessing panel.

Search for *geocode* to bring back geocoding tools.

To geocode a layer of 3 word addresses (convert to coordinates from our API) the Geocode Addresses processing tool can be used.
You will need to specify the point layer to be used, the what3words Locator, the single field option and specify the field that the 3 word addresses lie within.

To reverse geocode a layer of points you can use the reverse geocode tool (convert to 3 word address from our API). You will need to specify the layer to find 3 word addresses for and the what3words Locator.
**Note** that the output of the Reverse Geocode tool is the points (ie. geometry) of the 3 word address and not the points of your original dataset.
Therefore we recommend doing the following to create a populated what3words column on your original dataset:
1. Use the Reverse Geocode tool to create a new layer of the 3 word address points for your source layer.
2. Add a “what3words” field to your original (source) layer.
3. Run the following Python script in the Python window (`View > Python Window`) changing the variables at the start of your layers, the what3words field you have added, and the join field (ie your unique ID field)
Alternatively, you can manually do the same process as the Python script does by:
1. Joining the new geocoded layer to the source layer joins on a unique ID.
2. Update the what3words field using the field calculator taking the 3 word address from the new layer.
**Python**
```python
# Import the necessary arcpy module
import arcpy
# Paths to the source feature class and the reverse geocoded feature class
sourceFc = r"C:/Data/MyProject7.gdb/sourceLayer" # Original source layer
geocodeFc = r"C:/Data/MyProject7.gdb/sourceLayer_ReverseGeocode" # Reverse geocoded layer
# Define the ID field to join on, what3words field in the source layer, and the field from the reverse geocode layer
idFld = "ID" # Field to join on
w3wFld = "what3words" # Field in the source layer to update with what3words addresses
reverseFld = "REV_Match_addr" # Field from reverse geocode layer containing the 3 word address
try:
# Check if fields exist in both feature classes before proceeding
sourceFields = [f.name for f in arcpy.ListFields(sourceFc)]
geocodeFields = [f.name for f in arcpy.ListFields(geocodeFc)]
if idFld not in sourceFields or w3wFld not in sourceFields:
raise ValueError(f"Field '{idFld}' or '{w3wFld}' not found in source layer.")
if idFld not in geocodeFields or reverseFld not in geocodeFields:
raise ValueError(f"Field '{idFld}' or '{reverseFld}' not found in reverse geocode layer.")
# Create a dictionary from the reverse geocoded data to map IDs to 3 word addresses
valueDi = dict((key, val) for key, val in arcpy.da.SearchCursor(geocodeFc, [idFld, reverseFld]))
# Open an UpdateCursor on the source layer to update the what3words field
with arcpy.da.UpdateCursor(sourceFc, [w3wFld, idFld]) as cursor:
for row in cursor:
key = row[1] # Extract the ID field from the current row
if key in valueDi:
row[0] = valueDi[key] # Update the what3words field with the corresponding 3 word address
cursor.updateRow(row)
print("Update completed successfully.")
except arcpy.ExecuteError:
# Catch and report any ArcPy-specific errors
print(f"ArcPy error occurred: {arcpy.GetMessages()}")
except Exception as e:
# Catch any other errors
print(f"An error occurred: {str(e)}")
finally:
# Clean up cursors if they were not properly closed
if 'cursor' in locals():
del cursor
```
---
# Using the what3words Locator within ArcGIS API for JavaScript
A collection of resources for developers using the ArcGIS API for JavaScript to integrate what3words Locator.
Topics: ArcGIS, GIS
Section: [GIS & Spreadsheet Tools](https://developer.what3words.com/docs/gis-spreadsheet-tools.md) > [ArcGIS](https://developer.what3words.com/docs/gis-spreadsheet-tools/arcgis.md)
Source: https://developer.what3words.com/tutorial/using-the-what3words-arcgis-locator-within-arcgis-api-for-javascript
Updated: 2026-11-27
This guide describes how to use what3words ArcGIS Locator for ArcGIS API for JavaScript to build compelling web apps that unlock your data’s potential with interactive user experiences and stunning 2D and 3D visualizations.
There are multiple options for bringing the ArcGIS API for JavaScript into your app. The most common way is to use the AMD modules via ArcGIS CDN, however, you can also use ES modules for local builds. The examples here will show how to integrate what3words ArcGIS locator to the AMD modules via ArcGIS CDN.
**Resources:** Full examples of how to use what3words ArcGIS Locator for ArcGIS API for JavaScript are available in our
[Github repository](https://github.com/what3words/w3w-arcgis-javascript-samples)
## 1. Get API key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Getting started with ArcGIS Developer guide
If you are new to ArcGIS start with the [mapping APIs and location services guide.](https://developers.arcgis.com/documentation/mapping-apis-and-services/)
## 3. What can you do with ArcGIS Locator
1. [Convert a 3 word address to coordinates](https://developer.what3words.com/tutorial/using-the-what3words-arcgis-locator-within-arcgis-api-for-javascript#convert-to-coordinates);
2. [Convert coordinates to a 3 word address](https://developer.what3words.com/tutorial/using-the-what3words-arcgis-locator-within-arcgis-api-for-javascript#convert-to-3-word-address);
3. [Autosuggestion of 3 word addresses](https://developer.what3words.com/tutorial/using-the-what3words-arcgis-locator-within-arcgis-api-for-javascript#autosuggestion-of-3-word-addresses);
4. [Batch geocode of a list of 3 word addresses](https://developer.what3words.com/tutorial/using-the-what3words-arcgis-locator-within-arcgis-api-for-javascript#batch-geocode-of-a-list-of-3-word-addresses);
5. [What3words locator can be added to the search bar widget](https://developer.what3words.com/tutorial/using-the-what3words-arcgis-locator-within-arcgis-api-for-javascript#what3words-locator-on-the-search-bar-widget).
## 4. Install and set up ArcGIS API for Javascript
In this example, we will use the AMD modules via ArcGIS CDN. Add the following code to the `` tag of your `index.html` file.
**HTML**
```html
```
## 5. Create an HTML page
Define an HTML page to create a map that is the full width and height of the web browser window.
Add HTML and CSS to create a page with an `viewDiv` element. The `viewDiv` is the element that displays the map and its CSS resets any browser settings, so it can consume the full width and height of the browser. The `` tag is not required in CodeSandbox. If you are using a different editor or running the page on a local server, be sure to add this tag to the top of your HTML page.
**HTML**
```html
The what3words Locator on ArcGIS API for Javascript
```
## 6. Reference the API
In the `` tag, add references to the CSS file and JS library.
**HTML**
```html
The what3words Locator on ArcGIS API for Javascript
```
## 7. Add AMD modules
The ArcGIS JS API contains [Asynchronous Module Definition (AMD)](https://dojotoolkit.org/documentation/tutorials/1.10/modules/index.html) modules to load JS resources into memory. By defining their API’s object classes in modules, Esri made those classes easier to maintain and reuse. Loading the modules asynchronously (in parallel rather than one at a time) means that apps built on the API will load faster than they would in a non-AMD framework.
One of your recurring tasks as an Esri JS developer will be to identify the modules containing the object classes needed by your app. In our case, we are going to refer to the following modules:
- Map
- MapView
- locator
- esriRequest
Add these modules to the `require()` statement.
In the `` tag, add a `
```
## 8. List of all available languages
ArcGIS has its geocoder, to get the what3words ArcGIS Locator user needs to
1\. import the [Esri locator](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-locator.html). Represents a geocode service resource exposed by the ArcGIS Server REST API.
**JavaScript**
```javascript
require(["esri/rest/locator"], (locator) => { /* code goes here */ });
```
It is used to
- Find address candidates for multiple input addresses([addressesToLocations()](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-Locator.html#addressesToLocations))
- Sends a request to the ArcGIS REST geocode resource to find candidates for a single address specified in the address parameter([addressToLocations()](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-Locator.html#addressToLocations))
- Locates an address based on a given point ([locationToAddress()](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-Locator.html#locationToAddress))
- Get character-by-character autocomplete suggestions ([suggestLocations()](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-Locator.html#suggestLocations))
2\. Get the token from the what3words ArcGIS locator by
- using your credentials, what3words email address as username and what3words API key as password;
- using the [esriRequest](https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html) to retrieve data from the ArcGIS what3words remote server;
- adding the `response.data.token` to the URL of the what3words ArcGIS Server REST resource that represents a Locator service, for example, [https://arcgis.what3words.com/v2/arcgis/rest/services/what3words\_EN\_English/GeocodeServer](https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_EN_English/GeocodeServer)
**JavaScript**
```javascript
require([
"esri/rest/locator",
"esri/Map",
"esri/views/MapView",
"esri/request",
"esri/Graphic"
], function (locator, Map, MapView, esriRequest, Graphic) {
// Set up a locator task using the world geocoding service
const w3wLocator = esriRequest(
// First get the token for the what3words Locator
"https://arcgis.what3words.com/v2/arcgis/tokens", {
method: "get",
query: {
f: "json",
username: "YOUR-W3W-EMAIL-ADDRESS", // YOUR-W3W-EMAIL-ADDRESS
password: "YOUR-W3W-API-KEY", // YOUR-W3W-API-KEY
expiration: 10
}
}
).then((response) => {
// create url for using the what3words Locator to reverse geocode
const locatorUrl =
"https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_EN_English/GeocodeServer?token=" + response.data.token;
…
});
});
```
### Here is the list of all the what3words locator URLs for all languages that can be used to replace the one mentioned above.
`https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_AF_Afrikaans/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_AR_Arabic/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_BG_Bulgarian/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_BN_Bengali/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_COMBINED_Combined/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_CS_Czech/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_CY_Cymraeg/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_DA_Dansk/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_DE_Deutsch/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_EL_Greek/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_EN_English/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_ES_Espanol/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_FI_Suomi/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_FR_Francais/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_GU_Gujarati/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_HE_Hebrew/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_HI_Hindi/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_HU_Magyar/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_ID_Bahasa/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_IT_Italiano/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_JA_Japanese/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_KN_Kannada/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_KO_Korean/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_ML_Malayalam/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_MN_Mongolian/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_MR_Marathi/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_MS_Bahasa_Malayia/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_NE_Nepali/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_NL_Netherlands/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_NO_Norsk/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_PA_Panjabi/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_PL_Polski/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_PT_Portugues/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_RO_Romanian/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_RU_Russian/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_SV_Svenska/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_SW_Kiswahili/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_TA_Tamil/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_TE_Telugu/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_TH_Thai/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_TR_Turkish/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_UR_Urdu/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_VI_Vietnamese/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_XH_IsiXhosa/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_ZH_Chinese/GeocodeServer https://arcgis.what3words.com/v2/arcgis/rest/services/what3words_ZU_IsiZulu/GeocodeServer`
## 9. Convert to Coordinates
This function converts a 3 word address to a position, expressed as coordinates of latitude and longitude.
This function takes the `words` parameter as a string of 3 word addresses, e.g. `filled.count.soap`.
In ArcGIS API for JavaScript to achieve this task we use the following [locator](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-locator.html) method called [addressToLocations()](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-locator.html#addressToLocations), which sends a request to the ArcGIS REST geocode resource to find candidates for a single address specified in the address parameter.
**JavaScript**
```javascript
addressToLocations(url, params, requestOptions){Promise}
```
Parameters are:
- **Url =>** URL to the ArcGIS Server REST resource that represents a locator service.
- **Address =>** The address argument is a data object that contains properties representing the various address fields accepted by the corresponding geocode service.
[Convert a 3 word address to coordinates](https://codesandbox.io/s/arcgis-js-api-converttocoordinates-hiyf3) (interactive example)
## 10. Convert to 3 word address
This function converts coordinates (expressed as latitude and longitude) to a 3 word address. In ArcGIS API for JavaScript to achieve this task we use the following [locator](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-locator.html) method called [locationToAddress()](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-locator.html#locationToAddress), which locates an address based on a given point.
**JavaScript**
```javascript
locationToAddress(url, params, requestOptions){Promise}
```
Parameters are:
- **Url =>** URL to the ArcGIS Server REST resource that represents a locator service.
- **Location =>** (point feature) The point at which to search for the closest address. The location should be in the same spatial reference as that of the geocode service.
[Convert coordinates to a 3 word address](https://codesandbox.io/s/arcgis-js-api-convertto3wa-munpf) (interactive example)
## 11. AutoSuggestion of 3 word addresses
When presented with a 3 word address that may be incorrectly entered, **AutoSuggestion** returns a list of potentially correct 3 word addresses. It needs the first two words plus at least the first character of the third word to produce suggestions, e.g. `filled.count.s`.
This method provides corrections for mistyped words (including plural vs singular), and words being in the wrong order.
In ArcGIS API for JavaScript to achieve \`Autosuggested Locations\` we use the following [locator](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-locator.html) method called [suggestLocations()](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-locator.html#suggestLocations), which gets character-by-character auto-suggestions.
**JavaScript**
```javascript
suggestLocations(url, params, requestOptions){Promise}
```
Parameters are:
- **Url =>** URL to the ArcGIS Server REST resource that represents a locator service.
- **Text =>** The input text entered by a user which is used by the suggest operation to generate a list of possible matches.
[AutoSuggest and Convert to Coordinates](https://codesandbox.io/s/arcgis-js-api-autosuggest-converttocoordinates-d7tvx) (interactive example)
## 12. Batch geocode of a list of 3 word addresses
Users can use the batch geocoding function to convert a list of 3 word addresses to a set of complete addresses with locations using the what3words ArcGIS Locator.
In ArcGIS API for JavaScript, to achieve **Batch geocoding** we use the following [locator](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-locator.html) method called [addressesToLocations()](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-locator.html#addressesToLocations), which finds address candidates for multiple input addresses. Note that this method requires an ArcGIS Server 10.1 or greater geocode service.
**JavaScript**
```javascript
addressesToLocations(url, params, requestOptions){Promise}
```
Parameters are:
- **Url =>** URL to the ArcGIS Server REST resource that represents a locator service.
- **Addresses =>** The input addresses in the format supported by the geocode service. If the service supports ‘Single Line Input’ the input addresses will be in the following format:
**JSON**
```json
{
OBJECTID: 1,
what3words: "clean.wider.both"
}
```
[Batch geocode of a list of 3 word addresses](https://codesandbox.io/s/arcgis-js-api-batch-geocode-v5ox5) (interactive example)
## 13. What3words Locator on the search bar widget
In case users are interested in adding the what3words ArcGIS Locator to their Search bar widget, make sure to
- Follow [these instructions](https://developer.what3words.com/tutorial/how-to-setup-the-what3words-locator-for-arcgis-online) to share the ArcGIS locator within the organisation in your ArcGIS Online account;
- And pass the locator URL + token to the Search widget as is shown on the CodeSandbox
[What3words locator can be added to the search bar widget](https://codesandbox.io/s/arcgis-js-api-add-locator-to-search-kj208) (interactive example)
---
# Using the what3words for Excel add-in
With the what3words for Excel add-in, it's easy to convert coordinates into 3 word addresses and vice versa, translate 3 word addresses, and return AutoSuggest results for incomplete 3 word addresses – all from an Excel spreadsheet.
Topics: Excel, Spreadsheet
Section: [GIS & Spreadsheet Tools](https://developer.what3words.com/docs/gis-spreadsheet-tools.md)
Source: https://developer.what3words.com/tutorial/using-the-what3words-for-excel-add-on
Updated: 2026-11-27
**what3words for Excel add-in** brings the functionality of the what3words API to Excel as part of Office 365. You can convert coordinates to 3 word addresses (3wa) and vice versa using either formula-based or menu-based conversion. Menu-based conversion also supports language selection for coordinate-to-3wa conversions, making it useful for both ad-hoc lookups and large-scale batch operations.
The add-in can be with recent versions of Excel for both Mac and Windows in addition to Excel via Windows 365 and Excel online.
**You can download the add-in from the Office 365 store [here](https://appsource.microsoft.com/en-us/product/office/WA200003136).**

Before you begin, you’ll need a what3words API key. If you don’t have one currently, you can register to get one **[here](https://accounts.what3words.com/)**.
Once you have downloaded and installed the add-in, you will find a new what3words section under “Home” in your Excel toolbar. Here, you can set your API key and choose the language used when converting coordinates to 3wa through the menu-based workflow. English is selected by default. Choose your preferred language from the dropdown list before running conversions.
Once your API key is saved, you’re ready to start using the add-on.
Please note – you may need to expand the “Home” section of your toolbar if you don’t see it initially!
## How to Use:
The add-on now supports **two conversion methods**. Choose the one that best fits your use case:
| Method | Best For | Quota Risk |
| --- | --- | --- |
| Menu-based conversion (new) | Large-scale / batch conversions | Low - pastes values directly |
| Formula-based conversion | Single lookups, dynamic/live data | Higher - recalculates on sheet changes |
## 1. Method 1: Menu-Based Conversion (Recommended for bulk use)

A menu-based approach was introduced to solve a known issue with large-scale formula conversions, where Google Sheets would trigger a circular recalculation loop (conversion -> cell changes -> Sheets recalculates everything -> repeat).
The new menu items paste results directly as **static values**, bypassing the recalculation loop entirely. For coordinate-to-3wa conversions, the menu-based workflow uses the language selected in “what3words for Excel” add-in under “Home”. If you need 3 word addresses in a different supported language, update the dropdown there before running the conversion.
### Convert to 3 word address
1. To convert coordinates into the corresponding 3wa, make sure to place **latitude** values in the first column and **longitude** values in the second column.
2. If needed, go to “what3words for Excel” add-in under “Home” and choose your preferred language. English is selected by default.
3. Select both columns, or the specific cell pairs you want to convert as a batch.
4. Right click -> “what3words” -> “Paste as value (Convert to what3word address)”.
5. Results will be pasted directly as values into the adjacent column.
### Convert to coordinates
1. Enter all your 3wa (e.g. `filled.count.soap`) in one column.
2. Select the cells you want to convert.
3. Right click → “what3words” → “Paste as value (Convert to coordinates)”.
4. Results will be pasted directly as values.
### Batch Conversions
Simply **select multiple rows** before right clicking and choosing the menu item – the add-in will process all selected cells at once.
## 2. Method 2: Formula-Based Conversion
There are several formulas you can use with the what3words for Excel add-in. Here, you can see the different options you have!
### Convert to 3 word address
**\=W3W.CONVERTTO3WA(lat, long, lang)**
To convert coordinates into the corresponding 3wa, simply input the latitude and longitude as separate values and include the 2 digit ISO code for the language
For example: `=W3W.CONVERTTO3WA(51.5207944, -0.1973824, "en")` will return the 3wa `"filer.chips.faces"`.
### Convert to coordinates
**\=W3W.CONVERTTOCOORD(“address”)**
To convert a 3w into the corresponding coordinates, simply input the 3wa in the correct format (e.g. *filled.count.soap*) into this formula.
For example: `=W3W.CONVERTTOCOORD("filled.count.soap")` will return the coordinates `51.520847,-0.195521`.
### Translate a 3 word address
**\=W3W.LANGUAGECHANGE(“address”, “language”)**
With this formula, you can easily change the language of a 3wa by having the 3wa in question and the two letter code for the language as the input.
For example: `=W3W.LANGUAGECHANGE("index.home.raft", "de")` will translate the 3wa `///index.home.raft` into German, and return the result `welche.tischtennis.bekannte`.
### Return AutoSuggest
**\=W3W.AUTOSUGGEST(“address”, rank)**
You can use this formula to return a result from the what3words AutoSuggest for an incomplete 3wa. You just need to use the incomplete 3wa up to the beginning of the third word along with the rank of the result you would like to return.
For example: `=W3W.AUTOSUGGEST("filled.count.so", 1)` will return the first autosuggest result for the incomplete 3wa `"filled.count.so"`. You can change the rank to return other autosuggest results.
### Return AutoSuggest with focus
**\=W3W.AUTOSUGGESTFOCUS(“address”, rank, lat, long)**
As with the previous formula, this allows you to return an AutoSuggest result for an incomplete 3wa, but this time using coordinates formatted as latitude and longitude to specify a focus around which results will be centred.
For example: `=W3W.AUTOSUGGESTFOCUS("index.home.ra", 1, 51.520847, -0.195521)` will return the first autosuggest result for the incomplete 3wa `"index.home.ra"` focused on the coordinates specified, which in this case would be `"index.home.raft"`.
### Return AutoSuggest with country clipping
**\=W3W.AUTOSUGGESTCOUNTRYCLIP(“address”, rank, “country”)**
As with the previous, this allows you to return an AutoSuggest result for an incomplete 3wa, but this time specifying a country within which results should be limited using the 2-digit country code.
For example: `=W3W.AUTOSUGGESTCOUNTRYCLIP("filled.count.so", 1, "GB")` will return the first autosuggest result for the incomplete 3wa `"filled.count.so"`, with results being limited to Great Britain only. You can specify the country you would like to clip to using the ISO 3166-1 alpha-2 country code.
### Troubleshooting

If you have installed the what3words Add-in on your Excel Desktop and you see this issue, it could depend on which country and default system settings you have registered your Home Office. In some instances also numbers had to be encased in quotes (not only strings) and the default separator is not always comma but it can be a semicolon e.g.:
`=W3W.CONVERTTO3WA(51.5207944, -0.1973824, "en")`
would in that case change to
`=W3W.CONVERTTO3WA("51.5207944"; "-0.1973824"; "en")`
If you encounter errors or issues related to convert-to-coordinate, convert-to-3wa and grid-section requests while using the Free plan, please check the network panel for the following error message `Error 402 payment required` and its response, indicating the need to upgrade to a higher plan:
**JSON**
```json
{
"error": {
"code": "QuotaExceeded",
"message": "Quota exceeded or API plan does not have access to this feature. Please change your plan at https://accounts.what3words.com/select-plan, or contact support@what3words.com"
}
}
```
For more information, visit our [API plans page](https://accounts.what3words.com/select-plan). If you need further assistance, contact [support@what3words.com](mailto:support@what3words.com).
### How to uninstall the Excel Add-in

In case you wish to uninstall the what3words Excel Add-in, here are the steps to follow:
Click on **Insert tab > My Add-ins >** right-click on **what3words for Excel >** click on **Remove**.
**Have any questions****?**
We’re here to support you! If you have any questions while using what3words for Excel, get in touch with us by writing us an email at [support@what3words.com](mailto:support@what3words.com)
---
# Using the what3words ArcGIS Locator across the ArcGIS platform
Adding and using the what3words Locator across the ArcGIS Platform.
Topics: ArcGIS, GIS
Section: [GIS & Spreadsheet Tools](https://developer.what3words.com/docs/gis-spreadsheet-tools.md) > [ArcGIS](https://developer.what3words.com/docs/gis-spreadsheet-tools/arcgis.md)
Source: https://developer.what3words.com/tutorial/using-the-what3words-locator-across-the-arcgis-platform
Updated: 2026-11-27
### Step by step
The what3words ArcGIS Locator brings the functionality of the what3words API to the ArcGIS platform. You can use the Locator throughout the ArcGIS product suite wherever a custom locator can be added. This includes ArcGIS Desktop – ArcCatalog and ArcMap as well as ArcGIS Pro.
On web, you can use the Locator within ArcGIS Online and any products able to connect to Online such as in app using Survey123. Or for GIS developers the ArcGIS APIs and SDKs in the Developer suite can harness the ArcGIS Locator as a REST API.
The Locator gives you the ability to convert to and from coordinates, or more commonly known within ArcGIS as forward/reverse address geocoding. Functionality varies by ArcGIS product so take a look at our tutorials to see how the locator works within ArcGIS.
## 1. Sign up for Locator access
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Upgrading Locator version
The current version of the what3words Locator is v2.0. For users of what3words Locator v1.0 you will need to upgrade to V2.0 to continue to use the service.
In order to upgrade the Locator you will need to change the following:
**URL:** Change the URL prefix from [https://arcgis.what3words.com/w3w/rest/services/](https://arcgis.what3words.com/w3w/rest/services/) to [https://arcgis.what3words.com/v2/arcgis/rest/services/](https://arcgis.what3words.com/v2/arcgis/rest/services/)
**Username:** This should now be your email address
**Password:** This should now be your API key
## 3. Adding to ArcGIS Desktop
The Locator can be added as an ArcGIS web service via ArcCatalog.
View this **[TUTORIAL](https://developer.what3words.com/tutorial/how-to-setup-the-what3words-locator-for-arcgis-desktop/)** for the steps to add to ArcCatalog.
Once added, the Locator can be used within the rest of the ArcGIS desktop suite to:
- [Search for 3 word addresses](https://developer.what3words.com/tutorial/discover-and-search-for-3-word-addresses-in-arcmap/)
- [Discover the 3 word address for a location](https://developer.what3words.com/tutorial/discover-and-search-for-3-word-addresses-in-arcmap/)
- Batch geocode locations within ArcGIS Toolbox.
Requires ArcGIS 10.6 or newer.
## 4. Adding to ArcGIS Online
Once the Locator is added as Content within ArcGIS Online it will be available across ArcGIS Online and any product that connects to ArcGIS Online such as ArcGIS Pro and Survey123.
View this **[TUTORIAL](https://developer.what3words.com/tutorial/how-to-setup-the-what3words-locator-for-arcgis-online/)** for the steps to add to ArcGIS Online.
Once added the Locator can be used to:
- [Search for 3 word addresses](https://developer.what3words.com/tutorial/search-for-3-word-addresses-in-arcgis-online/)
- [Plot a CSV file of addresses](https://developer.what3words.com/tutorial/how-to-plot-a-file-of-3-word-addresses-in-arcgis-online/)
- [Use within ArcGIS Pro for reverse and forward geocoding](https://developer.what3words.com/tutorial/using-the-what3words-arcgis-locator-in-arcgis-pro)
## 5. Adding to ArcGIS Pro
First, add the what3words Locator to your ArcGIS Online account.
Once added the Locator will be available In ArcGIS Pro to:
- Search for 3 word addresses using the Locate feature
- Discover a 3 word address by right-clicking on the map and selecting “What’s here?”
- Batch convert between 3 word address and coordinates and coordinates and 3 word addresses using the Toolbox.
## 6. Adding to Portal for ArcGIS Enterprise
The process for adding the Locator to Portal for ArcGIS Enterprise is very similar to ArcGIS Online. Once the Locator is added as Content within Portal for ArcGIS it will be available across Portal and any product that connects to Portal such as ArcGIS Pro and Survey123.
View this **[TUTORIAL](https://developer.what3words.com/tutorial/how-to-add-the-what3words-locator-to-portal-for-arcgis-enterprise)** for the steps to add to Portal for ArcGIS Enterprise.
Once added the Locator can be used to:
- [Search for 3 word addresses](https://developer.what3words.com/tutorial/search-for-3-word-addresses-in-arcgis-online/)
- [Plot a CSV file of addresses](https://developer.what3words.com/tutorial/how-to-plot-a-file-of-3-word-addresses-in-arcgis-online/)
- [Use within ArcGIS Pro for reverse and forward geocoding](https://developer.what3words.com/tutorial/using-the-what3words-arcgis-locator-in-arcgis-pro)
## 7. Adding to Survey123
Survey123 enables the creation of a survey for use in apps out in the field. Adding the Locator to Survey123 allows for 3 word addresses to be collected or viewed when out in the field.
First, add the what3words Locator to your ArcGIS Online account.
Then you will be able to [**add to your survey**](https://developer.what3words.com/tutorial/how-to-setup-the-what3words-locator-for-arcgis-online-and-survey123/) using the GeoPoint feature.
## 8. Adding to Field Maps
Field Maps helps mobile workers perform data collection and editing, find assets and information, and report their real-time locations. Adding the Locator to Field Maps allows for 3 word addresses to be viewed and collected when out in the field.
First, add the what3words Locator to your ArcGIS Online account.
Then you will be able to **[use it on your survey](https://developer.what3words.com/tutorial/how-to-add-the-what3words-locator-to-arcgis-online-and-field-maps/)** using the Field Maps app.
## 9. Adding to ArcGIS JavaScript API
The what3words ArcGIS Locator can be accessed as a REST API from the ArcGIS API for JavaScript.
A collection of resources for developers using the ArcGIS API for JavaScript to integrate the what3words ArcGIS Locator can be found **[HERE](https://developer.what3words.com/tutorial/using-the-what3words-arcgis-locator-within-arcgis-api-for-javascript)**.
For more information on how to call a `Locator` in ArcGIS see [this ArcGIS developer guide](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-Locator.html).
## 10. Adding to Web App Builder
The what3words ArcGIS Locator can be used within our widget built using Web AppBuilder for ArcGIS.
This widget will help you to perform reverse geocoding (convert a point to a what3words address) on your ArcGIS Online or Portal for ArcGIS.
First, make sure you have added correctly the what3words Locator to your ArcGIS Online or Portal for ArcGIS.
Then you will be able to use it within your web application by following this **[TUTORIAL](https://developer.what3words.com/tutorial/how-to-add-the-what3words-locator-to-web-appbuilder-for-arcgis/).**
## 11. Adding to Experience Builder
The what3words ArcGIS Locator can be used within our widget built using ArcGIS Experience Builder.
This widget will help you to perform reverse geocoding (convert a point to a what3words address) on your ArcGIS Online or Portal for ArcGIS.
First, make sure you have added correctly the what3words Locator to your ArcGIS Online or Portal for ArcGIS.
Then you will be able to use it within your web application by following this **[TUTORIAL](https://developer.what3words.com/tutorial/how-to-add-the-what3words-locator-to-experience-builder-for-arcgis)**.
## 12. Troubleshooting
If you encounter errors or issues related to convert-to-coordinate, convert-to-3wa and grid-section requests while using the Free plan, please check the network panel for the following error message `Error 402 payment required` and its response, indicating the need to upgrade to a higher plan:
**JSON**
```json
{
"error": {
"code": "QuotaExceeded",
"message": "Quota exceeded or API plan does not have access to this feature. Please change your plan at https://accounts.what3words.com/select-plan, or contact support@what3words.com"
}
}
```
For more information, visit our [API plans page](https://accounts.what3words.com/select-plan). If you need further assistance, contact [support@what3words.com](mailto:support@what3words.com).
---
# UX guidelines
A quick tutorial on the fundamental user experience considerations for integrating what3words
Section: [Guidelines & Support](https://developer.what3words.com/docs/guidelines-support.md)
Source: https://developer.what3words.com/tutorial/ux-guidelines
Updated: 2026-11-27

## Displaying a 3 word address
- The 3 words address can be entered into an existing field or as its own independent field.
- The /// prefix to a what3words address should always be shown. Clarity on how to treat this prefix for right-to-left languages is available [here](https://what3words.com/news/blog/how-what3words-addresses-work-in-left-to-right-ltr-and-right-to-left-rtl-scripts).
- The words in a 3 word address when displayed, should always be separated by a full stop (‘.’), except in Japanese which should use the ideographic full stop (‘。’). Please don’t use spaces or commas as word separators. Vietnamese 3 word addresses should be displayed using the spaced version returned by the what3words API. These rules are for display only; for the input of 3 word addresses, there are wider rules available [here](https://what3words.com/news/general/understanding-the-what3words-regex-a-human-friendly-guide).
- what3words should feel native to your app or website, so we recommend using your existing styling and typography. You can show our slashes ‘///’ in red ( #E11F26 ) or use your primary colour.
- If displaying a 3 word address in a secondary language, you only need to display the slashes once. This is so users understand that they both refer to the same address.

## Entering a 3 word address
- A user should be able to enter a 3 word address with or without the ‘///’ at the beginning

## AutoSuggest
- Once the user has entered the **first letter** of the **3rd word** the autosuggest feature should be displayed
- For simplicity, we recommend only displaying 3 suggested results
- Every address should be accompanied by its nearest location.
---
# Using the what3words for Google Sheets add-on
With what3words for Google Sheets add-on, it's easy to single or batch convert coordinates into 3 word addresses and vice versa, translate 3 word addresses, and return AutoSuggest results for incomplete 3 word addresses – all from a Google Sheet.
Topics: Google Sheets, Spreadsheet
Section: [GIS & Spreadsheet Tools](https://developer.what3words.com/docs/gis-spreadsheet-tools.md)
Source: https://developer.what3words.com/tutorial/what3words-for-google-sheets-add-on
Updated: 2026-11-27
**what3words for Google Sheets** add-on brings the functionality of the what3words API to Google Sheets. You can convert coordinates to 3 word addresses (3wa) and vice versa using either formula-based or menu-based conversion. Menu-based conversion also supports language selection for coordinate-to-3wa conversions, making it useful for both ad-hoc lookups and large-scale batch operations.
The add-on can be used with Google Sheets in any browser.
## 1. Get an API Key
You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/).
## 2. Install the Add-on
To install the add-in, visit the **[what3words for Sheets](https://gsuite.google.com/marketplace/app/what3words_for_sheets/803436458621)** page in the Google Workspace Marketplace. You will need to be logged in with your Google account in order to install it.
Alternatively, you can install the add-in directly from an open Google Sheet. Select **“**Extensions**“** from the top menu, followed by **“**Add-ons” -> “Get add-ons”. Search for “what3words for Sheets” and install from there.
## 3. Configure Your Settings

Once installed, open any Google Sheet in a browser. From the top menu, select “Extensions” -> “what3words for Sheets” -> “Settings”. You will be prompted to log in to your Google account, where you can enter your what3words API key.
In Settings, you can also choose the language used when converting coordinates to 3 word addresses through the menu-based workflow. English is selected by default. Choose your preferred language from the dropdown list and save your settings before running conversions.
Once your API key is saved, you’re ready to start using the add-on.
## 4. Privacy
Please note that what3words for Sheets’ use of information received from Google APIs adheres to the **[Google API Services User Data Policy](https://developers.google.com/terms/api-services-user-data-policy#additional_requirements_for_specific_api_scopes)** including the Limited Use requirements.
## 5. Troubleshooting

Sharing a Google Sheet with what3words formula-based conversions is not currently supported for non-owners and will result in an error, as shown on the screenshot.
If the sheet is intended to be shared, it is recommended to use the menu-based conversion method, which outputs static values accessible to all users regardless of ownership.
If you encounter errors or issues related to convert-to-coordinate requests while using the Free plan, please check the network panel for the following error message `Error 402 payment required` and its response, indicating the need to upgrade to a higher plan:
**JSON**
```json
{
"error": {
"code": "QuotaExceeded",
"message": "Quota Exceeded. Please upgrade your usage plan, or contact support@what3words.com"
}
}
```
For more information, visit our [API plans page](https://accounts.what3words.com/select-plan). If you need further assistance, contact [support@what3words.com](mailto:support@what3words.com).
## How to Use
The add-on now supports **two conversion methods**. Choose the one that best fits your use case:
| Method | Best For | Quota Risk |
| --- | --- | --- |
| Menu-based conversion (new) | Large-scale / batch conversions | Low - pastes values directly |
| Formula-based conversion | Single lookups, dynamic/live data | Higher - recalculates on sheet changes |
## 6. Method 1: Menu-Based Conversion (Recommended for bulk use)

A menu-based approach was introduced to solve a known issue with large-scale formula conversions, where Google Sheets would trigger a circular recalculation loop (conversion -> cell changes -> Sheets recalculates everything -> repeat).
The new menu items paste results directly as **static values**, bypassing the recalculation loop entirely.
For coordinate-to-3wa conversions, the menu-based workflow uses the language selected in Settings. If you need 3wa in a different supported language, update the dropdown in Settings before running the conversion.
### Convert to 3 word address
1. To convert coordinates into the corresponding 3wa, make sure to place **latitude** values in the first column and **longitude** values in the second column.
2. If needed, go to “Extensions” -> “what3words for Sheets” -> “Settings” and choose your preferred language. English is selected by default. Save your settings.
3. Select both columns, or the specific cell pairs you want to convert as a batch.
4. From the top menu, go to “Extensions” -> “what3words for Sheets” -> “Convert to what3word address”.
5. Results will be pasted directly as values into the adjacent column
### Convert to coordinates
1. Enter all your 3wa (e.g. `filled.count.soap`) in one column.
2. Select the cells you want to convert.
3. From the top menu, go to “Extensions” → “what3words for Sheets” → “Convert to coordinates”.
4. Results will be pasted directly as values.
### Batch Conversions
Simply **select multiple rows** before clicking the menu item — the add-on will process all selected cells at once.
## 7. Method 2: Formula-Based Conversion
There are several formulas you can use with what3words for Sheets add-on and are ideal for dynamic or single-cell lookups:
### Convert to 3 word address
**\=W3WCONVERTTO3WA(lat, long)**
To convert coordinates into the corresponding 3wa, simply input the latitude and longitude as separate values.
### Convert to coordinates
**\=W3WCONVERTTOCOORD(“address”)**
To convert a 3wa into the corresponding formats, simply input the 3wa in the correct format (e.g. *filled.count.soap*) into this formula.
### Translate a 3 word address
**\=W3WLANGUAGECHANGE(“address”, “language”)**
With this formula, you can easily change the language of a 3wa by having the 3wa in question and the two letter code for the language as the input. For example, to find out the corresponding German 3wa for *filled.count.soap,* I would have (“filled.count.soap”, “de”) as the input.
### Return AutoSuggest
**\=W3WAUTOSUGGEST(“address”, rank)**
You can use this formula to return a result from the what3words AutoSuggest for an incomplete 3wa. You just need to use the incomplete 3wa up to the beginning of the third word along with the rank of the result you would like to return, i.e. 1 for the first result, 2 for the second and so on. It might look like (“filled.count.so”, 1) to return the first autosuggest result for *filled.count.so*
### Return AutoSuggest with focus
**\=W3WAUTOSUGGESTFOCUS(“address”, rank, lat, long)**
As with the previous formula, this allows you to return an AutoSuggest result for an incomplete 3wa, but this time using coordinates formatted as latitude and longitude to specify a focus around which results will be centered.
### Return AutoSuggest with country clipping
**\=W3WAUTOSUGGESTCOUNTRYCLIP(“address”, rank, “country”)**
As with the previous, this allows you to return an AutoSuggest result for an incomplete 3wa, but this time specifying a country within which results should be limited using the 2 digit country code. For example, using (“filled.count.so”, 2, “gb) would return the second ranked AutoSuggest result for “filled.count.so” within the UK.
### Troubleshooting
If you encounter errors or issues related to convert-to-coordinate, convert-to-3wa and grid-section requests while using the Free plan, please check the network panel for the following error message `Error 402 payment required` and its response, indicating the need to upgrade to a higher plan:
**JSON**
```json
{
"error": {
"code": "QuotaExceeded",
"message": "Quota exceeded or API plan does not have access to this feature. Please change your plan at https://accounts.what3words.com/select-plan, or contact support@what3words.com"
}
}
```
For more information, visit our [API plans page](https://accounts.what3words.com/select-plan). If you need further assistance, contact [support@what3words.com](mailto:support@what3words.com).
---
# API v3
The what3words API is a fast and simple interface that allows you to convert 3 word addresses to coordinates and vice versa.
Section: [API & SDK Reference](https://developer.what3words.com/docs/api-sdk-reference.md)
Source: https://developer.what3words.com/public-api/docs
OpenAPI: [openapi.yaml](https://developer.what3words.com/public-api/openapi.yaml) · [openapi.json](https://developer.what3words.com/public-api/openapi.json) · [Postman collection](https://developer.what3words.com/public-api/what3words.postman_collection.json)
It features a powerful AutoSuggest function, which can validate and autocorrect user input and limit it to certain geographic areas (this powers the search box on our map site). It allows you to request a section of the what3words grid (which can be requested as GeoJSON for easy display on online maps), and to request an up-to-date list of all languages supported by what3words. For advanced users, AutoSuggest can be used to post-process voice output.
All coordinates are latitude,longitude pairs in standard WGS-84 as commonly used worldwide in GPS systems. All latitudes must be in the range of -90 to 90 (inclusive).
| Endpoint | Name | Description |
| --- | --- | --- |
| [`GET /convert-to-3wa`](https://developer.what3words.com/public-api/docs#convert-to-3wa) | Convert to what3words address | This function will convert a latitude and longitude to a what3words address, in the language of your choice. |
| [`GET /convert-to-coordinates`](https://developer.what3words.com/public-api/docs#convert-to-coords) | Convert to coordinates | This function converts a what3words address to a latitude and longitude. |
| [`GET /autosuggest`](https://developer.what3words.com/public-api/docs#autosuggest) | AutoSuggest | AutoSuggest can take a slightly incorrect what3words address and suggest a list of valid what3words addresses. |
| [`GET /autosuggest-with-coordinates`](https://developer.what3words.com/public-api/docs#autosuggest-with-coordinates) | AutoSuggest with Coordinates | Similar to the AutoSuggest endpoint, but returns coordinates in the response. |
| [`GET /grid-section`](https://developer.what3words.com/public-api/docs#grid-section) | Grid section | Returns a section of the 3m x 3m what3words grid for a bounding box. |
| [`GET /available-languages`](https://developer.what3words.com/public-api/docs#available-languages) | Available languages | Retrieves all available what3words address languages and locale/script variants, including language code, English name and native name. |
Every operation, parameter and response on this page comes from the what3words OpenAPI definition. Browse it in the [OpenAPI reference](https://developer.what3words.com/public-api/openapi), or download it above.
## Overview
### Get started
1. [Get your free API key.](https://accounts.what3words.com/select-plan?referrer=/public-api/docs)
2. Check out our wrappers for [JavaScript](https://developer.what3words.com/tutorial/javascript), [Android](https://developer.what3words.com/tutorial/android), [C++](https://developer.what3words.com/tutorial/cpp), [Java](https://developer.what3words.com/tutorial/java), [Python](https://developer.what3words.com/tutorial/python), [PHP](https://developer.what3words.com/tutorial/php), [Swift](https://developer.what3words.com/tutorial/swift) and [Objective-C](https://developer.what3words.com/tutorial/objective-c).
3. Or start using the what3words API directly by requesting a URL:
#### 3 word address to coordinates
**URL**
```
https://api.what3words.com/v3/convert-to-coordinates?words=filled.count.soap&key=YOUR_API_KEY
```
#### Coordinates to 3 word address
**URL**
```
https://api.what3words.com/v3/convert-to-3wa?coordinates=51.521251%2C-0.203586&key=YOUR_API_KEY
```
### Tips
- Use HTTPS GET method only.
- Remember to always URL encode your parameters.
- Always include a valid API key in the `key=YOUR_API_KEY` parameter, or in the request header as `X-Api-Key: YOUR_API_KEY`.
- We support [CORS](http://enable-cors.org/index.html), which allows JavaScript requests to be made across domains. Each response contains the `Access-Control-Allow-Origin: *` header, that enables CORS.
### Locales
For some of our supported languages, a what3words locale can be specified within the API request using either the parameter `locale` or using the `language` parameter. The locale allows the what3words address to be displayed in a variant of a language. For example, Mongolian what3words addresses can be displayed in either Cyrillic or Latin characters and therefore by specifying the locale in the API request you can return either variant. The locale will also be included in the API response to show which variant has been returned.
Bosnian-Croatian-Montenegrin-Serbian is available using the language code `oo` with Cyrillic and Latin locales (`oo_cy` and `oo_la`).
Supported locales:
| Language/Locale code | Language variant |
| --- | --- |
| `oo_cy` | Bosnian-Croatian-Montenegrin-Serbian (Cyrillic) |
| `oo_la` | Bosnian-Croatian-Montenegrin-Serbian (Latin) |
| `kk_cy` | Kazakh (Cyrillic) |
| `kk_la` | Kazakh (Latin) |
| `mn_cy` | Mongolian (Cyrillic) |
| `mn_la` | Mongolian (Latin) |
| `zh_tr` | Chinese (Traditional) |
| `zh_si` | Chinese (Simplified) |
If a locale is not specified for these languages the default locale for the language will be returned. If a language does not have multiple locales, the response does not include a locale. For more information on how to pass in the locale please see the parameters for each API feature.
### Error handling
If all went well, you will get a 200 HTTP status code. If something went wrong, such as trying `convert-to-coordinates` with an invalid 3 word address such as `no.address.here`, you will get the appropriate HTTP error status (`400` in this case). Also, the body will contain an `error` block with a `code` and a `message`. `code` can be used programmatically so you can respond appropriately. `message` is intended as a helpful message to help you understand how to fix what went wrong. See [Error handling](https://developer.what3words.com/public-api/docs#error-handling) for every status and code.
## Convert to 3 word address
`GET https://api.what3words.com/v3/convert-to-3wa`
This function will convert a latitude and longitude to a what3words address, in the language of your choice. It also returns country, the bounds of the grid square, a nearby place (such as a local town) and a link to our map site.
### Parameters
| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `key` | query | string | optional | A valid API key. Provide it as query parameter `key`; `X-Api-Key` header is also supported. |
| `coordinates` | query | string | required | Coordinates as a comma separated string of latitude and longitude. Example `coordinates=51.521251,-0.203586`. |
| `language` | query | string | optional | A supported what3words language code from `/available-languages`. You can pass base language codes (for example `fr`) or script-specific codes where available (for example `mn_la`, `zh_tr`, `oo_la`). Defaults to `en` (English) if not specified. For Bosnian-Croatian-Montenegrin-Serbian use `oo`. See [Available languages](https://developer.what3words.com/public-api/docs#available-languages) for every code. Default `en`. Example `language=fr`. |
| `format` | query | string | optional | Return data format type; can be either `json` (the default) or `geojson`. One of `json`, `geojson`. Default `json`. |
| `locale` | query | string | optional | Optional locale/script-specific code. Can be passed on its own. If provided with `language`, both values must be identical strings (for example `language=mn_la&locale=mn_la`). See [Locales](https://developer.what3words.com/public-api/docs#locales) for more details. Example `locale=mn_la`. |
### Example request
**cURL**
```shellscript
curl --request GET \
--url 'https://api.what3words.com/v3/convert-to-3wa?coordinates=51.520847,-0.195521&key=YOUR_API_KEY'
```
**JavaScript**
```javascript
const params = new URLSearchParams({
coordinates: '51.520847,-0.195521',
key: 'YOUR_API_KEY',
});
const response = await fetch(`https://api.what3words.com/v3/convert-to-3wa?${params}`);
const data = await response.json();
console.log(data);
```
**Python**
```python
import requests
response = requests.get(
"https://api.what3words.com/v3/convert-to-3wa",
params={"coordinates": "51.520847,-0.195521", "key": "YOUR_API_KEY"},
)
print(response.json())
```
### Example result
Status: `200 OK`
**JSON**
```json
{
"country": "GB",
"square": {
"southwest": {
"lng": -0.195543,
"lat": 51.520833
},
"northeast": {
"lng": -0.195499,
"lat": 51.52086
}
},
"nearestPlace": "Bayswater, London",
"coordinates": {
"lng": -0.195521,
"lat": 51.520847
},
"words": "filled.count.soap",
"language": "en",
"map": "https://w3w.co/filled.count.soap"
}
```
**GeoJSON**
```json
{
"features": [
{
"bbox": [
-0.195543,
51.520833,
-0.195499,
51.52086
],
"geometry": {
"coordinates": [
-0.195521,
51.520847
],
"type": "Point"
},
"type": "Feature",
"properties": {
"country": "GB",
"nearestPlace": "Bayswater, London",
"words": "filled.count.soap",
"language": "en",
"map": "https://w3w.co/filled.count.soap"
}
}
],
"type": "FeatureCollection"
}
```
### Response fields
| Field | Type | Description |
| --- | --- | --- |
| `country` | string | The country in which the what3words address is located, as an ISO 3166-1 alpha-2 country code |
| `square` | object (Square) | |
| `square.southwest` | object (Coordinates) | |
| `square.southwest.lat` | number | Latitude |
| `square.southwest.lng` | number | Longitude |
| `square.northeast` | object (Coordinates) | |
| `square.northeast.lat` | number | Latitude |
| `square.northeast.lng` | number | Longitude |
| `nearestPlace` | string | The nearest place to the what3words address |
| `coordinates` | object (Coordinates) | |
| `coordinates.lat` | number | Latitude |
| `coordinates.lng` | number | Longitude |
| `words` | string | The what3words address |
| `language` | string | The language of the what3words address |
| `locale` | string | The locale of the what3words address, if returned |
| `map` | string | URL to view the what3words address on the what3words map |
### Errors
| Status | Code | Message |
| --- | --- | --- |
| 400 | `BadLanguage` | language must be a supported what3words language code, such as 'en', 'fr' or 'mn_la' |
| 400 | `BadCoordinates` | failed to parse one of the coordinates as a valid decimal number |
| 400 | `BadFormat` | Format must be one of json,geojson |
| 400 | `BadLanguage` | language and locale must not be different |
| 400 | `DuplicateParameter` | Duplicate parameter 'coordinates'. Please only pass in one of each parameter. |
| 401 | `InvalidKey` | Authentication failed; invalid API key |
| 401 | `MissingKey` | Authentication failed; missing required API key parameter or header |
## Convert to coordinates
`GET https://api.what3words.com/v3/convert-to-coordinates`
This function converts a what3words address to a latitude and longitude. It also returns country, the bounds of the grid square, a nearest place (such as a local town) and a link to our map site.
### Parameters
| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `key` | query | string | optional | A valid API key. Provide it as query parameter `key`; `X-Api-Key` header is also supported. |
| `words` | query | string | required | A what3words address. Input parsing is case-insensitive, accepts an optional leading `///`, and accepts supported dot-like delimiters (. 。 。 ・ ・ ︒ ។ ։ ။ ۔ ። ।). Vietnamese addresses must be supplied either with no internal spaces or with 1 to 3 internal spaces in every word (spaces are URL-encoded as `%20`); the two Vietnamese styles cannot be mixed in a single address. Example `words=filled.count.soap`. |
| `format` | query | string | optional | Return data format type; can be either `json` (the default) or `geojson`. One of `json`, `geojson`. Default `json`. |
### Example request
**cURL**
```shellscript
curl --request GET \
--url 'https://api.what3words.com/v3/convert-to-coordinates?words=filled.count.soap&key=YOUR_API_KEY'
```
**JavaScript**
```javascript
const params = new URLSearchParams({
words: 'filled.count.soap',
key: 'YOUR_API_KEY',
});
const response = await fetch(`https://api.what3words.com/v3/convert-to-coordinates?${params}`);
const data = await response.json();
console.log(data);
```
**Python**
```python
import requests
response = requests.get(
"https://api.what3words.com/v3/convert-to-coordinates",
params={"words": "filled.count.soap", "key": "YOUR_API_KEY"},
)
print(response.json())
```
### Example result
Status: `200 OK`
**JSON**
```json
{
"country": "GB",
"square": {
"southwest": {
"lng": -0.195543,
"lat": 51.520833
},
"northeast": {
"lng": -0.195499,
"lat": 51.52086
}
},
"nearestPlace": "Bayswater, London",
"coordinates": {
"lng": -0.195521,
"lat": 51.520847
},
"words": "filled.count.soap",
"language": "en",
"map": "https://w3w.co/filled.count.soap"
}
```
**GeoJSON**
```json
{
"features": [
{
"bbox": [
-0.195543,
51.520833,
-0.195499,
51.52086
],
"geometry": {
"coordinates": [
-0.195521,
51.520847
],
"type": "Point"
},
"type": "Feature",
"properties": {
"country": "GB",
"nearestPlace": "Bayswater, London",
"words": "filled.count.soap",
"language": "en",
"map": "https://w3w.co/filled.count.soap"
}
}
],
"type": "FeatureCollection"
}
```
### Response fields
| Field | Type | Description |
| --- | --- | --- |
| `country` | string | The country in which the what3words address is located, as an ISO 3166-1 alpha-2 country code |
| `square` | object (Square) | |
| `square.southwest` | object (Coordinates) | |
| `square.southwest.lat` | number | Latitude |
| `square.southwest.lng` | number | Longitude |
| `square.northeast` | object (Coordinates) | |
| `square.northeast.lat` | number | Latitude |
| `square.northeast.lng` | number | Longitude |
| `nearestPlace` | string | The nearest place to the what3words address |
| `coordinates` | object (Coordinates) | |
| `coordinates.lat` | number | Latitude |
| `coordinates.lng` | number | Longitude |
| `words` | string | The what3words address |
| `language` | string | The language of the what3words address |
| `locale` | string | The locale of the what3words address, if returned |
| `map` | string | URL to view the what3words address on the what3words map |
### Errors
| Status | Code | Message |
| --- | --- | --- |
| 400 | `MissingWords` | words must be specified |
| 400 | `BadWords` | words must be a valid 3 word address, such as filled.count.soap or ///filled.count.soap |
| 400 | `BadFormat` | Format must be one of json,geojson |
| 400 | `DuplicateParameter` | Duplicate parameter 'words'. Please only pass in one of each parameter. |
| 401 | `InvalidKey` | Authentication failed; invalid API key |
| 401 | `MissingKey` | Authentication failed; missing required API key parameter or header |
## AutoSuggest
`GET https://api.what3words.com/v3/autosuggest`
AutoSuggest can take a slightly incorrect what3words address and suggest a list of valid what3words addresses. It has powerful features that can, for example, optionally limit results to a country or area, and prioritize results that are near the user.
It provides corrections for the following types of input error:
- Typing errors
- Spelling errors
- Misremembered words (for example, singular vs. plural)
- Words in the wrong order
### Input 3 word address
AutoSuggest accepts either a full or partial 3 word address (it will be partial if the user is still typing in a search box, for example). A partial 3 word address must contain at least the first two words and first character of the third word. For example `filled.count.s` will return results, but anything shorter will not.
### Clipping and focus
Our clipping allows you to specify a country (or list of countries) and/or geographic area to exclude results that are not likely to be relevant to your users. To give a more targeted, shorter set of results to your users, we recommend you use the clipping parameters. If you know your user’s current location, we also strongly recommend that you use the `focus` to return results that are likely to be more relevant (that is, results near the user).
In summary, the clipping policy is used to optionally restrict the list of candidate AutoSuggest results, after which, if `focus` has been supplied, this will be used to weight the results in order of relevance to the `focus`.
Multiple clipping policies can be specified, though only one of each type. For example you can clip to country and clip to circle in the same AutoSuggest call, and it will clip to the intersection of the two (results must be in the circle AND in the country). However, you can't specify two `clip-to-circle` policies in the same call.
### Language
AutoSuggest will search in all languages. However, you can additionally specify a fallback language, to help the API in situations where the input is particularly messy. For normal text input, the `language` parameter is optional, and AutoSuggest will work well even without a `language` parameter. However, for voice input the `language` should always be specified.
### Voice input
As well as Cerence-based speech recognition systems, AutoSuggest also supports a Generic Voice option. This supports output from any speech recognition software. This input type handles spaces between words, for example, 'filled count soap'. Users should not pronounce 'dot' when speaking a 3 word address, and this input type cannot handle text in languages in which words are not separated by spaces, such as Chinese. Language detection should be disabled, so `language` must always be set. See [Using AutoSuggest with voice](https://developer.what3words.com/public-api/docs#speech-recognition).
### Parameters
| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `key` | query | string | optional | A valid API key. Provide it as query parameter `key`; `X-Api-Key` header is also supported. |
| `input` | query | string | required | The full or partial what3words address to obtain suggestions for. At minimum this must be the first two complete words plus at least one character from the third word. Input parsing is case-insensitive, accepts an optional leading `///`, and accepts supported dot-like delimiters (. 。 。 ・ ・ ︒ ។ ։ ။ ۔ ። ।). Example `input=filled.count.s`. |
| `focus` | query | string | optional | This is a location, specified as latitude,longitude (often where the user making the query is). If specified, the results will be weighted to give preference to those near the focus. For convenience, longitude is allowed to wrap around the 180 line, so 361 is equivalent to 1. Example `focus=51.521251,-0.203586`. |
| `n-focus-results` | query | integer | optional | Controls how many top suggestions are strongly biased towards the `focus` coordinate. Defaults to `n-results` when omitted. Non-numeric values return `BadNFocusResults`. Default `3`. Maximum 100. Example `n-focus-results=5`. |
| `clip-to-country` | query | string | optional | Restricts results to the specified country or countries, specified as comma-separated ISO 3166-1 alpha-2 country codes (for example `GB,US`). Parsing is case-insensitive, though uppercase is recommended. Entries must be two a-z letters. If the two-letter code does not correspond to a country, there is no error: the API simply returns no results. Example `clip-to-country=GB,US`. |
| `clip-to-circle` | query | string | optional | Restricts results to a circle, specified by `latitude,longitude,kilometres`. For example, `51.4243877,-0.3474524,10` constrains results to those within 10 km of the point 51.4243877,-0.3474524. Example `clip-to-circle=51.4243877,-0.3474524,10`. |
| `clip-to-bounding-box` | query | string | optional | Restricts results to a bounding box, specified by `southwest latitude,southwest longitude,northeast latitude,northeast longitude`. Latitudes and longitudes should be specified in order of increasing size. Longitude is allowed to wrap, so that you can specify bounding boxes which cross the ante-meridian, e.g., `-4,178.2,22,195.4`. Example `clip-to-bounding-box=51.515900,-0.212517,51.527649,-0.191746`. |
| `clip-to-polygon` | query | string | optional | Restricts results to a polygon, specified by a comma-separated list of `lat,lng` pairs. The polygon should be closed, i.e. the first element should be repeated as the last element; also the list should contain at least 4 entries. The API is currently limited to accepting up to 25 pairs. Example `clip-to-polygon=51.521,-0.343,52.6,2.3324,54.234,8.343,51.521,-0.343`. |
| `language` | query | string | optional | For text input, adds a preferred language or locale to the set Autosuggest considers. Exact whole-word matches in the input can also add languages or locales. If omitted for text input, English is added as the default backstop. For voice input (`input-type` != `text`), this must be provided. Use a supported what3words code from `/available-languages`, including locale/script-specific codes where available (for example `mn_la`, `zh_tr`, `oo_la`). For Bosnian-Croatian-Montenegrin-Serbian use `oo`. See [Available languages](https://developer.what3words.com/public-api/docs#available-languages). Default `en`. |
| `locale` | query | string | optional | Optional locale/script-specific code. Can be passed on its own. If provided with `language`, both values must be identical strings (for example `language=mn_la&locale=mn_la`). See [Locales](https://developer.what3words.com/public-api/docs#locales) for more details. Example `locale=mn_la`. |
| `input-type` | query | string | optional | For power users, used to specify voice input mode. Can be `text` (default), `vocon-hybrid`, `nmdp-asr`, `generic-voice`, `speechmatics`, or `vin-big-data`. Voice modes require `language`. If `input` is not in the expected format for a selected voice mode, the API may return `BadInput`. See [Using AutoSuggest with voice](https://developer.what3words.com/public-api/docs#speech-recognition) for more details. One of `text`, `vocon-hybrid`, `nmdp-asr`, `generic-voice`, `speechmatics`, `vin-big-data`. Default `text`. |
| `n-results` | query | integer | optional | The number of AutoSuggest results to return. Non-numeric values return `BadNResults`. Values greater than 100 are truncated to 100. Values less than or equal to 0 return an empty suggestions list. The default is 3. Default `3`. Maximum 100. |
| `prefer-land` | query | boolean | optional | Makes AutoSuggest prefer results on land to those in the sea. This setting is on by default. Use false to disable this setting and receive more suggestions in the sea. Default `true`. |
| `format` | query | string | optional | Return data format type; can be either `json` (the default) or `geojson`. One of `json`, `geojson`. Default `json`. |
### Example request
**cURL**
```shellscript
curl --request GET \
--url 'https://api.what3words.com/v3/autosuggest?input=film.crunchy.spiri&focus=50.842404,4.361177&key=YOUR_API_KEY'
```
**JavaScript**
```javascript
const params = new URLSearchParams({
input: 'film.crunchy.spiri',
focus: '50.842404,4.361177',
key: 'YOUR_API_KEY',
});
const response = await fetch(`https://api.what3words.com/v3/autosuggest?${params}`);
const data = await response.json();
console.log(data);
```
**Python**
```python
import requests
response = requests.get(
"https://api.what3words.com/v3/autosuggest",
params={"input": "film.crunchy.spiri", "focus": "50.842404,4.361177", "key": "YOUR_API_KEY"},
)
print(response.json())
```
### Example result
Status: `200 OK`
**JSON**
```json
{
"suggestions": [
{
"country": "BE",
"nearestPlace": "Brussels, Brussels Capital",
"words": "film.crunchy.spirits",
"rank": 1,
"distanceToFocusKm": 1,
"language": "en"
},
{
"country": "ES",
"nearestPlace": "Caldes de Montbui, Catalonia",
"words": "film.crunchy.spirit",
"rank": 2,
"distanceToFocusKm": 1039,
"language": "en"
},
{
"country": "NL",
"nearestPlace": "Weert, Limburg",
"words": "firm.crunchy.spires",
"rank": 3,
"distanceToFocusKm": 105,
"language": "en"
}
]
}
```
### Response fields
| Field | Type | Description |
| --- | --- | --- |
| `suggestions[]` | array of AutosuggestSuggestion | List of suggested what3words addresses |
| `suggestions[].words` | string | The suggested what3words address |
| `suggestions[].country` | string | The country in which the what3words address is located, as an ISO 3166-1 alpha-2 country code |
| `suggestions[].nearestPlace` | string | The nearest place to the what3words address |
| `suggestions[].language` | string | The language of the what3words address |
| `suggestions[].locale` | string | The locale of the what3words address, if applicable |
| `suggestions[].rank` | integer | The relative ranking of this suggestion |
| `suggestions[].distanceToFocusKm` | number | The distance in kilometers from the focus point to this suggestion's coordinates |
### Errors
| Status | Code | Message |
| --- | --- | --- |
| 400 | `MissingInput` | input must be specified |
| 400 | `BadFocus` | focus must be a lat,lng |
| 400 | `BadClipToCountry` | Countries are specified as a comma separated list of uppercase ISO 3166-1 alpha-2 country codes, such as US,CA |
| 400 | `BadClipToBoundingBox` | Must be four lat,lng,lat,lng coordinates such as 50,-2,53.12,2.34 |
| 400 | `BadClipToCircle` | clip-to-circle needs to be lat,lng,km. Example: 51.453,0.344,112 |
| 400 | `BadClipToPolygon` | Failed to parse one of the coordinates as a valid decimal number |
| 400 | `MissingLanguage` | for voice input. language must be specified |
| 400 | `BadLanguage` | language must be a supported what3words language code, such as 'en', 'fr' or 'mn_la' |
| 400 | `BadInputType` | prefer-land must be one of true or false |
| 400 | `BadLanguage` | language and locale must not be different |
| 400 | `BadNResults` | n-results must be a valid integer |
| 400 | `BadNFocusResults` | n-focus-results must be a valid integer |
| 400 | `BadInput` | Invalid autosuggest input |
| 400 | `DuplicateParameter` | Duplicate parameter 'input'. Please only pass in one of each parameter. |
| 401 | `InvalidKey` | Authentication failed; invalid API key |
| 401 | `MissingKey` | Authentication failed; missing required API key parameter or header |
### More example requests
#### AutoSuggest
This example returns AutoSuggest results for the partial 3 word address `film.crunchy.spiri`; the results are not clipped and not ranked for proximity to a given location.
**URL**
```
https://api.what3words.com/v3/autosuggest?input=film.crunchy.spiri&key=YOUR_API_KEY
```
#### AutoSuggest with focus only
This example returns AutoSuggest results for the partial 3 word address `film.crunchy.spiri`; the results are ranked for proximity relevance to the `focus` point of 50.842404,4.361177.
**URL**
```
https://api.what3words.com/v3/autosuggest?input=film.crunchy.spiri&focus=50.842404,4.361177&key=YOUR_API_KEY
```
#### AutoSuggest with clip-to-circle
This example searches for `plan.clips.a`; the results are constrained to those that are within 10 km of the point 51.4243877,-0.3474524.
**URL**
```
https://api.what3words.com/v3/autosuggest?input=plan.clips.a&clip-to-circle=51.4243877,-0.3474524,10&key=YOUR_API_KEY
```
#### AutoSuggest with focus and clip-to-country
**URL**
```
https://api.what3words.com/v3/autosuggest?input=plan.clips.a&focus=51.4243877,-0.3474524&clip-to-country=GB&key=YOUR_API_KEY
```
#### AutoSuggest with clip-to-bounding-box
This searches for `plan.clips.a` in the bounding box described by a NE corner of 54,2 and a SW corner of 50,-4.
**URL**
```
https://api.what3words.com/v3/autosuggest?input=plan.clips.a&clip-to-bounding-box=50,-4,54,2&key=YOUR_API_KEY
```
## AutoSuggest with coordinates
> [!NOTE]
> This endpoint needs special permissions on your API key. Contact [support@what3words.com](mailto:support@what3words.com) or your account manager to enable it. Without them, it returns `401` with the code `InvalidKey`.
It takes the same parameters as [AutoSuggest](https://developer.what3words.com/public-api/docs#autosuggest) and also returns the coordinates, grid square and map link of each suggestion.
`GET https://api.what3words.com/v3/autosuggest-with-coordinates`
Similar to the AutoSuggest endpoint, but returns coordinates in the response. This endpoint requires special permissions.
### Parameters
| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `key` | query | string | optional | A valid API key. Provide it as query parameter `key`; `X-Api-Key` header is also supported. |
| `input` | query | string | required | The full or partial what3words address to obtain suggestions for. At minimum this must be the first two complete words plus at least one character from the third word. Input parsing is case-insensitive, accepts an optional leading `///`, and accepts supported dot-like delimiters (. 。 。 ・ ・ ︒ ។ ։ ။ ۔ ። ।). Example `input=filled.count.s`. |
| `focus` | query | string | optional | This is a location, specified as latitude,longitude (often where the user making the query is). If specified, the results will be weighted to give preference to those near the focus. For convenience, longitude is allowed to wrap around the 180 line, so 361 is equivalent to 1. Example `focus=51.521251,-0.203586`. |
| `n-focus-results` | query | integer | optional | Controls how many top suggestions are strongly biased towards the `focus` coordinate. Defaults to `n-results` when omitted. Non-numeric values return `BadNFocusResults`. Default `3`. Maximum 100. Example `n-focus-results=5`. |
| `clip-to-country` | query | string | optional | Restricts results to the specified country or countries, specified as comma-separated ISO 3166-1 alpha-2 country codes (for example `GB,US`). Parsing is case-insensitive, though uppercase is recommended. Example `clip-to-country=GB,US`. |
| `clip-to-circle` | query | string | optional | Restricts results to a circle, specified by `latitude,longitude,kilometres`. For example, `51.4243877,-0.3474524,10` constrains results to those within 10 km of the point 51.4243877,-0.3474524. Example `clip-to-circle=51.4243877,-0.3474524,10`. |
| `clip-to-bounding-box` | query | string | optional | Restricts results to a bounding box, specified by `southwest latitude,southwest longitude,northeast latitude,northeast longitude`. Latitudes and longitudes should be specified in order of increasing size. Longitude is allowed to wrap, so that you can specify bounding boxes which cross the ante-meridian, e.g., `-4,178.2,22,195.4`. Example `clip-to-bounding-box=51.515900,-0.212517,51.527649,-0.191746`. |
| `clip-to-polygon` | query | string | optional | Restricts results to a polygon, specified by a comma-separated list of `lat,lng` pairs. The polygon should be closed, i.e. the first element should be repeated as the last element; also the list should contain at least 4 entries. The API is currently limited to accepting up to 25 pairs. Example `clip-to-polygon=51.521,-0.343,52.6,2.3324,54.234,8.343,51.521,-0.343`. |
| `language` | query | string | optional | For text input, adds a preferred language or locale to the set Autosuggest considers. Exact whole-word matches in the input can also add languages or locales. If omitted for text input, English is added as the default backstop. For voice input (`input-type` != `text`), this must be provided. Use a supported what3words code from `/available-languages`, including locale/script-specific codes where available (for example `mn_la`, `zh_tr`, `oo_la`). Default `en`. |
| `locale` | query | string | optional | Optional locale/script-specific code. Can be passed on its own. If provided with `language`, both values must be identical strings (for example `language=mn_la&locale=mn_la`). Example `locale=mn_la`. |
| `input-type` | query | string | optional | For power users, used to specify voice input mode. Can be `text` (default), `vocon-hybrid`, `nmdp-asr`, `generic-voice`, `speechmatics`, or `vin-big-data`. Voice modes require `language`. If `input` is not in the expected format for a selected voice mode, the API may return `BadInput`. One of `text`, `vocon-hybrid`, `nmdp-asr`, `generic-voice`, `speechmatics`, `vin-big-data`. Default `text`. |
| `n-results` | query | integer | optional | The number of AutoSuggest results to return. Non-numeric values return `BadNResults`. Values greater than 100 are truncated to 100. Values less than or equal to 0 return an empty suggestions list. The default is 3. Default `3`. Maximum 100. |
| `prefer-land` | query | boolean | optional | Makes AutoSuggest prefer results on land to those in the sea. This setting is on by default. Use false to disable this setting and receive more suggestions in the sea. Default `true`. |
| `format` | query | string | optional | Return data format type; can be either `json` (the default) or `geojson`. One of `json`, `geojson`. Default `json`. |
### Example request
**cURL**
```shellscript
curl --request GET \
--url 'https://api.what3words.com/v3/autosuggest-with-coordinates?input=film.crunchy.spiri&focus=50.842404,4.361177&key=YOUR_API_KEY'
```
**JavaScript**
```javascript
const params = new URLSearchParams({
input: 'film.crunchy.spiri',
focus: '50.842404,4.361177',
key: 'YOUR_API_KEY',
});
const response = await fetch(`https://api.what3words.com/v3/autosuggest-with-coordinates?${params}`);
const data = await response.json();
console.log(data);
```
**Python**
```python
import requests
response = requests.get(
"https://api.what3words.com/v3/autosuggest-with-coordinates",
params={"input": "film.crunchy.spiri", "focus": "50.842404,4.361177", "key": "YOUR_API_KEY"},
)
print(response.json())
```
### Example result
Status: `200 OK`
**JSON**
```json
{
"suggestions": [
{
"country": "BE",
"square": {
"southwest": {
"lng": 4.347436,
"lat": 50.848237
},
"northeast": {
"lng": 4.347479,
"lat": 50.848264
}
},
"nearestPlace": "Brussels, Brussels Capital",
"words": "film.crunchy.spirits",
"coordinates": {
"lng": 4.347457,
"lat": 50.848251
},
"rank": 1,
"distanceToFocusKm": 1,
"language": "en",
"map": "https://w3w.co/film.crunchy.spirits"
},
{
"country": "ES",
"square": {
"southwest": {
"lng": 2.164394,
"lat": 41.625835
},
"northeast": {
"lng": 2.16443,
"lat": 41.625862
}
},
"nearestPlace": "Caldes de Montbui, Catalonia",
"words": "film.crunchy.spirit",
"coordinates": {
"lng": 2.164412,
"lat": 41.625849
},
"rank": 2,
"distanceToFocusKm": 1039,
"language": "en",
"map": "https://w3w.co/film.crunchy.spirit"
},
{
"country": "NL",
"square": {
"southwest": {
"lng": 5.681058,
"lat": 51.289807
},
"northeast": {
"lng": 5.681101,
"lat": 51.289834
}
},
"nearestPlace": "Weert, Limburg",
"words": "firm.crunchy.spires",
"coordinates": {
"lng": 5.68108,
"lat": 51.289821
},
"rank": 3,
"distanceToFocusKm": 105,
"language": "en",
"map": "https://w3w.co/firm.crunchy.spires"
}
]
}
```
### Response fields
| Field | Type | Description |
| --- | --- | --- |
| `suggestions[]` | array of AutosuggestWithCoordinatesSuggestion | List of suggested what3words addresses including coordinates |
| `suggestions[].words` | string | The suggested what3words address |
| `suggestions[].country` | string | The country in which the what3words address is located, as an ISO 3166-1 alpha-2 country code |
| `suggestions[].square` | object (Square) | |
| `suggestions[].square.southwest` | object (Coordinates) | |
| `suggestions[].square.southwest.lat` | number | Latitude |
| `suggestions[].square.southwest.lng` | number | Longitude |
| `suggestions[].square.northeast` | object (Coordinates) | |
| `suggestions[].square.northeast.lat` | number | Latitude |
| `suggestions[].square.northeast.lng` | number | Longitude |
| `suggestions[].nearestPlace` | string | The nearest place to the what3words address |
| `suggestions[].coordinates` | object (Coordinates) | |
| `suggestions[].coordinates.lat` | number | Latitude |
| `suggestions[].coordinates.lng` | number | Longitude |
| `suggestions[].language` | string | The language of the what3words address |
| `suggestions[].locale` | string | The locale of the what3words address, if returned |
| `suggestions[].rank` | integer | The relative ranking of this suggestion |
| `suggestions[].distanceToFocusKm` | number | The distance in kilometers from the focus point to this suggestion's coordinates |
| `suggestions[].map` | string | URL to view the what3words address on the what3words map |
### Errors
| Status | Code | Message |
| --- | --- | --- |
| 400 | `MissingInput` | input must be specified |
| 400 | `BadFocus` | focus must be a lat,lng |
| 400 | `BadClipToCountry` | Countries are specified as a comma separated list of uppercase ISO 3166-1 alpha-2 country codes, such as US,CA |
| 400 | `BadClipToBoundingBox` | Must be four lat,lng,lat,lng coordinates such as 50,-2,53.12,2.34 |
| 400 | `BadClipToCircle` | clip-to-circle needs to be lat,lng,km. Example: 51.453,0.344,112 |
| 400 | `BadClipToPolygon` | Failed to parse one of the coordinates as a valid decimal number |
| 400 | `MissingLanguage` | for voice input. language must be specified |
| 400 | `BadLanguage` | language must be a supported what3words language code, such as 'en', 'fr' or 'mn_la' |
| 400 | `BadInputType` | prefer-land must be one of true or false |
| 400 | `BadLanguage` | language and locale must not be different |
| 400 | `BadNResults` | n-results must be a valid integer |
| 400 | `BadNFocusResults` | n-focus-results must be a valid integer |
| 400 | `BadInput` | Invalid autosuggest input |
| 400 | `DuplicateParameter` | Duplicate parameter 'input'. Please only pass in one of each parameter. |
| 401 | `InvalidKey` | Authentication failed; invalid API key |
| 401 | `InvalidKey` | Auth failed; /v3/autosuggest-with-coordinates. Contact support@what3words.com or your account manager to enable your account |
| 401 | `MissingKey` | Authentication failed; missing required API key parameter or header |
## Grid section
`GET https://api.what3words.com/v3/grid-section`
Returns a section of the 3m x 3m what3words grid for a bounding box. The bounding box is specified by lat,lng,lat,lng as south,west,north,east. You can request the grid in GeoJSON format, making it very simple to display on a map.
### Parameters
| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `key` | query | string | optional | A valid API key. Provide it as query parameter `key`; `X-Api-Key` header is also supported. |
| `bounding-box` | query | string | required | Bounding box, as a `lat,lng,lat,lng`, for which the grid should be returned. The requested box must not exceed `4km` from corner to corner, or a `BadBoundingBoxTooBig` error will be returned. Latitudes must be `>= -90` and `<= 90`, but longitudes are allowed to wrap around 180. To specify a bounding-box that crosses the anti-meridian, use longitude greater than 180. e.g.: `bounding-box=50.0,179.995,50.01,180.0005`. Example `bounding-box=52.207988,0.116126,52.208867,0.117540`. |
| `format` | query | string | optional | Return data format type; can be either `json` (the default) or `geojson`. One of `json`, `geojson`. Default `json`. |
### Example request
**cURL**
```shellscript
curl --request GET \
--url 'https://api.what3words.com/v3/grid-section?bounding-box=52.207988,0.116126,52.208867,0.117540&key=YOUR_API_KEY'
```
**JavaScript**
```javascript
const params = new URLSearchParams({
'bounding-box': '52.207988,0.116126,52.208867,0.117540',
key: 'YOUR_API_KEY',
});
const response = await fetch(`https://api.what3words.com/v3/grid-section?${params}`);
const data = await response.json();
console.log(data);
```
**Python**
```python
import requests
response = requests.get(
"https://api.what3words.com/v3/grid-section",
params={"bounding-box": "52.207988,0.116126,52.208867,0.117540", "key": "YOUR_API_KEY"},
)
print(response.json())
```
### Example result
Status: `200 OK`
**JSON**
```json
{
"lines": [
{
"start": {
"lng": 0.116126,
"lat": 52.20801
},
"end": {
"lng": 0.11754,
"lat": 52.20801
}
},
{
"start": {
"lng": 0.116126,
"lat": 52.208037
},
"end": {
"lng": 0.11754,
"lat": 52.208037
}
}
]
}
```
**GeoJSON**
```json
{
"features": [
{
"geometry": {
"coordinates": [
[
[
0.116126,
52.20801
],
[
0.11754,
52.20801
]
],
[
[
0.116126,
52.208037
],
[
0.11754,
52.208037
]
]
],
"type": "MultiLineString"
},
"type": "Feature",
"properties": {}
}
],
"type": "FeatureCollection"
}
```
*Shortened to the first two lines of the grid; the full response has a line for every grid row and column in the bounding box.*
### Response fields
| Field | Type | Description |
| --- | --- | --- |
| `lines[]` | array of object | Array of line objects that make up the grid |
| `lines[].start` | object (Coordinates) | |
| `lines[].start.lat` | number | Latitude |
| `lines[].start.lng` | number | Longitude |
| `lines[].end` | object (Coordinates) | |
| `lines[].end.lat` | number | Latitude |
| `lines[].end.lng` | number | Longitude |
### Errors
| Status | Code | Message |
| --- | --- | --- |
| 400 | `BadBoundingBox` | bounding-box must be specified as south_lat,west_lng,north_lat,east_lng |
| 400 | `BadBoundingBoxTooBig` | Bounding box too large (exceeds 4km from corner to corner) |
| 400 | `BadFormat` | Format must be one of json,geojson |
| 400 | `DuplicateParameter` | Duplicate parameter 'bounding-box'. Please only pass in one of each parameter. |
| 401 | `InvalidKey` | Authentication failed; invalid API key |
| 401 | `MissingKey` | Authentication failed; missing required API key parameter or header |
## Available languages
Bosnian-Croatian-Montenegrin-Serbian is available using the language code `oo` with Cyrillic and Latin locales (`oo_cy` and `oo_la`).
`GET https://api.what3words.com/v3/available-languages`
Retrieves all available what3words address languages and locale/script variants, including language code, English name and native name. Use top-level `code` values as base `language` codes, and use nested `locales[].code` values where explicit locale/script selection is needed (for example `en`, `mn`, `mn_la`, `zh_tr`, `oo_cy`).
### Parameters
| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `key` | query | string | optional | A valid API key. Provide it as query parameter `key`; `X-Api-Key` header is also supported. |
### Example request
**cURL**
```shellscript
curl --request GET \
--url 'https://api.what3words.com/v3/available-languages?key=YOUR_API_KEY'
```
**JavaScript**
```javascript
const params = new URLSearchParams({
key: 'YOUR_API_KEY',
});
const response = await fetch(`https://api.what3words.com/v3/available-languages?${params}`);
const data = await response.json();
console.log(data);
```
**Python**
```python
import requests
response = requests.get(
"https://api.what3words.com/v3/available-languages",
params={"key": "YOUR_API_KEY"},
)
print(response.json())
```
### Example result
Status: `200 OK`
**JSON**
```json
{
"languages": [
{
"nativeName": "Deutsch",
"code": "de",
"name": "German"
},
{
"nativeName": "English",
"code": "en",
"name": "English"
},
{
"nativeName": "Français",
"code": "fr",
"name": "French"
},
{
"nativeName": "Монгол хэл",
"code": "mn",
"name": "Mongolian",
"locales": [
{
"nativeName": "Монгол хэл (Латинаар)",
"name": "Mongolian (Latin)",
"code": "mn_la"
},
{
"nativeName": "Монгол хэл (Криллээр)",
"name": "Mongolian (Cyrillic)",
"code": "mn_cy"
}
]
},
{
"nativeName": "中文",
"code": "zh",
"name": "Chinese",
"locales": [
{
"nativeName": "中文(繁體)",
"name": "Chinese (Traditional)",
"code": "zh_tr"
},
{
"nativeName": "中文(简体)",
"name": "Chinese (Simplified)",
"code": "zh_si"
}
]
}
]
}
```
*Shortened to five languages; the full response lists all 58 languages.*
### Response fields
| Field | Type | Description |
| --- | --- | --- |
| `languages[]` | array of Language | List of available languages |
| `languages[].code` | string | The what3words language code for the language or language family (for example `en`, `mn`, `oo`). |
| `languages[].name` | string | The English name of the language |
| `languages[].nativeName` | string | The name of the language in that language |
| `languages[].locales[]` | array of Locale | List of available locales for this language, if applicable |
| `languages[].locales[].code` | string | The locale code |
| `languages[].locales[].name` | string | The name of the locale |
| `languages[].locales[].nativeName` | string | The native name of the locale |
### Errors
| Status | Code | Message |
| --- | --- | --- |
| 401 | `InvalidKey` | Authentication failed; invalid API key |
| 401 | `MissingKey` | Authentication failed; missing required API key parameter or header |
## Using AutoSuggest with voice
By default, AutoSuggest accepts text input. However, AutoSuggest also has powerful routines specifically optimised to post-process output from speech recognition systems.
As well as Cerence-based speech recognition systems, AutoSuggest also supports a Generic Voice option. This supports output from any speech recognition software. This input type handles spaces between words, for example, 'filled count soap'. Users should not pronounce 'dot' when speaking a 3 word address, and this input type cannot handle text in languages in which words are not separated by spaces, such as Chinese. Language detection is disabled, so `language` must always be set.
Currently, we support two Cerence-based speech recognition systems: NMDP-ASR and VoCon Hybrid. To use speech recognition, you will first need to process your audio using one of Cerence's Automated Speech Recognition systems, then pass the output into our `autosuggest` function. Use the `input-type` parameter to specify which system's output you are processing. For non-English languages, you must also always specify a `language` parameter.
The OpenAPI definition also lists the `speechmatics` and `vin-big-data` input types. Like the other voice modes, they require `language`.
### Generic Voice
AutoSuggest can post-process output for any speech recognition software. All of [AutoSuggest's parameters](https://developer.what3words.com/public-api/docs#autosuggest) such as clipping and focus can be used as normal. To use AutoSuggest in Generic Voice mode, set `input-type=generic-voice`, set `input` to the space separated 3 word address output, and set `language` to the appropriate language value, for example `language=en`.
### Cerence VoCon Hybrid
AutoSuggest can post-process output for [Cerence's VoCon Hybrid](https://www.cerence.com/cerence-products/core-technologies). All of [AutoSuggest's parameters](https://developer.what3words.com/public-api/docs#autosuggest) such as clipping and focus can be used as normal. To use AutoSuggest in VoCon Hybrid mode, set `input-type=vocon-hybrid` and set `input` to the URL-encoded JSON output from VoCon Hybrid.
#### AutoSuggest with focus (VoCon Hybrid)
This example returns Voice AutoSuggest results for the supplied Cerence VoCon Hybrid JSON; the results are ranked for proximity relevance to the `focus` point of 51.4243877,-0.3474524.
**cURL**
```shellscript
curl --request GET --url 'https://api.what3words.com/v3/autosuggest?input=%7B%22_isInGrammar%22%3A%22yes%22%2C%22_isSpeech%22%3A%22yes%22%2C%22_hypotheses%22%3A%5B%7B%22_score%22%3A342516%2C%22_startRule%22%3A%22whatthreewordsgrammar%23_main_%22%2C%22_conf%22%3A6546%2C%22_endTimeMs%22%3A6360%2C%22_beginTimeMs%22%3A1570%2C%22_lmScore%22%3A300%2C%22_items%22%3A%5B%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A34225%2C%22_orthography%22%3A%22tend%22%2C%22_conf%22%3A6964%2C%22_endTimeMs%22%3A2250%2C%22_beginTimeMs%22%3A1580%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A47670%2C%22_orthography%22%3A%22artichokes%22%2C%22_conf%22%3A7176%2C%22_endTimeMs%22%3A3180%2C%22_beginTimeMs%22%3A2260%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A43800%2C%22_orthography%22%3A%22poached%22%2C%22_conf%22%3A6181%2C%22_endTimeMs%22%3A4060%2C%22_beginTimeMs%22%3A3220%7D%5D%7D%2C%7B%22_score%22%3A342631%2C%22_startRule%22%3A%22whatthreewordsgrammar%23_main_%22%2C%22_conf%22%3A6498%2C%22_endTimeMs%22%3A6360%2C%22_beginTimeMs%22%3A1570%2C%22_lmScore%22%3A300%2C%22_items%22%3A%5B%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A34340%2C%22_orthography%22%3A%22tent%22%2C%22_conf%22%3A6772%2C%22_endTimeMs%22%3A2250%2C%22_beginTimeMs%22%3A1580%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A47670%2C%22_orthography%22%3A%22artichokes%22%2C%22_conf%22%3A7176%2C%22_endTimeMs%22%3A3180%2C%22_beginTimeMs%22%3A2260%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A43800%2C%22_orthography%22%3A%22poached%22%2C%22_conf%22%3A6181%2C%22_endTimeMs%22%3A4060%2C%22_beginTimeMs%22%3A3220%7D%5D%7D%2C%7B%22_score%22%3A342668%2C%22_startRule%22%3A%22whatthreewordsgrammar%23_main_%22%2C%22_conf%22%3A6474%2C%22_endTimeMs%22%3A6360%2C%22_beginTimeMs%22%3A1570%2C%22_lmScore%22%3A300%2C%22_items%22%3A%5B%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A34225%2C%22_orthography%22%3A%22tend%22%2C%22_conf%22%3A6964%2C%22_endTimeMs%22%3A2250%2C%22_beginTimeMs%22%3A1580%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A47670%2C%22_orthography%22%3A%22artichokes%22%2C%22_conf%22%3A7176%2C%22_endTimeMs%22%3A3180%2C%22_beginTimeMs%22%3A2260%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A41696%2C%22_orthography%22%3A%22perch%22%2C%22_conf%22%3A5950%2C%22_endTimeMs%22%3A4020%2C%22_beginTimeMs%22%3A3220%7D%5D%7D%2C%7B%22_score%22%3A342670%2C%22_startRule%22%3A%22whatthreewordsgrammar%23_main_%22%2C%22_conf%22%3A6474%2C%22_endTimeMs%22%3A6360%2C%22_beginTimeMs%22%3A1570%2C%22_lmScore%22%3A300%2C%22_items%22%3A%5B%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A34379%2C%22_orthography%22%3A%22tinge%22%2C%22_conf%22%3A6705%2C%22_endTimeMs%22%3A2250%2C%22_beginTimeMs%22%3A1580%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A47670%2C%22_orthography%22%3A%22artichokes%22%2C%22_conf%22%3A7176%2C%22_endTimeMs%22%3A3180%2C%22_beginTimeMs%22%3A2260%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A43800%2C%22_orthography%22%3A%22poached%22%2C%22_conf%22%3A6181%2C%22_endTimeMs%22%3A4060%2C%22_beginTimeMs%22%3A3220%7D%5D%7D%2C%7B%22_score%22%3A342783%2C%22_startRule%22%3A%22whatthreewordsgrammar%23_main_%22%2C%22_conf%22%3A6426%2C%22_endTimeMs%22%3A6360%2C%22_beginTimeMs%22%3A1570%2C%22_lmScore%22%3A300%2C%22_items%22%3A%5B%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A34340%2C%22_orthography%22%3A%22tent%22%2C%22_conf%22%3A6772%2C%22_endTimeMs%22%3A2250%2C%22_beginTimeMs%22%3A1580%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A47670%2C%22_orthography%22%3A%22artichokes%22%2C%22_conf%22%3A7176%2C%22_endTimeMs%22%3A3180%2C%22_beginTimeMs%22%3A2260%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A41696%2C%22_orthography%22%3A%22perch%22%2C%22_conf%22%3A5950%2C%22_endTimeMs%22%3A4020%2C%22_beginTimeMs%22%3A3220%7D%5D%7D%2C%7B%22_score%22%3A342822%2C%22_startRule%22%3A%22whatthreewordsgrammar%23_main_%22%2C%22_conf%22%3A6402%2C%22_endTimeMs%22%3A6360%2C%22_beginTimeMs%22%3A1570%2C%22_lmScore%22%3A300%2C%22_items%22%3A%5B%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A34379%2C%22_orthography%22%3A%22tinge%22%2C%22_conf%22%3A6705%2C%22_endTimeMs%22%3A2250%2C%22_beginTimeMs%22%3A1580%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A47670%2C%22_orthography%22%3A%22artichokes%22%2C%22_conf%22%3A7176%2C%22_endTimeMs%22%3A3180%2C%22_beginTimeMs%22%3A2260%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A41696%2C%22_orthography%22%3A%22perch%22%2C%22_conf%22%3A5950%2C%22_endTimeMs%22%3A4020%2C%22_beginTimeMs%22%3A3220%7D%5D%7D%5D%2C%22_resultType%22%3A%22NBest%22%7D&language=en&focus=51.4243877,-0.3474524&input-type=vocon-hybrid&key=YOUR_API_KEY'
```
### Cerence NMDP ASR
AutoSuggest can post-process output for [Cerence's NMDP ASR](https://www.cerence.com/cerence-products/core-technologies). Please contact Cerence before attempting to use this server. Use with text from any other source is unsupported and results may not be as expected. Does not handle text in languages in which words are not separated by spaces, such as Chinese. All of [AutoSuggest's parameters](https://developer.what3words.com/public-api/docs#autosuggest) such as clipping and focus can be used as normal. To pass in NMDP-ASR output, simply set `input-type=nmdp-asr` and set `input` to the NMDP ASR output.
## Error handling
A successful API call will return an HTTP status code of 200. However, your code should always also handle potential errors. The most common error is a `BadWords`, which occurs when you call `convert-to-coordinates` with an invalid 3 word address. In this case you will get the appropriate HTTP error status (`400` in this case). Also, the body will contain an `error` block with a `code` and a `message`. `code` can be used programmatically so you can respond appropriately. `message` is intended as a helpful message to help you understand what went wrong.
### Example error
**URL**
```
https://api.what3words.com/v3/convert-to-coordinates?words=no.address.here&key=YOUR_API_KEY
```
The response will be an HTTP 400, with the following body:
Status: `400 Bad Request`
**JSON**
```json
{
"error": {
"code": "BadWords",
"message": "words must be a valid 3 word address, such as filled.count.soap or ///filled.count.soap"
}
}
```
### HTTP status codes
Below is a list of all HTTP error codes. This is not an exhaustive list; new error codes may be added in future.
| Code | Description |
| --- | --- |
| `200` | Successful |
| `400` | Bad request. This could be caused by an invalid character (make sure you [URL encode](https://en.wikipedia.org/wiki/Percent-encoding) all parameters); a bad parameter, where the `code` will be set to, for example, `BadWords`, `BadCoordinates`, `BadLanguage`, `BadFormat`, `BadClipToPolygon` and so on; a missing parameter, where a required parameter was missing, for example `MissingWords`, `MissingInput` or `MissingBoundingBox`; or a duplicate parameter: a parameter must only be specified once, or you will see a `DuplicateParameter` error code. |
| `401` | `MissingKey` or `InvalidKey`. Check your API key is supplied as `key=YOUR_API_KEY`. If not supplied as a parameter, a key must be supplied as a request header `X-Api-Key`. |
| `402` | For API accounts on the Free tier, the requested feature is not available. For accounts on a Business plan, the `convert-to-coordinates` quota has been exceeded. Go to [accounts.what3words.com/select-plan](https://accounts.what3words.com/select-plan) to adjust your API plan. |
| `404` | URL not found. Check the URL of the endpoint you're trying to reach. |
| `405` | Method not allowed. You must use a GET request. |
| `429` | Too many requests. See [Rate limits](https://developer.what3words.com/public-api/docs#rate-limits). |
| `50x` | Internal Server Error. |
### Error codes
Every error code in the OpenAPI definition, with the endpoints that return it.
| Code | HTTP status | Returned by |
| --- | --- | --- |
| `MissingWords` | 400 | `/convert-to-coordinates` |
| `BadWords` | 400 | `/convert-to-coordinates` |
| `BadFormat` | 400 | `/convert-to-3wa`, `/convert-to-coordinates`, `/grid-section` |
| `BadCoordinates` | 400 | `/convert-to-3wa` |
| `BadBoundingBox` | 400 | `/grid-section` |
| `BadBoundingBoxTooBig` | 400 | `/grid-section` |
| `BadFocus` | 400 | `/autosuggest`, `/autosuggest-with-coordinates` |
| `BadClipToCountry` | 400 | `/autosuggest`, `/autosuggest-with-coordinates` |
| `BadClipToBoundingBox` | 400 | `/autosuggest`, `/autosuggest-with-coordinates` |
| `BadClipToCircle` | 400 | `/autosuggest`, `/autosuggest-with-coordinates` |
| `BadClipToPolygon` | 400 | `/autosuggest`, `/autosuggest-with-coordinates` |
| `MissingLanguage` | 400 | `/autosuggest`, `/autosuggest-with-coordinates` |
| `BadLanguage` | 400 | `/convert-to-3wa`, `/autosuggest`, `/autosuggest-with-coordinates` |
| `InvalidKey` | 401 | `/convert-to-3wa`, `/convert-to-coordinates`, `/autosuggest`, `/autosuggest-with-coordinates`, `/grid-section`, `/available-languages` |
| `InvalidKeyNoPermissions` | 401 | `/autosuggest-with-coordinates` |
| `BadInputType` | 400 | `/autosuggest`, `/autosuggest-with-coordinates` |
| `MissingInput` | 400 | `/autosuggest`, `/autosuggest-with-coordinates` |
| `MissingKey` | 401 | `/convert-to-3wa`, `/convert-to-coordinates`, `/autosuggest`, `/autosuggest-with-coordinates`, `/grid-section`, `/available-languages` |
| `DuplicateParameter` | 400 | `/convert-to-3wa`, `/convert-to-coordinates`, `/autosuggest`, `/autosuggest-with-coordinates`, `/grid-section` |
| `BadNResults` | 400 | `/autosuggest`, `/autosuggest-with-coordinates` |
| `BadNFocusResults` | 400 | `/autosuggest`, `/autosuggest-with-coordinates` |
| `BadInput` | 400 | `/autosuggest`, `/autosuggest-with-coordinates` |
## Quota and usage limits
### API plans
When signing up for the what3words API you will need to select a [what3words API plan](https://accounts.what3words.com/select-plan).
The Free plan only has access to the `autosuggest` and `available-languages` API functions.
Each Business plan has a quota for the number of `convert-to-coordinates` requests that can be made during your account’s billing period. If you exceed your quota during your billing period, any subsequent `convert-to-coordinates` requests will receive an `HTTP 402` response until either the API plan is upgraded or the billing period resets. Other API functions are covered by our [Fair Usage Policy](https://what3words.com/api-licence-agreement).
If you need a higher quota than specified by our plans then please discuss with the [what3words team](mailto:support@what3words.com) so we can advise on the best product for your use case. We also offer free and discounted plans for qualifying NGOs, charities and emergency services. [Get in touch](mailto:support@what3words.com) to find out more.
### Rate limits
Each API function has a rate limit that restricts the frequency that requests can be sent to the API. If you exceed the rate limit, subsequent requests will be throttled and will receive a `HTTP 429 (Too Many Requests)` response from the API until your request rate drops below the limit.
The what3words Free plan has a restriction of 10 requests per second for the `autosuggest` function. We recommend selecting one of our business plans to increase the rate limit.
If you need a higher rate than specified for a plan then please discuss with the [what3words team](mailto:support@what3words.com) so we can advise on the best product for your use case.
Plan rate limits (requests per second) are as follows:
| Plan | AutoSuggest | Convert to coordinates | Convert to 3 word address | Grid | Available languages |
| --- | --- | --- | --- | --- | --- |
| Free | 10 | N/A | N/A | N/A | 200 |
| Basic | 200 | 200 | 200 | 200 | 200 |
| Standard | 200 | 200 | 200 | 200 | 200 |
| Plus | 200 | 200 | 200 | 200 | 200 |
| Premium | 200 | 200 | 200 | 200 | 200 |
### Terms of use
Use of the what3words API is covered by the [API licence agreement](https://what3words.com/api-licence-agreement).
---
# API v2
The what3words API allows you to convert a 3 word address to coordinates (forward geocoding), to convert coordinates to a 3 word address (reverse geocoding), to obtain suggestions based on a full or partial 3 word address (AutoSuggest, Voice AutoSuggest and StandardBlend), to obtain a geographically bounded section of the 3m x 3m what3words grid and to determine the languages that the API currently supports.
Section: [API & SDK Reference](https://developer.what3words.com/docs/api-sdk-reference.md) > [Cloud REST API](https://developer.what3words.com/public-api/docs.md)
Source: https://developer.what3words.com/public-api/docsv2
> [!WARNING]
> This page describes version 2 of the API which was officially deprecated in March 2019 and will no longer be available after the 1st February 2021. Please use the [latest version](https://developer.what3words.com/public-api/docs).
| Endpoint | Name | Description |
| --- | --- | --- |
| [`GET /v2/forward`](https://developer.what3words.com/public-api/docsv2#forward) | Forward geocoding | Forward geocodes a 3 word address to a position, expressed as coordinates of latitude and longitude. |
| [`GET /v2/reverse`](https://developer.what3words.com/public-api/docsv2#reverse) | Reverse geocoding | Reverse geocodes coordinates, expressed as latitude and longitude to a 3 word address. |
| [`GET /v2/autosuggest`](https://developer.what3words.com/public-api/docsv2#autosuggest) | AutoSuggest | Returns a list of 3 word addresses based on user input and other parameters. |
| [`GET /v2/voice-autosuggest`](https://developer.what3words.com/public-api/docsv2#voice-autosuggest) | Voice AutoSuggest | Returns a list of 3 word addresses based on an input string from a Cerence speech recognition system. |
| [`GET /v2/standardblend`](https://developer.what3words.com/public-api/docsv2#standardblend) | StandardBlend | Returns a blend of the three most relevant 3 word address candidates for a given location. |
| [`GET /v2/voice-standardblend`](https://developer.what3words.com/public-api/docsv2#voice-standardblend) | Voice StandardBlend | Returns a blend of the three most relevant candidates from Cerence VoCon Hybrid JSON. |
| [`GET /v2/grid`](https://developer.what3words.com/public-api/docsv2#grid-section) | Grid section | Returns a section of the 3m x 3m what3words grid for a given area. |
| [`GET /v2/languages`](https://developer.what3words.com/public-api/docsv2#available-languages) | Get languages | Retrieves a list of the currently loaded and available 3 word address languages. |
## Overview
### Get started
1. [Get your free API key.](https://accounts.what3words.com/select-plan)
2. Start using the what3words API by requesting a URL:
### 3 word address to coordinates
**URL**
```
https://api.what3words.com/v2/forward?addr=index.home.raft&key=YOUR_API_KEY
```
### Coordinates to 3 word address
**URL**
```
https://api.what3words.com/v2/reverse?coords=51.521251%2C-0.203586&key=YOUR_API_KEY
```
### Key points
- Use HTTPS GET method only
- Remember to always URL encode your parameters
- Always include a valid API key in the `key=api-key` parameter, or in the request header as `X-Api-Key: YOUR_API_KEY`
- We support [CORS](http://enable-cors.org/index.html), which allows Javascript requests to be made across domains. Each response contains the `Access-Control-Allow-Origin: *` header, that enables CORS.
### Error handling
Wherever possible, the what3words API tries to use the appropriate HTTP status code to indicate problems or errors when invoking an API resource; the status code and reason message are additionally returned in the `status` section of the response body as `status` and `reason` respectively.
Both the HTTP status and the API status should be checked; it is entirely possible to have an HTTP status of `200` returned because the API request was well formed but to have an API error code returned because the request generated an error or contained an invalid parameter.
For example, attempting to forward geocode an invalid 3 word address such as `no.address.here` would return an HTTP status of `200` and an API error code of `300`.
### Example error
```json
{
"status": {
"status": 200,
"reason": "OK",
"code": 300,
"message": "Invalid or non-existent 3 word address"
},
"thanks": "Thanks from all of us at index.home.raft for using a what3words API"
}
```
| Code | Description |
| --- | --- |
| `200` | The API resource call was well formed and successfully handled; additional information may also be available in the `status` section of the response body. |
| `400` | An attempt was made to access an SSL only API endpoint via vanilla HTTP. |
| `400` | A required parameter was missing or contained an invalid value. |
| `401` | An invalid what3words API key was supplied or the what3words API key was missing. |
| `404` | An invalid or unknown API resource was invoked. |
| `405` | An invalid HTTP request method was used to access an API resource. |
| `50x` | A problem has occurred with the what3words API. |
Additional what3words specific error details are also provided in the `status` section of the response body as follows.
Authentication Failures:
| Code | Description |
| --- | --- |
| `1` | Authentication failed; missing required `key` parameter or header. |
| `2` | Authentication failed; invalid `key` parameter value or header value. |
| `3` | Authentication failed, the specified key is inactive. |
Optional Parameter Validation Failures:
| Code | Description |
| --- | --- |
| `100` | The `display` parameter is invalid or missing a display type. |
| `101` | The `format` parameter is invalid or missing a format type. |
| `102` | The `addr` parameter is invalid or missing a 3 word address. |
| `103` | The `lang` parameter is invalid or missing a language code. |
| `104` | The `coords` parameter is invalid or missing coordinates. |
| `105` | The `focus` parameter is invalid or missing coordinates or a 3 word address. |
| `106` | The `clip` parameter is invalid or missing the clip type and parameters. |
| `107` | The `count` parameter is invalid. |
| `108` | The `bbox` parameter is invalid. |
Mandatory Parameter Validation Failures
| Code | Description |
| --- | --- |
| `200` | Missing required `addr` parameter. |
| `201` | Missing required `coords` parameter. |
| `202` | Missing required `lang` parameter. |
| `203` | Missing required `bbox` parameter. |
Geocoding Failures
| Code | Description |
| --- | --- |
| `300` | Invalid or non-existent 3 word address. |
| `301` | Invalid or non-existent coordinates. |
Grid Failures
| Code | Description |
| --- | --- |
| `400` | The area described by the bounding box is too large; the distance between the NE and SW corners should be less than or equal to 2 km. |
## Forward geocoding
Forward geocodes a 3 word address to a position, expressed as coordinates of latitude and longitude.
`GET https://api.what3words.com/v2/forward`
### Parameters
| Parameter | Required | Description | Example |
| --- | --- | --- | --- |
| `addr` | required | A 3 word address as a string | `addr=index.home.raft` |
| `key` | required | A valid API key; if not supplied as a parameter, a key must be supplied as a request header | `key=YOUR_API_KEY` |
| `lang` | optional | A supported 3 word address language as an [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) 2 letter code. Defaults to `en` (English). | `lang=fr` |
| `display` | optional | Return display type; can be one of `full` (the default), `terse` (less output) or `minimal` (the bare minimum) | `display=full` |
| `format` | optional | Return data format type; can be one of `json` (the default), `geojson` or `xml` | `format=geojson` |
| `callback` | optional | Specifies that the response should be JSONP wrapped as a function; supplying a `callback` parameter is only supported for JSON and GeoJSON format responses. | `callback=jsonp` |
### Example request
**cURL**
```shellscript
curl --request GET --url 'https://api.what3words.com/v2/forward?addr=index.home.raft&key=YOUR_API_KEY&lang=en&format=json&display=full'
```
**URL**
```
https://api.what3words.com/v2/forward?addr=index.home.raft&display=full&format=json&key=YOUR_API_KEY
```
### Example result
Status: `200 OK`
**JSON**
```json
{
"crs": {
"properties": {
"type": "ogcwkt",
"href": "http://spatialreference.org/ref/epsg/4326/ogcwkt/"
},
"type": "link"
},
"bounds": {
"southwest": {
"lng": -0.203607,
"lat": 51.521238
},
"northeast": {
"lng": -0.203564,
"lat": 51.521265
}
},
"words": "index.home.raft",
"map": "http://w3w.co/index.home.raft",
"language": "en",
"geometry": {
"lng": -0.203586,
"lat": 51.521251
},
"status": {
"code": 200,
"message": "OK"
},
"thanks": "Thanks from all of us at index.home.raft for using a what3words API"
}
```
**GeoJSON**
```json
{
"crs": {
"properties": {
"type": "ogcwkt",
"href": "http://spatialreference.org/ref/epsg/4326/ogcwkt/"
},
"type": "link"
},
"bbox": [
-0.203607,
51.521238,
-0.203564,
51.521265
],
"properties": {
"words": "index.home.raft",
"map": "http://w3w.co/index.home.raft",
"language": "en",
"status": {
"code": 200,
"message": "OK"
},
"thanks": "Thanks from all of us at index.home.raft for using a what3words API"
},
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-0.203586,
51.521251
]
}
}
```
**XML**
```xml
index.home.raft51.521251-0.20358651.521265-0.20356451.521238-0.203607enhttp://spatialreference.org/ref/epsg/4326/ogcwkt/200OKThanks from all of us at index.home.raft for using a what3words API
```
## Reverse geocoding
Reverse geocodes coordinates, expressed as latitude and longitude to a 3 word address.
`GET https://api.what3words.com/v2/reverse`
### Parameters
| Parameter | Required | Description | Example |
| --- | --- | --- | --- |
| `coords` | required | Coordinates as a comma separated string of latitude and longitude | `coords=51.432393,-0.348023` |
| `key` | required | A valid API key; if not supplied as a parameter, a key must be supplied as a request header | `key=YOUR_API_KEY` |
| `lang` | optional | A supported 3 word address language as an ISO 639-1 2 letter code. Defaults to `en` | `lang=fr` |
| `display` | optional | Return display type; can be one of `full` (the default), `terse` (less output) or `minimal` (the bare minimum) | `display=full` |
| `format` | optional | Return data format type; can be one of `json` (the default), `geojson`or `xml` | `format=geojson` |
| `callback` | optional | Specifies that the response should be JSONP wrapped as a function; supplying a `callback` parameter is only supported for JSON and GeoJSON format responses. See JSONP Responses for more information. | `callback=jsonp` |
### Example request
**cURL**
```shellscript
curl --request GET --url 'https://api.what3words.com/v2/reverse?coords=51.521251%2C-0.203586&key=YOUR_API_KEY&lang=en&format=json&display=full'
```
**URL**
```
https://api.what3words.com/v2/reverse?coords=51.521251,-0.203586&display=full&format=json&key=YOUR_API_KEY
```
### Example result
Status: `200 OK`
**JSON**
```json
{
"crs": {
"type": "link",
"properties": {
"href": "http://spatialreference.org/ref/epsg/4326/ogcwkt/",
"type": "ogcwkt"
}
},
"words": "index.home.raft",
"bounds": {
"southwest": {
"lng": -0.203607,
"lat": 51.521238
},
"northeast": {
"lng": -0.203564,
"lat": 51.521265
}
},
"geometry": {
"lng": -0.203586,
"lat": 51.521251
},
"language": "en",
"map": "http://w3w.co/index.home.raft",
"status": {
"code": 200,
"message": "OK"
},
"thanks": "Thanks from all of us at index.home.raft for using a what3words API"
}
```
**GeoJSON**
```json
{
"crs": {
"type": "link",
"properties": {
"href": "http://spatialreference.org/ref/epsg/4326/ogcwkt/",
"type": "ogcwkt"
}
},
"bbox": [
-0.203607,
51.521238,
-0.203564,
51.521265
],
"geometry": {
"coordinates": [
-0.203586,
51.521251
],
"type": "Point"
},
"type": "Feature",
"properties": {
"words": "index.home.raft",
"language": "en",
"map": "http://w3w.co/index.home.raft",
"status": {
"code": 200,
"message": "OK"
},
"thanks": "Thanks from all of us at index.home.raft for using a what3words API"
}
}
```
**XML**
```xml
index.home.raft51.521251-0.20358651.521265-0.20356451.521238-0.203607enhttp://spatialreference.org/ref/epsg/4326/ogcwkt/200OKThanks from all of us at index.home.raft for using a what3words API
```
## AutoSuggest
Returns a list of 3 word addresses based on user input and other parameters.
`GET https://api.what3words.com/v2/autosuggest`
This resource provides corrections for the following types of input error:
- typing errors
- spelling errors
- misremembered words (e.g. singular vs. plural)
- words in the wrong order
AutoSuggest determines possible corrections to the supplied 3 word address string based on the probability of the input errors listed above and returns a ranked list of suggestions. AutoSuggest can also take into consideration the geographic proximity of possible corrections to a given location to further improve the suggestions returned.
### Input 3 word address
All AutoSuggest variants accept either a full or partial 3 word address. If a partial 3 word address is specified, you will only receive results back if the partial 3 word address you submit contains the first two words and at least the first character of the third word; otherwise an error will be returned.
### Clipping and focus
We provide various `clip` policies to allow you to specify a geographic area that is used to exclude results that are not likely to be relevant to your users. We recommend that you use the `clip` parameter to give a more targeted, shorter set of results to your user. If you know your user’s current location, we also strongly recommend that you use the `focus` to return results which are likely to be more relevant (results near the user are considered to be more relevant).
In summary, the `clip` policy is used to optionally restrict the list of candidate AutoSuggest results, after which, if `focus` has been supplied, this will be used to weight the results in order of relevancy to the `focus`.
Multiple clipping policies can be specified, though only one of each type. For example you can clip to country and clip to circle in the same autosuggest call, and it will clip to the intersection of the two (results must be in the circle AND in the country). However, you can't specify two `clip-to-circle` policies in the same call.
### Language
AutoSuggest will search in all languages. However, you can additionally specify a fallback language, to help the API in situations where the input is particularly messy. The `lang` parameter is optional, and AutoSuggest will work well even without a `lang` parameter.
### Results
A maximum of 100 AutoSuggest results may be returned, but you may choose to display fewer results to your user e.g. the first 3 or 5 (depending on your user interface). By default, 3 results will be returned. It is possible we may increase the number of results returned in the future, so if you choose to limit the list of results returned, we recommend that you choose to include e.g. the top 3/5/7 results rather than choose to exclude the bottom e.g. 18/19/20 results.
### Parameters
| Parameter | Required | Description | Example |
| --- | --- | --- | --- |
| `addr` | required | The full or partial 3 word address to obtain suggestions for. At minimum this must be the first two complete words plus at least one character from the third word | `addr=plan.clips.a` |
| `key` | required | A valid API key; if not supplied as a parameter, a key must be supplied as a request header | `key=YOUR_API_KEY` |
| `lang` | optional | Specifies a fallback language, which will help guide AutoSuggest if the input is particularly messy. If specified, this parameter must be a supported 3 word address language as an ISO 639-1 2 letter code | `lang=fr` |
| `focus` | optional | A location, specified as a latitude,longitude used to refine the results. If specified, the results will be weighted to give preference to those near the specified location in addition to considering similarity to the `addr` string. If omitted the default behaviour is to weight results for similarity to the `addr` string only. | `focus=51.521251,-0.203586` |
| `clip` | optional | Restricts results to those within a geographical area. If omitted defaults to `clip=none`. See the section on clipping policies below for full details on the differing clip policies available. | `clip=radius(51.521251,-0.203586,10)` |
| `count` | optional | The number of AutoSuggest results to return. A maximum of 100 results can be specified, if a number greater than this is requested, this will be truncated to the maximum. The default is `3` | `count=5` |
| `display` | optional | Return display type; can be one of `full` (the default) or `terse` | `display=full` |
| `format` | optional | Return data format type; can be one of `json` (the default), `geojson` or `xml` | `format=json` |
| `callback` | optional | Specifies that the response should be JSONP wrapped as a function; supplying a `callback` parameter is only supported for JSON and GeoJSON format responses. See JSONP Responses for more information. | `callback=jsonp` |
### Clipping policies
| Policy | Default | Description | Example |
| --- | --- | --- | --- |
| `None` | default | No clipping takes place; this is the default. | `clip=none` |
| `Radius` | | `clip=radius(lat,lng,km)`. Clips to a radius of `km` kilometers from the point specified as `lat,lng`. | `clip=radius(51.521251,-0.203586,10)` |
| `Focus` | | `clip=focus(km)`. Clips to a radius of `km` kilometers from the point specified by the `focus` parameter. | `clip=focus(10)` |
| `Bounding Box` | | `clip=bbox(nelat,nelng,swlat,swlng)`. Clips to 3 word addresses that are fully contained inside a bounding box, specified by the northeast and southwest corner coordinates. | `clip=bbox(51.521215,-0.2036011,51.520982,-0.2041395)` |
### Example requests
#### AutoSuggest
This example returns AutoSuggest results for the partial 3 word address `plan.clips.a`; the results are not clipped and not ranked for proximity to a given location.
**URL**
```
https://api.what3words.com/v2/autosuggest?addr=plan.clips.a&lang=en&key=YOUR_API_KEY
```
#### AutoSuggest with focus and without clip policy
This example returns AutoSuggest results for the partial 3 word address `plan.clips.a`; the results are ranked for proximity relevance to the `focus` point of 51.4243877,-0.3474524.
**URL**
```
https://api.what3words.com/v2/autosuggest?addr=plan.clips.a&lang=en&focus=51.4243877,-0.3474524&key=YOUR_API_KEY
```
#### AutoSuggest with radius clip policy
This example returns AutoSuggest results for the partial 3 word address `plan.clips.a`; the results are constrained to those that are within 10 km of the point 51.4243877,-0.3474524.
**URL**
```
https://api.what3words.com/v2/autosuggest?addr=plan.clips.a&clip=radius(51.4243877,-0.3474524,10)&lang=en&key=YOUR_API_KEY
```
#### AutoSuggest with focus clip policy
This example returns AutoSuggest results for the partial 3 word address `plan.clips.a`; the results are constrained to those that are within 10 km of the `focus` point of 51.4243877,-0.3474524.
**URL**
```
https://api.what3words.com/v2/autosuggest?addr=plan.clips.a&focus=51.4243877,-0.3474524&clip=focus(10)&lang=en&key=YOUR_API_KEY
```
#### AutoSuggest with bounding box clip policy
This example returns AutoSuggest results for the partial 3 word address `plan.clips.a`; the results are constrained to those that are within the bounding box described by a NE corner of 54,2 and a SW corner of 50,-4; the results are then ranked for proximity relevance to the `focus` point of 51.4243877,-0.3474524.
**URL**
```
https://api.what3words.com/v2/autosuggest?addr=plan.clips.a&focus=51.4243877,-0.3474524&clip=bbox(54,2,50,-4)&lang=en&key=YOUR_API_KEY
```
### Example result
Status: `200 OK`
**JSON**
```json
{
"suggestions": [
{
"country": "gb",
"distance": 14,
"words": "plan.clips.area",
"rank": 1,
"geometry": {
"lng": -0.140382,
"lat": 51.429293
},
"place": "Brixton Hill, London"
},
{
"country": "gb",
"distance": 7,
"words": "plan.flips.dawn",
"rank": 2,
"geometry": {
"lng": -0.443947,
"lat": 51.425332
},
"place": "Sunbury-on-Thames, Surrey"
},
{
"country": "gb",
"distance": 27,
"words": "plan.clips.arts",
"rank": 3,
"geometry": {
"lng": -0.249153,
"lat": 51.659134
},
"place": "Borehamwood, Herts."
}
],
"status": {
"status": 200,
"reason": "OK"
},
"thanks": "Thanks from all of us at index.home.raft for using a what3words API"
}
```
**GeoJSON**
```json
{
{
"features": [
{
"geometry": {
"coordinates": [
-0.140382,
51.429293
],
"type": "Point"
},
"type": "Feature",
"properties": {
"country": "gb",
"distance": 14,
"words": "plan.clips.area",
"rank": 1,
"place": "Brixton Hill, London"
}
},
{
"geometry": {
"coordinates": [
-0.443947,
51.425332
],
"type": "Point"
},
"type": "Feature",
"properties": {
"country": "gb",
"distance": 7,
"words": "plan.flips.dawn",
"rank": 2,
"place": "Sunbury-on-Thames, Surrey"
}
},
{
"geometry": {
"coordinates": [
-0.249153,
51.659134
],
"type": "Point"
},
"type": "Feature",
"properties": {
"country": "gb",
"distance": 27,
"words": "plan.clips.arts",
"rank": 3,
"place": "Borehamwood, Herts."
}
}
],
"type": "FeatureCollection",
"properties": {
"status": {
"status": 200,
"reason": "OK"
},
"thanks": "Thanks from all of us at index.home.raft for using a what3words API"
}
}
```
**XML**
```xml
1plan.clips.areagbBrixton Hill, London51.429293-0.140382142plan.flips.dawngbSunbury-on-Thames, Surrey51.425332-0.44394773plan.clips.artsgbBorehamwood, Herts.51.659134-0.24915327200OKThanks from all of us at index.home.raft for using a what3words API
```
## Voice AutoSuggest
Returns a list of 3 word addresses based on an input string from one of two Cerence speech recognition systems: VoCon Hybrid and NDEV. The default of these is the Cerence Vocon Hybrid, which accepts URL-encoded JSON. The Cerence NDEV plain text output can also be passed to this endpoint, although the results generally have lower accuracy when dealing with a 3 word address input. Please note that this resource does not provide speech recognition capabilities and that a separate licensing agreement is required with Cerence to use the VoCon Hybrid and/or NDEV technologies.
`GET https://api.what3words.com/v2/voice-autosuggest`
This resource provides corrections for the following types of input error:
- words which sound similar
- misremembered words (e.g. singular vs. plural)
- words in the wrong order
The `voice-autosuggest` resource determines possible corrections to the supplied 3 word addresses based on the probability of the input errors listed above and returns a ranked list of suggestions. This resource can also take into consideration the geographic proximity of possible corrections to a given location to further improve the suggestions returned.
### Clipping and focus
We provide various `clip` policies to allow you to specify a geographic area that is used to exclude results that are not likely to be relevant to your users. We recommend that you use the `clip` parameter to give a more targeted, shorter set of results to your user. If you know your user’s current location, we also strongly recommend that you use the `focus` to return results which are likely to be more relevant (results near the user are considered to be more relevant).
In summary, the `clip` policy is used to optionally restrict the list of candidate Voice AutoSuggest results, after which, if `focus` has been supplied, this will be used to weight the results in order of relevancy to the `focus`.
### Language
The `lang` parameter is mandatory for `voice-autosuggest`; we recommend that you set this according to the language of your user interface, or the browser/device language of your user. If your software or app displays 3 word addresses to users (in addition to accepting 3 words as a search/input) then we recommend you set the language parameter for this resource to the same language that 3 word addresses are displayed to your users. Currently, English is the only supported language for voice but more languages will be available soon.
### JSON or text input
The `json` parameter is mandatory when using the Cerence VoCon Hybrid speech recognition system, which is the default. To use the Cerence NDEV text input, you should specify `voice-type=ndev`, at which point the `text` parameter is mandatory. Both strings will typically contain non-URL complaint characters, and should be URL-encoded.
### Results
A maximum of 20 Voice AutoSuggest results may be returned, but you may choose to display fewer results to your user e.g. the first 3 or 5 (depending on your user interface). By default, 3 results will be returned. It is possible we may increase the number of results returned in the future, so if you choose to limit the list of results returned, we recommend that you choose to include e.g. the top 3/5/7 results rather than choose to exclude the bottom e.g. 18/19/20 results.
### Parameters
| Parameter | Required | Description | Example |
| --- | --- | --- | --- |
| `json` | required (see `voice-type`) | Cerence VoCon Hybrid JSON, which must be URL encoded. | `json=[URL encoded JSON string]` |
| `text` | required (see `voice-type`) | Cerence NDEV output, which must be URL encoded. | `text=[URL encoded text with spaces and newlines]` |
| `key` | required | A valid API key; if not supplied as a parameter, a key must be supplied as a request header | `key=YOUR_API_KEY` |
| `lang` | required | A supported 3 word address language as an ISO 639-1 2 letter code | `lang=fr` |
| `focus` | optional | A location, specified as a latitude,longitude used to refine the results. If specified, the results will be weighted to give preference to those near the specified location in addition to considering similarity to the voice input. If omitted the default behaviour is to weight results for similarity to the voice input only. | `focus=51.521251,-0.203586` |
| `clip` | optional | Restricts results to those within a geographical area. If omitted defaults to `clip=none`. See the section on clipping policies below for full details on the differing clip policies available. | `clip=radius(51.521251,-0.203586,10)` |
| `count` | optional | The number of Voice AutoSuggest results to return. A maximum of 20 results can be specified, if a number greater than 20 is requested, this will be truncated to the maximum. The default is `3` | `count=5` |
| `voice-type` | optional | Which Cerence speech recognition system is being used, and therefore which parameter of `json=` and `text=` is required. Can be one of `vocon` (the default) or `ndev` | `voice-type=vocon` |
| `display` | optional | Return display type; can be one of `full` (the default) or `terse` | `display=full` |
| `format` | optional | Return data format type; can be one of `json` (the default), `geojson` or `xml` | `format=json` |
| `callback` | optional | Specifies that the response should be JSONP wrapped as a function; supplying a `callback` parameter is only supported for JSON and GeoJSON format responses. See JSONP Responses for more information. | `callback=jsonp` |
### Clipping policies
| Policy | Default | Description | Example |
| --- | --- | --- | --- |
| `None` | default | No clipping takes place; this is the default. | `clip=none` |
| `Radius` | | `clip=radius(lat,lng,km)`. Clips to a radius of `km` kilometers from the point specified as `lat,lng`. | `clip=radius(51.521251,-0.203586,10)` |
| `Focus` | | `clip=focus(km)`. Clips to a radius of `km` kilometers from the point specified by the `focus` parameter. | `clip=focus(10)` |
| `Bounding Box` | | `clip=bbox(nelat,nelng,swlat,swlng)`. Clips to 3 word addresses that are fully contained inside a bounding box, specified by the northeast and southwest corner coordinates. | `clip=bbox(51.521215,-0.2036011,51.520982,-0.2041395)` |
### Example requests
#### Voice AutoSuggest with focus and without clip policy
This example returns Voice AutoSuggest results for the supplied Cerence VoCon Hybrid JSON; the results are ranked for proximity relevance to the `focus` point of 51.4243877,-0.3474524.
**URL**
```
https://api.what3words.dev/v2/voice-autosuggest?json=%7B%22_isInGrammar%22%3A%22yes%22%2C%22_isSpeech%22%3A%22yes%22%2C%22_hypotheses%22%3A%5B%7B%22_score%22%3A342516%2C%22_startRule%22%3A%22whatthreewordsgrammar%23_main_%22%2C%22_conf%22%3A6546%2C%22_endTimeMs%22%3A6360%2C%22_beginTimeMs%22%3A1570%2C%22_lmScore%22%3A300%2C%22_items%22%3A%5B%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A34225%2C%22_orthography%22%3A%22tend%22%2C%22_conf%22%3A6964%2C%22_endTimeMs%22%3A2250%2C%22_beginTimeMs%22%3A1580%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A47670%2C%22_orthography%22%3A%22artichokes%22%2C%22_conf%22%3A7176%2C%22_endTimeMs%22%3A3180%2C%22_beginTimeMs%22%3A2260%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A43800%2C%22_orthography%22%3A%22poached%22%2C%22_conf%22%3A6181%2C%22_endTimeMs%22%3A4060%2C%22_beginTimeMs%22%3A3220%7D%5D%7D%2C%7B%22_score%22%3A342631%2C%22_startRule%22%3A%22whatthreewordsgrammar%23_main_%22%2C%22_conf%22%3A6498%2C%22_endTimeMs%22%3A6360%2C%22_beginTimeMs%22%3A1570%2C%22_lmScore%22%3A300%2C%22_items%22%3A%5B%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A34340%2C%22_orthography%22%3A%22tent%22%2C%22_conf%22%3A6772%2C%22_endTimeMs%22%3A2250%2C%22_beginTimeMs%22%3A1580%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A47670%2C%22_orthography%22%3A%22artichokes%22%2C%22_conf%22%3A7176%2C%22_endTimeMs%22%3A3180%2C%22_beginTimeMs%22%3A2260%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A43800%2C%22_orthography%22%3A%22poached%22%2C%22_conf%22%3A6181%2C%22_endTimeMs%22%3A4060%2C%22_beginTimeMs%22%3A3220%7D%5D%7D%2C%7B%22_score%22%3A342668%2C%22_startRule%22%3A%22whatthreewordsgrammar%23_main_%22%2C%22_conf%22%3A6474%2C%22_endTimeMs%22%3A6360%2C%22_beginTimeMs%22%3A1570%2C%22_lmScore%22%3A300%2C%22_items%22%3A%5B%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A34225%2C%22_orthography%22%3A%22tend%22%2C%22_conf%22%3A6964%2C%22_endTimeMs%22%3A2250%2C%22_beginTimeMs%22%3A1580%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A47670%2C%22_orthography%22%3A%22artichokes%22%2C%22_conf%22%3A7176%2C%22_endTimeMs%22%3A3180%2C%22_beginTimeMs%22%3A2260%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A41696%2C%22_orthography%22%3A%22perch%22%2C%22_conf%22%3A5950%2C%22_endTimeMs%22%3A4020%2C%22_beginTimeMs%22%3A3220%7D%5D%7D%2C%7B%22_score%22%3A342670%2C%22_startRule%22%3A%22whatthreewordsgrammar%23_main_%22%2C%22_conf%22%3A6474%2C%22_endTimeMs%22%3A6360%2C%22_beginTimeMs%22%3A1570%2C%22_lmScore%22%3A300%2C%22_items%22%3A%5B%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A34379%2C%22_orthography%22%3A%22tinge%22%2C%22_conf%22%3A6705%2C%22_endTimeMs%22%3A2250%2C%22_beginTimeMs%22%3A1580%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A47670%2C%22_orthography%22%3A%22artichokes%22%2C%22_conf%22%3A7176%2C%22_endTimeMs%22%3A3180%2C%22_beginTimeMs%22%3A2260%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A43800%2C%22_orthography%22%3A%22poached%22%2C%22_conf%22%3A6181%2C%22_endTimeMs%22%3A4060%2C%22_beginTimeMs%22%3A3220%7D%5D%7D%2C%7B%22_score%22%3A342783%2C%22_startRule%22%3A%22whatthreewordsgrammar%23_main_%22%2C%22_conf%22%3A6426%2C%22_endTimeMs%22%3A6360%2C%22_beginTimeMs%22%3A1570%2C%22_lmScore%22%3A300%2C%22_items%22%3A%5B%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A34340%2C%22_orthography%22%3A%22tent%22%2C%22_conf%22%3A6772%2C%22_endTimeMs%22%3A2250%2C%22_beginTimeMs%22%3A1580%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A47670%2C%22_orthography%22%3A%22artichokes%22%2C%22_conf%22%3A7176%2C%22_endTimeMs%22%3A3180%2C%22_beginTimeMs%22%3A2260%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A41696%2C%22_orthography%22%3A%22perch%22%2C%22_conf%22%3A5950%2C%22_endTimeMs%22%3A4020%2C%22_beginTimeMs%22%3A3220%7D%5D%7D%2C%7B%22_score%22%3A342822%2C%22_startRule%22%3A%22whatthreewordsgrammar%23_main_%22%2C%22_conf%22%3A6402%2C%22_endTimeMs%22%3A6360%2C%22_beginTimeMs%22%3A1570%2C%22_lmScore%22%3A300%2C%22_items%22%3A%5B%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A34379%2C%22_orthography%22%3A%22tinge%22%2C%22_conf%22%3A6705%2C%22_endTimeMs%22%3A2250%2C%22_beginTimeMs%22%3A1580%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A47670%2C%22_orthography%22%3A%22artichokes%22%2C%22_conf%22%3A7176%2C%22_endTimeMs%22%3A3180%2C%22_beginTimeMs%22%3A2260%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A41696%2C%22_orthography%22%3A%22perch%22%2C%22_conf%22%3A5950%2C%22_endTimeMs%22%3A4020%2C%22_beginTimeMs%22%3A3220%7D%5D%7D%5D%2C%22_resultType%22%3A%22NBest%22%7D&lang=en&focus=51.4243877,-0.3474524&format=json&key=YOUR_API_KEY
```
### Example result
Status: `200 OK`
**JSON**
```json
{
"suggestions": [
{
"country": "ie",
"distance": 598,
"words": "tinges.artichokes.perch",
"rank": 1,
"geometry": {
"lng": -8.621144,
"lat": 53.283595
},
"place": "Athenry, Connaught"
},
{
"country": "ch",
"distance": 924,
"words": "tent.artichoke.perch",
"rank": 2,
"geometry": {
"lng": 9.739427,
"lat": 46.400132
},
"place": "Silvaplana, Grisons"
},
{
"country": "se",
"distance": 1183,
"words": "tending.artichokes.perch",
"rank": 3,
"geometry": {
"lng": 15.379507,
"lat": 56.805695
},
"place": "Lessebo, Kronoberg"
}
],
"status": {
"status": 200,
"reason": "OK"
},
"thanks": "Thanks from all of us at index.home.raft for using a what3words API"
}
```
**GeoJSON**
```json
{
"features": [
{
"geometry": {
"coordinates": [
-8.621144,
53.283595
],
"type": "Point"
},
"type": "Feature",
"properties": {
"country": "ie",
"distance": 598,
"words": "tinges.artichokes.perch",
"rank": 1,
"place": "Athenry, Connaught"
}
},
{
"geometry": {
"coordinates": [
9.739427,
46.400132
],
"type": "Point"
},
"type": "Feature",
"properties": {
"country": "ch",
"distance": 924,
"words": "tent.artichoke.perch",
"rank": 2,
"place": "Silvaplana, Grisons"
}
},
{
"geometry": {
"coordinates": [
15.379507,
56.805695
],
"type": "Point"
},
"type": "Feature",
"properties": {
"country": "se",
"distance": 1183,
"words": "tending.artichokes.perch",
"rank": 3,
"place": "Lessebo, Kronoberg"
}
}
],
"type": "FeatureCollection",
"properties": {
"status": {
"status": 200,
"reason": "OK"
},
"thanks": "Thanks from all of us at index.home.raft for using a what3words API"
}
}
```
**XML**
```xml
1tinges.artichokes.perchieAthenry, Connaught53.283595-8.6211445982tent.artichoke.perchchSilvaplana, Grisons46.4001329.7394279243tending.artichokes.perchseLessebo, Kronoberg56.80569515.3795071183200OKThanks from all of us at index.home.raft for using a what3words API
```
## StandardBlend
Returns a blend of the three most relevant 3 word address candidates for a given location, based on a full or partial 3 word address.
`GET https://api.what3words.com/v2/standardblend`
The specified 3 word address may either be a full 3 word address or a partial 3 word address containing the first 2 words in full and at least 1 character of the 3rd word. StandardBlend provides the search logic that powers the search box on map.what3words.com and in the what3words mobile apps.
### Language
StandardBlend will search in all languages. However, you can additionally specify a fallback language, to help the API in situations where the input is particularly messy. The `lang` parameter is optional, and StandardBlend will work well even without a `lang` parameter.
### Results
A maximum of 100 AutoSuggest results may be returned, but you may choose to display fewer results to your user e.g. the first 3 or 5 (depending on your user interface). By default, 3 results will be returned. It is possible we may increase the number of results returned in the future, so if you choose to limit the list of results returned, we recommend that you choose to include e.g. the top 3/5/7 results rather than choose to exclude the bottom e.g. 18/19/20 results.
### Parameters
| Parameter | Required | Description | Example |
| --- | --- | --- | --- |
| `addr` | required | The full or partial 3 word address to obtain blended candidates for. At minimum this must be the first two complete words plus at least one character from the third word | `addr=plan.clips.a` |
| `key` | required | A valid API key; if not supplied as a parameter, a key must be supplied as a request header | `key=YOUR_API_KEY` |
| `lang` | optional | Specifies a fallback language, which will help guide StandardBlend if the input is particularly messy. If specified, this parameter must be a supported 3 word address language as an ISO 639-1 2 letter code | `lang=fr` |
| `focus` | optional | A location, specified as a latitude,longitude used to refine the results. If specified, the results will be weighted to give preference to those near the specified location. | `focus=51.521251,-0.203586` |
| `format` | optional | Return data format type; can be one of `json` (the default), `geojson` or `xml` | `format=json` |
| `callback` | optional | Specifies that the response should be JSONP wrapped as a function; supplying a `callback` parameter is only supported for JSON and GeoJSON format responses. See JSONP Responses for more information. | `callback=jsonp` |
### Visualising StandardBlend
The what3words map site uses the `standardblend` method to display candidate 3 word addresses. If the contents of the search box matches a partial 3 word address, detected by a regular expression, then `standardblend` will be invoked and any resulting candidate 3 word addresses displayed. The map site also displays a relevant flag, keyed on the ISO 3166-1 alpha-2 country code that is returned by the API. For the map site, we are using a flag set licensed from IconDrawer with the addition of two additional flags for tn and xk.
### Example requests
#### StandardBlend
This example returns StandardBlend results for the partial 3 word address `plan.clips.a`; the results are ranked for proximity relevance to the `focus` point 51.4243877,-0.3474524.
**URL**
```
https://api.what3words.com/v2/standardblend?addr=plan.clips.above&lang=en&focus=51.4243877,-0.3474524&format=json&key=YOUR_API_KEY
```
### Example result
Status: `200 OK`
**JSON**
```json
{
"blends": [
{
"distance": 1,
"rank": 1,
"words": "plan.clips.above",
"language": "en",
"place": "Teddington, London",
"geometry": {
"lng": -0.348023,
"lat": 51.432393
},
"country": "gb"
},
{
"distance": 6405,
"rank": 2,
"words": "plans.clips.above",
"language": "en",
"place": "Warren Park, Indiana",
"geometry": {
"lng": -86.101238,
"lat": 39.785077
},
"country": "us"
},
{
"distance": 8822,
"rank": 3,
"words": "plan.clip.above",
"language": "en",
"place": "Coronado, California",
"geometry": {
"lng": -117.272099,
"lat": 32.716944
},
"country": "us"
}
],
"status": {
"status": 200,
"reason": "OK"
},
"thanks": "Thanks from all of us at index.home.raft for using a what3words API"
}
```
**GeoJSON**
```json
{
"features": [
{
"properties": {
"distance": 1,
"rank": 1,
"words": "plan.clips.above",
"language": "en",
"place": "Teddington, London",
"country": "gb"
},
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-0.348023,
51.432393
]
}
},
{
"properties": {
"distance": 6405,
"rank": 2,
"words": "plans.clips.above",
"language": "en",
"place": "Warren Park, Indiana",
"country": "us"
},
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-86.101238,
39.785077
]
}
},
{
"properties": {
"distance": 8822,
"rank": 3,
"words": "plan.clip.above",
"language": "en",
"place": "Coronado, California",
"country": "us"
},
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-117.272099,
32.716944
]
}
}
],
"type": "FeatureCollection",
"properties": {
"status": {
"status": 200,
"reason": "OK"
},
"thanks": "Thanks from all of us at index.home.raft for using a what3words API"
}
}
```
**XML**
```xml
1plan.clips.aboveenTeddington, London151.432393-0.3480232plans.clips.aboveenWarren Park, Indiana640539.785077-86.1012383plan.clip.aboveenCoronado, California882232.716944-117.272099200OKThanks from all of us at index.home.raft for using a what3words API
```
## Voice StandardBlend
Returns a blend of the three most relevant 3 word address candidates for a given location, based on an input string of URL encoded Cerence Vocon Hybrid JSON. Please note that this resource does not provide speech recognition capabilities and that a separate licensing agreement is required with Cerence to use the VoCon Hybrid SDK.
`GET https://api.what3words.com/v2/voice-standardblend`
### Parameters
| Parameter | Required | Description | Example |
| --- | --- | --- | --- |
| `json` | required | Cerence VoCon Hybrid JSON, which must be URL encoded. | `json=[URL encoded JSON string]` |
| `key` | required | A valid API key; if not supplied as a parameter, a key must be supplied as a request header | `key=YOUR_API_KEY` |
| `lang` | required | A supported 3 word address language as an ISO 639-1 2 letter code | `lang=fr` |
| `focus` | optional | A location, specified as a latitude,longitude used to refine the results. If specified, the results will be weighted to give preference to those near the specified location in addition to considering similarity to the voice input. If omitted the default behaviour is to weight results for similarity to the voice input only. | `focus=51.521251,-0.203586` |
| `format` | optional | Return data format type; can be one of `json` (the default), `geojson` or `xml` | `format=json` |
| `callback` | optional | Specifies that the response should be JSONP wrapped as a function; supplying a `callback` parameter is only supported for JSON and GeoJSON format responses. See JSONP Responses for more information. | `callback=jsonp` |
### Example requests
#### Single language StandardBlend
This example returns StandardBlend results for the supplied Cerence VoCon Hybrid JSON; the results are ranked for proximity relevance to the `focus` point 51.4243877,-0.3474524 not clipped.
**URL**
```
https://api.what3words.com/v2/voice-standardblend?json=%7B%22_isInGrammar%22%3A%22yes%22%2C%22_isSpeech%22%3A%22yes%22%2C%22_hypotheses%22%3A%5B%7B%22_score%22%3A342516%2C%22_startRule%22%3A%22whatthreewordsgrammar%23_main_%22%2C%22_conf%22%3A6546%2C%22_endTimeMs%22%3A6360%2C%22_beginTimeMs%22%3A1570%2C%22_lmScore%22%3A300%2C%22_items%22%3A%5B%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A34225%2C%22_orthography%22%3A%22tend%22%2C%22_conf%22%3A6964%2C%22_endTimeMs%22%3A2250%2C%22_beginTimeMs%22%3A1580%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A47670%2C%22_orthography%22%3A%22artichokes%22%2C%22_conf%22%3A7176%2C%22_endTimeMs%22%3A3180%2C%22_beginTimeMs%22%3A2260%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A43800%2C%22_orthography%22%3A%22poached%22%2C%22_conf%22%3A6181%2C%22_endTimeMs%22%3A4060%2C%22_beginTimeMs%22%3A3220%7D%5D%7D%2C%7B%22_score%22%3A342631%2C%22_startRule%22%3A%22whatthreewordsgrammar%23_main_%22%2C%22_conf%22%3A6498%2C%22_endTimeMs%22%3A6360%2C%22_beginTimeMs%22%3A1570%2C%22_lmScore%22%3A300%2C%22_items%22%3A%5B%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A34340%2C%22_orthography%22%3A%22tent%22%2C%22_conf%22%3A6772%2C%22_endTimeMs%22%3A2250%2C%22_beginTimeMs%22%3A1580%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A47670%2C%22_orthography%22%3A%22artichokes%22%2C%22_conf%22%3A7176%2C%22_endTimeMs%22%3A3180%2C%22_beginTimeMs%22%3A2260%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A43800%2C%22_orthography%22%3A%22poached%22%2C%22_conf%22%3A6181%2C%22_endTimeMs%22%3A4060%2C%22_beginTimeMs%22%3A3220%7D%5D%7D%2C%7B%22_score%22%3A342668%2C%22_startRule%22%3A%22whatthreewordsgrammar%23_main_%22%2C%22_conf%22%3A6474%2C%22_endTimeMs%22%3A6360%2C%22_beginTimeMs%22%3A1570%2C%22_lmScore%22%3A300%2C%22_items%22%3A%5B%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A34225%2C%22_orthography%22%3A%22tend%22%2C%22_conf%22%3A6964%2C%22_endTimeMs%22%3A2250%2C%22_beginTimeMs%22%3A1580%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A47670%2C%22_orthography%22%3A%22artichokes%22%2C%22_conf%22%3A7176%2C%22_endTimeMs%22%3A3180%2C%22_beginTimeMs%22%3A2260%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A41696%2C%22_orthography%22%3A%22perch%22%2C%22_conf%22%3A5950%2C%22_endTimeMs%22%3A4020%2C%22_beginTimeMs%22%3A3220%7D%5D%7D%2C%7B%22_score%22%3A342670%2C%22_startRule%22%3A%22whatthreewordsgrammar%23_main_%22%2C%22_conf%22%3A6474%2C%22_endTimeMs%22%3A6360%2C%22_beginTimeMs%22%3A1570%2C%22_lmScore%22%3A300%2C%22_items%22%3A%5B%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A34379%2C%22_orthography%22%3A%22tinge%22%2C%22_conf%22%3A6705%2C%22_endTimeMs%22%3A2250%2C%22_beginTimeMs%22%3A1580%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A47670%2C%22_orthography%22%3A%22artichokes%22%2C%22_conf%22%3A7176%2C%22_endTimeMs%22%3A3180%2C%22_beginTimeMs%22%3A2260%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A43800%2C%22_orthography%22%3A%22poached%22%2C%22_conf%22%3A6181%2C%22_endTimeMs%22%3A4060%2C%22_beginTimeMs%22%3A3220%7D%5D%7D%2C%7B%22_score%22%3A342783%2C%22_startRule%22%3A%22whatthreewordsgrammar%23_main_%22%2C%22_conf%22%3A6426%2C%22_endTimeMs%22%3A6360%2C%22_beginTimeMs%22%3A1570%2C%22_lmScore%22%3A300%2C%22_items%22%3A%5B%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A34340%2C%22_orthography%22%3A%22tent%22%2C%22_conf%22%3A6772%2C%22_endTimeMs%22%3A2250%2C%22_beginTimeMs%22%3A1580%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A47670%2C%22_orthography%22%3A%22artichokes%22%2C%22_conf%22%3A7176%2C%22_endTimeMs%22%3A3180%2C%22_beginTimeMs%22%3A2260%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A41696%2C%22_orthography%22%3A%22perch%22%2C%22_conf%22%3A5950%2C%22_endTimeMs%22%3A4020%2C%22_beginTimeMs%22%3A3220%7D%5D%7D%2C%7B%22_score%22%3A342822%2C%22_startRule%22%3A%22whatthreewordsgrammar%23_main_%22%2C%22_conf%22%3A6402%2C%22_endTimeMs%22%3A6360%2C%22_beginTimeMs%22%3A1570%2C%22_lmScore%22%3A300%2C%22_items%22%3A%5B%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A34379%2C%22_orthography%22%3A%22tinge%22%2C%22_conf%22%3A6705%2C%22_endTimeMs%22%3A2250%2C%22_beginTimeMs%22%3A1580%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A47670%2C%22_orthography%22%3A%22artichokes%22%2C%22_conf%22%3A7176%2C%22_endTimeMs%22%3A3180%2C%22_beginTimeMs%22%3A2260%7D%2C%7B%22_type%22%3A%22terminal%22%2C%22_score%22%3A41696%2C%22_orthography%22%3A%22perch%22%2C%22_conf%22%3A5950%2C%22_endTimeMs%22%3A4020%2C%22_beginTimeMs%22%3A3220%7D%5D%7D%5D%2C%22_resultType%22%3A%22NBest%22%7D&lang=en&focus=51.4243877,-0.3474524&format=json&key=YOUR_API_KEY
```
### Example result
Status: `200 OK`
**JSON**
```json
{
"blends": [{
"country": "ie",
"distance": 598,
"words": "tinges.artichokes.perch",
"rank": 1,
"language": "en",
"geometry": {
"lng": -8.621144,
"lat": 53.283595
},
"place": "Athenry, Connaught"
},
{
"country": "ca",
"distance": 5378,
"words": "tend.artichokes.perch",
"rank": 2,
"language": "en",
"geometry": {
"lng": -78.736977,
"lat": 47.928107
},
"place": "Rouyn-Noranda, Quebec"
},
{
"country": "ca",
"distance": 6142,
"words": "tent.artichokes.perch",
"rank": 3,
"language": "en",
"geometry": {
"lng": -124.344359,
"lat": 65.803269
},
"place": "Norman Wells, Northwest Territories"
}
],
"status": {
"status": 200,
"reason": "OK"
},
"thanks": "Thanks from all of us at index.home.raft for using a what3words API"
}
```
**GeoJSON**
```json
{
"features": [{
"geometry": {
"coordinates": [-8.621144,
53.283595
],
"type": "Point"
},
"type": "Feature",
"properties": {
"country": "ie",
"distance": 598,
"words": "tinges.artichokes.perch",
"rank": 1,
"language": "en",
"place": "Athenry, Connaught"
}
},
{
"geometry": {
"coordinates": [-78.736977,
47.928107
],
"type": "Point"
},
"type": "Feature",
"properties": {
"country": "ca",
"distance": 5378,
"words": "tend.artichokes.perch",
"rank": 2,
"language": "en",
"place": "Rouyn-Noranda, Quebec"
}
},
{
"geometry": {
"coordinates": [-124.344359,
65.803269
],
"type": "Point"
},
"type": "Feature",
"properties": {
"country": "ca",
"distance": 6142,
"words": "tent.artichokes.perch",
"rank": 3,
"language": "en",
"place": "Norman Wells, Northwest Territories"
}
}
],
"type": "FeatureCollection",
"properties": {
"status": {
"status": 200,
"reason": "OK"
},
"thanks": "Thanks from all of us at index.home.raft for using a what3words API"
}
}
```
**XML**
```xml
1tinges.artichokes.perchieenAthenry, Connaught59853.283595-8.6211442tend.artichokes.perchcaenRouyn-Noranda, Quebec537847.928107-78.7369773tent.artichokes.perchcaenNorman Wells, Northwest Territories614265.803269-124.344359200OKThanks from all of us at index.home.raft for using a what3words API
```
## Grid section
Returns a section of the 3m x 3m what3words grid for a given area.
`GET https://api.what3words.com/v2/grid`
### Parameters
| Parameter | Required | Description | Example |
| --- | --- | --- | --- |
| `key` | required | A valid API key; if not supplied as a parameter, a key must be supplied as a request header | `key=YOUR_API_KEY` |
| `bbox` | required | Bounding box, specified by the northeast and southwest corner coordinates, for which the grid should be returned. | `bbox=52.207988,0.116126,52.208867,0.117540` |
| `format` | optional | Return data format type; can be either `json` (the default) or `geojson` | `format=geojson` |
| `callback` | optional | Specifies that the response should be JSONP wrapped as a function; supplying a `callback` parameter is only supported for JSON and GeoJSON format responses. See JSONP Responses for more information. | `callback=jsonp` |
### Example request
**cURL**
```shellscript
curl --request GET \
--url 'https://api.what3words.com/v2/grid?bbox=52.208867%2C0.117540%2C52.207988%2C0.116126&key=YOUR_API_KEY&format=json'
```
**URL**
```
https://api.what3words.com/v2/grid?bbox=52.208867,0.117540,52.207988,0.116126&format=json&key=YOUR_API_KEY
```
### Example result
Status: `200 OK`
**JSON**
```json
{
"lines": [
{
"start": {
"lng": 0.11612600000001,
"lat": 52.208009918068
},
"end": {
"lng": 0.11753999999999,
"lat": 52.208009918068
}
},
{
"start": {
"lng": 0.11612600000001,
"lat": 52.20803686934
},
"end": {
"lng": 0.11753999999999,
"lat": 52.20803686934
}
}
],
"status": {
"status": 200,
"reason": "OK"
},
"thanks": "Thanks from all of us at index.home.raft for using a what3words API"
}
```
**GeoJSON**
```json
{
"type": "MultiLineString",
"coordinates": [
[
[
0.11612600000001,
52.208009918068
],
[
0.11753999999999,
52.208009918068
]
],
[
[
0.11612600000001,
52.20803686934
],
[
0.11753999999999,
52.20803686934
]
]
],
"properties": {
"status": {
"status": 200,
"reason": "OK"
},
"thanks": "Thanks from all of us at index.home.raft for using a what3words API"
}
}
```
**XML**
```xml
52.2080099180681360.1161260000000083952.2080099180681360.117539999999991152.208036869340230.1161260000000083952.208036869340230.1175399999999911200OKThanks from all of us at index.home.raft for using a what3words API
```
## Get languages
Retrieves a list of the currently loaded and available 3 word address languages.
`GET https://api.what3words.com/v2/languages`
### Parameters
| Parameter | Required | Description | Example |
| --- | --- | --- | --- |
| `key` | required | A valid API key; if not supplied as a parameter, a key must be supplied as a request header | `key=YOUR_API_KEY` |
| `callback` | optional | Specifies that the response should be JSONP wrapped as a function; supplying a `callback` parameter is only supported for JSON and GeoJSON format responses. See JSONP Responses for more information. | `callback=jsonp` |
### Example request
**cURL**
```shellscript
curl --request GET \
--url 'https://api.what3words.com/v2/languages?key=YOUR_API_KEY'
```
**URL**
```
https://api.what3words.com/v2/languages?format=json&key=YOUR_API_KEY
```
### Example result
Status: `200 OK`
**JSON**
```json
{
"languages": [
{
"code": "de",
"name": "German",
"native_name": "Deutsch"
},
{
"code": "mn",
"name": "Mongolian",
"native_name": "Mонгол"
},
{
"code": "fi",
"name": "Finnish",
"native_name": "Suomi"
},
{
"code": "ru",
"name": "Russian",
"native_name": "Русский"
},
{
"code": "sv",
"name": "Swedish",
"native_name": "Svenska"
},
{
"code": "pt",
"name": "Portuguese",
"native_name": "Português"
},
{
"code": "sw",
"name": "Swahili",
"native_name": "Kiswahili"
},
{
"code": "en",
"name": "English",
"native_name": "English"
},
{
"code": "it",
"name": "Italian",
"native_name": "Italiano"
},
{
"code": "fr",
"name": "French",
"native_name": "Français"
},
{
"code": "es",
"name": "Spanish",
"native_name": "Español"
},
{
"code": "ar",
"name": "Arabic",
"native_name": "العربية"
},
{
"code": "pl",
"name": "Polish",
"native_name": "Polski"
},
{
"code": "tr",
"name": "Turkish",
"native_name": "Türkçe"
}
],
"status": {
"status": 200,
"reason": "OK"
},
"thanks": "Thanks from all of us at index.home.raft for using a what3words API"
}
```
**XML**
```xml
deGermanDeutschmnMongolianMонголfiFinnishSuomiruRussianРусскийsvSwedishSvenskaptPortuguesePortuguêsswSwahiliKiswahilienEnglishEnglishitItalianItalianofrFrenchFrançaisesSpanishEspañolarArabicالعربيةplPolishPolskitrTurkishTürkçe200OKThanks from all of us at index.home.raft for using a what3words API
```
---
# OpenAPI reference
Every endpoint in the what3words OpenAPI definition, with its parameters, responses, examples and schemas. The guide to each one is in the [API reference](https://developer.what3words.com/public-api/docs).
Section: [API & SDK Reference](https://developer.what3words.com/docs/api-sdk-reference.md)
Source: https://developer.what3words.com/public-api/openapi
OpenAPI: [openapi.yaml](https://developer.what3words.com/public-api/openapi.yaml) · [openapi.json](https://developer.what3words.com/public-api/openapi.json) · [Postman collection](https://developer.what3words.com/public-api/what3words.postman_collection.json)
The what3words API provides a simple and powerful interface to interact with the what3words addressing system.
It allows you to convert between what3words addresses and geographic coordinates, validate and autocorrect user input,
and retrieve information about supported languages and the what3words grid.
Key features include:
- **Convert to what3words address**: Convert latitude and longitude coordinates into a what3words address.
- **Convert to coordinates**: Convert a what3words address into latitude and longitude coordinates.
- **AutoSuggest**: Suggest valid what3words addresses based on partial or incorrect input, with options to prioritize results by location or restrict results to specific areas.
- **AutoSuggest with Coordinates**: Similar to AutoSuggest, but returns coordinates in the response. This endpoint requires special permissions, please contact [support@what3words.com](mailto:support@what3words.com) for more information.
- **Grid Section**: Retrieve a section of the what3words grid for a specified bounding box, useful for map visualizations.
- **Available Languages**: Get a list of all supported languages, including language codes (including script-specific variants) and native names.
For more details, visit the [what3words Public API Documentation](https://developer.what3words.com/public-api/docs#overview).
**Additional resources:**
- [API Authentication](https://accounts.what3words.com/select-plan?referrer=/public-api/docs)
- [Error Codes](https://developer.what3words.com/public-api/docs#error-handling)
- [Supported Languages](https://developer.what3words.com/public-api/docs#available-languages)
- [Rate Limits](https://developer.what3words.com/public-api/docs#rate-limits)
- [API Terms of Use](https://developer.what3words.com/public-api/docs#terms-of-use)
- [API Pricing](https://accounts.what3words.com/select-plan?referrer=/public-api/docs)
- [Postman Collection](https://openapi.what3words.com/what3words.postman_collection.json)
- [Blog: Minimum word and address lengths (code points vs characters)](https://what3words.com/news/blog/minimum-word-and-address-lengths-in-what3words-code-points-vs-characters)
- [Blog: Understanding locales in what3words](https://what3words.com/news/blog/understanding-locales-in-what3words)
- [Blog: Demystifying the alias parameter](https://what3words.com/news/blog/demystifying-the-alias-parameter-in-what3words-address-urls)
- [Blog: LTR and RTL scripts](https://what3words.com/news/blog/how-what3words-addresses-work-in-left-to-right-ltr-and-right-to-left-rtl-scripts)
- [Blog: Secondary words across languages](https://what3words.com/news/blog/how-what3words-supports-natural-variants-across-languages-using-secondary-words)
- [Blog: Understanding the what3words regex](https://what3words.com/news/general/understanding-the-what3words-regex-a-human-friendly-guide)
## Endpoints
| Endpoint | Name | Description |
| --- | --- | --- |
| [`GET /convert-to-3wa`](https://developer.what3words.com/public-api/openapi#convertTo3wa) | Convert to what3words address | This function will convert a latitude and longitude to a what3words address, in the language of your choice. |
| [`GET /convert-to-coordinates`](https://developer.what3words.com/public-api/openapi#convertToCoordinates) | Convert to coordinates | This function converts a what3words address to a latitude and longitude. |
| [`GET /autosuggest`](https://developer.what3words.com/public-api/openapi#autosuggest) | AutoSuggest | AutoSuggest can take a slightly incorrect what3words address and suggest a list of valid what3words addresses. |
| [`GET /autosuggest-with-coordinates`](https://developer.what3words.com/public-api/openapi#autosuggestWithCoordinates) | AutoSuggest with Coordinates | Similar to the AutoSuggest endpoint, but returns coordinates in the response. |
| [`GET /grid-section`](https://developer.what3words.com/public-api/openapi#gridSection) | Grid section | Returns a section of the 3m x 3m what3words grid for a bounding box. |
| [`GET /available-languages`](https://developer.what3words.com/public-api/openapi#availableLanguages) | Available languages | Retrieves all available what3words address languages and locale/script variants, including language code, English name and native name. |
## Authentication
Every request needs an API key, sent as the `key` query parameter or the `X-Api-Key` header. [Get your free API key.](https://accounts.what3words.com/select-plan?referrer=/public-api/openapi)
| Scheme | Where | Name | Description |
| --- | --- | --- | --- |
| ApiKeyAuth | query | `key` | API key for authentication. Provide it as query parameter `key`; `X-Api-Key` header is also supported. |
| ApiKeyHeader | header | `X-Api-Key` | API key for authentication. Provide it as query parameter `key`; `X-Api-Key` header is also supported. |
## Errors
Errors return an HTTP status and a JSON body with a stable `code` and a readable `message`. Use the code to decide how to handle the error. See the [error handling guide](https://developer.what3words.com/public-api/docs#error-handling) for an example.
### Error codes
| Code | HTTP status | Returned by |
| --- | --- | --- |
| `MissingWords` | 400 | `/convert-to-coordinates` |
| `BadWords` | 400 | `/convert-to-coordinates` |
| `BadFormat` | 400 | `/convert-to-3wa`, `/convert-to-coordinates`, `/grid-section` |
| `BadCoordinates` | 400 | `/convert-to-3wa` |
| `BadBoundingBox` | 400 | `/grid-section` |
| `BadBoundingBoxTooBig` | 400 | `/grid-section` |
| `BadFocus` | 400 | `/autosuggest`, `/autosuggest-with-coordinates` |
| `BadClipToCountry` | 400 | `/autosuggest`, `/autosuggest-with-coordinates` |
| `BadClipToBoundingBox` | 400 | `/autosuggest`, `/autosuggest-with-coordinates` |
| `BadClipToCircle` | 400 | `/autosuggest`, `/autosuggest-with-coordinates` |
| `BadClipToPolygon` | 400 | `/autosuggest`, `/autosuggest-with-coordinates` |
| `MissingLanguage` | 400 | `/autosuggest`, `/autosuggest-with-coordinates` |
| `BadLanguage` | 400 | `/convert-to-3wa`, `/autosuggest`, `/autosuggest-with-coordinates` |
| `InvalidKey` | 401 | `/convert-to-3wa`, `/convert-to-coordinates`, `/autosuggest`, `/autosuggest-with-coordinates`, `/grid-section`, `/available-languages` |
| `InvalidKeyNoPermissions` | 401 | `/autosuggest-with-coordinates` |
| `BadInputType` | 400 | `/autosuggest`, `/autosuggest-with-coordinates` |
| `MissingInput` | 400 | `/autosuggest`, `/autosuggest-with-coordinates` |
| `MissingKey` | 401 | `/convert-to-3wa`, `/convert-to-coordinates`, `/autosuggest`, `/autosuggest-with-coordinates`, `/grid-section`, `/available-languages` |
| `DuplicateParameter` | 400 | `/convert-to-3wa`, `/convert-to-coordinates`, `/autosuggest`, `/autosuggest-with-coordinates`, `/grid-section` |
| `BadNResults` | 400 | `/autosuggest`, `/autosuggest-with-coordinates` |
| `BadNFocusResults` | 400 | `/autosuggest`, `/autosuggest-with-coordinates` |
| `BadInput` | 400 | `/autosuggest`, `/autosuggest-with-coordinates` |
## Convert to what3words address
`GET https://api.what3words.com/v3/convert-to-3wa`
This function will convert a latitude and longitude to a what3words address, in the language of your choice. It also returns country, the bounds of the grid square, a nearby place (such as a local town) and a link to our map site.
### Parameters
| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `key` | query | string | optional | A valid API key. Provide it as query parameter `key`; `X-Api-Key` header is also supported. |
| `coordinates` | query | string | required | Coordinates as a comma separated string of latitude and longitude. Example `coordinates=51.521251,-0.203586`. |
| `language` | query | string | optional | A supported what3words language code from `/available-languages`. You can pass base language codes (for example `fr`) or script-specific codes where available (for example `mn_la`, `zh_tr`, `oo_la`). Defaults to `en` (English) if not specified. Default `en`. Example `language=fr`. |
| `format` | query | string | optional | Return data format type; can be either `json` (the default) or `geojson`. One of `json`, `geojson`. Default `json`. |
| `locale` | query | string | optional | Optional locale/script-specific code. Can be passed on its own. If provided with `language`, both values must be identical strings (for example `language=mn_la&locale=mn_la`). Example `locale=mn_la`. |
### Example request
**cURL**
```shellscript
curl --request GET \
--url 'https://api.what3words.com/v3/convert-to-3wa?coordinates=51.520847,-0.195521&key=YOUR_API_KEY'
```
**JavaScript**
```javascript
const params = new URLSearchParams({
coordinates: '51.520847,-0.195521',
key: 'YOUR_API_KEY',
});
const response = await fetch(`https://api.what3words.com/v3/convert-to-3wa?${params}`);
const data = await response.json();
console.log(data);
```
**Python**
```python
import requests
response = requests.get(
"https://api.what3words.com/v3/convert-to-3wa",
params={"coordinates": "51.520847,-0.195521", "key": "YOUR_API_KEY"},
)
print(response.json())
```
### Example result
Status: `200 OK`
**JSON**
```json
{
"country": "GB",
"square": {
"southwest": {
"lng": -0.195543,
"lat": 51.520833
},
"northeast": {
"lng": -0.195499,
"lat": 51.52086
}
},
"nearestPlace": "Bayswater, London",
"coordinates": {
"lng": -0.195521,
"lat": 51.520847
},
"words": "filled.count.soap",
"language": "en",
"map": "https://w3w.co/filled.count.soap"
}
```
**GeoJSON**
```json
{
"features": [
{
"bbox": [
-0.195543,
51.520833,
-0.195499,
51.52086
],
"geometry": {
"coordinates": [
-0.195521,
51.520847
],
"type": "Point"
},
"type": "Feature",
"properties": {
"country": "GB",
"nearestPlace": "Bayswater, London",
"words": "filled.count.soap",
"language": "en",
"map": "https://w3w.co/filled.count.soap"
}
}
],
"type": "FeatureCollection"
}
```
### Response fields
| Field | Type | Description |
| --- | --- | --- |
| `country` | string | The country in which the what3words address is located, as an ISO 3166-1 alpha-2 country code |
| `square` | object (Square) | |
| `square.southwest` | object (Coordinates) | |
| `square.southwest.lat` | number | Latitude |
| `square.southwest.lng` | number | Longitude |
| `square.northeast` | object (Coordinates) | |
| `square.northeast.lat` | number | Latitude |
| `square.northeast.lng` | number | Longitude |
| `nearestPlace` | string | The nearest place to the what3words address |
| `coordinates` | object (Coordinates) | |
| `coordinates.lat` | number | Latitude |
| `coordinates.lng` | number | Longitude |
| `words` | string | The what3words address |
| `language` | string | The language of the what3words address |
| `locale` | string | The locale of the what3words address, if returned |
| `map` | string | URL to view the what3words address on the what3words map |
### Responses
**200** Successful conversion to what3words address (application/json). Schema: ConvertTo3waResponse
**400** Bad request (application/json). Schema: ErrorResponse
**BadLanguage**
```json
{
"error": {
"code": "BadLanguage",
"message": "language must be a supported what3words language code, such as 'en', 'fr' or 'mn_la'"
}
}
```
**BadCoordinates**
```json
{
"error": {
"code": "BadCoordinates",
"message": "failed to parse one of the coordinates as a valid decimal number"
}
}
```
**BadFormat**
```json
{
"error": {
"code": "BadFormat",
"message": "Format must be one of json,geojson"
}
}
```
**BadLanguageLocaleMismatch**
```json
{
"error": {
"code": "BadLanguage",
"message": "language and locale must not be different"
}
}
```
**DuplicateParameter**
```json
{
"error": {
"code": "DuplicateParameter",
"message": "Duplicate parameter 'coordinates'. Please only pass in one of each parameter."
}
}
```
**401** Unauthorized - Invalid API key (application/json). Schema: ErrorResponse
**InvalidKey**
```json
{
"error": {
"code": "InvalidKey",
"message": "Authentication failed; invalid API key"
}
}
```
**MissingKey**
```json
{
"error": {
"code": "MissingKey",
"message": "Authentication failed; missing required API key parameter or header"
}
}
```
[Read the guide](https://developer.what3words.com/public-api/docs#convert-to-3wa) · [Try it in the Playground](https://developer.what3words.com/public-api/playground#convert-to-3wa)
## Convert to coordinates
`GET https://api.what3words.com/v3/convert-to-coordinates`
This function converts a what3words address to a latitude and longitude. It also returns country, the bounds of the grid square, a nearest place (such as a local town) and a link to our map site.
### Parameters
| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `key` | query | string | optional | A valid API key. Provide it as query parameter `key`; `X-Api-Key` header is also supported. |
| `words` | query | string | required | A what3words address. Input parsing is case-insensitive, accepts an optional leading `///`, and accepts supported dot-like delimiters (. 。 。 ・ ・ ︒ ។ ։ ။ ۔ ። ।). Example `words=filled.count.soap`. |
| `format` | query | string | optional | Return data format type; can be either `json` (the default) or `geojson`. One of `json`, `geojson`. Default `json`. |
### Example request
**cURL**
```shellscript
curl --request GET \
--url 'https://api.what3words.com/v3/convert-to-coordinates?words=filled.count.soap&key=YOUR_API_KEY'
```
**JavaScript**
```javascript
const params = new URLSearchParams({
words: 'filled.count.soap',
key: 'YOUR_API_KEY',
});
const response = await fetch(`https://api.what3words.com/v3/convert-to-coordinates?${params}`);
const data = await response.json();
console.log(data);
```
**Python**
```python
import requests
response = requests.get(
"https://api.what3words.com/v3/convert-to-coordinates",
params={"words": "filled.count.soap", "key": "YOUR_API_KEY"},
)
print(response.json())
```
### Example result
Status: `200 OK`
**JSON**
```json
{
"country": "GB",
"square": {
"southwest": {
"lng": -0.195543,
"lat": 51.520833
},
"northeast": {
"lng": -0.195499,
"lat": 51.52086
}
},
"nearestPlace": "Bayswater, London",
"coordinates": {
"lng": -0.195521,
"lat": 51.520847
},
"words": "filled.count.soap",
"language": "en",
"map": "https://w3w.co/filled.count.soap"
}
```
**GeoJSON**
```json
{
"features": [
{
"bbox": [
-0.195543,
51.520833,
-0.195499,
51.52086
],
"geometry": {
"coordinates": [
-0.195521,
51.520847
],
"type": "Point"
},
"type": "Feature",
"properties": {
"country": "GB",
"nearestPlace": "Bayswater, London",
"words": "filled.count.soap",
"language": "en",
"map": "https://w3w.co/filled.count.soap"
}
}
],
"type": "FeatureCollection"
}
```
### Response fields
| Field | Type | Description |
| --- | --- | --- |
| `country` | string | The country in which the what3words address is located, as an ISO 3166-1 alpha-2 country code |
| `square` | object (Square) | |
| `square.southwest` | object (Coordinates) | |
| `square.southwest.lat` | number | Latitude |
| `square.southwest.lng` | number | Longitude |
| `square.northeast` | object (Coordinates) | |
| `square.northeast.lat` | number | Latitude |
| `square.northeast.lng` | number | Longitude |
| `nearestPlace` | string | The nearest place to the what3words address |
| `coordinates` | object (Coordinates) | |
| `coordinates.lat` | number | Latitude |
| `coordinates.lng` | number | Longitude |
| `words` | string | The what3words address |
| `language` | string | The language of the what3words address |
| `locale` | string | The locale of the what3words address, if returned |
| `map` | string | URL to view the what3words address on the what3words map |
### Responses
**200** Successful conversion to coordinates (application/json). Schema: ConvertToCoordinatesResponse
**400** Bad request (application/json). Schema: ErrorResponse
**MissingWords**
```json
{
"error": {
"code": "MissingWords",
"message": "words must be specified"
}
}
```
**BadWords**
```json
{
"error": {
"code": "BadWords",
"message": "words must be a valid 3 word address, such as filled.count.soap or ///filled.count.soap"
}
}
```
**BadFormat**
```json
{
"error": {
"code": "BadFormat",
"message": "Format must be one of json,geojson"
}
}
```
**DuplicateParameter**
```json
{
"error": {
"code": "DuplicateParameter",
"message": "Duplicate parameter 'words'. Please only pass in one of each parameter."
}
}
```
**401** Unauthorized - Invalid API key (application/json). Schema: ErrorResponse
**InvalidKey**
```json
{
"error": {
"code": "InvalidKey",
"message": "Authentication failed; invalid API key"
}
}
```
**MissingKey**
```json
{
"error": {
"code": "MissingKey",
"message": "Authentication failed; missing required API key parameter or header"
}
}
```
[Read the guide](https://developer.what3words.com/public-api/docs#convert-to-coords) · [Try it in the Playground](https://developer.what3words.com/public-api/playground#convert-to-coordinates)
## AutoSuggest
`GET https://api.what3words.com/v3/autosuggest`
AutoSuggest can take a slightly incorrect what3words address and suggest a list of valid what3words addresses. It has powerful features that can, for example, optionally limit results to a country or area, and prioritize results that are near the user.
### Parameters
| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `key` | query | string | optional | A valid API key. Provide it as query parameter `key`; `X-Api-Key` header is also supported. |
| `input` | query | string | required | The full or partial what3words address to obtain suggestions for. At minimum this must be the first two complete words plus at least one character from the third word. Input parsing is case-insensitive, accepts an optional leading `///`, and accepts supported dot-like delimiters (. 。 。 ・ ・ ︒ ។ ։ ။ ۔ ። ।). Example `input=filled.count.s`. |
| `focus` | query | string | optional | This is a location, specified as latitude,longitude (often where the user making the query is). If specified, the results will be weighted to give preference to those near the focus. For convenience, longitude is allowed to wrap around the 180 line, so 361 is equivalent to 1. Example `focus=51.521251,-0.203586`. |
| `n-focus-results` | query | integer | optional | Controls how many top suggestions are strongly biased towards the `focus` coordinate. Defaults to `n-results` when omitted. Non-numeric values return `BadNFocusResults`. Default `3`. Maximum 100. Example `n-focus-results=5`. |
| `clip-to-country` | query | string | optional | Restricts results to the specified country or countries, specified as comma-separated ISO 3166-1 alpha-2 country codes (for example `GB,US`). Parsing is case-insensitive, though uppercase is recommended. Example `clip-to-country=GB,US`. |
| `clip-to-circle` | query | string | optional | Restricts results to a circle, specified by `latitude,longitude,kilometres`. For example, `51.4243877,-0.3474524,10` constrains results to those within 10 km of the point 51.4243877,-0.3474524. Example `clip-to-circle=51.4243877,-0.3474524,10`. |
| `clip-to-bounding-box` | query | string | optional | Restricts results to a bounding box, specified by `southwest latitude,southwest longitude,northeast latitude,northeast longitude`. Latitudes and longitudes should be specified in order of increasing size. Longitude is allowed to wrap, so that you can specify bounding boxes which cross the ante-meridian, e.g., `-4,178.2,22,195.4`. Example `clip-to-bounding-box=51.515900,-0.212517,51.527649,-0.191746`. |
| `clip-to-polygon` | query | string | optional | Restricts results to a polygon, specified by a comma-separated list of `lat,lng` pairs. The polygon should be closed, i.e. the first element should be repeated as the last element; also the list should contain at least 4 entries. The API is currently limited to accepting up to 25 pairs. Example `clip-to-polygon=51.521,-0.343,52.6,2.3324,54.234,8.343,51.521,-0.343`. |
| `language` | query | string | optional | For text input, adds a preferred language or locale to the set Autosuggest considers. Exact whole-word matches in the input can also add languages or locales. If omitted for text input, English is added as the default backstop. For voice input (`input-type` != `text`), this must be provided. Use a supported what3words code from `/available-languages`, including locale/script-specific codes where available (for example `mn_la`, `zh_tr`, `oo_la`). Default `en`. |
| `locale` | query | string | optional | Optional locale/script-specific code. Can be passed on its own. If provided with `language`, both values must be identical strings (for example `language=mn_la&locale=mn_la`). Example `locale=mn_la`. |
| `input-type` | query | string | optional | For power users, used to specify voice input mode. Can be `text` (default), `vocon-hybrid`, `nmdp-asr`, `generic-voice`, `speechmatics`, or `vin-big-data`. Voice modes require `language`. If `input` is not in the expected format for a selected voice mode, the API may return `BadInput`. One of `text`, `vocon-hybrid`, `nmdp-asr`, `generic-voice`, `speechmatics`, `vin-big-data`. Default `text`. |
| `n-results` | query | integer | optional | The number of AutoSuggest results to return. Non-numeric values return `BadNResults`. Values greater than 100 are truncated to 100. Values less than or equal to 0 return an empty suggestions list. The default is 3. Default `3`. Maximum 100. |
| `prefer-land` | query | boolean | optional | Makes AutoSuggest prefer results on land to those in the sea. This setting is on by default. Use false to disable this setting and receive more suggestions in the sea. Default `true`. |
| `format` | query | string | optional | Return data format type; can be either `json` (the default) or `geojson`. One of `json`, `geojson`. Default `json`. |
### Example request
**cURL**
```shellscript
curl --request GET \
--url 'https://api.what3words.com/v3/autosuggest?input=film.crunchy.spiri&focus=50.842404,4.361177&key=YOUR_API_KEY'
```
**JavaScript**
```javascript
const params = new URLSearchParams({
input: 'film.crunchy.spiri',
focus: '50.842404,4.361177',
key: 'YOUR_API_KEY',
});
const response = await fetch(`https://api.what3words.com/v3/autosuggest?${params}`);
const data = await response.json();
console.log(data);
```
**Python**
```python
import requests
response = requests.get(
"https://api.what3words.com/v3/autosuggest",
params={"input": "film.crunchy.spiri", "focus": "50.842404,4.361177", "key": "YOUR_API_KEY"},
)
print(response.json())
```
### Example result
Status: `200 OK`
**JSON**
```json
{
"suggestions": [
{
"country": "BE",
"nearestPlace": "Brussels, Brussels Capital",
"words": "film.crunchy.spirits",
"rank": 1,
"distanceToFocusKm": 1,
"language": "en"
},
{
"country": "ES",
"nearestPlace": "Caldes de Montbui, Catalonia",
"words": "film.crunchy.spirit",
"rank": 2,
"distanceToFocusKm": 1039,
"language": "en"
},
{
"country": "NL",
"nearestPlace": "Weert, Limburg",
"words": "firm.crunchy.spires",
"rank": 3,
"distanceToFocusKm": 105,
"language": "en"
}
]
}
```
### Response fields
| Field | Type | Description |
| --- | --- | --- |
| `suggestions[]` | array of AutosuggestSuggestion | List of suggested what3words addresses |
| `suggestions[].words` | string | The suggested what3words address |
| `suggestions[].country` | string | The country in which the what3words address is located, as an ISO 3166-1 alpha-2 country code |
| `suggestions[].nearestPlace` | string | The nearest place to the what3words address |
| `suggestions[].language` | string | The language of the what3words address |
| `suggestions[].locale` | string | The locale of the what3words address, if applicable |
| `suggestions[].rank` | integer | The relative ranking of this suggestion |
| `suggestions[].distanceToFocusKm` | number | The distance in kilometers from the focus point to this suggestion's coordinates |
### Responses
**200** Successful autosuggest results (application/json). Schema: AutosuggestResponse
**400** Bad request (application/json). Schema: ErrorResponse
**MissingInput**
```json
{
"error": {
"code": "MissingInput",
"message": "input must be specified"
}
}
```
**BadFocus**
```json
{
"error": {
"code": "BadFocus",
"message": "focus must be a lat,lng"
}
}
```
**BadClipToCountry**
```json
{
"error": {
"code": "BadClipToCountry",
"message": "Countries are specified as a comma separated list of uppercase ISO 3166-1 alpha-2 country codes, such as US,CA"
}
}
```
**BadClipToBoundingBox**
```json
{
"error": {
"code": "BadClipToBoundingBox",
"message": "Must be four lat,lng,lat,lng coordinates such as 50,-2,53.12,2.34"
}
}
```
**BadClipToCircle**
```json
{
"error": {
"code": "BadClipToCircle",
"message": "clip-to-circle needs to be lat,lng,km. Example: 51.453,0.344,112"
}
}
```
**BadClipToPolygon**
```json
{
"error": {
"code": "BadClipToPolygon",
"message": "Failed to parse one of the coordinates as a valid decimal number"
}
}
```
**MissingLanguage**
```json
{
"error": {
"code": "MissingLanguage",
"message": "for voice input. language must be specified"
}
}
```
**BadLanguage**
```json
{
"error": {
"code": "BadLanguage",
"message": "language must be a supported what3words language code, such as 'en', 'fr' or 'mn_la'"
}
}
```
**BadInputType**
```json
{
"error": {
"code": "BadInputType",
"message": "prefer-land must be one of true or false"
}
}
```
**BadLanguageLocaleMismatch**
```json
{
"error": {
"code": "BadLanguage",
"message": "language and locale must not be different"
}
}
```
**BadNResults**
```json
{
"error": {
"code": "BadNResults",
"message": "n-results must be a valid integer"
}
}
```
**BadNFocusResults**
```json
{
"error": {
"code": "BadNFocusResults",
"message": "n-focus-results must be a valid integer"
}
}
```
**BadInput**
```json
{
"error": {
"code": "BadInput",
"message": "Invalid autosuggest input"
}
}
```
**DuplicateParameter**
```json
{
"error": {
"code": "DuplicateParameter",
"message": "Duplicate parameter 'input'. Please only pass in one of each parameter."
}
}
```
**401** Unauthorized - Invalid API key (application/json). Schema: ErrorResponse
**InvalidKey**
```json
{
"error": {
"code": "InvalidKey",
"message": "Authentication failed; invalid API key"
}
}
```
**MissingKey**
```json
{
"error": {
"code": "MissingKey",
"message": "Authentication failed; missing required API key parameter or header"
}
}
```
[Read the guide](https://developer.what3words.com/public-api/docs#autosuggest) · [Try it in the Playground](https://developer.what3words.com/public-api/playground#autosuggest)
## AutoSuggest with Coordinates
`GET https://api.what3words.com/v3/autosuggest-with-coordinates`
Similar to the AutoSuggest endpoint, but returns coordinates in the response. This endpoint requires special permissions.
### Parameters
| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `key` | query | string | optional | A valid API key. Provide it as query parameter `key`; `X-Api-Key` header is also supported. |
| `input` | query | string | required | The full or partial what3words address to obtain suggestions for. At minimum this must be the first two complete words plus at least one character from the third word. Input parsing is case-insensitive, accepts an optional leading `///`, and accepts supported dot-like delimiters (. 。 。 ・ ・ ︒ ។ ։ ။ ۔ ። ।). Example `input=filled.count.s`. |
| `focus` | query | string | optional | This is a location, specified as latitude,longitude (often where the user making the query is). If specified, the results will be weighted to give preference to those near the focus. For convenience, longitude is allowed to wrap around the 180 line, so 361 is equivalent to 1. Example `focus=51.521251,-0.203586`. |
| `n-focus-results` | query | integer | optional | Controls how many top suggestions are strongly biased towards the `focus` coordinate. Defaults to `n-results` when omitted. Non-numeric values return `BadNFocusResults`. Default `3`. Maximum 100. Example `n-focus-results=5`. |
| `clip-to-country` | query | string | optional | Restricts results to the specified country or countries, specified as comma-separated ISO 3166-1 alpha-2 country codes (for example `GB,US`). Parsing is case-insensitive, though uppercase is recommended. Example `clip-to-country=GB,US`. |
| `clip-to-circle` | query | string | optional | Restricts results to a circle, specified by `latitude,longitude,kilometres`. For example, `51.4243877,-0.3474524,10` constrains results to those within 10 km of the point 51.4243877,-0.3474524. Example `clip-to-circle=51.4243877,-0.3474524,10`. |
| `clip-to-bounding-box` | query | string | optional | Restricts results to a bounding box, specified by `southwest latitude,southwest longitude,northeast latitude,northeast longitude`. Latitudes and longitudes should be specified in order of increasing size. Longitude is allowed to wrap, so that you can specify bounding boxes which cross the ante-meridian, e.g., `-4,178.2,22,195.4`. Example `clip-to-bounding-box=51.515900,-0.212517,51.527649,-0.191746`. |
| `clip-to-polygon` | query | string | optional | Restricts results to a polygon, specified by a comma-separated list of `lat,lng` pairs. The polygon should be closed, i.e. the first element should be repeated as the last element; also the list should contain at least 4 entries. The API is currently limited to accepting up to 25 pairs. Example `clip-to-polygon=51.521,-0.343,52.6,2.3324,54.234,8.343,51.521,-0.343`. |
| `language` | query | string | optional | For text input, adds a preferred language or locale to the set Autosuggest considers. Exact whole-word matches in the input can also add languages or locales. If omitted for text input, English is added as the default backstop. For voice input (`input-type` != `text`), this must be provided. Use a supported what3words code from `/available-languages`, including locale/script-specific codes where available (for example `mn_la`, `zh_tr`, `oo_la`). Default `en`. |
| `locale` | query | string | optional | Optional locale/script-specific code. Can be passed on its own. If provided with `language`, both values must be identical strings (for example `language=mn_la&locale=mn_la`). Example `locale=mn_la`. |
| `input-type` | query | string | optional | For power users, used to specify voice input mode. Can be `text` (default), `vocon-hybrid`, `nmdp-asr`, `generic-voice`, `speechmatics`, or `vin-big-data`. Voice modes require `language`. If `input` is not in the expected format for a selected voice mode, the API may return `BadInput`. One of `text`, `vocon-hybrid`, `nmdp-asr`, `generic-voice`, `speechmatics`, `vin-big-data`. Default `text`. |
| `n-results` | query | integer | optional | The number of AutoSuggest results to return. Non-numeric values return `BadNResults`. Values greater than 100 are truncated to 100. Values less than or equal to 0 return an empty suggestions list. The default is 3. Default `3`. Maximum 100. |
| `prefer-land` | query | boolean | optional | Makes AutoSuggest prefer results on land to those in the sea. This setting is on by default. Use false to disable this setting and receive more suggestions in the sea. Default `true`. |
| `format` | query | string | optional | Return data format type; can be either `json` (the default) or `geojson`. One of `json`, `geojson`. Default `json`. |
### Example request
**cURL**
```shellscript
curl --request GET \
--url 'https://api.what3words.com/v3/autosuggest-with-coordinates?input=film.crunchy.spiri&focus=50.842404,4.361177&key=YOUR_API_KEY'
```
**JavaScript**
```javascript
const params = new URLSearchParams({
input: 'film.crunchy.spiri',
focus: '50.842404,4.361177',
key: 'YOUR_API_KEY',
});
const response = await fetch(`https://api.what3words.com/v3/autosuggest-with-coordinates?${params}`);
const data = await response.json();
console.log(data);
```
**Python**
```python
import requests
response = requests.get(
"https://api.what3words.com/v3/autosuggest-with-coordinates",
params={"input": "film.crunchy.spiri", "focus": "50.842404,4.361177", "key": "YOUR_API_KEY"},
)
print(response.json())
```
### Example result
Status: `200 OK`
**JSON**
```json
{
"suggestions": [
{
"country": "BE",
"square": {
"southwest": {
"lng": 4.347436,
"lat": 50.848237
},
"northeast": {
"lng": 4.347479,
"lat": 50.848264
}
},
"nearestPlace": "Brussels, Brussels Capital",
"words": "film.crunchy.spirits",
"coordinates": {
"lng": 4.347457,
"lat": 50.848251
},
"rank": 1,
"distanceToFocusKm": 1,
"language": "en",
"map": "https://w3w.co/film.crunchy.spirits"
},
{
"country": "ES",
"square": {
"southwest": {
"lng": 2.164394,
"lat": 41.625835
},
"northeast": {
"lng": 2.16443,
"lat": 41.625862
}
},
"nearestPlace": "Caldes de Montbui, Catalonia",
"words": "film.crunchy.spirit",
"coordinates": {
"lng": 2.164412,
"lat": 41.625849
},
"rank": 2,
"distanceToFocusKm": 1039,
"language": "en",
"map": "https://w3w.co/film.crunchy.spirit"
},
{
"country": "NL",
"square": {
"southwest": {
"lng": 5.681058,
"lat": 51.289807
},
"northeast": {
"lng": 5.681101,
"lat": 51.289834
}
},
"nearestPlace": "Weert, Limburg",
"words": "firm.crunchy.spires",
"coordinates": {
"lng": 5.68108,
"lat": 51.289821
},
"rank": 3,
"distanceToFocusKm": 105,
"language": "en",
"map": "https://w3w.co/firm.crunchy.spires"
}
]
}
```
### Response fields
| Field | Type | Description |
| --- | --- | --- |
| `suggestions[]` | array of AutosuggestWithCoordinatesSuggestion | List of suggested what3words addresses including coordinates |
| `suggestions[].words` | string | The suggested what3words address |
| `suggestions[].country` | string | The country in which the what3words address is located, as an ISO 3166-1 alpha-2 country code |
| `suggestions[].square` | object (Square) | |
| `suggestions[].square.southwest` | object (Coordinates) | |
| `suggestions[].square.southwest.lat` | number | Latitude |
| `suggestions[].square.southwest.lng` | number | Longitude |
| `suggestions[].square.northeast` | object (Coordinates) | |
| `suggestions[].square.northeast.lat` | number | Latitude |
| `suggestions[].square.northeast.lng` | number | Longitude |
| `suggestions[].nearestPlace` | string | The nearest place to the what3words address |
| `suggestions[].coordinates` | object (Coordinates) | |
| `suggestions[].coordinates.lat` | number | Latitude |
| `suggestions[].coordinates.lng` | number | Longitude |
| `suggestions[].language` | string | The language of the what3words address |
| `suggestions[].locale` | string | The locale of the what3words address, if returned |
| `suggestions[].rank` | integer | The relative ranking of this suggestion |
| `suggestions[].distanceToFocusKm` | number | The distance in kilometers from the focus point to this suggestion's coordinates |
| `suggestions[].map` | string | URL to view the what3words address on the what3words map |
### Responses
**200** Successful autosuggest results (application/json). Schema: AutosuggestWithCoordinatesResponse
**400** Bad request (application/json). Schema: ErrorResponse
**MissingInput**
```json
{
"error": {
"code": "MissingInput",
"message": "input must be specified"
}
}
```
**BadFocus**
```json
{
"error": {
"code": "BadFocus",
"message": "focus must be a lat,lng"
}
}
```
**BadClipToCountry**
```json
{
"error": {
"code": "BadClipToCountry",
"message": "Countries are specified as a comma separated list of uppercase ISO 3166-1 alpha-2 country codes, such as US,CA"
}
}
```
**BadClipToBoundingBox**
```json
{
"error": {
"code": "BadClipToBoundingBox",
"message": "Must be four lat,lng,lat,lng coordinates such as 50,-2,53.12,2.34"
}
}
```
**BadClipToCircle**
```json
{
"error": {
"code": "BadClipToCircle",
"message": "clip-to-circle needs to be lat,lng,km. Example: 51.453,0.344,112"
}
}
```
**BadClipToPolygon**
```json
{
"error": {
"code": "BadClipToPolygon",
"message": "Failed to parse one of the coordinates as a valid decimal number"
}
}
```
**MissingLanguage**
```json
{
"error": {
"code": "MissingLanguage",
"message": "for voice input. language must be specified"
}
}
```
**BadLanguage**
```json
{
"error": {
"code": "BadLanguage",
"message": "language must be a supported what3words language code, such as 'en', 'fr' or 'mn_la'"
}
}
```
**BadInputType**
```json
{
"error": {
"code": "BadInputType",
"message": "prefer-land must be one of true or false"
}
}
```
**BadLanguageLocaleMismatch**
```json
{
"error": {
"code": "BadLanguage",
"message": "language and locale must not be different"
}
}
```
**BadNResults**
```json
{
"error": {
"code": "BadNResults",
"message": "n-results must be a valid integer"
}
}
```
**BadNFocusResults**
```json
{
"error": {
"code": "BadNFocusResults",
"message": "n-focus-results must be a valid integer"
}
}
```
**BadInput**
```json
{
"error": {
"code": "BadInput",
"message": "Invalid autosuggest input"
}
}
```
**DuplicateParameter**
```json
{
"error": {
"code": "DuplicateParameter",
"message": "Duplicate parameter 'input'. Please only pass in one of each parameter."
}
}
```
**401** Unauthorized - Invalid API key (application/json). Schema: ErrorResponse
**InvalidKey**
```json
{
"error": {
"code": "InvalidKey",
"message": "Authentication failed; invalid API key"
}
}
```
**InvalidKeyNoPermissions**
```json
{
"error": {
"code": "InvalidKey",
"message": "Auth failed; /v3/autosuggest-with-coordinates. Contact support@what3words.com or your account manager to enable your account"
}
}
```
**MissingKey**
```json
{
"error": {
"code": "MissingKey",
"message": "Authentication failed; missing required API key parameter or header"
}
}
```
[Read the guide](https://developer.what3words.com/public-api/docs#autosuggest-with-coordinates)
## Grid section
`GET https://api.what3words.com/v3/grid-section`
Returns a section of the 3m x 3m what3words grid for a bounding box. The bounding box is specified by lat,lng,lat,lng as south,west,north,east. You can request the grid in GeoJSON format, making it very simple to display on a map.
### Parameters
| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `key` | query | string | optional | A valid API key. Provide it as query parameter `key`; `X-Api-Key` header is also supported. |
| `bounding-box` | query | string | required | Bounding box, as a `lat,lng,lat,lng`, for which the grid should be returned. The requested box must not exceed `4km` from corner to corner, or a `BadBoundingBoxTooBig` error will be returned. Latitudes must be `>= -90` and `<= 90`, but longitudes are allowed to wrap around 180. To specify a bounding-box that crosses the anti-meridian, use longitude greater than 180. e.g.: `bounding-box=50.0,179.995,50.01,180.0005`. Example `bounding-box=52.207988,0.116126,52.208867,0.117540`. |
| `format` | query | string | optional | Return data format type; can be either `json` (the default) or `geojson`. One of `json`, `geojson`. Default `json`. |
### Example request
**cURL**
```shellscript
curl --request GET \
--url 'https://api.what3words.com/v3/grid-section?bounding-box=52.207988,0.116126,52.208867,0.117540&key=YOUR_API_KEY'
```
**JavaScript**
```javascript
const params = new URLSearchParams({
'bounding-box': '52.207988,0.116126,52.208867,0.117540',
key: 'YOUR_API_KEY',
});
const response = await fetch(`https://api.what3words.com/v3/grid-section?${params}`);
const data = await response.json();
console.log(data);
```
**Python**
```python
import requests
response = requests.get(
"https://api.what3words.com/v3/grid-section",
params={"bounding-box": "52.207988,0.116126,52.208867,0.117540", "key": "YOUR_API_KEY"},
)
print(response.json())
```
### Example result
Status: `200 OK`
**JSON**
```json
{
"lines": [
{
"start": {
"lng": 0.116126,
"lat": 52.20801
},
"end": {
"lng": 0.11754,
"lat": 52.20801
}
},
{
"start": {
"lng": 0.116126,
"lat": 52.208037
},
"end": {
"lng": 0.11754,
"lat": 52.208037
}
}
]
}
```
**GeoJSON**
```json
{
"features": [
{
"geometry": {
"coordinates": [
[
[
0.116126,
52.20801
],
[
0.11754,
52.20801
]
],
[
[
0.116126,
52.208037
],
[
0.11754,
52.208037
]
]
],
"type": "MultiLineString"
},
"type": "Feature",
"properties": {}
}
],
"type": "FeatureCollection"
}
```
*Shortened to the first two lines of the grid; the full response has a line for every grid row and column in the bounding box.*
### Response fields
| Field | Type | Description |
| --- | --- | --- |
| `lines[]` | array of object | Array of line objects that make up the grid |
| `lines[].start` | object (Coordinates) | |
| `lines[].start.lat` | number | Latitude |
| `lines[].start.lng` | number | Longitude |
| `lines[].end` | object (Coordinates) | |
| `lines[].end.lat` | number | Latitude |
| `lines[].end.lng` | number | Longitude |
### Responses
**200** Successful grid section retrieval (application/json, application/geo+json). Schema: GridSectionResponse
**400** Bad request (application/json)
**BadBoundingBox**
```json
{
"error": {
"code": "BadBoundingBox",
"message": "bounding-box must be specified as south_lat,west_lng,north_lat,east_lng"
}
}
```
**BadBoundingBoxTooBig**
```json
{
"error": {
"code": "BadBoundingBoxTooBig",
"message": "Bounding box too large (exceeds 4km from corner to corner)"
}
}
```
**BadFormat**
```json
{
"error": {
"code": "BadFormat",
"message": "Format must be one of json,geojson"
}
}
```
**DuplicateParameter**
```json
{
"error": {
"code": "DuplicateParameter",
"message": "Duplicate parameter 'bounding-box'. Please only pass in one of each parameter."
}
}
```
**401** Unauthorized - Invalid API key (application/json). Schema: ErrorResponse
**InvalidKey**
```json
{
"error": {
"code": "InvalidKey",
"message": "Authentication failed; invalid API key"
}
}
```
**MissingKey**
```json
{
"error": {
"code": "MissingKey",
"message": "Authentication failed; missing required API key parameter or header"
}
}
```
[Read the guide](https://developer.what3words.com/public-api/docs#grid-section) · [Try it in the Playground](https://developer.what3words.com/public-api/playground#grid-section)
## Available languages
`GET https://api.what3words.com/v3/available-languages`
Retrieves all available what3words address languages and locale/script variants, including language code, English name and native name. Use top-level `code` values as base `language` codes, and use nested `locales[].code` values where explicit locale/script selection is needed (for example `en`, `mn`, `mn_la`, `zh_tr`, `oo_cy`).
### Parameters
| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `key` | query | string | optional | A valid API key. Provide it as query parameter `key`; `X-Api-Key` header is also supported. |
### Example request
**cURL**
```shellscript
curl --request GET \
--url 'https://api.what3words.com/v3/available-languages?key=YOUR_API_KEY'
```
**JavaScript**
```javascript
const params = new URLSearchParams({
key: 'YOUR_API_KEY',
});
const response = await fetch(`https://api.what3words.com/v3/available-languages?${params}`);
const data = await response.json();
console.log(data);
```
**Python**
```python
import requests
response = requests.get(
"https://api.what3words.com/v3/available-languages",
params={"key": "YOUR_API_KEY"},
)
print(response.json())
```
### Example result
Status: `200 OK`
**JSON**
```json
{
"languages": [
{
"nativeName": "Deutsch",
"code": "de",
"name": "German"
},
{
"nativeName": "English",
"code": "en",
"name": "English"
},
{
"nativeName": "Français",
"code": "fr",
"name": "French"
},
{
"nativeName": "Монгол хэл",
"code": "mn",
"name": "Mongolian",
"locales": [
{
"nativeName": "Монгол хэл (Латинаар)",
"name": "Mongolian (Latin)",
"code": "mn_la"
},
{
"nativeName": "Монгол хэл (Криллээр)",
"name": "Mongolian (Cyrillic)",
"code": "mn_cy"
}
]
},
{
"nativeName": "中文",
"code": "zh",
"name": "Chinese",
"locales": [
{
"nativeName": "中文(繁體)",
"name": "Chinese (Traditional)",
"code": "zh_tr"
},
{
"nativeName": "中文(简体)",
"name": "Chinese (Simplified)",
"code": "zh_si"
}
]
}
]
}
```
*Shortened to five languages; the full response lists all 58 languages.*
### Response fields
| Field | Type | Description |
| --- | --- | --- |
| `languages[]` | array of Language | List of available languages |
| `languages[].code` | string | The what3words language code for the language or language family (for example `en`, `mn`, `oo`). |
| `languages[].name` | string | The English name of the language |
| `languages[].nativeName` | string | The name of the language in that language |
| `languages[].locales[]` | array of Locale | List of available locales for this language, if applicable |
| `languages[].locales[].code` | string | The locale code |
| `languages[].locales[].name` | string | The name of the locale |
| `languages[].locales[].nativeName` | string | The native name of the locale |
### Responses
**200** Successful retrieval of available languages (application/json). Schema: AvailableLanguagesResponse
**401** Unauthorized - Invalid API key (application/json). Schema: ErrorResponse
**InvalidKey**
```json
{
"error": {
"code": "InvalidKey",
"message": "Authentication failed; invalid API key"
}
}
```
**MissingKey**
```json
{
"error": {
"code": "MissingKey",
"message": "Authentication failed; missing required API key parameter or header"
}
}
```
[Read the guide](https://developer.what3words.com/public-api/docs#available-languages)
## Schemas
The objects the endpoints return.
### Coordinates
| Field | Type | Description |
| --- | --- | --- |
| `lat` | number | Latitude |
| `lng` | number | Longitude |
### Square
| Field | Type | Description |
| --- | --- | --- |
| `southwest` | object (Coordinates) | |
| `southwest.lat` | number | Latitude |
| `southwest.lng` | number | Longitude |
| `northeast` | object (Coordinates) | |
| `northeast.lat` | number | Latitude |
| `northeast.lng` | number | Longitude |
### ConvertTo3waResponse
| Field | Type | Description |
| --- | --- | --- |
| `country` | string | The country in which the what3words address is located, as an ISO 3166-1 alpha-2 country code |
| `square` | object (Square) | |
| `square.southwest` | object (Coordinates) | |
| `square.southwest.lat` | number | Latitude |
| `square.southwest.lng` | number | Longitude |
| `square.northeast` | object (Coordinates) | |
| `square.northeast.lat` | number | Latitude |
| `square.northeast.lng` | number | Longitude |
| `nearestPlace` | string | The nearest place to the what3words address |
| `coordinates` | object (Coordinates) | |
| `coordinates.lat` | number | Latitude |
| `coordinates.lng` | number | Longitude |
| `words` | string | The what3words address |
| `language` | string | The language of the what3words address |
| `locale` | string | The locale of the what3words address, if returned |
| `map` | string | URL to view the what3words address on the what3words map |
### ConvertToCoordinatesResponse
| Field | Type | Description |
| --- | --- | --- |
| `country` | string | The country in which the what3words address is located, as an ISO 3166-1 alpha-2 country code |
| `square` | object (Square) | |
| `square.southwest` | object (Coordinates) | |
| `square.southwest.lat` | number | Latitude |
| `square.southwest.lng` | number | Longitude |
| `square.northeast` | object (Coordinates) | |
| `square.northeast.lat` | number | Latitude |
| `square.northeast.lng` | number | Longitude |
| `nearestPlace` | string | The nearest place to the what3words address |
| `coordinates` | object (Coordinates) | |
| `coordinates.lat` | number | Latitude |
| `coordinates.lng` | number | Longitude |
| `words` | string | The what3words address |
| `language` | string | The language of the what3words address |
| `locale` | string | The locale of the what3words address, if returned |
| `map` | string | URL to view the what3words address on the what3words map |
### AutosuggestResponse
| Field | Type | Description |
| --- | --- | --- |
| `suggestions[]` | array of AutosuggestSuggestion | List of suggested what3words addresses |
| `suggestions[].words` | string | The suggested what3words address |
| `suggestions[].country` | string | The country in which the what3words address is located, as an ISO 3166-1 alpha-2 country code |
| `suggestions[].nearestPlace` | string | The nearest place to the what3words address |
| `suggestions[].language` | string | The language of the what3words address |
| `suggestions[].locale` | string | The locale of the what3words address, if applicable |
| `suggestions[].rank` | integer | The relative ranking of this suggestion |
| `suggestions[].distanceToFocusKm` | number | The distance in kilometers from the focus point to this suggestion's coordinates |
### GridSectionResponse
| Field | Type | Description |
| --- | --- | --- |
| `lines[]` | array of object | Array of line objects that make up the grid |
| `lines[].start` | object (Coordinates) | |
| `lines[].start.lat` | number | Latitude |
| `lines[].start.lng` | number | Longitude |
| `lines[].end` | object (Coordinates) | |
| `lines[].end.lat` | number | Latitude |
| `lines[].end.lng` | number | Longitude |
### GridSectionGeoJsonResponse
GeoJSON representation of the grid section
### Locale
| Field | Type | Description |
| --- | --- | --- |
| `code` | string | The locale code |
| `name` | string | The name of the locale |
| `nativeName` | string | The native name of the locale |
### Language
| Field | Type | Description |
| --- | --- | --- |
| `code` | string | The what3words language code for the language or language family (for example `en`, `mn`, `oo`). |
| `name` | string | The English name of the language |
| `nativeName` | string | The name of the language in that language |
| `locales[]` | array of Locale | List of available locales for this language, if applicable |
| `locales[].code` | string | The locale code |
| `locales[].name` | string | The name of the locale |
| `locales[].nativeName` | string | The native name of the locale |
### AvailableLanguagesResponse
| Field | Type | Description |
| --- | --- | --- |
| `languages[]` | array of Language | List of available languages |
| `languages[].code` | string | The what3words language code for the language or language family (for example `en`, `mn`, `oo`). |
| `languages[].name` | string | The English name of the language |
| `languages[].nativeName` | string | The name of the language in that language |
| `languages[].locales[]` | array of Locale | List of available locales for this language, if applicable |
| `languages[].locales[].code` | string | The locale code |
| `languages[].locales[].name` | string | The name of the locale |
| `languages[].locales[].nativeName` | string | The native name of the locale |
### Error
| Field | Type | Description |
| --- | --- | --- |
| `code` | string | Error code that can be used programmatically |
| `message` | string | A helpful message explaining what went wrong |
### ErrorResponse
| Field | Type | Description |
| --- | --- | --- |
| `error` | object (Error) | |
| `error.code` | string | Error code that can be used programmatically |
| `error.message` | string | A helpful message explaining what went wrong |
### AutosuggestSuggestion
| Field | Type | Description |
| --- | --- | --- |
| `words` | string | The suggested what3words address |
| `country` | string | The country in which the what3words address is located, as an ISO 3166-1 alpha-2 country code |
| `nearestPlace` | string | The nearest place to the what3words address |
| `language` | string | The language of the what3words address |
| `locale` | string | The locale of the what3words address, if applicable |
| `rank` | integer | The relative ranking of this suggestion |
| `distanceToFocusKm` | number | The distance in kilometers from the focus point to this suggestion's coordinates |
### AutosuggestWithCoordinatesSuggestion
| Field | Type | Description |
| --- | --- | --- |
| `words` | string | The suggested what3words address |
| `country` | string | The country in which the what3words address is located, as an ISO 3166-1 alpha-2 country code |
| `square` | object (Square) | |
| `square.southwest` | object (Coordinates) | |
| `square.southwest.lat` | number | Latitude |
| `square.southwest.lng` | number | Longitude |
| `square.northeast` | object (Coordinates) | |
| `square.northeast.lat` | number | Latitude |
| `square.northeast.lng` | number | Longitude |
| `nearestPlace` | string | The nearest place to the what3words address |
| `coordinates` | object (Coordinates) | |
| `coordinates.lat` | number | Latitude |
| `coordinates.lng` | number | Longitude |
| `language` | string | The language of the what3words address |
| `locale` | string | The locale of the what3words address, if returned |
| `rank` | integer | The relative ranking of this suggestion |
| `distanceToFocusKm` | number | The distance in kilometers from the focus point to this suggestion's coordinates |
| `map` | string | URL to view the what3words address on the what3words map |
### AutosuggestWithCoordinatesResponse
| Field | Type | Description |
| --- | --- | --- |
| `suggestions[]` | array of AutosuggestWithCoordinatesSuggestion | List of suggested what3words addresses including coordinates |
| `suggestions[].words` | string | The suggested what3words address |
| `suggestions[].country` | string | The country in which the what3words address is located, as an ISO 3166-1 alpha-2 country code |
| `suggestions[].square` | object (Square) | |
| `suggestions[].square.southwest` | object (Coordinates) | |
| `suggestions[].square.southwest.lat` | number | Latitude |
| `suggestions[].square.southwest.lng` | number | Longitude |
| `suggestions[].square.northeast` | object (Coordinates) | |
| `suggestions[].square.northeast.lat` | number | Latitude |
| `suggestions[].square.northeast.lng` | number | Longitude |
| `suggestions[].nearestPlace` | string | The nearest place to the what3words address |
| `suggestions[].coordinates` | object (Coordinates) | |
| `suggestions[].coordinates.lat` | number | Latitude |
| `suggestions[].coordinates.lng` | number | Longitude |
| `suggestions[].language` | string | The language of the what3words address |
| `suggestions[].locale` | string | The locale of the what3words address, if returned |
| `suggestions[].rank` | integer | The relative ranking of this suggestion |
| `suggestions[].distanceToFocusKm` | number | The distance in kilometers from the focus point to this suggestion's coordinates |
| `suggestions[].map` | string | URL to view the what3words address on the what3words map |