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

# Configuration

> Site preferences, services, certificates, export jobs, and live stock checks

## Custom Site Preferences

After metadata import, go to **BM > Merchant Tools > Site Preferences > Custom Preferences**.

<img src="https://mintcdn.com/kleepai/taAv0usV4Q0HyYiD/images/sfcc/image7.png?fit=max&auto=format&n=taAv0usV4Q0HyYiD&q=85&s=3cb6bcc19b6a641efc04bd899b903a40" alt="image.png" width="1429" height="699" data-path="images/sfcc/image7.png" />

Select **Kleep**:

<img src="https://mintcdn.com/kleepai/taAv0usV4Q0HyYiD/images/sfcc/image8.png?fit=max&auto=format&n=taAv0usV4Q0HyYiD&q=85&s=3bf7f87b789fd4e2c854e513666e1426" alt="image.png" width="1429" height="696" data-path="images/sfcc/image8.png" />

| Preference                     | Description                                                                                                                                                                                                                                                                                                                                                                                                         |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `kleepRetailerUUID`            | **Mandatory.** Unique identifier for your retailer on the Kleep platform, provided by your Kleep Account Manager. Must be entered manually — it is sent in every Kleep API call and used as the `domain` parameter of the Recommendation iframe to resolve your account. No automatic fallback: if left empty, tracking, the Recommendation feature and the iframe will not work (a configuration error is raised). |
| `isKleepRecommendationEnabled` | Enable/disable the Kleep button in PDP. Does not affect tracking or job exports.                                                                                                                                                                                                                                                                                                                                    |
| `kleepButtonColor`             | Button color (Black or White). Override via CSS for custom styling.                                                                                                                                                                                                                                                                                                                                                 |
| `kleepFontFamily`              | Font family for the Kleep button and iFrame.                                                                                                                                                                                                                                                                                                                                                                        |
| `kleepCountryCode`             | Market / Country Code ([ISO 3166 A-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)).                                                                                                                                                                                                                                                                                         |

## Services

Found in **Administration > Operations > Services**:

<img src="https://mintcdn.com/kleepai/taAv0usV4Q0HyYiD/images/sfcc/image9.png?fit=max&auto=format&n=taAv0usV4Q0HyYiD&q=85&s=1f298d1ff1d5c84cc878ba424ce7db61" alt="image.png" width="1429" height="473" data-path="images/sfcc/image9.png" />

**`kleep.sftp`** — Sends export files from SFCC WebDAV to Kleep SFTP. Replace the user with the one provided by Kleep, along with the `.p12` certificate. Don't set any password.

<img src="https://mintcdn.com/kleepai/taAv0usV4Q0HyYiD/images/sfcc/image10.png?fit=max&auto=format&n=taAv0usV4Q0HyYiD&q=85&s=ad947fb9b13e5868791ccc6a29951e39" alt="image.png" width="1254" height="1030" data-path="images/sfcc/image10.png" />

**`kleep`** — Used for all other features. No user/password needed — the request is authenticated by the `kleepRetailerUUID` site preference, sent in the payload of every Kleep API call to resolve your account.

## Private Key & Certificate

Go to **Administration > Operations > Private Keys and Certificates**:

1. Click **Import**
2. Click **Select** and choose the `.p12` file provided by Kleep
3. Use `kleep` as the alias
4. Click **Save**

<img src="https://mintcdn.com/kleepai/taAv0usV4Q0HyYiD/images/sfcc/image11.png?fit=max&auto=format&n=taAv0usV4Q0HyYiD&q=85&s=b8e9edbc87ec28cd95999906473cd556" alt="image.png" width="671" height="796" data-path="images/sfcc/image11.png" />

The result should look like this — it must be valid and named `kleep`:

<img src="https://mintcdn.com/kleepai/taAv0usV4Q0HyYiD/images/sfcc/image12.png?fit=max&auto=format&n=taAv0usV4Q0HyYiD&q=85&s=ac8df7c5e67683486e34ea129b17c186" alt="image.png" width="1432" height="439" data-path="images/sfcc/image12.png" />

## Export Jobs

Go to **Administration > Operations > Jobs**. Two jobs are pre-configured:

* **KleepExportProductsCSV** — exports your site's products
* **KleepExportOrdersCSV** — exports your customers' order history

<img src="https://mintcdn.com/kleepai/taAv0usV4Q0HyYiD/images/sfcc/image13.png?fit=max&auto=format&n=taAv0usV4Q0HyYiD&q=85&s=9578b9d90e65d26c10e0d749ac0feaae" alt="image.png" width="1430" height="526" data-path="images/sfcc/image13.png" />

Both are **disabled by default**. Enable them to run once per day:

<img src="https://mintcdn.com/kleepai/taAv0usV4Q0HyYiD/images/sfcc/image14.png?fit=max&auto=format&n=taAv0usV4Q0HyYiD&q=85&s=17a570801f04cbba179e771e8145dd78" alt="image.png" width="1429" height="1032" data-path="images/sfcc/image14.png" />

### Common settings (both jobs)

Go to the **Job Steps** tab → click **RefArch** to select the sites where you use Kleep.

* **Timeout** — seconds before stopping the export
* **OrdersMaxToExport** — max orders to export *(orders job only)*

<img src="https://mintcdn.com/kleepai/taAv0usV4Q0HyYiD/images/sfcc/image15.png?fit=max&auto=format&n=taAv0usV4Q0HyYiD&q=85&s=1e61450b40aa522b1ce0c9f81122c2a6" alt="image.png" width="1430" height="774" data-path="images/sfcc/image15.png" />

### KleepExportProductsCSV settings

<img src="https://mintcdn.com/kleepai/taAv0usV4Q0HyYiD/images/sfcc/image16.png?fit=max&auto=format&n=taAv0usV4Q0HyYiD&q=85&s=cfa7a5109d2d464ecfd56b06073c74c8" alt="image.png" width="1304" height="858" data-path="images/sfcc/image16.png" />

| Parameter      | Description                                                       | Default  |
| -------------- | ----------------------------------------------------------------- | -------- |
| `SkipMaster`   | Ignore master product exports                                     | Disabled |
| `OnlineOnly`   | Export only online products                                       | Disabled |
| `ExportType`   | Delta (only updated since last export) or Full                    | Delta    |
| `MainViewType` | Image view type for product images. Use the same one as your PDP. | `large`  |
| `Locale`       | Specific locale for export. Uses default if empty.                | —        |

<Note>
  The number of exported products may exceed the number processed. This happens when uncategorized products are included through their association with a categorized VariationGroup.
</Note>

<Warning>
  Make sure the **MainViewType** parameter matches your shop's configuration. A mismatched view type leads to missing product images, which are required for AI analysis.
</Warning>

<img src="https://mintcdn.com/kleepai/taAv0usV4Q0HyYiD/images/sfcc/image17.png?fit=max&auto=format&n=taAv0usV4Q0HyYiD&q=85&s=29874674c882456b59e41688bef4a693" alt="image.png" width="1432" height="630" data-path="images/sfcc/image17.png" />

### KleepResetLastExported (utility job)

A third job, **KleepResetLastExported**, is provided to force a **full re-export of orders**. Its `ResetKleepExportAttributes` step clears the export-tracking attributes on every order (`kleepLastExported` → empty, `isKleepExported` → false) so they are picked up again on the next `KleepExportOrdersCSV` run.

It is **disabled by default** and meant to be run manually, on demand (e.g. after a Kleep-side data reset). It takes no parameters.

## Live Stock Checks

Kleep queries stocks live to avoid recommending out-of-stock sizes. Configure access using **one** of the two methods below.

<Info>
  Not sure which one to pick? **OCAPI** is the traditional approach using the Business Manager Data API. **SCAPI (IAS)** is the newer Salesforce Commerce API with the Inventory Availability Service. Ask your Salesforce administrator if unsure.
</Info>

<Tabs>
  <Tab title="OCAPI (Open Commerce API)">
    Use this if your instance relies on **OCAPI** for inventory management.

    **Step 1 — Open OCAPI Settings**

    Navigate to **Administration > Site Development > Open Commerce API Settings**, then edit the **Data** API settings.

    **Step 2 — Set Up Client ID**

    For testing:

    ```
    "client_id": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    ```

    For production, generate a new client ID per the [Salesforce documentation](https://help.salesforce.com/s/articleView?id=cc.b2c_generate_api_client_id.htm\&type=5). [Video walkthrough](https://www.youtube.com/watch?v=Z3cZlQHWjtM).

    **Step 3 — Configure Resource Access**

    Add this to your OCAPI **Data** API configurations:

    ```
    Authorizations
    (GET) /inventory_lists/*
    (GET) /inventory_lists/*/product_inventory_records/*
    ```

    **Step 4 — Send credentials to Kleep**

    * Client ID
    * Client Secret
    * Inventory IDs (one per market — provide your mapping)
    * Production SBX URL (stock checks are enabled on production only)
  </Tab>

  <Tab title="SCAPI — Inventory Availability Service (IAS)">
    Use this if your instance uses **SCAPI** with the **Inventory Availability Service (IAS)** / Omnichannel Inventory (OCI).

    **Step 1 — Create an API Client**

    1. Log into [Salesforce Account Manager](https://account.demandware.com).
    2. Click **API Client** → **Add API Client**.
    3. Display name: e.g. `Kleep Inventory`.
    4. Token Endpoint Auth Method: `client_secret_post`.
    5. Access Token Format: `JWT`.
    6. Allowed Scopes: `sfcc.inventory.availability`
    7. Assign to your Organization.
    8. Save. **Copy the Client ID and Client Secret** — the secret is shown only once.

    <Warning>
      SCAPI and OCAPI clients cannot be shared. Each API framework requires its own client.
    </Warning>

    **Step 2 — Gather instance identifiers**

    | Identifier            | Where to find it                                                              | Example                        |
    | --------------------- | ----------------------------------------------------------------------------- | ------------------------------ |
    | **Short Code**        | BM > **Administration > Site Development > Salesforce Commerce API Settings** | `kv7kzm78`                     |
    | **Organization ID**   | Same page, or Account Manager                                                 | `f_ecom_zzzz_prd`              |
    | **Tenant ID**         | Account Manager > Organizations                                               | `zzzz_prd`                     |
    | **Location Group(s)** | BM > **Merchant Tools > Inventory > Inventory Availability**                  | `WAREHOUSE_FR`, `WAREHOUSE_US` |

    **Step 3 — Send credentials to Kleep**

    * Client ID & Client Secret
    * Short Code
    * Organization ID
    * Tenant ID
    * Location Group(s) (one per market — provide your mapping)
  </Tab>
</Tabs>
