Skip to main content
GET
Initialize session
Avant d’utiliser toute autre méthode de l’API dans la Product Recommendation API, appelez l’API init. Le processus d’initialisation accepte l’identifiant de l’utilisateur actuel et demande les paramètres du projet ainsi que les préférences de l’utilisateur.

Quand initialiser

Selon votre plateforme, les exigences d’exécution de init diffèrent :
  • cURL : initialisez à chaque rendu de la page.
  • Web : initialisez à chaque ouverture de la page (y compris les applications monopage).
  • iOS ou Android : initialisez à chaque lancement de l’application.
Lors du premier lancement sur un nouvel appareil, un identifiant d’appareil est absent. Appelez la méthode init sans device ID pour en générer un. Pour la logique de recommandation côté backend avec Kameleoon Web Experimentation, appelez cette API et stockez les IDs dans le cookie KameleoonProducts_session_code pour sid et KameleoonProducts_device_id pour did.

Paramètres de requête

Bien que le paramètre sid soit requis, ne l’ajoutez pas lors de la première initialisation, car le système le génère et le renvoie dans la réponse (en tant que seance).Une fois généré, utilisez le sid généré par le système pour les requêtes au sein de la session en cours.

Réponse

Paramètres de requête

shop_id
string
requis

Store Key. Find this in Recommendations > Settings > Store settings in the Kameleoon app. Contact your Customer Success Manager for the key if necessary.

did
string

A device ID. If a device ID already exists, specify it here. If you don't specify a did, the API generates a new one. Use this generated ID as the device ID for all future requests.

sid
string

A session ID is a temporary identifier assigned to the user for the current session. Do not include sid on the first init request; Kameleoon generates and returns it (as seance) in the response. If a sid is specified and does not exist in the system, an error occurs.

Réponse

200 - application/json

Session initialized. Verified against a live response on 2026-09-24; fields below reflect what the API actually returns, which is more than the did/seance pair described in the endpoint's prose.

did
string

The device ID. Store this for use on subsequent requests.

seance
string

The generated session ID (sid). Use it for requests within the current session.

currency
string

The shop's default currency symbol.

email_collector
boolean

Whether the email collector feature is enabled for this shop.

has_email
boolean

Whether an email address is already associated with this session.

recommendations
boolean

Whether product recommendations are enabled for this shop.

lazy_load
boolean

Whether recommendation blocks lazy-load on this shop.

auto_css_recommender
boolean

Whether Kameleoon automatically injects CSS for recommendation blocks.

cms
string

The CMS/platform identifier configured for this shop, if any.

snippets
object[]

Custom JavaScript snippets configured for this shop in the Kameleoon app, injected alongside recommendation blocks.

The shop's Search service configuration.