How to Get Place Details by Place ID or Coordinates
- API or service
- Place Details API
- Task
- Place ID or coordinates → place record and geometry
- Examples
- Difficulty
- Beginner
- Time
- 5 min
You already know which place you want—you have its Geoapify place ID from a geocoding or place search, or you have a latitude and longitude—and need its full record: name, address, categories, website, opening hours, Wikidata link, and geometry. The Geoapify Place Details API returns that record in one GET request.
The API accepts one lookup method per request:
- Place ID (
id): the recommended method when an earlier Geoapify response already identified the place. - Coordinates (
latandlon): returns the object located at that point, such as a building, a place inside a building, a park, or a body of water. - OpenStreetMap ID (
osm_idandosm_type): useful when your data already stores OpenStreetMap identifiers.
By default, the response contains one details feature with the place properties and its geometry. Add the features parameter to request the containing building, a fixed radius, or walking and driving isolines around the place.
Choose a lookup method
Choose the method from the input you already have. Use exactly one method per request: the API expects either id, or lat with lon, or osm_id with osm_type, and these alternatives must not be combined.
| Your input | Parameters | What the API returns | Use when |
|---|---|---|---|
| Place ID from Geocoding, Places, or another Geoapify response | id |
The record of that exact place | A user picked a search result, an autocomplete suggestion, or a place on a list |
| Latitude and longitude | lat, lon |
The most specific object at that point: a place, building, area, or water body; an empty list when nothing is mapped there | A user clicked a map, or a device reported a position |
| OpenStreetMap object ID | osm_id, osm_type (n node, w way, r relation) |
The record of that OpenStreetMap object | Your database already stores OpenStreetMap IDs |
| A coordinate, when you need the nearest postal address | Use Reverse Geocoding instead | The nearest address or place with a distance | You need a formatted address rather than the object under the point |
Prefer the place ID whenever you have it. A coordinate lookup depends on the exact point: the same building can contain several mapped places, and a point a few metres away may return a different object.
All three methods return the same response format: a GeoJSON FeatureCollection whose details feature has properties.feature_type set to details. The requests are charged like other feature-returning APIs: max(1, ceil(returned_features / 20)) credits, so a default request that returns one feature costs 1 credit. See Place Details pricing.
Get details by place ID
A place ID comes from properties.place_id in a Geoapify response. This forward geocoding request finds the Art Institute of Chicago and returns its place ID:
https://api.geoapify.com/v1/geocode/search?text=Art%20Institute%20of%20Chicago&filter=countrycode:us&limit=1&apiKey=YOUR_API_KEY
The first result has the place_id value used in the next request. Pass it as id. When features is omitted, the API returns only the details feature:
https://api.geoapify.com/v2/place-details?id=514044b467e0e755c059f4328ae596f04440f00101f901d28a1c0000000000c0020192031c5468652041727420496e73746974757465206f66204368696361676f&apiKey=YOUR_API_KEY
Reduced response: The response below keeps the identity, contact, address, and source fields. The building outline in geometry.coordinates is shortened, and datasource.raw keeps only the OpenStreetMap identifiers and one source tag.
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"feature_type": "details",
"name": "The Art Institute of Chicago",
"website": "https://www.artic.edu/",
"opening_hours": "Mo 11:00-17:00; Tu-We off; Th 11:00-20:00; Fr-Su 11:00-17:00",
"wiki_and_media": {
"wikidata": "Q239303",
"wikipedia": "en:Art Institute of Chicago"
},
"building": {
"type": "commercial"
},
"categories": [
"building",
"building.commercial",
"building.tourism",
"entertainment",
"entertainment.museum"
],
"datasource": {
"sourcename": "openstreetmap",
"attribution": "© OpenStreetMap contributors",
"license": "Open Database License",
"raw": {
"osm_type": "r",
"osm_id": 1870546,
"tourism": "museum"
}
},
"housenumber": "111",
"street": "South Michigan Avenue",
"city": "Chicago",
"state": "Illinois",
"postcode": "60603",
"country": "United States",
"country_code": "us",
"formatted": "The Art Institute of Chicago, 111 South Michigan Avenue, Chicago, IL 60603, United States of America",
"lat": 41.879605,
"lon": -87.6230716,
"timezone": {
"name": "America/Chicago"
},
"place_id": "51c2468267e0e755c0592e398be596f04440f00101f901d28a1c000000000092031c5468652041727420496e73746974757465206f66204368696361676f"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[-87.6240545, 41.8796872],
[-87.6240532, 41.8795517],
"…"
]
]
}
}
]
}
Read these fields from properties:
name,formatted, and the address fields (housenumber,street,city,state,postcode,country_code) describe the place and its address.categorieslists the Geoapify categories of the place. A museum that is also mapped as a building carries bothbuilding.*andentertainment.museumcategories.website,opening_hours, andwiki_and_mediaappear only when the source data contains them. Treat every optional field as possibly missing.opening_hoursuses the OpenStreetMap opening-hours syntax. Parse it with an opening-hours library rather than displaying it as plain text to end users.latandlongive a representative point.geometrycontains the place outline when the place is an area or a building, and aPointotherwise.
The place_id in the response can differ from the id you sent, as in this example. Both identify the same OpenStreetMap object (datasource.raw.osm_type r, osm_id 1870546), and the returned value works as id in later requests.
If you store OpenStreetMap identifiers instead of place IDs, request the same record with osm_id and osm_type:
https://api.geoapify.com/v2/place-details?osm_id=1870546&osm_type=r&apiKey=YOUR_API_KEY
An id that is not a valid Geoapify place ID returns HTTP 400:
{ "statusCode": 400, "error": "Bad Request", "message": "Invalid Place ID" }
Get details by coordinates
Send lat and lon as separate parameters in decimal degrees. Unlike the bias and filter parameters of the Places API, these are not a combined longitude,latitude value. This request asks for the object at the coordinates of the Art Institute of Chicago:
https://api.geoapify.com/v2/place-details?lat=41.879605&lon=-87.6230716&apiKey=YOUR_API_KEY
The response has the same format as the place ID request and, at this point, the same record: "name": "The Art Institute of Chicago" with its building polygon.
A coordinate lookup returns the most specific mapped object at the point, not the nearest named place. The same building contains other mapped places, so a point about 65 metres west returns one of them:
https://api.geoapify.com/v2/place-details?lat=41.8794&lon=-87.6238&apiKey=YOUR_API_KEY
Reduced response:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"feature_type": "details",
"name": "Ryerson & Burnham Libraries",
"formatted": "Ryerson & Burnham Libraries, 111 South Michigan Avenue, Chicago, IL 60603, United States of America",
"place_id": "…"
},
"geometry": {
"type": "Polygon",
"coordinates": ["…"]
}
}
]
}
What the API returns depends on what is mapped at the point:
| Point location | Example coordinates | Returned object |
|---|---|---|
| Inside a mapped place or building | 41.879605, -87.6230716 |
The Art Institute of Chicago (entertainment.museum, building polygon) |
| Inside another place in the same building | 41.8794, -87.6238 |
Ryerson & Burnham Libraries |
| On water | 41.88, -87.60 |
Chicago Harbor (maritime.marina) |
| Outside buildings, inside a mapped area | 41.9126, -87.6806 |
West Town (administrative.neighbourhood_level) |
| Nothing mapped at the point | 38.5, -116.5 (central Nevada) |
An empty features array with HTTP 200 |
Check properties.categories before you treat the result as a point of interest: a coordinate lookup can return a neighbourhood or a water body. Handle the empty features array as "nothing found", not as an error.
Both lat and lon are required for a coordinate lookup, and they must be valid coordinates. Missing or invalid values return HTTP 400, for example:
{ "statusCode": 400, "error": "Bad Request", "message": "\"value\" contains [lat] without its required peers [lon]" }
{ "statusCode": 400, "error": "Bad Request", "message": "\"lat\" must be less than or equal to 90" }
A request without any lookup parameters returns "message": "Invalid place location parameters.".
To show the user a postal address for a clicked point instead of the object under it, use Reverse Geocoding. Once a user confirms the place, keep its place_id and use the place ID lookup for later requests.
Request additional features
The features parameter selects which feature groups the response contains. Separate several values with |. When features is omitted, the API returns details only. When features is set, the response contains only the listed groups, so include details explicitly if you still need the place record.
| Value | Returned feature | Geometry |
|---|---|---|
details |
The place record shown in the previous steps | The place outline or point |
building |
The building that contains the place or point | Building polygon |
radius_100, radius_500, radius_1000 |
A circle of 100, 500, or 1,000 metres around the place | Polygon |
walk_5, walk_10, walk_15, walk_30 |
The area reachable on foot within 5, 10, 15, or 30 minutes | Polygon or MultiPolygon |
drive_5, drive_10, drive_15 |
The area reachable by car within 5, 10, or 15 minutes | Polygon or MultiPolygon |
This request returns the Art Institute of Chicago record and its 10-minute walking area in one call:
https://api.geoapify.com/v2/place-details?id=514044b467e0e755c059f4328ae596f04440f00101f901d28a1c0000000000c0020192031c5468652041727420496e73746974757465206f66204368696361676f&features=details|walk_10&apiKey=YOUR_API_KEY
Reduced response: The details feature is the same as in the place ID step. The isoline geometry is shortened.
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"feature_type": "details",
"name": "The Art Institute of Chicago"
},
"geometry": { "type": "Polygon", "coordinates": ["…"] }
},
{
"type": "Feature",
"properties": {
"feature_type": "walk_10",
"mode": "walk",
"type": "time",
"range": 600,
"lat": 41.879605,
"lon": -87.6230716
},
"geometry": { "type": "MultiPolygon", "coordinates": ["…"] }
}
]
}
Select features by properties.feature_type, not by their position in the array. range is in seconds for walking and driving areas (walk_10 has "range": 600) and in metres for radius areas (radius_500 has "range": 500).
The building group is useful with coordinate lookups. For the point inside Ryerson & Burnham Libraries from the previous step, features=building returns the containing building, The Art Institute of Chicago, with its polygon:
https://api.geoapify.com/v2/place-details?lat=41.8794&lon=-87.6238&features=building&apiKey=YOUR_API_KEY
Each returned feature counts toward the request cost of max(1, ceil(returned_features / 20)) credits; this two-feature response costs 1 credit. To search for specific places inside a returned area, pass its geometry to the Places API, as shown in Find places in a custom polygon.
Place details lookup with an AI coding agent
Copy this prompt into Codex, Claude Code, Cursor, or another coding agent to add a place details lookup to your project.
Add a place details lookup to my project with the Geoapify Place Details API.
Before you start
- Ask which language and framework the project uses, and where the lookup runs: backend, browser, or CLI.
- Ask which inputs the feature receives: a Geoapify place ID, latitude and longitude, an OpenStreetMap ID, or several of them.
- Ask which fields I need (for example name, formatted address, categories, website, opening hours, Wikidata ID, geometry) and whether I need extra feature groups such as building, radius_500, or walk_10.
- Ask me to configure a Geoapify API key before live requests. On a backend or CLI, read it from GEOAPIFY_API_KEY. In a browser, ask whether to use a restricted key or a backend proxy. Never hardcode, print, or log the key.
API flow
1. Send GET https://api.geoapify.com/v2/place-details with exactly one lookup method: id, or lat and lon, or osm_id and osm_type (n, w, or r). Never combine lookup methods.
2. Add features only when I need more than details. Separate several values with |. Omitting features returns details only.
3. Find features by properties.feature_type, not by array position, and read the place from the feature whose feature_type is details.
Requirements
- Send lat and lon as separate decimal-degree parameters and validate their ranges before the request.
- Treat website, opening_hours, wiki_and_media, contact fields, and address parts as optional.
- Treat an empty features array as "nothing found" and return a clear empty result.
- For coordinate lookups, check categories: the result can be a building, a place inside a building, a neighbourhood, or a water body rather than a point of interest.
- Keep the returned place_id for later lookups; it can differ from the id that was sent and still identifies the same place.
- Handle HTTP 400 messages, 401, timeouts, and limited 429 retries with backoff.
- Add a short test with a mocked response and a usage example.
Review the generated code against the requests in this guide. Check that it uses one lookup method per request, separate lat and lon values, optional-field handling, empty results, feature selection by feature_type, and API-key handling.