A cart is a record, not session data, so it can be restored from a link and merged into an account at sign-in. Every route but the list is open to visitors, with no credentials and no CSRF token. Each has two forms: with the cart’s uuid, /cdna-api/cart/{uuid}/…, for a headless client, and without it, for the visitor’s current cart, found from the cart cookie, which the response sets.
A cart is saved only once something is added: adding an item without a uuid creates it, and its uuid is in the response. Every response returns the whole cart under data.cart. A business failure, such as an unknown SKU or code, is not an HTTP error: the answer is 200, with the reason in data.cart.messages.
AccessVisitors
Open with no credentials and no CSRF token; only the list needs an admin user.
The fields and relations to return, such as {id,uuid,total}.
filtersquery
name=value
Any stored field, or a relation with a dot, such as parent.id=12. Prefix the name with !, >, <, % or |. Use stored field names exactly as in the model, and compare totalCount with the unfiltered list's to confirm a filter applied.
orderByquery
string
field:ASC or field:DESC, comma-separated. Stored fields only.
limitquery
integer
Records per response. There is no default.
offsetquery
integer
Records to skip.
Example
List carts
GET /cdna-api/cart/carts?limit=2&properties={id,uuid,total} HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Adds a product or variant, by its SKU, to the visitor’s current cart, and creates that cart if there is none: this is how a cart comes into being. The response sets the cart cookie and holds the new cart’s uuid.
Access
Anyone. The route takes no credentials, by design.
Returns
The whole cart under data.cart, with an info message for the item added.
Parameters
skupathrequired
string
The product’s or variant’s SKU, its code.
quantitybody
integer
How many; 1 when left out.
attributesbody
object
Choices recorded on the item, such as an engraving, as names and scalar values.
Adds a product or variant to a cart by its SKU. An unknown or unpublished SKU, or one with no price in the cart’s currency, still answers 200: the item is missing and messages says why. Without the uuid, /cdna-api/cart/…, it acts on the visitor’s current cart.
Access
Anyone. The route takes no credentials, by design.
Returns
The whole cart under data.cart.
Parameters
uuidpathrequired
string
The cart’s uuid, from any cart response.
skupathrequired
string
The product’s or variant’s SKU.
quantitybody
integer
How many; 1 when left out.
attributesbody
object
Choices recorded on the item, as names and scalar values.
Changes an item’s quantity and attributes. A quantity of 0 removes it. The path takes the cart item’s id, not the product’s. Without the uuid, /cdna-api/cart/…, it acts on the visitor’s current cart.
Access
Anyone. The route takes no credentials, by design.
Returns
The whole cart under data.cart.
Parameters
uuidpathrequired
string
The cart’s uuid, from any cart response.
item.idpathrequired
integer
The cart item’s id.
quantitybody
integer
The new quantity; 0 removes the item.
attributesbody
object
The item’s attributes; send them every time, or they are cleared.
Returns a new cart with a uuid, but does not save it or set the cookie, and the body is ignored. Until an item is added the uuid finds nothing, so start a cart with Add an item to the current cart instead.
Access
Anyone. The route takes no credentials, by design.
Returns
A new, unsaved cart under data.cart.
Example
Start a cart
POST /cdna-api/cart HTTP/1.1
Host: hub.coredna.com
Accept: application/json
Records the shopper’s email on the cart, the only field this route changes. An address that belongs to an account is refused unless it is the signed-in caller’s own. Without the uuid, /cdna-api/cart/…, it acts on the visitor’s current cart.
Access
Anyone. The route takes no credentials, by design.
Prices the cart again: availability, prices, discounts and tax, as they are now. There is no body. Without the uuid, /cdna-api/cart/…, it acts on the visitor’s current cart.
Access
Anyone. The route takes no credentials, by design.
Returns
The whole cart under data.cart.
Parameters
uuidpathrequired
string
The cart’s uuid, from any cart response.
Example
Evaluate a cart
PUT /cdna-api/cart/f6b4ec7c-8192-43ca-9327-1ba9add89fe3/evaluate HTTP/1.1
Host: hub.coredna.com
Accept: application/json
Applies a discount code, given in the path. A code that does not exist, or does not apply, answers 200 with an error in messages, as here. Without the uuid, /cdna-api/cart/…, it acts on the visitor’s current cart.
Access
Anyone. The route takes no credentials, by design.
Returns
The whole cart under data.cart.
Parameters
uuidpathrequired
string
The cart’s uuid, from any cart response.
codepathrequired
string
The discount code.
Example
Apply a discount code
POST /cdna-api/cart/f6b4ec7c-8192-43ca-9327-1ba9add89fe3/discount/SAVE10 HTTP/1.1
Host: hub.coredna.com
Accept: application/json