Skip to main content

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

ParameterTypeDefaultDescription
limitinteger10Number of results to return per page.
offsetinteger0Number of results to skip before returning results.
searchstringSearch term to lookup results by `id`, `name`.
orderingstringOrder results by (`id`, `order`, `parent`, `name`, `created_at`, `updated_at`.
id_minintegerMinimum ID to filter results by.
id_maxintegerMaximum ID to filter results by.
created_datestringFilter results by creation date (e.g., `2023-01-01`).
updated_datestringFilter results by last updated date (e.g., `2023-01-01`).
created_fromstringPost categories created after a specific date
created_tostringPost categories created before a specific date
updated_fromstringPost categories last updated after a specific date
updated_tostringPost categories last updated before a specific date
parent_idinteger_Filter post categories by their parent id
has_imageboolean_Filter post categories by having image
has_postsboolean_Filter post categories by having a related posts
has_parentboolean_Fitler post categories that have a parent
has_childrenboolean_Filter post categories that have at least one child category
order_mininteger_Filter post categories with order number larger than the defined value
order_maxinteger_Filter post categories with order number smaller than the defined value
posts_count_mininteger_Fitler post categories which their number of posts is larger than the defined value
posts_count_maxinteger_Filter post catgegories which their number of posts is smaller than the defined value
children_count_mininteger_Filter post categories which their number of child categories is larger than the defined value
children_count_maxinteger_Filter post categories which their number of child categories is smaller than the defined value

Example Requests

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())

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 PostCategory objects

PostCategory Object Structure

FieldTypeDescription
idIntegerId of the post category(unique)
image_dataObjectRelated image of the post category(nullable)
orderIntegerRow order of the category(nullable)
parentIntegerParent id of the category(nullable)
nameStringname of the category
slugStringslug of the category (unique, nullable)
descriptionStringdescription of the post category(nullable)
posts_countIntegerthe number of blog posts under this category
children_countIntegerthe number of child categories
created_atdatetimethe creation time of the post category
updated_atdatetimelast updated time of the post category

Image Data Structure

FieldTypeDescription
idIntegerUnique ID of the featured image (unique)
typeStringFile type (e.g., image/jpeg) (nullable)
nameStringOriginal file name (nullable)
sizeIntegerFile size in bytes (nullable)
human_readable_sizeStringHuman readable file size (e.g., 2.5 MB) (nullable)
fStringURL to access the image file
widthIntegerImage width in pixels (nullable)
heightIntegerImage height in pixels (nullable)
modeStringColor mode (e.g., RGB, CMYK) (nullable)
thumbnailsList of thumbnail objectsthumbnails of the image

Thumbnail Data Structure

FieldTypeDescription
idIntegerUnique ID of the thumbnail (unique)
fStringURL to access the thumbnail file
sizeIntegerFile 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"
}
]
}