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

# Migrating from Prefixbox

> Switch from Prefixbox to Molin AI with zero code changes using our Prefixbox-compatible API.

If you are currently using Prefixbox for product search, you can migrate to Molin AI seamlessly. We support both the Prefixbox JSON feed format and the full Prefixbox Product Data API, so your existing integration works with Molin out of the box.

## What you get

* **Prefixbox feed compatibility** — connect your existing Prefixbox JSON feed directly to Molin ([details](/home/platforms/prefixbox-feed))
* **Full Prefixbox Product Data API compatibility** — push real-time product updates to Molin using the same endpoints you already use with Prefixbox, all 5 supported

## Step 1: Connect your feed

If you already have a Prefixbox JSON feed, provide the feed URL to Molin during setup. We parse the same format — no changes needed on your side. See [Prefixbox feed](/home/platforms/prefixbox-feed) for details on the supported fields.

## Step 2: Push real-time updates

If you push real-time product updates to Prefixbox (price, stock, availability changes), you can push the same updates to Molin in parallel. The only differences are the base URL, the API key, and the `websiteTracker` value.

### Connection details

|                     | Prefixbox                               | Molin AI                                        |
| ------------------- | --------------------------------------- | ----------------------------------------------- |
| **Base URL**        | `https://api.prefixbox.com/productData` | `https://molin.ai/api/v0/prefixbox/productData` |
| **Auth header**     | `API-Key: <your Prefixbox key>`         | `API-Key: <your Molin key>`                     |
| **Website tracker** | Your Prefixbox `websiteTracker`         | Your Molin widget ID                            |

<Info>Contact us at [hey@molin.ai](mailto:hey@molin.ai) to receive your API key.</Info>

### Supported endpoints

We support all Prefixbox Product Data API endpoints:

| Method | Endpoint                                | Description                       |
| ------ | --------------------------------------- | --------------------------------- |
| `POST` | `/product`                              | Update a single product           |
| `POST` | `/products`                             | Update multiple products (batch)  |
| `POST` | `/product/add`                          | Add a new product                 |
| `POST` | `/products/add`                         | Add multiple new products (batch) |
| `GET`  | `/product/{websiteTracker}/{productId}` | Get a product (for testing)       |

All endpoints use the same request/response format as Prefixbox. See the [Prefixbox API docs](https://api-docs.prefixbox.com/#product-data-api) for the full specification.

### Update a single product

```sh theme={null}
curl -X POST "https://molin.ai/api/v0/prefixbox/productData/product" \
  -H "Content-Type: application/json" \
  -H "API-Key: <your Molin API key>" \
  -d '{
    "websiteTracker": "<your widget ID>",
    "identifier": "SKU-12345",
    "productData": {
      "price": "49990",
      "oldPrice": "59990",
      "availability": "in stock"
    }
  }'
```

### Update multiple products (batch)

```sh theme={null}
curl -X POST "https://molin.ai/api/v0/prefixbox/productData/products" \
  -H "Content-Type: application/json" \
  -H "API-Key: <your Molin API key>" \
  -d '{
    "websiteTracker": "<your widget ID>",
    "products": [
      {
        "identifier": "SKU-12345",
        "productData": {
          "price": "49990",
          "oldPrice": "59990",
          "availability": "in stock"
        }
      },
      {
        "identifier": "SKU-67890",
        "productData": {
          "price": "29990",
          "availability": "out of stock"
        }
      }
    ]
  }'
```

### Add a new product

```sh theme={null}
curl -X POST "https://molin.ai/api/v0/prefixbox/productData/product/add" \
  -H "Content-Type: application/json" \
  -H "API-Key: <your Molin API key>" \
  -d '{
    "websiteTracker": "<your widget ID>",
    "identifier": "SKU-NEW-001",
    "productData": {
      "displayText": "Samsung TV 55\" OLED",
      "url": "https://shop.com/product/tv-55-oled",
      "price": "499990",
      "description": "55 inch OLED TV with 4K HDR",
      "imageUrl": "https://images.shop.com/tv-55-oled.jpg",
      "availability": "in stock"
    }
  }'
```

<Note>`displayText` and `url` are required when adding a new product.</Note>

### Add multiple new products (batch)

```sh theme={null}
curl -X POST "https://molin.ai/api/v0/prefixbox/productData/products/add" \
  -H "Content-Type: application/json" \
  -H "API-Key: <your Molin API key>" \
  -d '{
    "websiteTracker": "<your widget ID>",
    "products": [
      {
        "identifier": "SKU-NEW-001",
        "productData": {
          "displayText": "Samsung TV 55\" OLED",
          "url": "https://shop.com/product/tv-55-oled",
          "price": "499990",
          "availability": "in stock"
        }
      },
      {
        "identifier": "SKU-NEW-002",
        "productData": {
          "displayText": "LG Washing Machine 8kg",
          "url": "https://shop.com/product/lg-wm-8kg",
          "price": "249990",
          "availability": "in stock"
        }
      }
    ]
  }'
```

### Verify a product

Use `GET /product/{widgetId}/{identifier}` to confirm a product exists and check its current data:

```sh theme={null}
curl "https://molin.ai/api/v0/prefixbox/productData/product/<widget ID>/SKU-12345" \
  -H "API-Key: <your Molin API key>"
```

### Responses

All endpoints return the same response codes:

| Status | Meaning                                                                   |
| ------ | ------------------------------------------------------------------------- |
| `204`  | Success                                                                   |
| `200`  | Success with warnings or partial success — response body contains details |
| `400`  | Validation error                                                          |

A `200` response includes information about which products failed:

```json theme={null}
{
  "warnings": [],
  "productsWithErrorResult": [
    {
      "identifier": "SKU-67890",
      "status": 404,
      "errorCause": "No product was found with identifier: SKU-67890"
    }
  ]
}
```

### Supported fields in `productData`

| Field                 | Description                                            |
| --------------------- | ------------------------------------------------------ |
| `price`               | Current price                                          |
| `oldPrice`            | Original price before discount                         |
| `discount`            | Discount amount                                        |
| `discountStart`       | Discount start date                                    |
| `discountEnd`         | Discount end date                                      |
| `discountAmount`      | Discount value                                         |
| `discountDisplayMode` | How the discount is displayed                          |
| `availability`        | `in stock`, `out of stock`, `preorder`, `discontinued` |
| `visible`             | Product visibility                                     |
| `attributes`          | Custom attributes object                               |
| `availableShops`      | Available store locations                              |

## Differences from Prefixbox

* **Larger batch sizes** — Prefixbox recommends batches of 100 products. Molin supports much larger batches (1,000+ products per request) with no performance penalty.
* **`stores` field** — Prefixbox supports per-store overrides via the `stores` field. Molin currently ignores this field. Each Molin widget represents one store, so if you have multiple stores (e.g. different countries), you will receive a separate widget ID for each.

## Important notes

* Products must already exist in Molin (imported via your feed) before they can be updated via the update endpoints (`POST /product` and `POST /products`).
* The add endpoints (`POST /product/add` and `POST /products/add`) require `displayText` and `url` in `productData`.
* You can run both Prefixbox and Molin in parallel during your migration — just point your update pipeline at both endpoints.
