Search API
Current version: 1.0.0, View Release Notes
The Search API provides comprehensive location search capabilities, enabling you to discover points of interest, addresses, administrative areas, and geographic locations with high accuracy and relevance. This powerful service combines forward geocoding (text-to-coordinates) and reverse geocoding (coordinates-to-address) functionality, making it essential for location-based applications, delivery systems, store locators, and any service requiring precise geographic information.
The API offers flexible search methods with sophisticated geographic filters - search around a specific point, within a defined area (polygon, circle, or bounding box), or along a route path. With support for POI category filtering, you can narrow results to specific business types like restaurants, gas stations, hotels, or any of hundreds of predefined categories. The ranking-based results ensure the most relevant locations appear first, while detailed address information includes street names, postal codes, administrative divisions, and contact details when available.
Whether you're building a store locator that finds the nearest locations, implementing address autocomplete for better user experience, geocoding user-entered addresses for delivery services, or enriching location data with reverse geocoding, the Search API provides the precision and flexibility needed for professional location intelligence applications.
View the complete Search API Reference for detailed request/response schemas, examples, and interactive documentation.
Endpoint: POST /locate
Base URL: https://api.magiclane.net/api/v1
Key Features:
- Search for places by name, address, or keyword
- Filter by POI categories (restaurants, hotels, gas stations, etc.)
- Geographic filtering: around a point, within an area, or along a path
- Ranked results based on relevance and proximity
- Detailed address and contact information
- Support for administrative area searches
Required Parameters:
None (at least one of text, categories, or geographic filter recommended)
Optional Parameters:
text- Search query text (place name, address, keyword)categories- Array of POI category filters (e.g.,["gas_stations", "restaurants"])at- Search around a point coordinate[longitude, latitude]in- Search within an area (polygon, circle, or bbox)polygon- Polygon area defined by coordinates or polylinecircle- Circle area with center[longitude, latitude]andradiusin metersbbox- Bounding box witheast,west,south,northcoordinates
along- Search along a path with:polyline- Encoded polyline pathcoords- Array of coordinates defining the pathradius- Search radius around the path in meters
limit- Maximum number of results to return (default: 20)locale- ISO 3166-1 language code for results
Example Request - Find Gas Stations Along Route
curl -X POST https://api.magiclane.net/api/v1/locate \
-H "Authorization: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "aral",
"categories": ["gas_stations"],
"along": {
"polyline": "uvxmHe{yp@UmBcAuIUsCGk@...",
"radius": 5000
},
"limit": 10
}'
This finds Aral gas stations within 5km of the specified route.
Example Request - Search Restaurants in Area
curl -X POST https://api.magiclane.net/api/v1/locate \
-H "Authorization: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "italian restaurant",
"categories": ["restaurants"],
"in": {
"circle": {
"center": [13.388860, 52.517037],
"radius": 2000
}
},
"limit": 20,
"locale": "en"
}'
This searches for Italian restaurants within a 2km radius of the specified location.
Example Request - Find Address Around Point
curl -X POST https://api.magiclane.net/api/v1/locate \
-H "Authorization: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Brandenburg Gate",
"at": [13.377704, 52.516275],
"limit": 5
}'
This searches for "Brandenburg Gate" near the specified coordinates.
Response Structure
The API returns a JSON object containing:
info- Copyright and attribution informationresults- Array of place objects, each containing:coordinates- Location as[longitude, latitude]name- Place namedescription- Place type/category descriptionaddress- Detailed address components:street name- Street namestreet number- House/building numberpostal code- Postal/ZIP codesettlement- Settlement/neighborhoodcity- City namecounty- County namestate- State/province namecountry- Country namecountry code- ISO country code
contact- Contact information (when available):Phone- Phone numbers arrayEmail- Email addresses arrayURL- Website URLs array
native_name- Place name in local languagedistance- Distance from search point in meters (when applicable)
POI Categories
The Search API supports hundreds of POI categories for filtering results. Common categories include:
Food & Dining:
restaurantscafesfast_foodbars
Accommodation:
hotelsmotelshostels
Transportation:
gas_stationscharging_stationsparkingcar_rental
Services:
banksatmspharmacieshospitals
Shopping:
supermarketsshopping_mallsconvenience_stores
Entertainment:
cinemastheatersmuseums
For a complete list of available categories, refer to the Search API Reference.
Related Documentation
For information about routing between locations you've discovered with the Search API, see Routing API.
For calculating reachable areas from a searched location, see Isochrones API.
For information about common parameters, see Common Parameters.