Introduction
The Categories API enables you to create, manage, and organize content categories for your blog posts. Categories support hierarchical structures with parent-child relationships, display ordering, and active/inactive states. Each category includes visual customization options like colors and icons to enhance content organization.Base Endpoint
Category Object
The category object represents a content classification with the following structure:Frontend Format (camelCase)
Unique identifier for the category
Display name of the category
URL-friendly identifier (auto-generated from name)
Detailed description of the category’s purpose
Hex color code for visual identification (e.g.,
#3B82F6)Icon identifier for the category display
Total number of posts assigned to this category
Whether the category is currently active and visible
ISO 8601 timestamp of category creation
ISO 8601 timestamp of last update
User ID of the category creator
Parent category ID for hierarchical organization (null for root categories)
Sort order for category display
Backend Format (snake_case)
The API communicates using snake_case notation:Unique identifier
Category name
URL slug
Category description
Hex color code
Icon identifier
Number of posts in category
Active status
Creator user ID
Parent category ID
Display order
Creation timestamp
Last update timestamp
List All Categories
Retrieve all categories with their metadata.Response
Get Hierarchical Categories
Retrieve categories organized in a hierarchical structure with parent-child relationships.Response
Returns categories with nested children based onparent_id relationships:
Get Active Categories
Filter and retrieve only active categories (client-side filtering).This operation filters the categories array on the client side based on the
isActive property. For server-side filtering, use query parameters with the main categories endpoint if supported.Category Icons
Categories support visual icons for better UX. Common icon identifiers include:Search- Search/SEO relatedTarget- Advertising/SEMMail- Email marketingShare2- Social mediaPenTool- Content creationBarChart3- AnalyticsShoppingCart- E-commerceTool- Tools and utilitiesFileText- General content
Hierarchical Structure
Categories support unlimited nesting levels through theparentId field:
Best Practices
Slug Generation: Slugs are automatically generated from category names by converting to lowercase and replacing spaces with hyphens.
Delete Protection: Categories with posts cannot be deleted (
postsCount > 0). Reassign or delete posts first.Color Consistency: Use consistent color schemes across related categories for better visual organization.
Hierarchy Depth: While unlimited nesting is supported, limit depth to 3-4 levels for optimal user experience.
Error Handling
The Categories API returns standard HTTP status codes:200 OK- Successful request201 Created- Category successfully created400 Bad Request- Invalid parameters404 Not Found- Category not found409 Conflict- Category with slug already exists500 Internal Server Error- Server error
Next Steps
Category Management
Learn about CRUD operations, status toggling, and statistics
Posts API
Associate posts with categories