Skip to main content
DELETE
/
products
/
{id}
Delete Product
curl --request DELETE \
  --url https://api.example.com/products/{id}
{
  "product": {
    "_id": "<string>",
    "brand": "<string>",
    "name": "<string>",
    "stock": 123,
    "price": 123,
    "normalizedName": "<string>"
  }
}
Deletes a product from the inventory system.

Authentication

This endpoint requires authentication. Include a valid JWT token in the Authorization header.

Path Parameters

id
string
required
The unique identifier of the product to delete

Response

product
object
The deleted product object
_id
string
Unique identifier for the product
brand
string
The product brand
name
string
The product name
stock
number
The quantity in stock
price
number
The product price
normalizedName
string
Normalized version of the product name for search purposes

Status Codes

  • 200: Product successfully deleted
  • 404: Product not found
  • 401: Authentication token missing or invalid
  • 500: Server error

Example Request

curl -X DELETE http://localhost:3000/products/507f1f77bcf86cd799439011 \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Example Response

{
  "product": {
    "_id": "507f1f77bcf86cd799439011",
    "brand": "TechCorp",
    "name": "Wireless Mouse",
    "stock": 150,
    "price": 29.99,
    "normalizedName": "wireless mouse"
  }
}

Error Response (404)

{
  "message": "❌ Producto no encontrado para eliminar..."
}

Error Response (500)

{
  "message": "❌ Error en el servidor...",
  "error": "Database deletion failed"
}

Build docs developers (and LLMs) love