How to Create a Free Mapbox API Token

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:

  1. Go to the Mapbox website
  2. Click on the “Get started for free” button on the homepage
  3. Create an account by following the on-screen instructions or log into your account if you already have one created
  4. On the main dashboard of your Mapbox account, click on the “Create a token” button under the “Access tokens” section
    Create A Mapbox Api Token
  1. 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
  2. You can even add multiple URLs if you like; press the “add URL” button to add additional URLs
  3. The Mapbox API token will automatically be restricted for all URLs you have entered, and your token will be safe to use
  4. Finally, click on the “Create Token” button to generate the Mapbox API token
    Screen Shot 2024 07 09 At 4.16.45 Pm

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.

Screen Shot 2024 07 09 At 4.18.32 Pm

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.

  1. Copy the Mapbox API token that you generated
  2. Login to your WP Maps account
  3. Click on the “Administrator” tab on the sidebar menu
  4. Under the “API Keys” section, select the “Mapbox” sub-tab
  5. Paste the Mapbox token in the “Mapbox access token” field
  6. Click on “Save Mapbox Token” 
    Screen Shot 2024 07 09 At 4.21.12 Pm

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:

  1. Login to your WP Maps account
  2. Go to the “Widgets” tab
  3. Click on the “Install Widget” button to create your store locator widget
    Screen Shot 2024 07 09 At 12.34.39 Pm

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:

  1. Click on the “Widgets” tab
  2. Locate the build you have created, and click on the “Update” button
  3. 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
    Screen Shot 2024 07 09 At 12.38.19 Pm

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.