Skip to main content

Get All Products

Retrieve a list of products with optional filtering, searching, and pagination.

HTTP Request​

GET/api/shop/products/
NOTE: NOT USING THE TRAILING SLASH AT THE END OF THE URL RESULTS TO AN EXTRA REDIRECT WITH 301 STATUS

Authorization​

Authorization

  • Required: No
  • Permission: Public (read-only)
  • Authentication: None

Query Parameters​

ParameterTypeDefaultDescription
limitinteger10Number of results to return per page
offsetinteger0Number of results to skip before returning results
searchstring—Search in product `title`.
orderingstring—Order results by (`id`, `title`, `created_at`, `updated_at`, `order`, `active`, `brand__id`, `brand__name`, `categories__id`, `categories__name`, `stock_type`, `stock`, `regular_price`, `sale_price`, `_price`, `_discount`, `_discount_percent`, `_in_stock`, `_rating`, `_comments_count`)
brand_idinteger—Filter by specific brand ID
brand_instring—Filter by multiple brand IDs (comma-separated: `1,2,3`)
category_idinteger—Filter by specific category ID
category_instring—Filter by multiple category IDs (comma-separated: `1,2,3`)
category_tree_idinteger—Filter by category tree ID (returns all products in the category and subcategories)
regular_price_minnumber—Minimum regular price filter
regular_price_maxnumber—Maximum regular price filter
sale_price_minnumber—Minimum sale price filter
sale_price_maxnumber—Maximum sale price filter
has_discountboolean—Filter products with/without discount
discount_percent_minnumber—Minimum discount percentage filter
discount_percent_maxnumber—Maximum discount percentage filter
discount_minnumber—Minimum discount amount filter
discount_maxnumber—Maximum discount amount filter
price_minnumber—Minimum final price filter
price_maxnumber—Maximum final price filter
in_stockboolean—Filter by stock availability
has_imageboolean—Filter products with/without image
has_commentsboolean—Filter products with/without comments
comments_count_mininteger—Minimum comments count filter
comments_count_maxinteger—Maximum comments count filter
rating_minnumber—Minimum rating filter
rating_maxnumber—Maximum rating filter
id_mininteger—Minimum ID filter
id_maxinteger—Maximum ID filter
created_datestring—Filter by creation date (e.g., `2023-01-01`)
updated_datestring—Filter by last updated date (e.g., `2023-01-01`)
created_fromstring—Filter by creation date range start
created_tostring—Filter by creation date range end
updated_fromstring—Filter by last updated date range start
updated_tostring—Filter by last updated date range end

Example Requests​

1import requests
2
3# Basic product listing
4response = requests.get('http://www.example.com/api/shop/products', params={
5  'limit': 20,
6  'ordering': '_price',
7  'search': 'smartphone',
8  'category_id': 1,
9  'has_discount': True,
10  'price_min': 100,
11  'price_max': 1000,
12  'in_stock': True
13})
14print(response.json())
15
16# With authentication for favorites
17response = requests.get('http://www.example.com/api/shop/products', 
18  params={'limit': 10},
19  headers={'Authorization': 'Token <your_api_key>'}
20)
21print(response.json())

Response Fields​

FieldTypeDescription
countIntegerTotal number of categories
nextStringURL for the next page of results
previousStringURL for the previous page of results
resultsArray[Object]Array of Product objects

Product Object Data Structure

FieldTypeDescription
idIntegerUnique ID of the product
imageObjectProduct image data (`id`, `url`, `name`, etc.)
codeStringProduct code/SKU
titleStringProduct name
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)
brandObjectBrand information (`id`, `name`, `slug`)
categoriesArray[Object]Categories information (`id`, `name`, `slug`)

Image Data Structure

FieldTypeDescription
idIntegerUnique ID of the image
typeStringFile type (e.g., image)
mime_typeStringMime type of the File (e.g., image/jpeg) (nullable)
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

Example Response​

{
"count": 11,
"next": "http://127.0.0.1:8000/api/shop/products/?limit=2&offset=2",
"previous": null,
"results": [
{
"id": 60,
"image": {
"id": 2,
"type": "image",
"mime_type": "image/jpeg",
"name": "logitech-mx-1",
"size": 4766,
"human_readable_size": "4.65 KB",
"f": "http://127.0.0.1:8000/media/core_media/2025/11/22/logitech-mx-1.jpg",
"width": 225,
"height": 225,
"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": "661",
"title": "Cheese",
"slug": "product-name25",
"stock_type": "limited",
"in_stock": true,
"stock": 10,
"regular_price": 1000,
"sale_price": 900,
"discount": 100,
"discount_percent": 10,
"price": 900,
"rating": 0.0,
"comments_count": 0,
"price_notes": "for each one",
"excerpt": "<p>Id earum eveniet tenetur natus pariatur dolorum minus corrupti molestias. Fuga nisi quia autem perspiciatis. Est sint hic quo atque eos et eaque. Est fugit qui alias deserunt. Voluptatem quia voluptatibus ratione. Delectus nihil nulla.</p>",
"is_favorite": false,
"brand": null,
"categories": []
},
{
"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"
}
]
}
]
}