Skip to main content

List All Categories

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

HTTP Request

GET/api/shop/categories/
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
searchstringSearch in categories `names`.
orderingstringOrder results by (`id`, `order`, `name`, `parent`, `created_at`, `updated_at`)
parent_idinteger-Filter by parent category id
has_imageboolean-Filter categories with/without image
has_productsboolean-Filter catgegories with/without products
has_parentboolean-Filter categories with/without parent
has_childrenboolean-Filter categories with/without child categories
id_minintegerMinimum ID filter
id_maxintegerMaximum ID filter
created_datestringFilter by creation date (e.g., `2023-01-01`)
updated_datestringFilter by last updated date (e.g., `2023-01-01`)
created_fromstringFilter by creation date range start
created_tostringFilter by creation date range end
updated_fromstringFilter by last updated date range start
updated_tostringFilter by last updated date range end

Example Requests

1import requests
2
3# Category listing
4response = requests.get('http://www.example.com/api/shop/categories/', params={
5  'limit': 20,
6  'search': 'phone',
7})
8print(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 Category objects

Category Object Data Structure

FieldTypeDescription
idIntegerUnique ID of the category
orderIntegerDisplay order of the category
imageObjectCategory image data (`id`, `url`, `name`, etc.)
parentIntegerCategory parent id
nameStringCategory name
slugStringURL-friendly category identifier
descriptionStringExtra descriptions of the category
products_countIntegerNumber of products in this category
children_countIntegerNumber of children categories
created_atStringCreation time of the category
updated_atStringLast updated time of the category

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)

Example Response

{
"count": 4,
"next": null,
"previous": null,
"results": [
{
"id": 4,
"order": 1,
"image": {
"id": 5,
"type": "image",
"name": "keyboard",
"size": 2131742,
"human_readable_size": "2.03 MB",
"f": "http://127.0.0.1:8000/media/core_media/2025/11/29/Fantasticheskie_kartinki_dlja_monitora_68_96.jpg",
"width": 2560,
"height": 1600,
"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
}
]
},
"parent": null,
"name": "aut",
"slug": "some-slug",
"description": "secondary",
"products_count": 0,
"children_count": 0,
"created_at": "2025-12-24T12:55:33.521626Z",
"updated_at": "2025-12-24T13:03:28.043589Z"
},
{
"id": 3,
"order": 1,
"image": null,
"parent": null,
"name": "blanditiis",
"slug": null,
"description": "modular",
"products_count": 0,
"children_count": 0,
"created_at": "2025-12-24T12:55:26.483589Z",
"updated_at": "2025-12-24T12:55:26.483597Z"
},
{
"id": 1,
"order": 1,
"image": null,
"parent": null,
"name": "کالای دیجیتال",
"slug": "digital-products",
"description": "",
"products_count": 1,
"children_count": 1,
"created_at": "2025-11-22T14:34:46.278532Z",
"updated_at": "2025-11-22T14:34:46.278538Z"
},
{
"id": 2,
"order": 2,
"image": {
"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
}
]
},
"parent": 1,
"name": "ماوس",
"slug": "mouse",
"description": "",
"products_count": 2,
"children_count": 0,
"created_at": "2025-11-22T14:35:00.236637Z",
"updated_at": "2025-12-24T13:01:33.436128Z"
}
]
}