# Add Item to Cart

<mark style="color:green;">`POST`</mark> `{{Base_url}}/rest/V1/carts/mine/items`

The endpoint `/rest/V1/carts/mine/items` is used to **add an item to the customer’s shopping cart** in a Magento-based system. The `mine` keyword ensures the action is performed on the cart of the currently authenticated customer.

**Body**

{% tabs %}
{% tab title="Request Body" %}

```json
{
  "cartItem": {
    "sku": "IFPZMB-RD0",
    "qty": 1,
    "quote_id": "615982"
  }
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Curl" %}

```json
curl --location '{{Base_url}}/rest/V1/carts/mine/items' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJraWQiOiIxIiwiYWxnIjoiSFMyNTYifQ.eyJ1aWQiOjIxMDAyNywidXR5cGlkIjozLCJpYXQiOjE3Mzc0NjQ1NTYsImV4cCI6MTczNzQ2ODE1Nn0.PUmQFwFrXoWtuBJrBifTJ5NtCc05OCO4mcqws7IK6ys' \
--header 'Cookie: PHPSESSID=2639naaq26nbe7st472kk4ms4i' \
--data '{
  "cartItem": {
    "sku": "IFPZMB-RD0",
    "qty": 1,
    "quote_id": "615982"
  }
}
'
```

{% endtab %}
{% endtabs %}

**`cartItem`**:\
This object represents an item to be added to the cart.

* **`sku`**:\
  The **Stock Keeping Unit** (SKU) is a unique identifier for the product. Example: `"IFPZMB-RD0"`. It helps identify the product being added to the cart.
* **`qty`**:\
  The **quantity** of the item being added to the cart. Example: `1`, indicating that one unit of the item should be added.
* **`quote_id`**:\
  The **quote ID** represents the current cart (quote). It is a unique identifier for the shopping cart/quote. Example: `"615982"` refers to the cart that this item is being added to.

**Responses**

{% tabs %}
{% tab title="Success Response 200" %}

```javascript
{
    "item_id": 97337,
    "sku": "IFPZMB-RD0",
    "qty": 1,
    "name": "iFrogz Audio- Ear Pollution Plugz with Mic - Red",
    "price": 399,
    "product_type": "simple",
    "quote_id": "615982"
}
```

{% endtab %}
{% endtabs %}

#### **Response Attributes:**

**1. `item_id`:**

* **Value:** `97337`
* **Explanation:**\
  The unique identifier for the specific item in the cart. This ID is assigned when the item is added to the cart and is used to manage the cart items (e.g., updating or removing an item).

***

**2. `sku`:**

* **Value:** `"IFPZMB-RD0"`
* **Explanation:**\
  The **Stock Keeping Unit (SKU)** is a unique code for the product. It helps identify the product in the catalog and ensures that the correct item has been added to the cart.

***

**3. `qty`:**

* **Value:** `1`
* **Explanation:**\
  The quantity of this specific item in the cart. In this case, one unit of the product is included.

***

**4. `name`:**

* **Value:** `"iFrogz Audio- Ear Pollution Plugz with Mic - Red"`
* **Explanation:**\
  The name of the product added to the cart. This is a human-readable description of the product for display purposes.

***

**5. `price`:**

* **Value:** `399`
* **Explanation:**\
  The price of a single unit of the product. This is the base price fetched from the product catalog, excluding any discounts or tax adjustments.

***

**6. `product_type`:**

* **Value:** `"simple"`
* **Explanation:**\
  The type of product added to the cart.
  * **`simple`:** A standalone product with no configurable options.
  * Other possible values include `configurable`, `grouped`, or `bundle` for more complex products.

***

**7. `quote_id`:**

* **Value:** `"615982"`
* **Explanation:**\
  The unique identifier for the customer’s cart (also called a "quote"). This ID links the item to a specific shopping cart instance for the authenticated user. It is used for cart operations like adding more items or proceeding to checkout.

{% tabs %}
{% tab title="Token not passed 401" %}

```javascript
{
    "message": "The consumer isn't authorized to access %resources.",
    "parameters": {
        "resources": "self"
    }
}
```

{% endtab %}

{% tab title="Invalid url 404" %}

```python
{
    "message": "Request does not match any route.",
    "trace": null
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://zrpl-co-1.gitbook.io/zrpl/reference/api-reference/add-item-to-cart.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
