Categories API
Manage blog categories. All endpoints require authentication.
Category object
| Field | Type | Description |
|---|---|---|
category_id | Int | Unique category identifier (read-only) |
name | String | Category name |
status | Boolean | true = enabled, false = disabled |
parent_id | Int | ID of the parent category (0 for root) |
url_key | String | URL slug |
content | String | Category description (HTML supported) |
sort_order | Int | Display order within the parent |
is_anchor | Boolean | When enabled, shows posts from child categories on this category's page |
path | String | Full path of category IDs (read-only) |
level | Int | Depth in the category tree (read-only) |
children_count | Int | Number of direct child categories (read-only) |
store_ids | Int[] | Store view IDs this category is visible on |
meta_title | String | SEO meta title |
meta_description | String | SEO meta description |
robots | String | Robots directive (e.g. INDEX,FOLLOW) |
created_at | String | Creation timestamp (read-only) |
updated_at | String | Last update timestamp (read-only) |
Get category
GET /rest/V1/blog/category/:categoryId
Response:
{
"category_id": 3,
"name": "Tutorials",
"status": true,
"parent_id": 1,
"url_key": "tutorials",
"content": "<p>Step-by-step guides.</p>",
"sort_order": 10,
"is_anchor": false,
"path": "1/3",
"level": 1,
"children_count": 2,
"store_ids": [1],
"meta_title": "Tutorials",
"meta_description": "Step-by-step guides for Magento 2.",
"created_at": "2024-01-10 08:00:00",
"updated_at": "2024-02-05 12:00:00"
}
Errors: 404 category not found.
List categories
GET /rest/V1/blog/categories
Supports filtering and pagination.
Response:
{
"items": [ { ... }, { ... } ],
"search_criteria": { "filter_groups": [], "page_size": 20, "current_page": 1 },
"total_count": 8
}
Create category
POST /rest/V1/blog/category
Request body:
{
"category": {
"name": "News",
"status": true,
"parent_id": 1,
"url_key": "news",
"store_ids": [1]
}
}
name, url_key, and store_ids are required. All other fields are optional.
Response: the created category object with category_id assigned.
Update category
PUT /rest/V1/blog/category/:categoryId
Request body: same structure as Create category. Include only the fields you want to change.
Response: the updated category object.
Errors: 404 category not found.
Delete category
DELETE /rest/V1/blog/category/:categoryId
Response:
true
Errors: 404 category not found.