The Recent Search API provides endpoints to manage a user’s recent search history. It allows developers to clear all recent searches or remove specific search items as needed. These endpoints serve as utility functions to help maintain clean, relevant, and privacy-compliant recent search lists for each user.
Endpoint to Clear All Recent Searches
GET https://{domain_name}/api/web/query-history/recent-searches/clear
Request Parameters
Parameter | Description | Data Type | Sample | Required |
|---|---|---|---|---|
p | This is your partner ID. Navigate to 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 |
Endpoint to Clear a Single Recent Search Item
GET https://{domain_name}/api/web/query-history/recent-searches/clear/item
Request Parameters
Parameter | Description | Data Type | Sample | Required |
|---|---|---|---|---|
p | This is your partner ID. Navigate to 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 |
id | Unique identifier of the specific recent search item to be removed (obtained from search-highlights response) | String | rs_001 | Yes |
Endpoint to Get Recent Searches
GET https://{domain_name}/api/web/suggestions/search-highlights
This endpoint can return both Recent Searches and Popular Searches. However, this content focuses only on the Recent Searches response.
Request Parameters
Parameter | Description | Data Type | Sample | Required |
|---|---|---|---|---|
p | This is your partner ID. Navigate to 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 | ["recent"] | 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 Recent 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
Clear All Recent Searches Request
GET /api/web/query-history/recent-searches/clear?p=10000000&l=en_US&u=user_abc123
X-AUTH-TOKEN: your_token_hereClear Single Recent Search Item Request
GET /api/web/query-history/recent-searches/clear/item?p=10000000&l=en_US&u=user_abc123&id=rs_001
X-AUTH-TOKEN: your_token_hereGet Recent and Popular Searches Request
GET /api/web/suggestions/search-highlights?p=10000000&l=en_US&insightTypes=recent
X-AUTH-TOKEN: your_token_hereSuccess 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": null
},
"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 |
|---|---|---|
UserIdNotFound | User ID is not provided. The required parameter u is missing from the request | 400 |
ItemIdNotFound | Given recent search item ID not found. The specified ID parameter does not match any recent search item for the user | 400 |