Quick Start

Two APIs to go live: This quick start guide will take you through the two APIs required for you to go live with Neuralens AI search: Indexing, and Search.

Get your API keys

Your API requests are authenticated using API keys. Any request that doesn't include an API key will return an error.

Indexing API

Indexing is how you add your products to the search engine. For better understanding by the Neuralens Engine and better relevance, refer the set of standardized fields. If you product attributes are not in the standardized set, you can use custom field names.

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

Indexes a new product. You can index up to 100 products in a single request.

Indexing is asynchronous. It may take up to an hour for newly indexed products to reflect in Search.

Request Headers

Header
Value

X-Neuralens-API-Key

Bearer YOUR_API_KEY_HERE

X-Neuralens-Application-ID

YOUR_APPLICATION_ID

Request Body

products: [
    {
        "id": "AD176",
        "title": "Printed T-shirt",
        "categories": ["Women", "Topwear", "Tshirts"],
        "productUrl": "https://example.com/product/id/AD176",
        "images": ["https://cdn.example.com/123", "https://cdn.example.com/789"],
        "currency": "USD",
        "listPrice": 18.99,
        "salePrice": 14.99,
        "size": "L",
        "fabricPrimary": "Cotton",
        "fabricOthers": ["Viscose"],
        "brand": "H&M",
    },
    {
        ...
    }
]

Explore Indexing API

Search API

Use the Search API to query the indexed products. The Search API is also used to apply any sorts or filters.

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

Request Headers

Header
Value

X-Neuralens-API-Key

Bearer YOUR_API_KEY_HERE

X-Neuralens-Application-ID

YOUR_APPLICATION_ID

Request Body

{
    "query": "shirt",
    "offset": 0,
    "limit": 20,
    "filters": [
        {
            "field": "brand",
            "values": ["H&M", "Lacoste", "Nike"]
        }
    ],
    "fields": ["id", "productUrl", "title", "images"],
    "sort": "price",
    "sortOrder": "desc",
    "analytics": {
        "userId": "8769"
    }
}

Response

{
    "qid": "59f7e4d1-1364-4903-9f92-8691af26d7e2",
    "hasNextPage": true,
    "results": [    
        {
            "id": "AD176",
            "title": "Printed T-shirt",
            "images": ["https://cdn.example.com/123", "https://cdn.example.com/789"],
            "productUrl": "https://example.com/product/AD176"
        },
        {
            ...
        }
    ],
    "filters": [
        {
            "field": "size",
            "label": "Size",
            "values": ["S", "M", "L", "XL", "XXL"],
            "is_applied": false
        },
        ...
    ],
    "sorts": [
        {
            "field": "relevance",
            "order": "desc",
            "label": "Relevance",
            "is_applied": true
        },
        {
            "field": "price",
            "order": "asc",
            "label": "Price - Low to High",
            "is_applied": false
        },
        ...
    ]
    "pagination": {
        "total": 45,
        "current_offset": 0,
        "next_offset": 20
    }
}

Explore Search API

Last updated