Skip to main content
DELETE
/
api
/
cart
Delete from Cart
curl --request DELETE \
  --url https://api.example.com/api/cart \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: <content-type>' \
  --header 'x-api-key: <x-api-key>' \
  --data '{
  "cartId": 123
}'
{
  "success": true,
  "message": "<string>"
}

Authentication

This endpoint requires JWT authentication.

Required Headers

x-api-key
string
required
Your API key for authentication
Authorization
string
required
Bearer token for user authentication. Format: Bearer {token}
Content-Type
string
required
Must be application/json

Request Body

cartId
integer
required
The unique identifier of the cart item to remove. This is the cart_id returned from the GET /api/cart endpoint.

Response

success
boolean
Indicates if the request was successful
message
string
Response message confirming the removal or indicating an error

Example Request

curl -X DELETE 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 '{
    "cartId": 1
  }'

Example Response

{
  "success": true,
  "message": "Product removed from cart successfully"
}

Behavior Notes

The endpoint verifies that the cart item belongs to the authenticated user before deletion. You cannot delete items from another user’s cart.
Make sure to use the correct cart_id value from the GET /api/cart response. Using an invalid or non-existent cart ID will return a 404 error.

Error Codes

Status CodeDescription
200Cart item removed successfully
401Missing or invalid authentication credentials
404Cart item not found or doesn’t belong to the user
500Internal server error

Build docs developers (and LLMs) love