Authentication
This endpoint requires authentication. Include a valid JWT token in the Authorization header.
Authorization: Bearer <token>
Path Parameters
The ID of the cart item to update (not the product ID)
Request Body
The new quantity for the cart item. Must be at least 1.
Response
Returns the updated cart item.
Unique identifier for the cart item
ID of the cart this item belongs to
Updated quantity of the product in the cart
{
"id": 10,
"cartId": 1,
"productId": 42,
"quantity": 5
}
Behavior
- This endpoint sets the quantity to the specified value (not incremental)
- The cart item must belong to the authenticated user’s cart
- Use the DELETE endpoint if you want to remove the item entirely
Error Responses
Cart Item Not Found (404)
{
"message": "Item no encontrado en tu carrito"
}
This error occurs when:
- The cart item ID doesn’t exist
- The cart item belongs to another user’s cart
Validation Error (400)
{
"errors": [
{
"field": "quantity",
"message": "La cantidad debe ser al menos 1"
}
]
}
Unauthorized (401)
{
"message": "Usuario no autenticado"
}