Skip to main content

Update Product

Update an existing product.

HTTP Request

PATCH/api/products/:id

Authorization

Authorization

  • Required: Yes
  • Permission: Staff with ProductCPermission or Admin
  • Permission Code: 1843
  • Authentication: Token-based (Authorization: Token <your_api_key>)

Path Parameters

ParameterTypeRequiredDescription
idIntegerYesUnique ID of the product to update

Request Body

FieldTypeRequiredDescription
activeBooleanNoWhether the product is active (default: true)
orderIntegerNoDisplay order priority
codeStringNoProduct code/SKU (unique)
titleStringNoProduct title
slugStringNoURL-friendly product identifier(unique)
stock_typeStringNoStock management type (choices: call, limited, unlimited, out_of_stock)
stockIntegerNoAvailable stock quantity
regular_priceDecimalNoOriginal price of the product
sale_priceDecimalNoSale price (if on sale)
price_notesStringNoAdditional pricing notes
excerptStringNoShort product description
imageIntegerNoID of the product's main image
brandIntegerNoBrand ID
categoriesArray of IntegersNoList of Category IDs
descriptionStringNoFull product description

Example Requests

1import requests
2
3# Partial update (PATCH)
4response = requests.patch('http://www.example.com/api/products/123', 
5  json={
6      'title': 'Updated Gaming Laptop Pro',
7      'sale_price': 1250000,
8      'stock': 25,
9      'active': True
10  },
11  headers={'Authorization': 'Token <your_api_key>'}
12)
13print(response.json())
14
15# Update price and stock
16response = requests.patch('http://www.example.com/api/products/123', 
17  json={
18      'regular_price': 12580000,
19      'sale_price': 11580000,
20      'stock': 100
21  },
22  headers={'Authorization': 'Token <your_api_key>'}
23)
24print(response.json())

Response Fields

FieldTypeDescription
idIntegerUnique ID of the product
activeBooleanWhether the product is active
orderIntegerRow-order priority (nullable)
codeStringProduct code/SKU (unique, nullable)
titleStringProduct title
slugStringURL-friendly product identifier (unique)
stock_typeStringStock management type
stockIntegerAvailable stock quantity
in_stockBooleanWhether the product is in stock (computed)
regular_priceDecimalOriginal price of the product
sale_priceDecimalSale price (if on sale)
discountDecimalDiscount amount (computed)
discount_percentDecimalDiscount percentage (computed)
priceDecimalFinal price after discount (computed)
price_notesStringAdditional pricing notes
excerptStringShort product description
comments_countIntegerNumber of comments (computed)
ratingDecimalAverage product rating (computed)
image_dataObjectImage details
created_atString (ISO 8601)Timestamp when product was created
updated_atString (ISO 8601)Timestamp when product was last updated
brand_dataObjectThe product brand data
categories_dataList[Object]The product categories list
descriptionStringAdditional descriptions of the product
metaList[Object]List of meta data on the product

Image Data Structure

FieldTypeDescription
idIntegerUnique ID of the image
typeStringFile type (e.g., image/jpeg)
nameStringOriginal file name
sizeIntegerFile size in bytes
human_readable_sizeStringHuman readable file size (e.g., 2.5 MB)
fStringURL to access the image file
widthIntegerImage width in pixels
heightIntegerImage height in pixels
modeStringColor mode (e.g., RGB, CMYK)
thumbnailsList of thumbnail objectsImgae thumbnails

Thumbnail Data Structure

FieldTypeDescription
idIntegerUnique ID of the thumbnail (unique)
fStringURL to access the thumbnail file
sizeIntegerFile size in bytes (nullable)

Brand Data Structure

FieldTypeDescription
idIntegerUnique ID of the brand
nameStringName of the brand

Categories Data Structure

FieldTypeDescription
idIntegerUnique ID of the category
nameStringName of the category

Meta Data Structure

FieldTypeDescription
idIntegerUnique ID of the meta data
keyStringThe key name of the meta data
value_textStringThe text value of the meta data
value_fileObjectThe file value of the meta data

Meta value_file data structure

FieldTypeDescription
idIntegerUnique ID of the file
typeStringThe type of the file
nameStringThe name of the file
sizeIntegerThe size of the file in bytes
human_readable_sizeStringThe human-readable size of the file
fStringThe url to the file

Example Response

{
"id": 36,
"active": true,
"order": 1,
"code": "1001001",
"title": "ماوس لاجیتک MX Vertical",
"slug": "logitech-mouse-mx-vertical",
"stock_type": "limited",
"stock": 4,
"in_stock": true,
"regular_price": 12000000,
"sale_price": 10760000,
"discount": 1240000,
"discount_percent": 10,
"price": 10760000,
"price_notes": "قیمت فروش",
"excerpt": "<p style=\"text-align: right;\">ماوس &laquo;MX VERTICA&raquo; از سری محصولات خاص و مطرح برند شناخته&zwnj;شده&zwnj;ی لایجیتک (Logitech) است. این محصول لاجیتک با استفاده سه راه مختلف به کامپیوتر یا لپ&zwnj;تاپ شما متصل می&zwnj;شود. این راه&zwnj;ها شامل گیرنده وایرلس بی&zwnj;سیم ....USB، فناوری هوشمند بلوتوث و یا کابل شارژ USB-C ....</p>",
"comments_count": 1,
"rating": 1.0,
"image_data": {
"id": 13,
"type": "image",
"name": "chris fehn2",
"size": 512458,
"human_readable_size": "500.45 KB",
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/test2_ecH0zVV.jpg",
"width": 800,
"height": 546,
"mode": "RGB",
"thumbnails": [
{
"id": 313,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_64x64.jpg",
"size": 64
},
{
"id": 314,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_128x128.jpg",
"size": 128
},
{
"id": 315,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_512x512.jpg",
"size": 512
},
{
"id": 316,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_1080x1080.jpg",
"size": 1080
}
]
},
"created_at": "2025-11-22T14:40:51.362255Z",
"updated_at": "2026-02-03T12:09:12.364653Z",
"brand_data": {
"id": 1,
"name": "Logitech"
},
"categories_data": [
{
"id": 2,
"name": "ماوس"
}
],
"description": "<p>ماوس &laquo;MX VERTICA&raquo; از سری محصولات خاص و مطرح برند شناخته&zwnj;شده&zwnj;ی لایجیتک (Logitech) است. این محصول لاجیتک با استفاده سه راه مختلف به کامپیوتر یا لپ&zwnj;تاپ شما متصل می&zwnj;شود. این راه&zwnj;ها شامل گیرنده وایرلس بی&zwnj;سیم USB، فناوری هوشمند بلوتوث و یا کابل شارژ USB-C می&zwnj;شود. این محصول لاجیتک با انواع سیستم&zwnj;عامل&zwnj;های مطرح مانند ویندوز، مک و اندروید سازگار است تا بتوانید در انواع و اقسام سیستم&zwnj;های کامپیوتری از آن استفاده کنید. این ماوس دارای سنسور اپتیکال است و دقت بالایی دارد. MX Vertical با یک&zwnj;بار شارژ تا 4 ماه شارژدهی خواهد داشت جز اولین ماوس&zwnj;های عمودی شرکت لاجیتک است. هدف از این نوع طراحی این بوده که کمتری آسیب به مچ دست کاربر برسد. با این طراحی، میزان فعالیت عضله مچ دست را تا ده درصد کاهش می&zwnj;دهد. دکمه&zwnj;ای که در بخش بالایی این موس قرار دارد به کاربر اجازه می&zwnj;دهد تا میزان دقت موس را به مقدار دلخواه تنظیم کند.</p>",
"meta": []
}

Notes

  • Each product can belong to multiple categories
  • The meta data related to each product is definable from the PageMeta endpoints
  • discount, discount_percent, price, comment_count, rating are computed fields
  • Valid choices for the stock type are: limited, unlimited, call, out_of_stock