Address autocomplete and geocoding
Find any address in North America and Europe as it is typed.
MapsHQ is a typeahead and geocoding API built on open address data, with a free plan and prices well below the incumbents.
1600 pennsylvania av
select1600 Pennsylvania Avenue NW Washington, DC 20500
rooftop- placeType
- address
- lat
- 38.8977
- lng
- -77.0365
MapsHQ is in development and has not launched. This page describes the API as it is specified and built so far, and its samples are illustrative.
One call per keystroke. One result shape for every endpoint.
Suggestions arrive while the address is still a prefix, and a typed house number resolves to its point.
Request
curl 'https://api.mapshq.org/v1/suggest?q=1600+pennsylvania+av&limit=1&session_token=3f0c2a9e-7d41-4b8a-9a55-1c2e6f7d8b90' \
-H 'X-MapsHQ-Key: mapshq_pk_...'
- Keys. Publishable keys are locked to your origins. Secret keys travel in the header only.
- Sessions. One token covers up to 50 suggestions and the retrieve that ends them, billed as one session.
- Credits. Each response names the data sources behind its results.
Response 200 application/json
{
"results": [
{
"id": "mhq:address:1234567890123456789:1600",
"text": "1600 Pennsylvania Avenue NW, Washington, DC 20500",
"center": { "lat": 38.8977, "lng": -77.0365 },
"placeType": "address",
"relevance": 0.97,
"properties": {
"house_number": "1600", "housenumber": "1600",
"street": "Pennsylvania Avenue NW", "unit": null,
"postcode": "20500", "city": "Washington", "state": "DC",
"country_code": "us", "confidence": "rooftop",
"accuracy": "rooftop", "source": "us-nad"
}
}
],
"attribution": "National Address Database (NAD) from the U.S. Department of Transportation"
}
- GET /v1/suggest
- Suggestions while the address is being typed.
- Billed per session
- GET /v1/retrieve/{id}
- The full result for the suggestion that was picked.
- Ends the session
- GET /v1/search
- Geocodes a finished address, street or place.
- Billed per request
- GET /v1/reverse
- The cities, towns and villages nearest a coordinate.
- Billed per request
Open data in, two search tiers, one answer out.
Open address data
Overture Maps is the main address feed, admitted one source at a time after its licence is reviewed. Places come from GeoNames.
Streets in memory
The first tier keeps one entry per street in a locality, with places and postcode areas, so the street is found while you type.
House numbers on disk
The second tier packs each street's house numbers into a read-only store. It is read only when a number was typed.
Every suggest answer times its own stages in a Server-Timing header:
- parse
- tier1
- tier2
- rank
- format
38 countries and territories, and an honest level for each.
Coverage follows the open data. Where a country publishes no open address register, MapsHQ says so instead of guessing.
- House numbers in 27
- Address points exist for most of the country.
- Streets and postcodes in 1
- Streets resolve; house numbers do not.
- United Kingdom
- Cities and towns in 10
- Localities only, until an approved address source is added.
- Bulgaria, Cyprus, Greece, Hungary, Ireland, Liechtenstein, Malta, Portugal, Romania, Sweden
Priced per session, not per keystroke.
A typeahead session is every suggestion for one address plus the retrieve that ends it. Search and reverse calls count as requests.
Free
$0
- Included each month
- 10,000 sessions and 10,000 requests
- Beyond that
- Hard cap, then a 429 with an upgrade link
- "Powered by MapsHQ" credit required
Pro
$29 a month
- Included each month
- 100,000 sessions and 100,000 requests
- Beyond that
- $1.50 per 1,000 sessions, $0.75 per 1,000 requests
- No MapsHQ credit required
Business
$199 a month
- Included each month
- 1,000,000 sessions and 1,000,000 requests
- Beyond that
- $1 per 1,000 sessions, $0.50 per 1,000 requests
- No MapsHQ credit required
Enterprise is priced by contract. Data source credits apply on every plan.
A small surface with a stable contract.
Works with ts-maps unchanged
Search and reverse speak the ts-maps Gazetteer contract, so its geocoder needs a base URL and a key, and no MapsHQ-specific code.
import { GazetteerGeocoder } from 'ts-maps/services'
const geocoder = new GazetteerGeocoder({
baseUrl: 'https://api.mapshq.org/v1',
headers: { 'X-MapsHQ-Key': key },
})
const results = await geocoder.search('1600 Pennsylvania Avenue NW')
Additive within /v1
New endpoints, optional parameters and fields only. A breaking change is a /v2, and /v1 stays for at least 12 months after it ships.
Headers that explain themselves
Responses carry a request id, the standard RateLimit fields and the id of the data release that answered.
Errors a program can read
Every error is problem JSON with a stable code and a request id to quote.
{
"type": "https://mapshq.org/errors/invalid_parameter",
"title": "Invalid parameter",
"status": 400,
"code": "invalid_parameter",
"detail": "limit must be an integer from 1 to 10",
"param": "limit",
"request_id": "req_..."
}
The Free plan is the trial.
10,000 sessions and 10,000 requests a month for $0.