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
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | Integer | Yes | Unique ID of the product to update |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| active | Boolean | No | Whether the product is active (default: true) |
| order | Integer | No | Display order priority |
| code | String | No | Product code/SKU (unique) |
| title | String | No | Product title |
| slug | String | No | URL-friendly product identifier(unique) |
| stock_type | String | No | Stock management type (choices: call, limited, unlimited, out_of_stock) |
| stock | Integer | No | Available stock quantity |
| regular_price | Decimal | No | Original price of the product |
| sale_price | Decimal | No | Sale price (if on sale) |
| price_notes | String | No | Additional pricing notes |
| excerpt | String | No | Short product description |
| image | Integer | No | ID of the product's main image |
| brand | Integer | No | Brand ID |
| categories | Array of Integers | No | List of Category IDs |
| description | String | No | Full product description |
Example Requests
- 🐍 Python
- 🌐 Curl
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())1# Partial update (PATCH)
2curl -X PATCH "http://www.example.com/api/products/123" -H "Authorization: Token <your_api_key>" -H "Content-Type: application/json" -d '{
3 "title": "Updated Gaming Laptop Pro",
4 "sale_price": 12580000,
5 "stock": 25,
6 "active": true
7}'
8
9# Update price and stock
10curl -X PATCH "http://www.example.com/api/products/123" -H "Authorization: Token <your_api_key>" -H "Content-Type: application/json" -d '{
11 "regular_price": 12580000,
12 "sale_price": 11580000,
13 "stock": 100
14}'Response Fields
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the product |
| active | Boolean | Whether the product is active |
| order | Integer | Row-order priority (nullable) |
| code | String | Product code/SKU (unique, nullable) |
| title | String | Product title |
| slug | String | URL-friendly product identifier (unique) |
| stock_type | String | Stock management type |
| stock | Integer | Available stock quantity |
| in_stock | Boolean | Whether the product is in stock (computed) |
| regular_price | Decimal | Original price of the product |
| sale_price | Decimal | Sale price (if on sale) |
| discount | Decimal | Discount amount (computed) |
| discount_percent | Decimal | Discount percentage (computed) |
| price | Decimal | Final price after discount (computed) |
| price_notes | String | Additional pricing notes |
| excerpt | String | Short product description |
| comments_count | Integer | Number of comments (computed) |
| rating | Decimal | Average product rating (computed) |
| image_data | Object | Image details |
| created_at | String (ISO 8601) | Timestamp when product was created |
| updated_at | String (ISO 8601) | Timestamp when product was last updated |
| brand_data | Object | The product brand data |
| categories_data | List[Object] | The product categories list |
| description | String | Additional descriptions of the product |
| meta | List[Object] | List of meta data on the product |
Image Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the image |
| type | String | File type (e.g., image/jpeg) |
| name | String | Original file name |
| size | Integer | File size in bytes |
| human_readable_size | String | Human readable file size (e.g., 2.5 MB) |
| f | String | URL to access the image file |
| width | Integer | Image width in pixels |
| height | Integer | Image height in pixels |
| mode | String | Color mode (e.g., RGB, CMYK) |
| thumbnails | List of thumbnail objects | Imgae thumbnails |
Thumbnail Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the thumbnail (unique) |
| f | String | URL to access the thumbnail file |
| size | Integer | File size in bytes (nullable) |
Brand Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the brand |
| name | String | Name of the brand |
Categories Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the category |
| name | String | Name of the category |
Meta Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the meta data |
| key | String | The key name of the meta data |
| value_text | String | The text value of the meta data |
| value_file | Object | The file value of the meta data |
Meta value_file data structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the file |
| type | String | The type of the file |
| name | String | The name of the file |
| size | Integer | The size of the file in bytes |
| human_readable_size | String | The human-readable size of the file |
| f | String | The 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;\">ماوس «MX VERTICA» از سری محصولات خاص و مطرح برند شناخته‌شده‌ی لایجیتک (Logitech) است. این محصول لاجیتک با استفاده سه راه مختلف به کامپیوتر یا لپ‌تاپ شما متصل می‌شود. این راه‌ها شامل گیرنده وایرلس بی‌سیم ....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>ماوس «MX VERTICA» از سری محصولات خاص و مطرح برند شناخته‌شده‌ی لایجیتک (Logitech) است. این محصول لاجیتک با استفاده سه راه مختلف به کامپیوتر یا لپ‌تاپ شما متصل می‌شود. این راه‌ها شامل گیرنده وایرلس بی‌سیم USB، فناوری هوشمند بلوتوث و یا کابل شارژ USB-C می‌شود. این محصول لاجیتک با انواع سیستم‌عامل‌های مطرح مانند ویندوز، مک و اندروید سازگار است تا بتوانید در انواع و اقسام سیستم‌های کامپیوتری از آن استفاده کنید. این ماوس دارای سنسور اپتیکال است و دقت بالایی دارد. MX Vertical با یک‌بار شارژ تا 4 ماه شارژدهی خواهد داشت جز اولین ماوس‌های عمودی شرکت لاجیتک است. هدف از این نوع طراحی این بوده که کمتری آسیب به مچ دست کاربر برسد. با این طراحی، میزان فعالیت عضله مچ دست را تا ده درصد کاهش می‌دهد. دکمه‌ای که در بخش بالایی این موس قرار دارد به کاربر اجازه می‌دهد تا میزان دقت موس را به مقدار دلخواه تنظیم کند.</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,ratingare computed fields- Valid choices for the stock type are:
limited,unlimited,call,out_of_stock