Autocomplete

Autocomplete API

The Autocomplete API returns suggestions for the autocompleter, as the user types the query in the search bar. It is suggested to wait at least 300ms between keystrokes before calling the API.

POST https://api.neuralens.ai/search/autocomplete

Autocomplete API can return lists of query suggestions, and products that match the query. Use appropriate limit values as per use case.

Request Headers

Header
Value

X-Neuralens-API-Key

Bearer YOUR_API_KEY_HERE

X-Neuralens-Application-ID

YOUR_APPLICATION_ID

Request Params

Param
Value

partition

Partition field's value (required in case partitioning is done)

Let's say partition is enabled on field "continent", then when sending request for the continent "asia", partition will be asia

Request Body

{
    "query": "appl",
    "limit": {
        "text": 10,
        "products": 10
    },
    "fields": ["id","title","images","productUrl"],
    "analytics": {
        "userId": "87023"
    }
}

query The text typed by the user

limit text limit and products limits are the number of text results and product results required in response. One of these is required.

fields Fields required in response

analytics For personalization and performance tuning

Response

{
    "qid": "4fcb0b58-e040-4aa0-96cf-859692f77f53",
    "results": {
        "text": [
            {
                "title": "Apple",
                "images": ["https://cdn.example.com/123"],
            },
            ...
        ],
        "products": [
            {
                "id": "AD176",
                "type": "product",
                "title": "Apple - Fuji",
                "images": ["https://cdn.example.com/123", "https://cdn.example.com/789"],
                "productUrl": "https://example.com/product/AD176"
            },
            ...
        ]
    }
}

Last updated