The Recommend API client is part of the algoliasearch package. To install this package, run:

1
npm install algoliasearch

To use the Recommend client:

1
2
3
4
import { algoliasearch } from "algoliasearch";

const client = algoliasearch("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY");
const recommendClient = client.initRecommend();

The algoliasearch package includes API clients for the Search, Recommend, Analytics, A/B testing, and Personalization API. If you just want to use the Recommend API client, you can install its package on its own:

1
npm install @algolia/recommend

To use it, run:

1
2
3
4
5
6
import { recommendClient } from "@algolia/recommend";

const client = recommendClient(
  "ALGOLIA_APPLICATION_ID",
  "ALGOLIA_API_KEY"
);

If you just want to retrieve recommendations, but don’t need to manage Rules, you can use the liteClient:

1
2
3
import { liteClient } from "algoliasearch/lite";

const client = liteClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY");

List of methods

Each method makes one request to the Recommend API.

Recommendations

Rules

Did you find this page helpful?
JavaScript API clients v5