The MapBox API


2 min read

The MapBox API just got a fresh coat of paint and much-improved documentation to make it easier build new applications with fast, custom maps hosted with MapBox. To show it off I wrote a quick demo called Scope that uses the API in combination with Easey and Modest Maps to do a whole new kind of map browser for MapBox’s maps.

We’ve already used the API to build custom sites for NPR, the World Food Programme, and others, providing an established version that will continue to work as development on the API continues. We’ve also added extensive documentation on how to work with the API.

b7c589040ac7  0QdstQq6KktUQQF6V

So what does the API provide? One example is that you can grab a listing of your maps and information about each one as TileJSON, which you can then turn into an interactive map using Wax.

For instance, here’s the Baltimore Retro map described by the API:

  "name":"Baltimore Retro",
    -76.74498303380417, 39.17336668704772,
    -76.49504406900537, 39.39976653736744
    -76.62001355140478, 39.28656661220758,

It’s super easy to use this with Wax and Modest Maps:

  function(tilejson) {
    var map = new com.modestmaps.Map(

The API speaks JSON, a format that has parsers in nearly every programming environment and is especially friendly with Javascript. Every API endpoint is also accessible with JSONP, which lets you pull it from MapBox without the need for messy proxies or cross-domain restrictions. For Flash users, we provide a crossdomain.xml file as well, and for those on the cutting edge, the service supports CORS.

b7c589040ac7  0 sDWw9 LUAAg3LOB

The API is open source and is only tied to MapBox’s account in one place

  • so everyone is welcome to tinker with changes or use it as their own map browser.

While we’re busy making TileMill and MapBox Hosting amazing, there’s so much more that is still waiting to be built. Hopefully this API brings those ideas closer to reality.

What we're doing.