Skip to main content
PATCH
/
products
/
{id}
curl -X PATCH https://api.example.com/products/123 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "price": 15.99
  }'
{
  "id": 123,
  "name": "Premium Espresso Coffee",
  "price": 15.99,
  "image": "espresso.jpg",
  "inventory": 75,
  "categoryId": 1,
  "category": {
    "id": 1,
    "name": "Beverages",
    "image": "beverages.jpg"
  }
}
Update an existing product’s information. All fields are optional.

Authentication

This endpoint requires authentication with the admin role.

Path Parameters

id
integer
required
The unique identifier of the product to update

Request Body

All fields are optional. Only include the fields you want to update.
name
string
The product name (max 60 characters)
price
number
The product price (max 2 decimal places)
image
string
The product image URL or filename
inventory
number
The quantity in stock (integer)
categoryId
integer
The ID of the category this product belongs to

Response

id
integer
The unique identifier for the product
name
string
The updated product name
price
number
The updated product price
image
string
The updated product image URL or filename
inventory
number
The updated quantity in stock
categoryId
integer
The updated category ID
category
object
The category object with full details
curl -X PATCH https://api.example.com/products/123 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "price": 15.99
  }'
{
  "id": 123,
  "name": "Premium Espresso Coffee",
  "price": 15.99,
  "image": "espresso.jpg",
  "inventory": 75,
  "categoryId": 1,
  "category": {
    "id": 1,
    "name": "Beverages",
    "image": "beverages.jpg"
  }
}

Errors

statusCode
integer
HTTP status code
message
array
Array of error messages
{
  "statusCode": 404,
  "message": ["Product not found"]
}

Build docs developers (and LLMs) love