---
title: "Add cart items"
method: POST
path: "/carts/{cart_id}/items"
tags: ["Carts"]
---

# Add cart items

`POST /carts/{cart_id}/items`

## Request

- Base URL: `https://dummyHandle.shoplineapp.com/storefront-api/v1`
- URL: `https://dummyHandle.shoplineapp.com/storefront-api/v1/carts/{cart_id}/items`
- Auth: one of:
  - API key in header `X-Storefront-Token`
  - API key in header `X-Storefront-Token` and API key in header `X-Customer-Token`

Add items to cart by cart id and mid

## Path parameters

- `cart_id` string, required

## Request body

- object
  - `items` object[], required
    - `created_by` string: Adding item from who
    - `variation_id` string: Product variation
    - `main_product_id` string: Main product in items
    - `item_data` object: Infos of bundle product
      - `name` string
      - `ref_id` string
      - `discount_type` string
      - `selected_child_products` object[]: List of bundle products
        - `child_variation_id` string
        - `quantity` integer
        - `child_product_id` string
    - `product_id` string, required: Product identifier
    - `quantity` integer, required: Product quantity
    - `type` string, required: Product type, can be `addon_product`, `product`, `product_set`, `subscription_product`, `subscription_order` ,`addon_feature`, `gift`, `custom_product`, `custom_discount`, `promotion`, `redeem_gift` and `manual_gift`

## Response `207`

Bad Request

- object
  - `error` object
    - `message` object[], nullable
      - `index` integer: Cart item index
      - `code` string: Cart item error code
      - `reason` string: Cart item error reason
  - `trace_id` string

---

[API](https://skmtc.dev/shoplineapp/apis/shopline-storefront-api.md) - [All operations](https://skmtc.dev/shoplineapp/apis/shopline-storefront-api/llms.txt) - [OpenAPI document](https://skmtc.dev/shoplineapp/apis/shopline-storefront-api/revisions/8c9cd5ce664d?raw)
