> ## 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.

# Bought together API

> Read what other customers bought together with a product, from the same public endpoint the bought-together row calls.

The Bought together API returns the products your customers most often bought in the same order as a given product, counted from your real orders. It powers [`<molin-bought-together>`](https://docs.molin.ai/home/general/elements), and you can call it directly to build your own "frequently bought together" block.

The endpoint is public, read-only, and needs no API key: the widget ID identifies the shop, and shoppers call it straight from the browser.

> [!NOTE]
>
> Call `widget.molin.ai`, never `molin.ai`. Keeping every widget request on one origin means you don't have to add another origin to your [Content Security
> Policy](https://docs.molin.ai/home/general/content-security-policy.md).

Shopify, Shoprenter, UNAS, and Shoper shops: ask Molin support to enable order syncing. Recommendations use your synced orders from the last 60 days. A companion only appears once it was bought with the product in at least two orders.

## `GET /v1/bought-together`

```bash theme={null}
curl "https://widget.molin.ai/v1/bought-together?widgetId=abc12345&url=https%3A%2F%2Fstore.example%2Fproducts%2Falpine-tent&limit=4"
```

**widgetId** `string` *required*

Your widget ID, which selects the shop.

**url** `string` *required*

The product page URL. Tracking parameters and fragments are ignored, and the page is matched to your catalog by URL, or by `gtin` or `sku` when given.

**gtin** `string`

The product's GTIN, when your storefront URL differs from the product feed URL.

**sku** `string`

The product's SKU, when your storefront URL differs from the product feed URL.

**limit** `number` (default: 3)

Products to return, from 1 through 12.

**explain** `'0' | '1'` (default: 0)

`1` adds an AI-written paragraph explaining why these products go with the one on the page.

**language** `string`

Language tag the explanation is written in, such as `hu` or `en-US`. Defaults to your widget's language.

### Response

```json theme={null}
{
  "product": {
    "url": "https://store.example/products/alpine-tent",
    "title": "Alpine 3-Person Tent",
    "price": "199.00 EUR",
    "originalPrice": "",
    "priceAmount": 199,
    "priceCurrency": "EUR",
    "image": "https://store.example/cdn/alpine-tent.jpg",
    "sku": "TENT-001",
    "gtin": "",
    "storefrontProductId": "8123456780"
  },
  "products": [
    {
      "url": "https://store.example/products/tent-pegs",
      "title": "Steel Tent Pegs",
      "price": "9.00 EUR",
      "originalPrice": "12.00 EUR",
      "priceAmount": 9,
      "priceCurrency": "EUR",
      "image": "https://store.example/cdn/tent-pegs.jpg",
      "sku": "PEG-001",
      "gtin": "",
      "storefrontProductId": "8123456789",
      "coOrders": 41
    }
  ],
  "explanation": "Other customers who bought the Alpine Tent most often added the Steel Tent Pegs, which hold it down on hard ground."
}
```

**product** `object | null`

The page's own product, so you can show it at the head of the set the way a "frequently bought together" row does. `null` when the page is not a known product, or when nothing was bought with it.

**products** `array`

Companions, strongest first, each once even when it sits in several sets. `coOrders` is how many orders held both this product and the page product. `originalPrice` is empty when the source didn't
provide a price before the discount. Only products that can still be bought are returned.

**priceAmount** `number | null`

The price as a number, with `priceCurrency` as its ISO code, on the page product and on every companion. Use them to add a bundle total up rather than parsing the display price. `priceAmount` is
`null` when the source price could not be read as a number.

**explanation** `string`

The AI-written paragraph when `explain=1` was given and the text could be written, otherwise empty.

An unknown product, or one nobody has bought anything with yet, answers `200` with an empty `products` list rather than an error.

## Caching and limits

Responses are cached for one hour. Requests are rate limited per IP.

## Errors

The endpoint answers `400` for a missing or unknown widget ID, a missing `url`, and a `limit` outside the range described earlier, with no body. Treat a rejection as a bug in the request rather than something to retry.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.