TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ALEJ4NDRO2025/urban-store/llms.txt
Use this file to discover all available pages before exploring further.
/api/cart/ endpoint provides all four standard cart operations under a single URL. All methods require a valid Bearer token; the user’s cart is identified by the email field extracted from the JWT payload. A cart document is created automatically in MongoDB on first access — you never need to explicitly initialize one.
Authentication required for all methods:
GET /api/cart/
Retrieve the authenticated user’s current cart, including all items and computed totals. If the user has no existing cart, an empty one is created and returned.Response Fields
The email address extracted from the user’s JWT, used as the cart’s unique identifier.
All items currently in the cart. See item fields below.
Slug of the product this item refers to.
Display name of the product at the time it was added.
Number of units of this specific variant in the cart.
The size chosen for this item (e.g.
"M").The color chosen for this item (e.g.
"negro").Price per unit captured when the item was added to the cart.
Cloudinary URL of the product image snapshot for display in the cart UI.
Sum of
price_at_time × quantity for all items.Sum of quantities across all items.
Example
POST /api/cart/ — Add Item
Add a product variant to the cart. If the same combination ofproduct_slug, selected_size, and selected_color already exists in the cart, the existing item’s quantity is incremented by the requested amount instead of creating a duplicate entry.
Request Body
Slug of the product to add to the cart.
Current unit price. Captured and stored with the item so the cart total reflects the price at the moment of addition.
Display name of the product. Stored for rendering the cart without an additional product lookup.
Number of units to add. Defaults to
1.The size variant being added (e.g.
"M"). Defaults to an empty string if omitted.The color variant being added (e.g.
"negro"). Defaults to an empty string if omitted.Cloudinary URL of the product image for display in the cart UI. Defaults to an empty string if omitted.
Response
- 201 Created — a new item was appended to the cart.
- 200 OK — an existing matching item had its quantity incremented.
GET /api/cart/).
Example
PUT /api/cart/ — Update Quantity
Set the exact quantity of a specific cart item identified by itsproduct_slug, selected_size, and selected_color. If the provided quantity is 0 or negative, the item is automatically removed from the cart.
Request Body
Slug of the product whose quantity to update.
Size of the item to target. Must match the value stored in the cart.
Color of the item to target. Must match the value stored in the cart.
New quantity. Set to
0 or any negative value to remove the item entirely.Response
200 OK — returns the full updated cart object.Example
DELETE /api/cart/ — Remove Item
Remove a specific item from the cart, regardless of its current quantity. The item is identified by the combination ofproduct_slug, selected_size, and selected_color.
Request Body
Slug of the product to remove.
Size of the item to remove. Must match the value stored in the cart.
Color of the item to remove. Must match the value stored in the cart.