Mapbox Geocoding drop-in replacement
Both the older v5 Geocoding API and the current v6 endpoints answer at mapbox.mygeocode.com. Results are GeoJSON FeatureCollections with the same context arrays, place_type values and coordinate order that Mapbox clients rely on.
Change one hostname
| Original host |
|
|---|---|
| Use instead | mapbox.mygeocode.com |
| Key parameter | access_token (optional: any address gets 2,500 requests a day with no key; put your My Geocode key here for credit, packages and a usage history) |
curl "https://api.mapbox.com/geocoding/v5/mapbox.places/1%20Market%20St%2C%20San%20Francisco%2C%20CA.json?access_token=YOUR_MAPBOX_TOKEN"curl "https://mapbox.mygeocode.com/geocoding/v5/mapbox.places/1%20Market%20St%2C%20San%20Francisco%2C%20CA.json?access_token=YOUR_MYGEOCODE_KEY"Why people move
Mapbox bills temporary and permanent geocoding differently and ties usage to an account with a card on file. Here, results are yours to keep and every account's first 2,500 requests a day are free.
Same free allowance, key or not. Requests to mapbox.mygeocode.com count toward the same 2,500 free requests a day your address, or your key, gets on our own endpoints. Above that, prepaid credit at €0.0001 per request, or €50 a month for an Unlimited key. Signing up takes a name and an email address, and no card.
Endpoints
| Path on mapbox.mygeocode.com | What it does | Backed by |
|---|---|---|
/geocoding/v5/mapbox.places/{query}.json | Forward geocoding, v5 | Forward geocoding |
/geocoding/v5/mapbox.places/{lon},{lat}.json | Reverse geocoding, v5 | Reverse geocoding |
/geocoding/v5/mapbox.places-permanent/{query}.json | Permanent geocoding, v5 (answered like mapbox.places) | Forward geocoding |
/search/geocode/v6/forward?q=... | Forward geocoding, v6 | Forward geocoding |
/search/geocode/v6/reverse?longitude=...&latitude=... | Reverse geocoding, v6 | Reverse geocoding |
/search/searchbox/v1/suggest?q=... | Search Box suggestions | Address autocomplete |
Example response
This is what the request above returns. Field names, nesting and types follow Mapbox. Only the data behind them is ours.
{
"type": "FeatureCollection",
"query": ["1", "market", "st", "san", "francisco", "ca"],
"features": [
{
"id": "address.2563491525",
"type": "Feature",
"place_type": ["address"],
"relevance": 1.0,
"properties": {
"accuracy": "interpolated"
},
"text": "Market St",
"place_name": "1 Market St, San Francisco, CA 94102, United States",
"center": [-122.414784, 37.778742],
"geometry": {
"type": "Point",
"coordinates": [-122.414784, 37.778742]
},
"address": "1",
"context": [
{
"id": "postcode.1338638920",
"text": "94102"
},
{
"id": "place.1062917827",
"text": "San Francisco"
},
{
"id": "region.3476656697",
"short_code": "US-CA",
"text": "California"
},
{
"id": "country.3667771338",
"short_code": "us",
"text": "United States"
}
]
},
{
"id": "address.623645742",
"type": "Feature",
"place_type": ["address"],
"relevance": 1.0,
"properties": {
"accuracy": "interpolated"
},
"text": "Market St",
"place_name": "1 Market St, San Francisco, CA 94105, United States",
"center": [-122.394747, 37.794478],
"geometry": {
"type": "Point",
"coordinates": [-122.394747, 37.794478]
},
"address": "1",
"context": [
{
"id": "postcode.3517880299",
"text": "94105"
},
{
"id": "place.1062917827",
"text": "San Francisco"
},
{
"id": "region.3476656697",
"short_code": "US-CA",
"text": "California"
},
{
"id": "country.3667771338",
"short_code": "us",
"text": "United States"
}
]
}
],
"attribution": "My Geocode, https://www.mygeocode.com/terms/"
}Details and differences
No key is needed for the first 2,500 requests a day. To use a My Geocode key, put it where your Mapbox key went: the access_token query parameter. The X-API-Key header, Authorization: Bearer and HTTP Basic authentication (the key as the user name) work on every host too, so client libraries that authenticate their own way keep working unchanged.
Copyright lines, licence names, terms and privacy links in the response are ours rather than the original provider’s. Everything else keeps the original shape.
- Both the v5 Places and the v6 search endpoints are routed, along with the Search Box suggest endpoint.
POST /search/geocode/v6/batchwith a JSON array of up to 1,000 query objects (forwardqor reverselongitude/latitude) answers{"batch": [...]}with one FeatureCollection per query, as Mapbox does; each query counts as one request, as Mapbox counts them.
If your client depends on a field or behaviour that is not listed here, tell us. Compatibility gaps get fixed quickly because they are usually small.
Other drop-in hosts
- Google Maps
- Bing Maps
- HERE
- Geocode.Farm
- Nominatim (OSM)
- OpenCage
- LocationIQ
- Geoapify
- TomTom
- MapQuest
- Geocodio
- PositionStack
- ip-api
- ipinfo
- ipstack
- Open-Elevation
How the drop-ins work, the overview, and the JavaScript library drop-ins.