POST
/
cart
/
items
curl -X POST 'https://api.henrylabs.ai/v0/cart/items' \
  -H 'x-api-key: YOUR_API_KEY' \
  -H 'x-user-id: user123' \
  -H 'Content-Type: application/json' \
  --data '{
    "productsDetails": [
      {
        "name": "Nike Air Max 270",
        "price": "150.00",
        "quantity": 1,
        "productLink": "https://nike.com/air-max-270",
        "productImageLink": "https://nike.com/images/air-max-270.jpg",
        "metadata": {
          "size": "10",
          "color": "Black"
        }
      },
      {
        "name": "Adidas Ultraboost 22",
        "price": "190.00",
        "quantity": 2,
        "productLink": "https://adidas.com/ultraboost-22"
      }
    ]
  }'
{
  "success": true,
  "status": "success",
  "message": "Products added to cart successfully",
  "data": {
    "total_cart_items": 3
  }
}

Overview

This endpoint allows you to add products to a user’s cart. You can add multiple products in a single request, and the cart will persist across sessions.

Authentication

x-api-key
string
required
Your API key for authentication
x-user-id
string
required
Unique identifier for the user

Request Body

productsDetails
array
required
Array of products to add to the cart

Response

success
boolean
Indicates if the request was successful
status
string
Status of the request
message
string
Descriptive message about the operation
data
object
Response data
curl -X POST 'https://api.henrylabs.ai/v0/cart/items' \
  -H 'x-api-key: YOUR_API_KEY' \
  -H 'x-user-id: user123' \
  -H 'Content-Type: application/json' \
  --data '{
    "productsDetails": [
      {
        "name": "Nike Air Max 270",
        "price": "150.00",
        "quantity": 1,
        "productLink": "https://nike.com/air-max-270",
        "productImageLink": "https://nike.com/images/air-max-270.jpg",
        "metadata": {
          "size": "10",
          "color": "Black"
        }
      },
      {
        "name": "Adidas Ultraboost 22",
        "price": "190.00",
        "quantity": 2,
        "productLink": "https://adidas.com/ultraboost-22"
      }
    ]
  }'
{
  "success": true,
  "status": "success",
  "message": "Products added to cart successfully",
  "data": {
    "total_cart_items": 3
  }
}

Authorizations

x-api-key
string
header
required

Headers

x-user-id
string
required

Body

application/json

Response

200
application/json

Product added to the cart successfully.

The response is of type object.