# Indexing

## 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](#standardized-fields). If you product attributes are not in the standardized set, you can use [custom field names](#custom-fields).

<mark style="color:green;">`POST`</mark> `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 Params

<table><thead><tr><th width="138">Param</th><th>Value</th></tr></thead><tbody><tr><td>partition</td><td>Partition field's value (required in case partitioning is done)</td></tr></tbody></table>

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

### Request Body

```json
[
    {
        "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",
        // Any other custom fields
    },
    {
        ...
    }
]
```

### Response

```json
{
    "status": "success",    // or failure
    "message": ""    // failure message
}
```

### Standardized Fields

{% hint style="info" %}
These fields allow Neuralens to understand what the product is, and greatly affect the search performance.
{% endhint %}

Standardized fields are product fields that have a special meaning in the Neuralens system. Use the standardized fields instead of custom fields wherever a standardized field exists. That means, instead of adding the product name to a field called "name", use the standardized "title" field. For a field like Brand, or Fabric, use custom fields.&#x20;

The following fields are standardized:

<table><thead><tr><th width="155">Field Name</th><th width="129">Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>string</td><td>The product's unique identifier. A call to /search/index for an id which already exists will overwrite the existing data</td></tr><tr><td>title</td><td>string</td><td>The product's name</td></tr><tr><td>productUrl</td><td>string</td><td>The URL to the product details page of the product. The url that is opened on clicking the product.</td></tr><tr><td>categories</td><td>list of string</td><td>The category hierarchy of the product in the catalog. The categories should be ordered with the top level hierarchy coming first in the list. <br><code>NOTE: </code><strong><code>last value of categories will be treated as product type</code></strong><br>eg: ["Women", "Topwear", "Tshirts"],</td></tr><tr><td>images</td><td>list of string</td><td>eg: ["https://cdn.example.com/123", "https://cdn.example.com/789"]</td></tr><tr><td>listPrice</td><td>float</td><td>The original price of the product </td></tr><tr><td>salePrice</td><td>float</td><td>The discounted price</td></tr></tbody></table>

### Custom Fields

Any attribute which is not a part of the standardized fields set is a custom field.

The following types are supported in custom fields:

* String
* Integer
* Float
* Boolean
* Datetime
* List (lists of Strings, Integers, Floats are supported. A list should have values of only one type)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.neuralens.ai/reference/api-reference/indexing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
