Skip to Content

DELETE /api/v1/cart

Clear all cart items, or only items of a specific cart type.

Authentication: Required

Cache: None

Request Body

FieldTypeRequiredDescription
cartTypestringNoClear only this cart type. Omit to clear all items.

Sample Request

# Clear all items curl -X DELETE -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ https://api.grails.app/api/v1/cart \ -d '{}' # Clear only "buy" items curl -X DELETE -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ https://api.grails.app/api/v1/cart \ -d '{ "cartType": "buy" }'

Response

// 200 OK — with cartType specified { "success": true, "data": { "message": "Cleared buy cart", "deletedCount": 3 }, "meta": { "timestamp": "2026-04-08T00:00:00.000Z", "version": "1.0.0" } }

When cartType is omitted, all items are cleared:

// 200 OK — all items { "success": true, "data": { "message": "Cleared all cart items", "deletedCount": 5 }, "meta": { "timestamp": "2026-04-08T00:00:00.000Z", "version": "1.0.0" } }

Error Responses

StatusCodeDescription
400VALIDATION_ERRORInvalid request body
400INVALID_CART_TYPECart type does not exist
401UNAUTHORIZEDMissing or invalid token
500INTERNAL_ERRORFailed to clear cart
Last updated on