## Search API {docsify-ignore}

<div style="max-width:600px;">

The Search API is a web service that returns suggestions for names of places in response to an HTTP request. The request can contain a string keyword (required), geographical coordinates (optional), and a radius (optional) within which to look for results. 

The Search API is designed with UI elements, such as search and suggestion boxes in mind. The response is optimized to be smaller in size, and certain data elements (such as geographical coordinates) have been left out.

To get geographic coordinates for a given search result, you can then submit an API request to the [Places API](/v1/services/places.md).  

A sample search HTTP request has the following form:
</div>

<pre><code class="language-sh">https://api.baato.io/api/v1/search?key=YOUR_BAATO_ACCESS_TOKEN&q=shemrock nepalgunj&limit=4</code></pre>



<div style="max-width:600px; margin-top:30px; ">



> For easy integration with web and android based projects, this service is also available as part of our [JavaScript](v1/libraries/js-client), and [Java](/v1/libraries/java-client) based libraries.


#### Required Parameters

- `q` — *STRING* — short hand for query, is the search keyword, against which the service will look for results.
- `key` — *STRING* — your baato.io access token. 

#### Optional Parameters
- `lat` and `lon` — *DOUBLE* — latitude and longitude coordinates. Useful in mobile applications for providing geographical context to the search. 
- `type` — *STRING* — The type or category of results that the request should return. For example: hospital, cafe etc.
- `radius` — *INTEGER* —  radius, in kilometers from the specified lat/lon pair within which to look for results. Only integer values supported. By default the value is set to `10`.
- `limit` — *INTEGER* — The number of results that the request should return. By default the value is set to `5`.


#### Response

The response is a JSON object of the following form:

</div>

<pre><code class="language-js">{
    "timestamp": "Thu May 14 07:35:16 NPT 2020",
    "status": 200,
    "message": "Success",
    "data": [
        {
            "placeId": 344470,
            "name": "Shemrock Kids Kingdom",
            "address": "Kurmi Tol, Nepalgunj Sub-Metropolitan, Banke, Nepal",
            "type": "kindergarten",
            "score": 0.011614336
        },
        {
            "placeId": 102235,
            "name": "Shemrock School",
            "address": "Kamal Pokhari, Kathmandu Metropolitan City, Kathmandu, Nepal",
            "type": "school",
            "score": 0.008917106
        },
        {
            "placeId": 168222,
            "name": "Shemrock Kindergarten",
            "address": "Kiran Chowk, Kathmandu Metropolitan City, Kathmandu, Nepal",
            "type": "kindergarten",
            "score": 0.008529406
        },
        {
            "placeId": 194697,
            "name": "Shemrock Little Harvard",
            "address": "Solti Mod, Kathmandu Metropolitan City, Kathmandu, Nepal",
            "type": "kindergarten",
            "score": 0.008427755
        }
    ]
}</code></pre>

