Legacy

Mapbox.js is no longer in active development. To learn more about our newer mapping tools see Mapbox GL JS.

You are viewing an older version of Mapbox.js. Check out v3.3.1 for the latest.

API access tokens

Mapbox.js uses the Mapbox web services API, which requires an API access token. You must supply an access token to Mapbox.js:

 L.mapbox.accessToken = '<your access token>';

To obtain an access token, sign in to Mapbox and visit the Account Apps page. For Mapbox.js, a "Public" token (starting with "pk") is required.

You may create multiple tokens and use different ones for different applications. If necessary, you can use different tokens on the same page by using the accessToken option when creating Mapbox.js objects. For example:

 var map = L.mapbox.map('map', 'mapbox.outdoors', {
   accessToken: '<your access token>'
 });

For additional help, see "How do I create an API access token?".