The Popular Search API returns trending search terms for a specified account and locale. It powers the Popular Searches module in Eureka, helping users discover high-demand and trending queries in real time. By analyzing aggregated search behavior, this API enhances product discovery and increases user engagement within the search experience.
Endpoint
GET https://{domain_name}/api/web/suggestions/search-highlights
When the request is sent without proper authentication, an authentication exception is thrown for security reasons. Therefore, when sending the request, set the X-AUTH-TOKEN header to the token you were provided.
This endpoint can return both Recent Searches and Popular Searches. However, this content focuses only on the Popular Searches response.
Request Parameters
Parameter | Description | Data Type | Sample | Required |
|---|---|---|---|---|
p | This is your partner ID. Navigate to InOne > Inone Settings > Account Settings to copy your partner ID. | String | 10000000 | Yes |
l | Locale is required to get your products in the current language of the website. | String | en_US | Yes |
u | Identifier for the end user making the request | String | user_abc123 | Yes |
insightTypes | Types of insights to retrieve. | Array of String | ["popular"] | Yes |
The insightTypes parameter indicates the type of analysis you want to retrieve. It supports only two values: "recent" and "popular".
Therefore, insightTypes can be ["recent"], ["popular"], or a combination such as ["recent", "popular"].
Get Recent and Popular Searches in a single request
To retrieve both recent and popular searches in a single request, include both insight types in the insightTypes parameter:
Sample Request
GET /api/web/suggestions/search-highlights?p=10000000&l=en_US&u=user_abc123&insightTypes=recent&insightTypes=popular
X-AUTH-TOKEN: your_token_hereThis will return both the user's recent search history and trending popular searches for the given locale in a single response.
Sample Response
{
"status": "Success",
"data": {
"recent_searches": [
{
"id": "rs_001",
"display": "wireless headphones"
},
{
"id": "rs_002",
"display": "laptop stand"
},
{
"id": "rs_003",
"display": "ergonomic keyboard"
}
],
"popular_searches": [
"smart watch",
"bluetooth speaker",
"phone case",
"charging cable",
"screen protector"
]
},
"error": null,
"validations": null
}Sample Responses
Parameter | Definition |
|---|---|
status | It shows the results of popular searches. This field can be: |
data | Contains the actual response payload with the Popular Searches array. |
error | Array of error messages when status is Error, BusinessException, or RuntimeException |
validations | When the request is incorrect (HTTP 4XX), this field contains an array of type and message details. |
200 Response Examples
Sample Request
GET /api/web/suggestions/search-highlights?p=10000000&l=en_US&insightTypes=popular
X-AUTH-TOKEN: your_token_hereSuccess Response
{
"status": "Success",
"data": {
"recent_searches": null,
"popular_searches": [
"smart watch",
"bluetooth speaker",
"phone case",
"charging cable",
"screen protector"
]
},
"error": null,
"validations": null
}500 Internal Server Error
{
"status": "Error",
"data": null,
"error": {
"code": "500 INTERNAL_SERVER_ERROR",
"message": "Something went wrong. We are working to solve it. If it continues, you can contact the team."
},
"validations": null
}400 Validation Exception
{
"status": "Invalid",
"data": null,
"error": null,
"validations": [
{
"type": "InsightTypesNotFound",
"message": "Insight types are not provided."
}
]
}Fail Records Messages
Business Exceptions
Message | Definition | HTTP Code |
|---|---|---|
PartnerConfigNotFound | Your config cannot be found in the Search Metadata Cache. The specified partner ID does not have configuration data available in the system. | 400 |
AnyInsightTypeNotFound | You do not have any of the requested insight types enabled. Your configuration does not support the requested insight types (recent or popular). | 400 |
Validation Exceptions
Message | Definition | HTTP Code |
|---|---|---|
InsightTypesNotFound | Insight types are not provided. The required parameter insightTypes is missing from the request, or it is an empty array. | 400 |