Nearby places and hours
GET /v1/nearby answers "what is around here": the places nearest a point, nearest first, each with its distance. It returns places only — museums, shops, restaurants — never address rows. For the nearest addresses, or both together, use reverse geocoding.
curl -G "https://api.oslew.com/v1/nearby" \
-H "Authorization: Bearer $GEO_API_KEY" \
--data-urlencode 'at=19.4406,-99.2047' \
--data-urlencode 'category=restaurant' \
--data-urlencode 'limit=3'from oslew import Client
# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")
answer = client.nearby("19.4406,-99.2047", category="restaurant", limit=3)import { Client } from "@oslew/client";
// The key is read from GEO_API_KEY.
const client = new Client({ baseUrl: "https://api.oslew.com" });
const answer = await client.nearby("19.4406,-99.2047", { category: "restaurant", limit: 3 });HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 100
ratelimit-remaining: 299
ratelimit-reset: 1
{
"at": [
19.4406,
-99.2047
],
"category": "restaurant",
"results": [
{
"doc": 348326,
"name": "Comedor Corporativo Carso",
"lat": 19.440441368738824,
"lon": -99.20457299255855,
"distance_m": 22.10178797284887,
"precision": "poi",
"precision_m": 6.756173533775122,
"hierarchy": {
"locality": "Miguel Hidalgo",
"region": "CMX",
"country": "MX",
"category": "restaurant",
"postcode": null,
"street": null
},
"normalized": {
"locality": "Miguel Hidalgo",
"region": "CMX",
"country": "MX",
"formatted": "Comedor Corporativo Carso, Miguel Hidalgo, CMX, MX"
},
"provenance": {
"name": "overture-places",
"release": "2026-08-19.0",
"license": "CDLA-Permissive-2.0"
},
"attributes": null
},
{
"doc": 348330,
"name": "La Raclette",
"lat": 19.440998179292325,
"lon": -99.20448644914455,
"distance_m": 49.61579035889554,
"precision": "poi",
"precision_m": 6.756173533775122,
"hierarchy": {
"locality": "Ciudad de México",
"region": "Ciudad de México",
"country": "MX",
"category": "restaurant",
"postcode": null,
"street": null
},
"normalized": {
"locality": "Ciudad de México",
"region": "Ciudad de México",
"country": "MX",
"formatted": "La Raclette, Ciudad de México, Ciudad de México, MX"
},
"provenance": {
"name": "overture-places",
"release": "2026-08-19.0",
"license": "CDLA-Permissive-2.0"
},
"attributes": null
},
{
"doc": 348343,
"name": "Applebee’s Carso",
"lat": 19.441099050554577,
"lon": -99.20431336259566,
"distance_m": 68.7235865703977,
"precision": "poi",
"precision_m": 6.756173533775122,
"hierarchy": {
"locality": "Miguel Hidalgo",
"region": "CMX",
"country": "MX",
"category": "restaurant",
"postcode": null,
"street": null
},
"normalized": {
"locality": "Miguel Hidalgo",
"region": "CMX",
"country": "MX",
"formatted": "Applebee’s Carso, Miguel Hidalgo, CMX, MX"
},
"provenance": {
"name": "overture-places",
"release": "2026-08-19.0",
"license": "CDLA-Permissive-2.0"
},
"attributes": null
}
],
"segments": 2,
"took_us": 465
}A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.
The answer echoes the point and the category as it was matched, and each result carriesdistance_m from the point — here, three restaurants within 70 m of Museo Soumaya. "Nearest" means the nearest the data holds, however far, up to the reach described below: where places are sparse the nearest can be kilometres away, so deciding what counts as near enough is yours, and distance_m is there so you can. Every attributes here is null: no attributes feed knows these places.
Parameters
| Parameter | Default | Is |
|---|---|---|
at | required | lat,lon. |
category | none | Keep only places of this category, matched whole or as one word of it. |
open_at | none | now or unix seconds. Keep only places an attributes feed says are open then. |
limit | 5 | Places to return, clamped to 1–50. |
How far it looks
The search starts with the level-15 cells around the point — about 300 m — and widens a level at a time until it has limit places it can vouch for as the nearest, stopping at level 10, about 10 km (seecells and levels). Past that it answers with what it found, which may be fewer thanlimit, or nothing: an empty results with status 200, not an error. Positions, and so distances, are measured from level-20 cell centres, which carry up to about 7 m of error like every position the service returns.
Categories
The category you send is normalised — case and accents folded, punctuation including underscores turned into spaces — and matched against each place's own category, as hierarchy.category shows it. A place matches when its category equals yours or carries it as one word:
restaurantmatchesrestaurantandmexican_restaurant.mexican_restaurantandMexican Restaurantare the same request; the answer echoes both asmexican restaurant.shopmatchescoffee_shop, butcoffee shopdoes not matchspecialty_coffee_shop: a category of several words must match the whole category.
The vocabulary is the place source's, in snake_case — museum, restaurant,coffee_shop, real_estate_service — and the reliable way to learn it is to look at the categories real answers carry. A category no place has is not an error; it answers an empty list. So an empty list after a category you typed by hand is worth checking for spelling before concluding the area has none. The filter is applied to each row's category code as the neighbourhood is walked, before any place is built — not by fetching everything nearby and discarding most of it.
Open at a moment
open_at=now, or a unix time, keeps only the places whose opening hours say they are open at that instant. The instant is turned into a local weekday and minute in the time zone at at — the point you asked about, which near a zone border is not every place's own — from the time-zone layer (seetime zones), and tested against that weekday's hours. Two things have to be loaded for this to mean anything:
- A time-zone layer that covers the point. Without one the request is refused:
400,no time zone at the point; open_at needs one. Open sea outside any zone gets the same answer. - An attributes feed that carries hours for the places there. A place no feed knows is dropped. With no attributes feed loaded at all, nothing is ever open: the answer is an empty list, not an error.
Anything other than now or an integer is 400, open_at is `now` or unix seconds.
Hours that run past midnight are approximated in the small hours. On a day whose own hours run past midnight, the time from 00:00 to that day's closing time counts as open; the previous day's late hours are consulted only when the day itself is closed. For a place with the same late hours every night that is the right answer. For one whose schedule changes from day to day — late on Saturday, early on Monday — a request between midnight and the late closing time can be wrong in either direction, so read the hours yourself if the small hours matter.
The attributes object
Ratings, reviews, prices and opening hours are what open place data does not carry. They come from anattributes feed, joined into every place answer — nearby, reverse, geocode, here — by where and what: a cell of about 75 m around the place (and the eight around it) and its normalised name. Where no feed knows the place, attributes is null, rather than guessed. Where one does:
| Field | Is |
|---|---|
rating | 0–5, or null when the feed gives none. |
reviews | A count. 0 when the feed gives none — which cannot be told apart from a place nobody has reviewed. |
price | A tier, 0–4, or null. |
hours | Seven [open, close] pairs, Monday first, in minutes from local midnight. [0, 0] is closed that day; [0, 65535] is open all day; a close before its open runs past midnight — [1080, 120] is 18:00 to 02:00. |
photo | A Wikimedia Commons URL, when the feed has one; absent otherwise. The image is under its own Commons licence, which its Commons page states — not the feed's. |
provenance | Which feed, which release, and its licence. The attributes' own, separate from the place's. |
The same object, from a real answer — /v1/reverse beside Museo Soumaya:
HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 100
ratelimit-remaining: 298
ratelimit-reset: 1
{
"at": [
19.4406,
-99.2047
],
"admin": [
{
"doc": 2174,
"id": "7f1f3634-1218-43e7-9538-ac3d1f43fc1c",
"name": "México",
"subtype": "country",
"country": "MX",
"region": null,
"admin_level": null,
"via": "interior",
"provenance": {
"name": "overture-divisions",
"release": "2026-08-19.0",
"license": "ODbL-1.0"
}
},
{
"doc": 61,
"id": "0831989a-c65b-47db-802e-f930af64b9e4",
"name": "México",
"subtype": "country",
"country": "MX",
"region": null,
"admin_level": null,
"via": "interior",
"provenance": {
"name": "overture-divisions-maritime",
"release": "2026-08-19.0",
"license": "ODbL-1.0"
}
},
{
"doc": 1560,
"id": "bc8dbc34-544b-47c4-bdb1-d3f5ecfc6af7",
"name": "Ciudad de México",
"subtype": "region",
"country": "MX",
"region": "MX-CMX",
"admin_level": 1,
"via": "boundary",
"provenance": {
"name": "overture-divisions",
"release": "2026-08-19.0",
"license": "ODbL-1.0"
}
},
{
"doc": 1357,
"id": "f7ff371f-1662-496e-9413-54c1ff115318",
"name": "Miguel Hidalgo",
"subtype": "county",
"country": "MX",
"region": "MX-CMX",
"admin_level": 2,
"via": "boundary",
"provenance": {
"name": "overture-divisions",
"release": "2026-08-19.0",
"license": "ODbL-1.0"
}
},
{
"doc": 1522,
"id": "2b1d49e2-98ef-4665-b9f6-1ce96c9f015b",
"name": "Ciudad de México",
"subtype": "locality",
"country": "MX",
"region": "MX-CMX",
"admin_level": null,
"via": "boundary",
"provenance": {
"name": "overture-divisions",
"release": "2026-08-19.0",
"license": "ODbL-1.0"
}
},
{
"doc": 1349,
"id": "7b906a62-7024-45cf-bbfa-1618f4bb7b32",
"name": "Ampliación Granada",
"subtype": "neighborhood",
"country": "MX",
"region": "MX-CMX",
"admin_level": null,
"via": "boundary",
"provenance": {
"name": "overture-divisions",
"release": "2026-08-19.0",
"license": "ODbL-1.0"
}
},
{
"doc": 147,
"id": "America/Mexico_City",
"name": "America/Mexico_City",
"subtype": "timezone",
"country": null,
"region": null,
"admin_level": null,
"via": "interior",
"provenance": {
"name": "timezone-boundary-builder",
"release": "2026d",
"license": "ODbL-1.0"
}
}
],
"results": [
{
"doc": 348329,
"name": "Museo Soumaya",
"lat": 19.44062110346353,
"lon": -99.20465953606559,
"distance_m": 4.848551852818172,
"precision": "poi",
"precision_m": 6.756173533775122,
"hierarchy": {
"locality": "Miguel Hidalgo",
"region": "CMX",
"country": "MX",
"category": "museum",
"postcode": null,
"street": null
},
"normalized": {
"locality": "Miguel Hidalgo",
"region": "CMX",
"country": "MX",
"formatted": "Museo Soumaya, Miguel Hidalgo, CMX, MX"
},
"provenance": {
"name": "overture-places",
"release": "2026-08-19.0",
"license": "CDLA-Permissive-2.0"
},
"attributes": {
"rating": null,
"reviews": 0,
"price": null,
"hours": [
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
]
],
"photo": "https://commons.wikimedia.org/wiki/Special:FilePath/Museo_Soumaya%2C_Ciudad_de_M%C3%A9xico%2C_M%C3%A9xico%2C_2015-07-18%2C_DD_12.JPG",
"provenance": {
"name": "wikidata",
"release": "2026-11-23",
"license": "CC0; images under their Commons licences"
}
}
},
{
"doc": 348328,
"name": "Nuevo Polanco",
"lat": 19.440713171602745,
"lon": -99.20465953606559,
"distance_m": 13.280140073732118,
"precision": "poi",
"precision_m": 6.756173533775122,
"hierarchy": {
"locality": "Miguel Hidalgo",
"region": "CMX",
"country": "MX",
"category": "real_estate_service",
"postcode": null,
"street": null
},
"normalized": {
"locality": "Miguel Hidalgo",
"region": "CMX",
"country": "MX",
"formatted": "Nuevo Polanco, Miguel Hidalgo, CMX, MX"
},
"provenance": {
"name": "overture-places",
"release": "2026-08-19.0",
"license": "CDLA-Permissive-2.0"
},
"attributes": {
"rating": null,
"reviews": 0,
"price": null,
"hours": [
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
]
],
"photo": "https://commons.wikimedia.org/wiki/Special:FilePath/Ext_06Museo_Soumaya_FREE_Fernando_Romero_EnterprisE_photo_by_Adam_Wiseman.jpg",
"provenance": {
"name": "wikidata",
"release": "2026-11-23",
"license": "CC0; images under their Commons licences"
}
}
},
{
"doc": 348327,
"name": "Slimlandia",
"lat": 19.44052023216659,
"lon": -99.20483262335881,
"distance_m": 16.494187463828435,
"precision": "poi",
"precision_m": 6.756173533775122,
"hierarchy": {
"locality": "Miguel Hidalgo",
"region": "CMX",
"country": "MX",
"category": "arts_and_entertainment",
"postcode": null,
"street": null
},
"normalized": {
"locality": "Miguel Hidalgo",
"region": "CMX",
"country": "MX",
"formatted": "Slimlandia, Miguel Hidalgo, CMX, MX"
},
"provenance": {
"name": "overture-places",
"release": "2026-08-19.0",
"license": "CDLA-Permissive-2.0"
},
"attributes": null
}
],
"segments": 2,
"took_us": 2573
}A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.
Hours are only as good as the feed
Look closely at the two attributes above. Both come from a feed named wikidata, whose licence reads CC0; images under their Commons licences. It carries photos and nothing else: ratingnull, reviews 0, price null — and hours of [0, 0] on all seven days.
By the encoding, [0, 0] means closed, and the encoding has no way to say "unknown". A feed that carries no hours writes [0, 0] for every day it has nothing for, so seven [0, 0]pairs almost always mean "this feed has no hours", not "closed all week". Nothing here says the museum is shut; the feed says nothing about its hours at all. A day a feed leaves out is written the same way, so a feed that lists weekdays only shows every weekend as closed. The filter is at least safe with this: such a place is never returned by open_at, so it is never claimed open — it is only missing from the list.
The second result shows the other limit of joining by name and position rather than by an id. A real-estate office called Nuevo Polanco, 13 m from the museum, carries a feed row's photograph of the museum's façade, because a feed row with that name sits in the same few cells. A shared name nearby is enough to attach one thing's attributes to another.
So, before showing hours or a photo:
- Check
attributes.provenanceand know which of your feeds carry hours at all. - Treat hours as known only when at least one day is something other than
[0, 0]. - Say where the hours came from, and do not present them as more current than the feed's
release. - Coverage is the feed's, place by place and city by city. Do not assume a feed that has hours for one area has them for the next.
DAYS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
ALL_DAY = 65535
def opening_hours(place: dict) -> dict | None:
"""Hours by weekday, or None when the answer does not really have any."""
a = place.get("attributes")
if not a or all(day == [0, 0] for day in a["hours"]):
return None # no feed, or a feed without hours: unknown, not closed
def hhmm(m: int) -> str:
return f"{m // 60:02d}:{m % 60:02d}"
out = {}
for name, (open_, close) in zip(DAYS, a["hours"]):
if (open_, close) == (0, 0):
out[name] = "closed"
elif (open_, close) == (0, ALL_DAY):
out[name] = "open all day"
else:
out[name] = f"{hhmm(open_)}–{hhmm(close)}" # close < open runs past midnight
return outNearby, reverse, here and autocomplete
| You want | Use |
|---|---|
| Places around a point, optionally of one kind or open now | /v1/nearby |
| The nearest addresses and places, with the administrative chain | /v1/reverse |
| Everything at a point in one call, places included | /v1/here |
| A place by the name someone is typing | /v1/autocomplete |
Nearby belongs to the search product, with autocomplete (see products and plans). The store locator example builds a page on it.