For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Dev Portal
DocsAPI ReferenceLearnCommunityChangelog
DocsAPI ReferenceLearnCommunityChangelog
    • About Our APIs
  • REST
    • Overview
      • Overview
      • Carts
          • GETGet Cart
          • POSTCreate Cart
          • DELDelete Cart
            • POSTAdd Cart Line Items
            • PUTUpdate Cart Line Item
            • DELDelete Cart Line Item
      • Checkouts
      • Consent
      • Customers
      • Subscriptions
      • Form Fields
      • Orders
      • Pickup Options
  • GraphQL
    • Overview
  • MCP
    • Overview
Dev Portal
LogoLogo
RESTStorefrontCartsCart Items

Add Cart Line Items

POST
https://your_store.example.com/api/storefront/carts/:cartId/items
POST
/api/storefront/carts/:cartId/items
$curl -X POST https://your_store.example.com/api/storefront/carts/cartId/items \
> -H "Accept: application/json" \
> -H "Content-Type: application/json" \
> -d '{
> "lineItems": [
> {
> "productId": 230,
> "quantity": 2,
> "giftWrapping": {
> "wrapTogether": true,
> "wrapDetails": [
> {
> "id": 1,
> "message": "Happy Birthday"
> }
> ]
> },
> "variantId": 124
> }
> ],
> "version": 1
>}'
1{
2 "id": "string",
3 "customerId": 1,
4 "email": "string",
5 "currency": {
6 "code": "string",
7 "decimalPlaces": 1,
8 "name": "US Dollar",
9 "symbol": "$"
10 },
11 "isTaxIncluded": true,
12 "baseAmount": 1.1,
13 "discountAmount": 1.1,
14 "cartAmount": 1.1,
15 "coupons": [
16 {
17 "code": "string",
18 "couponType": 1,
19 "discountedAmount": 1.1,
20 "displayName": "string",
21 "id": "string"
22 }
23 ],
24 "discounts": [
25 {
26 "discountedAmount": 1.1,
27 "id": "string"
28 }
29 ],
30 "lineItems": {
31 "customItems": [
32 {
33 "extendedListPrice": 1,
34 "id": "f1f3a531-fbcf-439b-bac1-40d5ae5c2bff",
35 "listPrice": 10,
36 "name": "Custom Item Name",
37 "quantity": 1,
38 "sku": "SM-456"
39 }
40 ],
41 "digitalItems": [
42 {
43 "quantity": 1.1,
44 "brand": "string",
45 "couponAmount": 1.1,
46 "discountAmount": 1.1,
47 "discounts": [
48 {
49 "discountedAmount": 1.1,
50 "id": 1.1
51 }
52 ],
53 "extendedListPrice": 1.1,
54 "extendedSalePrice": 1.1,
55 "id": "4",
56 "imageUrl": "string",
57 "isMutable": true,
58 "isTaxable": true,
59 "listPrice": 1.1,
60 "name": "string",
61 "options": [
62 {
63 "name": "string",
64 "nameId": 125,
65 "value": "string",
66 "valueId": 127
67 }
68 ],
69 "originalPrice": 1.1,
70 "parentId": "6",
71 "productId": 1.1,
72 "salePrice": 1.1,
73 "sku": "string",
74 "type": "digital",
75 "url": "string",
76 "variantId": 7
77 }
78 ],
79 "giftCertificates": [
80 {
81 "amount": 1.1,
82 "recipient": {
83 "email": "string",
84 "name": "string"
85 },
86 "sender": {
87 "email": "string",
88 "name": "string"
89 },
90 "theme": "string",
91 "id": "string",
92 "taxable": true,
93 "message": "string",
94 "name": "string",
95 "type": "giftCertificate"
96 }
97 ],
98 "physicalItems": [
99 {
100 "quantity": 1.1,
101 "brand": "string",
102 "couponAmount": 1.1,
103 "discountAmount": 1.1,
104 "discounts": [
105 {
106 "discountedAmount": 1.1,
107 "id": "string"
108 }
109 ],
110 "extendedListPrice": 1.1,
111 "extendedSalePrice": 1.1,
112 "giftWrapping": {
113 "amount": 1.1,
114 "message": "string",
115 "name": "string"
116 },
117 "id": "4",
118 "imageUrl": "string",
119 "isMutable": true,
120 "isShippingRequired": true,
121 "isTaxable": true,
122 "listPrice": 1.1,
123 "name": "string",
124 "options": [
125 {
126 "name": "string",
127 "nameId": 125,
128 "value": "string",
129 "valueId": 127
130 }
131 ],
132 "originalPrice": 1.1,
133 "parentId": 6,
134 "productId": 1.1,
135 "salePrice": 1.1,
136 "sku": "string",
137 "type": "physical",
138 "url": "string",
139 "variantId": 7
140 }
141 ]
142 },
143 "createdTime": "string",
144 "updatedTime": "string",
145 "locale": "string",
146 "version": 1
147}
Adds a line items to the *Cart*. > #### Notes > * Substitute your storefront domain for `yourstore.example.com`. > * The Send a Test Request feature is not currently supported for this endpoint. > * To prevent lost updates due to concurrent requests overriding changes made by others, it is recommended to enable optimistic concurrency control by including the `version` field in the request payload. If the provided version does not match the version on the server, a conflict error will be returned, which the client can handle accordingly.
Was this page helpful?
Previous

Update Cart Currency

Next

Update Cart Line Item

Built with

Adds a line items to the Cart.

Notes

  • Substitute your storefront domain for yourstore.example.com.
  • The Send a Test Request feature is not currently supported for this endpoint.
  • To prevent lost updates due to concurrent requests overriding changes made by others, it is recommended to enable optimistic concurrency control by including the version field in the request payload. If the provided version does not match the version on the server, a conflict error will be returned, which the client can handle accordingly.

Path parameters

cartIdstringRequiredformat: "uuid"

This cartʼs unique ID.

Headers

AcceptstringRequiredDefaults to application/json
The [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of the response body.

Query parameters

includelist of enumsOptional
To return product options add one of the following include: `lineItems.physicalItems.options`: The Cart returns an abbreviated result. Use this to return physical items product options. Can also be used in a /POST to have the extended Cart object return. `lineItems.digitalItems.options`: The Cart returns an abbreviated result. Use this to return digital items product options. Can also be used in a /POST to have the extended Cart object return. `lineItems.digitalItems.options,lineItems.physicalItems.options`: The Cart returns an abbreviated result. Use this to return digital and physical options. Can also be used in a /POST to have the extended Cart object return.
Allowed values:

Request

objectRequired
OR
objectRequired
OR
objectRequired

Response

idstringformat: "UUID"
Cart ID, provided after creating a cart with a POST.
customerIdinteger
ID of the customer to which the cart belongs.
emailstring
The cart's email. This is the same email that is used in the billing address
currencyobject
This will always be the same between cart and checkout.
isTaxIncludedboolean
Whether this item is taxable.
baseAmountdouble

Cost of cart’s contents, before applying discounts.

discountAmountdouble

Order based discounted amount only - Coupon discounts and product based discounts are excluded.

cartAmountdouble

Sum of line-items amounts, minus cart-level discounts and coupons. This amount includes taxes (where applicable).

couponslist of objects
discountslist of objects
lineItemsobject
createdTimestringformat: "ISO-8601"
Time when the cart was created.
updatedTimestringformat: "ISO-8601"
Time when the cart was last updated.
localestring
Locale of the cart.
versioninteger
The current version of the cart increments with each successful update. You can use it to enable optimistic concurrency control for subsequent updates.

Errors

409
Conflict Error

The MIME type of the response body.

To return product options add one of the following include:

lineItems.physicalItems.options: The Cart returns an abbreviated result. Use this to return physical items product options. Can also be used in a /POST to have the extended Cart object return.

lineItems.digitalItems.options: The Cart returns an abbreviated result. Use this to return digital items product options. Can also be used in a /POST to have the extended Cart object return.

lineItems.digitalItems.options,lineItems.physicalItems.options: The Cart returns an abbreviated result. Use this to return digital and physical options. Can also be used in a /POST to have the extended Cart object return.