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
| Parameter | Type | Default | Description |
|---|---|---|---|
| limit | integer | 10 | Number of results to return per page |
| offset | integer | 0 | Number of results to skip before returning results |
| search | string | — | Search in categories `names`. |
| ordering | string | — | Order results by (`id`, `order`, `name`, `parent`, `created_at`, `updated_at`) |
| parent_id | integer | - | Filter by parent category id |
| has_image | boolean | - | Filter categories with/without image |
| has_products | boolean | - | Filter catgegories with/without products |
| has_parent | boolean | - | Filter categories with/without parent |
| has_children | boolean | - | Filter categories with/without child categories |
| id_min | integer | — | Minimum ID filter |
| id_max | integer | — | Maximum ID filter |
| created_date | string | — | Filter by creation date (e.g., `2023-01-01`) |
| updated_date | string | — | Filter by last updated date (e.g., `2023-01-01`) |
| created_from | string | — | Filter by creation date range start |
| created_to | string | — | Filter by creation date range end |
| updated_from | string | — | Filter by last updated date range start |
| updated_to | string | — | Filter by last updated date range end |
Example Requests
- 🐍 Python
- 🌐 Curl
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())1# Basic listing
2curl "http://www.example.com/api/shop/categories?limit=20&ordering=_price&search=smartphone"Response Fields
| Field | Type | Description |
|---|---|---|
| count | Integer | Total number of categories |
| next | String | URL for the next page of results |
| previous | String | URL for the previous page of results |
| results | Array[Object] | Array of Category objects |
Category Object Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the category |
| order | Integer | Display order of the category |
| image | Object | Category image data (`id`, `url`, `name`, etc.) |
| parent | Integer | Category parent id |
| name | String | Category name |
| slug | String | URL-friendly category identifier |
| description | String | Extra descriptions of the category |
| products_count | Integer | Number of products in this category |
| children_count | Integer | Number of children categories |
| created_at | String | Creation time of the category |
| updated_at | String | Last updated time of the category |
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) |
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"
}
]
}