Get FBT Recommendations API
Use this endpoint to retrieve items that users have frequently viewed together in your search index.
HTTP Request
GET /v1/recommendations/{index_public_key}
{index_public_key}: Your AddSearch index's public key.
Query Parameters
| Parameter | Description | Type | Notes |
|---|---|---|---|
configurationKey | The identifier of the FBT (Frequently Bought Together) configuration used to generate recommendations. | string | Defines which events the recommendations are based on. |
ItemId | The ID of the item for which you want to retrieve related items. This can be a document ID or a custom field configured in your documents. | string | Must correspond to the configured document field in your index. |
Usage Notes
- Ensure the
configurationKeycorresponds to an active FBT configuration in your AddSearch dashboard. - The
ItemIdshould match the ID of the item stored in your index that you want recommendations for.
See Configuring FBT Recommendations for details on setting up configurations.
Example Response
The following is a sample response showing items frequently viewed together, sorted by relevance.
{
"total_hits": 2,
"processing_time_ms": 10264,
"hits": [
{
"id": "45250165ec33a1cc191ae10d2ceb0010",
"type": "DEFAULT",
"url": "/docs/api/overview/",
"title": "API Reference - AddSearch Documentation",
"meta_description": "The AddSearch REST API provides programmatic access the search index. You can add, update and retrieve data from the index with the AddSearch Rest API.",
"meta_categories": null,
"custom_fields": {
"documentation_category": "API Reference#fe0201"
},
"highlight": "REST API Reference Welcome to AddSearch API! The AddSearch REST API provides access to request data from the index. It also allows you to update the data in the index as well as ad",
"ts": "2020-02-13T11:27:28",
"categories": [
"0xwww.addsearch.com",
"1xdocs",
"2xapi",
"3xoverview"
],
"document_type": "html",
"images": {
"main": null,
"capture": null
},
"score": 1
},
{
// Additional hit data goes here
}
]
}
For detailed information about the response fields, see the Search API response reference.