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)

1Step 1: Get Started#

  • Create a what3words account by signing up to a plan

Get an API key

You will need a what3words API key to complete this tutorial

  • 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 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. 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
{
    "message_code": 894,
    "message": "Client key not provided"
}

2Step 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
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"}'
ParametersRequired/OptionalDescriptionExample
keyRequiredPartner API keykey=PK2D3J230291

Request body

Request BodyRequired/OptionalDescriptionExample
nameRequiredName of API key. Could be the account name or an ID."name": "My app"
descriptionRequiredDescription of API key. Could be the account name or an ID or type of account"description": "My test app"

Example Request

POST

Example Result

JSON
{
   "api_key": "PG122LFC4W98",
   "name": "name of app",
   "description": "description of app",
   "suspended": false
}

3Step 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
curl --location --request GET 'https://accountsapi.what3words.com/partner/v1/application?key=PK2D3j230291&page=1&per_page=10'
ParametersRequired/OptionalDescriptionExample
keyRequiredPartner API keykey=PK2D3J230291
api_keyOptionalAPI keyapi_key=LFC4W98R
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
       }
   ]
}

4Step 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
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"}'
ParametersRequired/OptionalDescriptionExample
keyRequiredPartner API keykey=PK2D3J230291

Request body

Request BodyRequired/OptionalDescriptionExample
api_keyRequiredKey to be changed"api_key": "PGLFC4W98R"
suspendedRequiredSuspended - true/false"suspended": false
JSON
{
   "api_key": "PGLFC4W98R",
   "name": "name of app",
   "description": "description of app",
   "suspended": false
}

5Step 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
curl --location --request POST 'https://accountsapi.what3words.com/partner/v1/application/link?key=PK2D3J230291' \
--header 'Content-Type: application/json' \
--data-raw '{"client_api_key": "<client-application-key>"}'
ParametersRequired/OptionalDescriptionExample
keyRequiredPartner API keykey=PK2D3J230291

Request body

Request BodyRequired/OptionalDescriptionExample
client_api_keyRequiredAPI key created through accounts.what3words.com{ "client_api_key": "<client-application-key>" }

Example Request

POST

esc
↑ ↓ to choose↵ to openesc to close