Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.quickshops.app/llms.txt

Use this file to discover all available pages before exploring further.

The Cart endpoints let you create carts, add or update items, and clear them. All cart operations require a secret key. You should create a cart when a user begins shopping and persist the returned id in their browser session so subsequent requests can reference the same cart.
Store the cartId in the user’s browser session (e.g. a cookie or sessionStorage). You will need it for every subsequent cart operation and when creating a checkout session.

Create cart

Creates a new, empty cart for your store.
POST /v1/cart

Request

curl -X POST https://api.quickshops.app/v1/cart \
  -H "x-api-key: qk_your_secret_key_here"

Response

{
  "id": "cart_01j...",
  "storeId": "store_01j...",
  "lines": [],
  "totals": {
    "subtotal": 0,
    "total": 0,
    "currency": "usd"
  }
}
id
string
required
Unique identifier for the cart. Persist this value in the user’s session.
storeId
string
required
Identifier of the store this cart belongs to.
lines
object[]
required
Array of cart line items. Empty on a newly created cart.
totals
object
required
Calculated totals for the cart.

Get cart

Retrieves the current state of a cart.
GET /v1/cart/:cartId

Path parameters

cartId
string
required
The ID of the cart to retrieve.

Request

curl https://api.quickshops.app/v1/cart/cart_01j... \
  -H "x-api-key: qk_your_secret_key_here"

Response

Returns a cart object with the same shape as Create cart.
{
  "id": "cart_01j...",
  "storeId": "store_01j...",
  "lines": [
    { "productId": "prod_01j...", "quantity": 2 }
  ],
  "totals": {
    "subtotal": 3998,
    "total": 3998,
    "currency": "usd"
  }
}

Add item

Adds a product to the cart. If the product is already in the cart, the quantity is increased by the amount you specify.
POST /v1/cart/:cartId/lines

Path parameters

cartId
string
required
The ID of the cart to add the item to.

Body parameters

productId
string
required
The ID of the product to add.
quantity
number
required
The number of units to add.

Request

curl -X POST https://api.quickshops.app/v1/cart/cart_01j.../lines \
  -H "x-api-key: qk_your_secret_key_here" \
  -H "Content-Type: application/json" \
  -d '{ "productId": "prod_01j...", "quantity": 1 }'

Response

Returns the updated cart object.
{
  "id": "cart_01j...",
  "storeId": "store_01j...",
  "lines": [
    { "productId": "prod_01j...", "quantity": 1 }
  ],
  "totals": {
    "subtotal": 1999,
    "total": 1999,
    "currency": "usd"
  }
}

Update item quantity

Sets the quantity of an existing line item. Use this to increase or decrease the quantity of a product already in the cart.
PATCH /v1/cart/:cartId/lines/:productId

Path parameters

cartId
string
required
The ID of the cart containing the item.
productId
string
required
The ID of the product whose quantity you want to update.

Body parameters

quantity
number
required
The new quantity for this line item.

Request

curl -X PATCH https://api.quickshops.app/v1/cart/cart_01j.../lines/prod_01j... \
  -H "x-api-key: qk_your_secret_key_here" \
  -H "Content-Type: application/json" \
  -d '{ "quantity": 3 }'

Response

Returns the updated cart object.

Remove item

Removes a product from the cart entirely.
DELETE /v1/cart/:cartId/lines/:productId

Path parameters

cartId
string
required
The ID of the cart containing the item.
productId
string
required
The ID of the product to remove.

Request

curl -X DELETE https://api.quickshops.app/v1/cart/cart_01j.../lines/prod_01j... \
  -H "x-api-key: qk_your_secret_key_here"

Response

Returns the updated cart object with the item removed.

Clear cart

Removes all items from the cart, resetting it to an empty state.
DELETE /v1/cart/:cartId

Path parameters

cartId
string
required
The ID of the cart to clear.

Request

curl -X DELETE https://api.quickshops.app/v1/cart/cart_01j... \
  -H "x-api-key: qk_your_secret_key_here"

Response

Returns the cart object with an empty lines array and zeroed totals.
{
  "id": "cart_01j...",
  "storeId": "store_01j...",
  "lines": [],
  "totals": {
    "subtotal": 0,
    "total": 0,
    "currency": "usd"
  }
}