Update an existing product (admin only)
curl --request PUT \
--url https://api.example.com/products/:id \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"price": 123,
"imageUrl": "<string>",
"categoryId": 123
}
'{
"id": 123,
"name": "<string>",
"description": "<string>",
"price": 123,
"imageUrl": "<string>",
"stock": 123,
"categoryId": 123,
"createdAt": {},
"updatedAt": {}
}Documentation Index
Fetch the complete documentation index at: https://mintlify.com/GioTaipe/E-commerce/llms.txt
Use this file to discover all available pages before exploring further.
PUT /products/:id
Authorization: Bearer <your_token>
multipart/form-data format if uploading a new image, or application/json for other updates.
name: If provided, must be a valid stringdescription: If provided, must be a valid stringprice: If provided, must be a number with maximum 2 decimal placescategoryId: If provided, must be an integer >= 1image: Optional file field - if provided, will replace the existing imagecurl -X PUT https://api.example.com/products/1 \
-H "Authorization: Bearer <your_admin_token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Premium Laptop",
"price": 1499.99
}'
curl -X PUT https://api.example.com/products/1 \
-H "Authorization: Bearer <your_admin_token>" \
-F "name=Premium Laptop" \
-F "price=1499.99" \
-F "image=@/path/to/new-laptop.jpg"
{
"id": 1,
"name": "Premium Laptop",
"description": "High-performance laptop for professionals",
"price": "1499.99",
"imageUrl": "https://example.com/uploads/laptop-updated-1234567890.jpg",
"stock": 15,
"categoryId": 2,
"createdAt": "2026-01-15T10:30:00.000Z",
"updatedAt": "2026-03-06T14:25:00.000Z"
}
200 OK
{
"error": "Product not found"
}
404 Not Found
{
"error": "Validation failed",
"details": [
{
"field": "price",
"message": "El precio debe ser un número válido con máximo 2 decimales"
}
]
}
400 Bad Request
{
"error": "Unauthorized"
}
401 Unauthorized
{
"error": "Admin access required"
}
403 Forbidden
{
"error": "Validation failed",
"details": [
{
"field": "categoryId",
"message": "Debe proporcionar un ID de categoría válido"
}
]
}
400 Bad Requestcurl --request PUT \
--url https://api.example.com/products/:id \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"price": 123,
"imageUrl": "<string>",
"categoryId": 123
}
'{
"id": 123,
"name": "<string>",
"description": "<string>",
"price": 123,
"imageUrl": "<string>",
"stock": 123,
"categoryId": 123,
"createdAt": {},
"updatedAt": {}
}