APIs
Address autocomplete API
An address autocomplete API suggests addresses and places while a person is still typing, treating the last word as an unfinished prefix. oslew returns ranked completions, each with a position, a precision and a licence code, and deliberately no confidence score, because a half-typed query does not yet determine an answer. It is sold as a sustained rate on the Search plan, so the dozen requests one address can generate, keystroke by keystroke, add nothing to the bill.
Last reviewed
Autocomplete is the one geocoding interaction where the person is still forming the question. That changes almost everything about how it should behave: what it matches, how it ranks, what it claims about its answers, and — because it runs on every pause in typing — how it should be priced. GET /v1/autocomplete is built around those differences rather than being a geocoder called early.
How a half-typed query is read
Every word except the last must match a whole word of a name, after the same normalisation the geocoder applies: case and accents folded, punctuation dropped, abbreviations expanded. The last word is a prefix. Museo Sou asks for names containing the word museo and a word beginning sou. The prefix is expanded to the dictionary terms it starts, up to a fixed cap, most prominent and most common first — which means a one- or two-letter prefix reaches the famous names and misses obscure ones until more is typed.
A house number is a word like any other, so it completes too: a number typed after a street can offer that number and longer ones beginning with the same digits, each an address point. When nothing at all begins with the letters typed, the last word is repaired as if it were misspelt, by one edit or two swapped neighbouring letters. A repaired suggestion is not marked as one, so if that matters in your interface, compare the suggestion’s name with what was typed before showing it.
Ranking for someone still typing
Completions are ordered by three keys, each visible on the result so the order can be explained:
- Words matched, most first, the typed prefix counting as one. Matching more of the query always wins.
- Prominence, highest first: a logarithmic measure of how widely a place is referenced in Wikidata, zero where it is not matched there.
- Extra words in the name that the query did not cover, fewest first.
Forward geocoding puts the last two the other way round, on purpose. Someone who has finished typing museo wants the place called exactly that, so the shorter name should win. Someone who has typed mus and paused most likely wants the museum everyone means, so the famous one should win even though its name is longer.
Why there is no confidence score
The geocoder’s confidence is calibrated against finished queries: it reports how often answers of the same shape were right. A prefix is not a finished query, so a completion carries no confidence and no tied_at_top. Inventing either would put an unmeasured number in front of a developer who would then threshold on it.
A completion is deliberately smaller than a geocoding result: a name, a position, a precision — poi for a place, the address row’s own kind otherwise — a hierarchy with locality, region, postcode and street as the row records them, the three ranking keys, and its provenance with a licence code. There is no normalised address and no match explanation. The doc field is a position inside an index segment, not an identifier: it changes when the index is rebuilt, so never store it.
Where: near, and why commas do little here
near keeps only suggestions inside the grid cell of about 10 km that holds a point — roughly a city. It is a filter, not a preference: it does not order by distance, it drops places just across the cell’s edge, and it does not widen when nothing inside matches. Pass the user’s position, the centre of the map they are looking at, or the city they chose earlier, when the answer must be there; leave it out for a search box that means anywhere.
As in geocoding, text after the last comma is treated as context, but here it is used raw. It must equal a value a row actually records — a locality, a region, a postcode, a country — with no resolution through the administrative divisions and no fallback. So suggestions vanish while someone types a city after a comma, and reappear only when the word is complete and spelt as the data spells it. For a free-typing box, send the text before the first comma and express “where” with near.
Keystrokes, and why a rate suits them
One completed address costs one geocode and, typically, five to fifteen suggestion requests. Priced per request, that multiplier lands on the bill; priced per session, the unit changes but every address typed still carries a price. Two published examples: Autocomplete Requests (Places API (New), Essentials) are billed at $2.83 per 1,000 from the end of the 10,000 free cap to 100,000 a month. (Google Maps Platform, read 24 Sep 2026) Search Box API sessions (up to 50 /suggest calls and 1 /retrieve) are free up to 500 a month, then $3.00 per 1,000 sessions at introductory preview pricing. (Mapbox, read 24 Sep 2026) The public Nominatim instance rules the pattern out altogether: Auto-complete search is strictly forbidden on the public instance, including building it client-side on the API. (Nominatim (OpenStreetMap Foundation public instance), read 24 Sep 2026)
oslew sells autocomplete as capacity. The Search plan is $299 a month for 20 requests a second sustained, burst 100 of search, and a suggestion inside that rate is already paid for, however many a form sends. What you size is concurrency — how many people are typing at the same moment — not how many addresses they eventually enter. Search is its own product with its own bucket, separate from the Address bucket that geocoding and validation use, so a burst of typing on one page never makes a geocode elsewhere wait. The explainer on rate limits and quotas goes through why a sustained rate with a burst fits traffic shaped like this.
Keys stay on your server
The service sends no CORS headers, so a page on another origin cannot call it from a browser. A key grants every product its plan includes: there are no per-key scopes, IP allowlists or referrer restrictions. Together those settle the architecture: the browser calls a small route on your own backend, and the backend calls oslew with the key in the Authorization header. That proxy is also where you enforce what the page may ask for — the query text and a near point, with limit fixed — and where you put a per-user or per-session limit, because otherwise anyone who finds the route can spend your rate through it.
Debouncing and the rest of a good search box
- Debounce. Send a request when typing pauses for a couple of hundred milliseconds, not on every keystroke. Every request takes a token whether anyone sees its answer or not.
- Wait for a few characters. Below about three, a prefix expands to the commonest words it starts and the list is noise.
- Cancel the request in flight when a newer one starts. Answers do not arrive in the order they were asked, and a slow answer to an older prefix must not replace a fresh one. Cancelling fixes the order; it saves nothing, because the token is already spent — which is why debouncing, not cancelling, keeps a box within its rate.
- Fail quietly. On HTTP 429 or any error, show no suggestions and let the person keep typing. A suggestion that arrives after a retry is for text that no longer exists.
After the pick
When the person chooses, call geocoding with the chosen name and something that pins it — its postcode or locality after a comma — or address validation once they have added a house number, and keep that answer rather than the completion. Only the full answer carries a normalised address to store, a calibrated confidence and a tie count, and only validation says whether the number exists on that street. The checkout form use case puts the whole sequence together.
Limits worth knowing
- No confidence, no tie count and no normalised address on a completion.
- Context after a comma must match a recorded value exactly; there is no fallback.
nearis a hard cell boundary, not a distance ranking.- A repaired, misspelt-word suggestion is not labelled as a repair.
- Suggestions are limited to the addresses and places loaded for the area.
Bottom line
Use autocomplete to help a person pick something the data knows, then resolve their pick with a geocode or validation. Debounce it, proxy it, and size the Search rate by how many people type at once — the number of keystrokes is not something you pay for.
Questions
Why does the autocomplete API return no confidence score?
Because there is nothing yet to be confident about. A calibrated confidence says how often answers of a given shape turned out right on finished queries. A prefix such as Museo Sou has no right answer, only likelier and less likely continuations, and a number that looked like a probability would be one nobody measured. Confidence arrives with the geocode or validation you run after the person chooses.
Can I call the autocomplete API directly from the browser?
The service sends no CORS headers, so a page on another origin cannot call it from a browser. A key also grants every product on its plan, with no referrer or IP restriction, so a key shipped in a web page is a key anyone can copy. The browser calls a route on your own server, and that server calls the API with the key it holds.
How many requests does address autocomplete make?
Typically between five and fifteen suggestion requests for one completed address, one per pause in typing, plus one geocode or validation when the person chooses. With a debounce of a couple of hundred milliseconds, one person typing steadily sends at most a handful a second, and usually far fewer.
Does near bias suggestions towards the user’s location?
No, it filters. near keeps only suggestions inside the grid cell of about 10 km that contains the point, and does not reorder anything within it. A place just across the cell’s edge is not offered at all, and if nothing inside the cell matches, the list is empty rather than widened.
Which plan includes address autocomplete?
Autocomplete and nearby places make up the Search product. The Search plan is $299 a month for 20 requests a second sustained, burst 100 of search, alongside the Address product for the geocode that follows a selection; Platform and Scale include it too. Each product has its own bucket, so typing never slows a geocode.