List All Blog Post Categories
Retrieve a list of blog post categories
HTTP Request
GET/api/blog/categories
Authorization
Authorization
- Required: Yes
- Permission: Staff with required PostCategoryPermission or Admin
- Permission Code: 3202
- Authentication: Token-based (Authorization: Token <your_api_key>)
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 term to lookup results by `id`, `name`. |
| ordering | string | — | Order results by (`id`, `order`, `parent`, `name`, `created_at`, `updated_at`. |
| id_min | integer | — | Minimum ID to filter results by. |
| id_max | integer | — | Maximum ID to filter results by. |
| created_date | string | — | Filter results by creation date (e.g., `2023-01-01`). |
| updated_date | string | — | Filter results by last updated date (e.g., `2023-01-01`). |
| created_from | string | — | Post categories created after a specific date |
| created_to | string | — | Post categories created before a specific date |
| updated_from | string | — | Post categories last updated after a specific date |
| updated_to | string | — | Post categories last updated before a specific date |
| parent_id | integer | _ | Filter post categories by their parent id |
| has_image | boolean | _ | Filter post categories by having image |
| has_posts | boolean | _ | Filter post categories by having a related posts |
| has_parent | boolean | _ | Fitler post categories that have a parent |
| has_children | boolean | _ | Filter post categories that have at least one child category |
| order_min | integer | _ | Filter post categories with order number larger than the defined value |
| order_max | integer | _ | Filter post categories with order number smaller than the defined value |
| posts_count_min | integer | _ | Fitler post categories which their number of posts is larger than the defined value |
| posts_count_max | integer | _ | Filter post catgegories which their number of posts is smaller than the defined value |
| children_count_min | integer | _ | Filter post categories which their number of child categories is larger than the defined value |
| children_count_max | integer | _ | Filter post categories which their number of child categories is smaller than the defined value |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2response = requests.get('http://www.example.com/api/blog/categories', params={
3 'limit': 5,
4 'ordering': 'created_at',
5 'search': 'tech',
6 'limit': 2,
7 'offset': 0,
8 'id_max': 3,
9 'created_from': '2023-01-01',
10 'created_to': '2023-12-31'
11},headers={'Authorization': 'Token <your_api_key>'})
12print(response.json())1curl "http://www.example.com/api/blog/categories?limit=5&ordering=created_at&search=tech&limit=2&offset=0&id_max=3&created_from=2023-01-01&created_to=2023-12-31" -H "Authorization: Token <your_api_key>"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 PostCategory objects |
PostCategory Object Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Id of the post category(unique) |
| image_data | Object | Related image of the post category(nullable) |
| order | Integer | Row order of the category(nullable) |
| parent | Integer | Parent id of the category(nullable) |
| name | String | name of the category |
| slug | String | slug of the category (unique, nullable) |
| description | String | description of the post category(nullable) |
| posts_count | Integer | the number of blog posts under this category |
| children_count | Integer | the number of child categories |
| created_at | datetime | the creation time of the post category |
| updated_at | datetime | last updated time of the post category |
Image Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the featured image (unique) |
| type | String | File type (e.g., image/jpeg) (nullable) |
| name | String | Original file name (nullable) |
| size | Integer | File size in bytes (nullable) |
| human_readable_size | String | Human readable file size (e.g., 2.5 MB) (nullable) |
| f | String | URL to access the image file |
| width | Integer | Image width in pixels (nullable) |
| height | Integer | Image height in pixels (nullable) |
| mode | String | Color mode (e.g., RGB, CMYK) (nullable) |
| thumbnails | List of thumbnail objects | thumbnails of the image |
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) |
Response Example
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 2,
"image_data": {
"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": 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
}
]
},
"order": 1,
"parent": null,
"name": "Technology",
"slug": "technology",
"description": "technology category",
"posts_count": 3,
"children_count": 3,
"created_at": "2025-11-29T18:25:17.700049Z",
"updated_at": "2025-12-02T14:17:36.227143Z"
},
{
"id": 1,
"image_data": null,
"order": 1,
"parent": 2,
"name": "Computer",
"slug": "computer",
"description": "",
"posts_count": 2,
"children_count": 0,
"created_at": "2025-11-29T18:24:40.324367Z",
"updated_at": "2025-11-29T18:25:28.645153Z"
}
]
}