In this article, we will explain how to get a Mapbox API token, for free, that can be used for your WP Maps account.
How to Get a Mapbox API Token #
To get or generate a Mapbox API token please follow the below steps:
- Go to the Mapbox website
- Click on the “Get started for free” button on the homepage
- Create an account by following the on-screen instructions or log into your account if you already have one created
- On the main dashboard of your Mapbox account, click on the “Create a token” button under the “Access tokens” section
- On the next page, give the token a name that relates to your project and enter the address of the website (in this form – https://www.mywebsite.com) that will use the Mapbox API token
- You can even add multiple URLs if you like; press the “add URL” button to add additional URLs
- The Mapbox API token will automatically be restricted for all URLs you have entered, and your token will be safe to use
- Finally, click on the “Create Token” button to generate the Mapbox API token
You will get a notification confirming that the Mapbox token has been created.
Now you can copy the newly created token by clicking on the “copy” icon on your Mapbox account.
Adding the Mapbox API Token to WP Maps #
Now that you know how to generate a Mapbox API token, let’s see how you can add this token to WP Maps so that your store locator widget will be able to use the services of Mapbox.
Please follow the below steps to add your Mapbox token to your WP Maps account successfully.
- Copy the Mapbox API token that you generated
- Login to your WP Maps account
- Click on the “Administrator” tab on the sidebar menu
- Under the “API Keys” section, select the “Mapbox” sub-tab
- Paste the Mapbox token in the “Mapbox access token” field
- Click on “Save Mapbox Token”
Now when you create a store locator widget using WP Maps, the Mapbox map embedded in the store locator widget will function properly.
To create a store locator widget using WP Maps please follow the below steps:
- Login to your WP Maps account
- Go to the “Widgets” tab
- Click on the “Install Widget” button to create your store locator widget
Please see the following article for more details on how to configure a store and product locator widget on WP Maps.
If you have already created a widget build, then you will need to update the build after you add the Mapbox API token. To update an existing build, please follow the below steps:
- Click on the “Widgets” tab
- Locate the build you have created, and click on the “Update” button
- Now the build that you had previously created will use the Mapbox API token key that you created, and the map on the store locator will function properly
For more details on how to get a Mapbox API token and how to add it to WP Maps, please see the below article which includes a video tutorial.