---
title: "Add a product to compare list"
method: POST
path: "/compare_items"
tags: ["CompareItem"]
---

# Add a product to compare list

`POST /compare_items`

## Request

- Base URL: `http://localhost:8000/api/shop`
- URL: `http://localhost:8000/api/shop/compare_items`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/bagisto/apis/bagisto-shop-api/docs/compare_items/post.ts> (a function with typed inputs; its response is checked against the schema)

Adds a product to the authenticated customer's compare list.

## Headers

- `X-STOREFRONT-KEY` string, required
- `X-Locale` string
- `X-Channel` string
- `X-Currency` string

## Request body

- object
  - `productId` integer, required

## Response `201`

The product was added to the compare list.

## Other responses

- `400`: Invalid input
- `422`: Missing/invalid product_id, or product already in compare list.

---

[API](https://skmtc.dev/bagisto/apis/bagisto-shop-api.md) - [All operations](https://skmtc.dev/bagisto/apis/bagisto-shop-api/llms.txt) - [OpenAPI document](https://skmtc.dev/bagisto/apis/bagisto-shop-api/revisions/f619df36bf29?raw)
