Add a product to the authenticated user’s shopping cart or update quantity if already exists
curl --request POST \
--url https://api.example.com/api/cart \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"productId": 123,
"quantity": 123,
"variant": "<string>"
}
'{
"success": true,
"message": "<string>"
}Documentation Index
Fetch the complete documentation index at: https://mintlify.com/memoowi/e-comm-api-demo-2/llms.txt
Use this file to discover all available pages before exploring further.
Bearer {token}application/jsoncurl -X POST https://api.example.com/api/cart \
-H "x-api-key: your_api_key" \
-H "Authorization: Bearer your_jwt_token" \
-H "Content-Type: application/json" \
-d '{
"productId": 123,
"quantity": 2,
"variant": "Black"
}'
{
"success": true,
"message": "Product added to cart successfully"
}
variant field is required. The variant value must match one of the available variants for the product, otherwise a 400 error will be returned.| Status Code | Description |
|---|---|
| 200 | Product quantity updated successfully |
| 201 | Product added to cart successfully |
| 400 | Missing required fields or invalid variant |
| 401 | Missing or invalid authentication credentials |
| 404 | Product not found |
| 500 | Internal server error |
curl --request POST \
--url https://api.example.com/api/cart \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"productId": 123,
"quantity": 123,
"variant": "<string>"
}
'{
"success": true,
"message": "<string>"
}