---
title: "Lists the products discounted when bought together with what a cart holds, or with a product, at what they would cost; a visitor's cart is priced too."
---

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

Path: Sherpo customer API › cross

`POST /v1/stores/{store}/cross_sells/query`

## Authentication

Requires one of the following:

- `bearer`, http, header `Authorization`, scopes: `read`
- `publishableKey`, apiKey, in header, header `Publishable-Key`

## Path parameters

- `store` (`listCrossSells.path.store`; string, required) — A hostname of the store.

## Request body

_Optional._

- `checkout` (`listCrossSells.checkout`; object, optional) — The customer's own cart.
  - `id` (`listCrossSells.checkout.id`; string, required)
    - minLength 1; maxLength 512
- `lines` (`listCrossSells.lines`; array<object>, optional) — A visitor's cart kept in their browser, by its prices; in place of `checkout`.
  - `price` (`listCrossSells.lines.price`; object, required)
    - `id` (`listCrossSells.lines.price.id`; string, required)
      - minLength 1; maxLength 512
  - `quantity` (`listCrossSells.lines.quantity`; number, optional) — Units the line holds, 1 when absent.
    - min 1; max 99
- `product` (`listCrossSells.product`; any of, optional) — A product shown on its own, whose cross-sells count it as in the cart.
  - any of: `object`, `object`
- `price` (`listCrossSells.price`; object, optional) — The product's price picked to buy, the one its cross-sells count; each of its live prices when absent.
  - `id` (`listCrossSells.price.id`; string, required)
    - minLength 1; maxLength 512
- `coupon` (`listCrossSells.coupon`; string, optional) — A visitor's coupon code, priced as their cart would take it; a named cart prices with its own.
  - maxLength 64

## Example request

```json
{
  "checkout": {
    "id": "string"
  },
  "lines": [
    {
      "price": {
        "id": "string"
      },
      "quantity": 1
    }
  ],
  "product": {
    "id": "string"
  },
  "price": {
    "id": "string"
  },
  "coupon": "string"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.sherpo.io/customer/v1/stores/<store>/cross_sells/query' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "checkout": {
    "id": "string"
  },
  "lines": [
    {
      "price": {
        "id": "string"
      },
      "quantity": 1
    }
  ],
  "product": {
    "id": "string"
  },
  "price": {
    "id": "string"
  },
  "coupon": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.sherpo.io/customer/v1/stores/<store>/cross_sells/query';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    checkout: {id: 'string'},
    lines: [{price: {id: 'string'}, quantity: 1}],
    product: {id: 'string'},
    price: {id: 'string'},
    coupon: 'string'
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.sherpo.io/customer/v1/stores/<store>/cross_sells/query"

payload = {
    "checkout": { "id": "string" },
    "lines": [
        {
            "price": { "id": "string" },
            "quantity": 1
        }
    ],
    "product": { "id": "string" },
    "price": { "id": "string" },
    "coupon": "string"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Lists the products discounted when bought together with what a cart holds, or with a product, at what they would cost; a visitor's cart is priced too.

#### Example

```json
{
  "items": [
    {
      "discount_id": "string",
      "with": [
        "string"
      ],
      "with_price_id": "string",
      "product": {
        "id": "string",
        "slug": "string",
        "title": "string",
        "category": "string"
      },
      "price_id": "string",
      "currency": "string",
      "exponent": 0,
      "amount": 0,
      "charge": 0
    }
  ],
  "lines": [
    {
      "with": [
        "string"
      ],
      "price_id": "string",
      "product_id": "string",
      "amount": 0,
      "charge": 0,
      "discount_id": "string"
    }
  ]
}
```

- `items` (`listCrossSells.response.200.items`; array<object>, required)
  - `discount_id` (`listCrossSells.response.200.items.discount_id`; string, required)
  - `with` (`listCrossSells.response.200.items.with`; array<string>, required)
  - `with_price_id` (`listCrossSells.response.200.items.with_price_id`; any of, required)
    - any of: `string`, `null`
  - `product` (`listCrossSells.response.200.items.product`; object, required)
    - `id` (`listCrossSells.response.200.items.product.id`; string, required)
    - `slug` (`listCrossSells.response.200.items.product.slug`; string, required)
    - `title` (`listCrossSells.response.200.items.product.title`; string, required)
    - `category` (`listCrossSells.response.200.items.product.category`; string, required)
  - `price_id` (`listCrossSells.response.200.items.price_id`; string, required)
  - `currency` (`listCrossSells.response.200.items.currency`; string, required)
  - `exponent` (`listCrossSells.response.200.items.exponent`; any of, required)
    - any of: `number`, `null`
  - `amount` (`listCrossSells.response.200.items.amount`; number, required)
  - `charge` (`listCrossSells.response.200.items.charge`; number, required)
- `lines` (`listCrossSells.response.200.lines`; array<object>, required)
  - `with` (`listCrossSells.response.200.lines.with`; array<string>, required)
  - `price_id` (`listCrossSells.response.200.lines.price_id`; string, required)
  - `product_id` (`listCrossSells.response.200.lines.product_id`; string, required)
  - `amount` (`listCrossSells.response.200.lines.amount`; any of, required)
    - any of: `number`, `null`
  - `charge` (`listCrossSells.response.200.lines.charge`; any of, required)
    - any of: `number`, `null`
  - `discount_id` (`listCrossSells.response.200.lines.discount_id`; any of, required)
    - any of: `string`, `null`

### default

A problem; see https://api.sherpo.io/customer/docs/errors.

#### Example

```json
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "context": {},
  "reached_core": true,
  "core_answer": "string"
}
```

- `type` (`listCrossSells.response.default.type`; string, required)
  - format `uri`
- `title` (`listCrossSells.response.default.title`; string, required)
- `status` (`listCrossSells.response.default.status`; integer, required)
- `detail` (`listCrossSells.response.default.detail`; string, required)
- `code` (`listCrossSells.response.default.code`; string, optional)
- `context` (`listCrossSells.response.default.context`; object, optional)
- `reached_core` (`listCrossSells.response.default.reached_core`; boolean, optional)
- `core_answer` (`listCrossSells.response.default.core_answer`; string, optional)


Source: https://docs.sherpo.io/customer-api/reference/list-cross-sells/index.md
