Create Post Categories
Create a new blog post categories
HTTP Request
POST/api/blog/categories
Authorization
Authorization
- Required: Yes
- Permission: Staff with required PostCategoryPermission or Admin
- Permission Code: 3201
- Authentication: Token-based (Authorization: Token <your_api_key>)
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| image | Integer | No | Related image of the post category |
| order | Integer | No | Row order of the post category |
| parent | Integer | No | The parent category id of the post category |
| name | String | Yes | Name of the post category |
| slug | String | Yes | The slug of the post category(uniqeu) |
| description | String | No | The description of the post category |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2response = requests.post('http://www.example.com/api/blog/categories', json={
3 "image": 7,
4 "order": 1,
5 "parent": null,
6 "name": "cpu",
7 "slug": "cpu",
8 "description": "central processing unit"
9},
10headers={'Authorization': 'Token <your_api_key>'})
11print(response.json())1curl -X POST "http://www.example.com/api/blog/categories"
2-H "Content-Type: application/json"
3-H "Authorization: Token <your_api_key>"
4-d '{
5 "image": 7,
6 "order": 1,
7 "parent": null,
8 "name": "cpu",
9 "slug": "cpu",
10 "description": "central processing unit"
11}Response Fields
| 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) |
Example Response
{
"id": 3,
"image_data": {
"id": 7,
"type": "image",
"name": "computers",
"size": 3284,
"human_readable_size": "3.21 KB",
"f": "http://127.0.0.1:8000/media/core_media/2025/12/02/computer.png",
"width": 235,
"height": 215,
"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": "cpu",
"slug": "cpu",
"description": "central processing unit",
"posts_count": 0,
"children_count": 0,
"created_at": "2025-12-02T14:33:37.856753Z",
"updated_at": "2025-12-02T14:33:37.856762Z"
}