> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kameleoon.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 商品レコメンデーションの取得

> レコメンダーコードを使用して、Kameleoon Product Recommendation API からパーソナライズされた商品レコメンデーションを取得します。

このエンドポイントは商品レコメンデーションを取得します。

### クエリパラメーター

| パラメーター | 型 | 必須 | 説明 |
| :- | :- | :- | :- |
| `did` | String | True | デバイス ID。`KameleoonProducts_device_id` クッキーからこの ID を取得します。このエンドポイントを呼び出す前に、バックエンドから取得してください。"Recently Viewed" や "Recommended for You" など、過去のデバイスデータに依存するフィルターまたはアルゴリズムを使用する場合にのみ `did` を提供します。 |
| `shop_id` | String | True | ストアキー。Kameleoon アプリの **Recommendations** > **Settings** > **Store settings** で確認できます。必要に応じてカスタマーサクセスマネージャーにキーをお問い合わせください。 |
| `sid` | String | True | 一時的なユーザーセッション ID。`KameleoonProducts_session_code` クッキーからこの ID を取得します。このエンドポイントを呼び出す前に、バックエンドから取得してください。"Recently Viewed" や "Recommended for You" など、過去のユーザーデータに依存するフィルターまたはアルゴリズムを使用する場合にのみ `sid` を提供します。 |
| `recommender_code` | String | True | 商品レコメンデーションブロックの ID。`recommender_code` はブロック管理 UI で確認できます。 |
| `resize_image` | Integer | Optional | リサイズ用の画像サイズ(px)。サポートされる値: `120`、`140`、`160`、`180`、`200`、`220`。 |
| `extended` | Integer or empty | Optional | 推奨商品の拡張情報を追加します。`1` の場合、API はすべての商品情報を返します。空の場合、API は商品 ID のみを返します。 |
| `with_locations` | Boolean | False | `true` で、かつ `extended` パラメーターも `true` の場合、レスポンスにはすべての在庫場所の `location_ids` が含まれます。`extended` が指定されていないか `false` の場合、API は `with_locations` を無視し、デフォルトで `false` になります。 |

### レスポンス

| 名前 | 型 | 説明 |
| :- | :- | :- |
| `html` | string | 商品ブロックの HTML コード。Kameleoon の個人アカウントで HTML テンプレートをカスタマイズします。 |
| `title` | string | ブロックのタイトル。ブロックルールの "Action" 要素の値と一致します。 |
| `recommends` | array | 商品 ID のリスト。 |
| `id` | number | 一意のブロック識別子。Kameleoon の個人アカウントのブロック ID と一致します。 |


## OpenAPI

````yaml product-recommendation.api.json GET /recommend/{recommender_code}
openapi: 3.1.0
info:
  title: Kameleoon Product Recommendation API
  version: 1.0.0
  description: >-
    REST API for importing product, category, and order data into Kameleoon,
    initializing recommendation sessions, and retrieving product
    recommendations, collections, and search results.
servers:
  - url: https://api.products.kameleoon.com
security: []
paths:
  /recommend/{recommender_code}:
    get:
      tags:
        - Recommend
      summary: Retrieve product recommendations
      description: >-
        Obtain personalized product recommendations from the Kameleoon Product
        Recommendation API using recommender codes.
      operationId: retrieveProductRecommendations
      parameters:
        - name: recommender_code
          in: path
          required: true
          schema:
            type: string
          description: >-
            ID of the product recommendations block. Find the `recommender_code`
            in the blocks management UI.
        - name: did
          in: query
          required: true
          schema:
            type: string
          description: >-
            Device ID. Get this ID from the `KameleoonProducts_device_id`
            cookie. Retrieve it from the backend before calling this endpoint.
            Only provide `did` when using filters or algorithms that rely on
            historical device data, such as "Recently Viewed" or "Recommended
            for You."
        - name: shop_id
          in: query
          required: true
          schema:
            type: string
          description: >-
            Store Key. Find this in **Recommendations** > **Settings** > **Store
            settings** in the Kameleoon app. Contact your Customer Success
            Manager for the key if necessary.
        - name: sid
          in: query
          required: true
          schema:
            type: string
          description: >-
            Temporary user session ID. Get this ID from the
            `KameleoonProducts_session_code` cookie. Retrieve it from the
            backend before calling this endpoint. Only provide `sid` when using
            filters or algorithms that rely on historical user data, such as
            "Recently Viewed" or "Recommended for You."
        - name: resize_image
          in: query
          required: false
          schema:
            type: integer
            enum:
              - 120
              - 140
              - 160
              - 180
              - 200
              - 220
          description: Image size (px) for resizing.
        - name: extended
          in: query
          required: false
          schema:
            type: integer
          description: >-
            Adds extended information for recommended products. If `1`, the API
            returns all product information. If empty, the API returns only
            product IDs.
        - name: with_locations
          in: query
          required: false
          schema:
            type: boolean
          description: >-
            If `true` and `extended` is also `true`, the response includes
            `location_ids` for all availability places. If `extended` is missing
            or `false`, this parameter is ignored and defaults to `false`.
      responses:
        '200':
          description: The recommendation block's products and rendered HTML.
          content:
            application/json:
              schema:
                type: object
                properties:
                  html:
                    type: string
                    description: >-
                      HTML code for the product block. Customize the HTML
                      template in the Kameleoon personal account.
                  title:
                    type: string
                    description: >-
                      Block title. Matches the "Action" element value in the
                      block rules.
                  recommends:
                    type: array
                    items:
                      type: string
                    description: List of recommended product IDs.
                  id:
                    type: number
                    description: >-
                      Unique block identifier. Matches the block ID in the
                      Kameleoon personal account.

````