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 (put your My Geocode key here, or leave it out for the free 2,500 a day) |
curl "https://api.mapbox.com/geocoding/v5/mapbox.places/1%20Market%20St%20San%20Francisco.json?access_token=YOUR_MAPBOX_TOKEN"curl "https://mapbox.mygeocode.com/geocoding/v5/mapbox.places/1%20Market%20St%20San%20Francisco.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 the first 2,500 requests a day are free.
Try it before you sign up for anything. Requests to mapbox.mygeocode.com count toward the same 2,500 a day you get on our own endpoints, with no key and no account. Above that, credits at $0.001 per request or €50 a month unlimited. Signing up takes an email address and nothing else.
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 |
/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"],
"features": [
{
"id": "address.mg.us.4d2e8b10",
"type": "Feature",
"place_type": ["address"],
"relevance": 1,
"properties": { "accuracy": "rooftop" },
"text": "Market Street",
"place_name": "1 Market Street, San Francisco, California 94105, United States",
"center": [-122.394626, 37.793858],
"geometry": { "type": "Point", "coordinates": [-122.394626, 37.793858] },
"address": "1",
"context": [
{ "id": "neighborhood.mg.us.fidi", "text": "Financial District" },
{ "id": "postcode.mg.us.94105", "text": "94105" },
{ "id": "place.mg.us.sanfrancisco", "wikidata": "Q62", "text": "San Francisco" },
{ "id": "region.mg.us.ca", "short_code": "US-CA", "text": "California" },
{ "id": "country.mg.us", "short_code": "us", "text": "United States" }
]
}
],
"attribution": "My Geocode, https://mygeocode.com/terms/"
}Details and differences
- Coordinates are [longitude, latitude] as in GeoJSON. properties.accuracy reports rooftop, street, interpolated or approximate from our precision field.
- The proximity, bbox, country, language, limit, types and autocomplete parameters are honoured on both v5 and v6.
- Permanent geocoding (mapbox.places-permanent) and batch endpoints are answered as normal requests. You may store our results under our terms, so the distinction does not exist here.
- mapbox-gl-geocoder can point at this host with its origin option. See the JavaScript drop-ins page.
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.