post

/carts

Creates a Cart.

Required Fields

Field Details
line_items
custom_items Only required if adding a custom item to the cart.
gift_certificates Only required if adding a gift certificate to the cart.

Usage Notes

  • A cart id (UUID) is returned in the response.
  • A cart id is the same as a checkout id.
  • A cart can be created by adding an existing catalog item or a custom item.
  • Carts are valid for 30 days from the last modification (this includes creating the cart or editing the cart).
  • If a product has modifiers, omit the variant_id and instead use the option_selections array to describe both the variant and the modifier selections.
  • Redirect URLs can only be generated from carts created using the Server-to-Server Carts API.
  • To get cart redirect_urls in the response, append the following query parameter to the request URL: include=redirect_urls.
  • To restore a cart that was created by a shopper or via the Storefront Cart API, first recreate the cart using the Server to Server Cart API.

Authorization

apiKey - X-Auth-Client
apiKey - X-Auth-Token

Request Parameters

1 Query Parameter
2 Headers

Request Body

Examples:

  1. Creating a cart by adding a simple product (a product without option selections).
  2. Creating a cart with a variant. This works when a product can be specified purely by a variant, without any other required options.
  3. Creating a cart with a variant, a checkbox, and a picklist modifier added.
  4. Creating a cart using a custom item.
4 Examples
Schema
object
customer_id
integer
line_items
oneOf
custom_items
array[object]
gift_certificates
array[object]
channel_id
integer

If no channel is specified, defaults to 1.

currency
object

Responses

Schema
object

A cart contains a collection of items, prices, discounts, etc… It does not contain customer-related data.

id
string

Cart ID, provided after creating a cart with a POST.

1 validation
parent_id
string

Bundled items will have their parent’s item Id.

customer_id
integer

ID of the customer to which the cart belongs.

email
string

The cart’s email. This is the same email that is used in the billing address

currency
object

This will always be the same between cart and checkout.

tax_included
boolean
base_amount
number

Cost of cart’s contents, before applying discounts.

discount_amount
number

Discounted amount.

cart_amount
number

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

coupons
array[object]
discounts
array[object]
line_items
array[object]
created_time
string

Time when the cart was created.

1 validation
updated_time
string

Time when the cart was last updated.

1 validation
channel_id
integer

If no channel is specified, defaults to 1.

Send a Test Request

Send requests directly from the browser (CORS must be enabled)
$$.env
2 variables not set
store_hash
X-Auth-Client
X-Auth-Token