Skip to main content
POST
/
api
/
v1
/
cart
/
add.json
Add to Cart
curl --request POST \
  --url https://api.launchmystore.io/api/v1/cart/add.json \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "items": [
    {
      "variant_id": "<string>",
      "quantity": 123,
      "properties": {},
      "selling_plan_id": "<string>"
    }
  ]
}
'
{
  "success": true,
  "data": {
    "items": [
      {}
    ],
    "cart": {}
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.launchmystore.io/llms.txt

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

Add to Cart

Adds one or more items to the cart.

Request

curl -X POST "https://api.launchmystore.io/api/v1/cart/add.json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      {
        "variant_id": "var_def456",
        "quantity": 2
      }
    ]
  }'

Body Parameters

items
array
required
Array of items to add

Shorthand Format

You can also use the shorthand format for adding a single item:
{
  "id": "var_def456",
  "quantity": 2
}

Response

success
boolean
Whether the request succeeded
data
object
The added item(s) and updated cart

Example Response

{
  "success": true,
  "data": {
    "items": [
      {
        "id": "li_003",
        "product_id": "prod_abc123",
        "variant_id": "var_def456",
        "title": "Classic T-Shirt",
        "variant_title": "Medium / Black",
        "quantity": 2,
        "price": 2500,
        "line_price": 5000,
        "sku": "TSHIRT-M-BLK",
        "image": {
          "src": "https://cdn.launchmystore.io/images/tshirt-black.jpg",
          "alt": "Black T-Shirt"
        },
        "properties": {}
      }
    ],
    "cart": {
      "token": "cart_xyz789",
      "item_count": 2,
      "total_price": 5000,
      "items": [...]
    }
  }
}

Adding Items with Properties

Add personalized items with custom properties:
{
  "items": [
    {
      "variant_id": "var_gift001",
      "quantity": 1,
      "properties": {
        "Engraving": "Happy Birthday!",
        "Gift Wrap": "Yes"
      }
    }
  ]
}

Error Codes

CodeDescription
UNAUTHORIZEDInvalid or missing access token
NOT_FOUNDVariant not found
OUT_OF_STOCKVariant is out of stock
QUANTITY_UNAVAILABLERequested quantity exceeds available stock
VALIDATION_ERRORInvalid request body