Skip to main content

Retrieve a Product

Retrieves detailed information about a specific product by its slug.

HTTP Request

GET/api/shop/products/:slug

Authorization

Authorization

  • Required: No
  • Permission: Public (read-only)
  • Authentication: Optional (affects `is_favorite` field)

Path Parameters

ParameterTypeRequiredDescription
slugstringYesURL-friendly product identifier

Example Requests

1import requests
2
3# Without authentication
4response = requests.get('http://www.example.com/api/shop/products/iphone-14-pro')
5print(response.json())
6
7# With authentication for favorites
8response = requests.get('http://www.example.com/api/shop/products/iphone-14-pro', headers={
9  'Authorization': 'Token <your_api_key>'
10})
11print(response.json())

Response Fields

FieldTypeDescription
idIntegerUnique ID of the product
imageObjectMain product image data
codeStringProduct code/SKU
titleStringProduct title
slugStringURL-friendly product identifier
stock_typeStringType of stock management
in_stockBooleanWhether product is in stock
stockIntegerCurrent stock quantity
regular_priceDecimalRegular price of the product
sale_priceDecimalSale price (if on sale)
discountDecimalDiscount amount
discount_percentDecimalDiscount percentage
priceDecimalFinal calculated price
ratingDecimalAverage product rating
comments_countIntegerNumber of product comments/reviews
price_notesStringAdditional price information
excerptStringShort product description
is_favoriteBooleanWhether product is in user's favorites (requires auth)
brand_dataObjectBrand information (`id`, `name`, `slug`)
category_dataArray[Object]Categories information (`id`, `name`, `slug`)
attributesArray[Object]Product attributes (`id`, `name`, `values`)
imagesArray[Object]All product images
descriptionStringFull product description
created_atString (ISO 8601)Timestamp when product was created
updated_atString (ISO 8601)Timestamp when product was last updated

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

Attributes Data Structure

FieldTypeDescription
idIntegerUnique ID of the attribute
nameStringName of the attribute
valuesArray[String]Values of the attribute

Example Response

{
"id": 59,
"image": {
"id": 3,
"type": "image",
"name": "logitech-mx-2",
"size": 3166,
"human_readable_size": "3.09 KB",
"f": "http://127.0.0.1:8000/media/core_media/2025/11/22/logitech-mx-2.jpg",
"width": 275,
"height": 183,
"mode": "RGB",
"thumbnails": [
{
"id": 213,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_64x64.jpg",
"size": 64
},
{
"id": 214,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_128x128.jpg",
"size": 128
},
{
"id": 215,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_512x512.jpg",
"size": 512
},
{
"id": 216,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_1080x1080.jpg",
"size": 1080
}
]
},
"code": "857",
"title": "Bike",
"slug": "product-name10",
"stock_type": "limited",
"in_stock": true,
"stock": 10,
"regular_price": 121999,
"sale_price": 122000,
"discount": -1,
"discount_percent": 0,
"price": 122000,
"rating": 3.5,
"comments_count": 2,
"price_notes": "for each one",
"excerpt": "<p>Doloribus a consequatur natus laboriosam mollitia et totam. Dicta sit qui aut possimus officia tempora dicta vitae ab. Delectus dolores voluptas. Voluptas incidunt sit vel sapiente enim enim perspiciatis voluptatum ab. Repellendus et provident explicabo laudantium atque quos magni. Omnis dolorum totam qui reprehenderit facere.</p>",
"is_favorite": false,
"brand": {
"id": 1,
"name": "Logitech",
"slug": "logitech"
},
"categories": [
{
"id": 1,
"name": "کالای دیجیتال",
"slug": "digital-products"
},
{
"id": 2,
"name": "ماوس",
"slug": "mouse"
}
],
"attributes": [
{
"id": 1,
"name": "Color",
"values": [
"red"
]
},
{
"id": 2,
"name": "body",
"values": [
"Full Metal",
"Plastic"
]
}
],
"images": [
{
"id": 6,
"type": "image",
"name": "technology",
"size": 5123,
"human_readable_size": "5.00 KB",
"f": "http://127.0.0.1:8000/media/core_media/2025/12/02/technology.png",
"width": 225,
"height": 225,
"mode": "P",
"thumbnails": [
{
"id": 213,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_64x64.jpg",
"size": 64
},
{
"id": 214,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_128x128.jpg",
"size": 128
},
{
"id": 215,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_512x512.jpg",
"size": 512
},
{
"id": 216,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_1080x1080.jpg",
"size": 1080
}
]
},
{
"id": 7,
"type": "image",
"name": "computers",
"size": 3284,
"human_readable_size": "3.21 KB",
"f": "http://127.0.0.1:8000/media/core_media/2025/12/02/computer.png",
"width": 235,
"height": 215,
"mode": "P",
"thumbnails": [
{
"id": 213,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_64x64.jpg",
"size": 64
},
{
"id": 214,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_128x128.jpg",
"size": 128
},
{
"id": 215,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_512x512.jpg",
"size": 512
},
{
"id": 216,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_1080x1080.jpg",
"size": 1080
}
]
}
],
"description": "<p>long description for product</p>",
"created_at": "2025-12-27T12:26:43.168297Z",
"updated_at": "2025-12-27T15:28:18.364540Z"
}