REST API and personalization with Postman

Hi, where would you pass in the user token when making a rest API call to the search query. For instance, I am calling POST to the API URL to “/1/indexes/products_gotdoodle/query” and passing in the params in the body. I tried setting the X-Algolia-UserToken in the request headers but is returning results back with the non-personalized data.

Please help.

We recommend using an API client rather than hitting the REST API directly. There is no SLA on the REST API itself.

You can inject the user-token directly into the search operation using the API clients. For instance, here is the JavaScript version:

index.search('query', {
  enablePersonalization: true,
  userToken: '123456'
}).then(({ hits }) => {
  console.log(hits);
});

If you must hit the REST API directly, you’ll want to add enablePersonalization and userToken to the params section of your POST data on the query operation.