Products
Delete Product
Delete a product from the catalog (admin only)
DELETE
Delete Product
Overview
This endpoint allows administrators to permanently delete a product from the catalog. This action cannot be undone.Endpoint
Path Parameters
The unique identifier of the product to delete
Authentication
Required: Admin role This endpoint requires a valid JWT token with admin privileges. Include the token in the Authorization header:Response
Returns no content on successful deletion. Status Code:204 No Content
Example Request
Example Response
No response body. HTTP status code204 No Content indicates successful deletion.
Error Responses
Product Not Found
404 Not Found
Unauthorized
401 Unauthorized
Forbidden (Non-Admin User)
403 Forbidden
Conflict (Product in Orders)
If the product has associated order items, deletion may be restricted based on the database constraints:409 Conflict
Important Notes
- This action is permanent and cannot be undone
- Due to the Prisma schema’s
onDelete: Restrictconstraint on OrderItem relations, products that are referenced in existing orders cannot be deleted - CartItem relations use
onDelete: Cascade, so deleting a product will automatically remove it from all carts - Only administrators can perform this action
Delete Product