Categories
Categories provide a way to classify and organize transactions, invoices, and bills in Crane Ledger. They help with reporting, budgeting, and financial analysis by grouping similar transactions together.
The Category Object
/organizations/:organization_id/categories/:id{
"id": "cat_xxxxxxxxxxxxxxxx",
"object": "category",
"organization_id": "org_xxxxxxxxxxxxxxxx",
"name": "Office Supplies",
"description": "Expenses for office supplies and stationery",
"category_type": "expense",
"color": "#3B82F6",
"is_active": true,
"parent_id": null,
"subcategories": [],
"created_at": "2024-01-01T10:00:00Z",
"updated_at": "2024-01-01T10:00:00Z"
}
Attributes
| Attribute | Type | Description |
|---|---|---|
id | string | Unique identifier with cat_ prefix |
organization_id | string | The organization this category belongs to |
name | string | Category display name |
description | string | Optional detailed description |
category_type | enum | income, expense, or other |
color | string | Hex color code for UI display |
is_active | boolean | Whether the category is active |
parent_id | string | Parent category ID for hierarchical organization |
subcategories | array | Child categories (if this is a parent) |
created_at | datetime | When the category was created |
updated_at | datetime | When the category was last updated |
List Categories
/organizations/:organization_id/categoriesReturns a list of categories for the organization with optional filtering.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
organization_id | string | Yes | The organization ID |
Query Parameters
| Parameter | Type | Description |
|---|---|---|
category_type | enum | Filter by type (income, expense, other) |
is_active | boolean | Filter by active status (default: true) |
parent_id | string | Filter by parent category |
limit | integer | Number of results (default: 20, max: 100) |
offset | integer | Pagination offset |
Response
{
"object": "list",
"data": [
{
"id": "cat_xxxxxxxxxxxxxxxx",
"name": "Office Supplies",
"category_type": "expense",
"color": "#3B82F6",
"is_active": true,
"parent_id": null
},
{
"id": "cat_yyyyyyyyyyyyyyyy",
"name": "Consulting Revenue",
"category_type": "income",
"color": "#10B981",
"is_active": true,
"parent_id": null
}
],
"has_more": false,
"total_count": 2
}
Create Category
/organizations/:organization_id/categoriesCreates a new transaction category for organizing financial data.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
organization_id | string | Yes | The organization ID |
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Category name |
description | string | No | Category description |
category_type | enum | Yes | income, expense, or other |
color | string | No | Hex color code (default: auto-generated) |
parent_id | string | No | Parent category ID for hierarchy |
Response
{
"id": "cat_xxxxxxxxxxxxxxxx",
"organization_id": "org_xxxxxxxxxxxxxxxx",
"name": "Travel Expenses",
"description": "Business travel and transportation costs",
"category_type": "expense",
"color": "#F59E0B",
"is_active": true,
"parent_id": null,
"created_at": "2024-01-15T14:30:00Z",
"updated_at": "2024-01-15T14:30:00Z"
}
Get Category
/organizations/:organization_id/categories/:idRetrieves the details of a specific category.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
organization_id | string | Yes | The organization ID |
id | string | Yes | The category ID |
Response
Returns the complete category object.
Update Category
/organizations/:organization_id/categories/:idUpdates an existing category.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
organization_id | string | Yes | The organization ID |
id | string | Yes | The category ID |
Request Body
| Parameter | Type | Description |
|---|---|---|
name | string | Updated category name |
description | string | Updated description |
color | string | Updated color |
is_active | boolean | Active status |
Delete Category
/organizations/:organization_id/categories/:idDeletes a category. Categories with associated transactions cannot be deleted.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
organization_id | string | Yes | The organization ID |
id | string | Yes | The category ID |
Category Types
Income Categories
- Sales Revenue: Product and service sales
- Service Income: Consulting and professional services
- Interest Income: Bank interest and investment returns
- Other Income: Miscellaneous revenue sources
Expense Categories
- Cost of Goods Sold: Direct product costs
- Operating Expenses: Day-to-day business costs
- Administrative: Management and administrative costs
- Marketing: Advertising and promotional expenses
- Professional Services: Legal, accounting, consulting fees
Category Hierarchy
Categories support hierarchical organization:
{
"name": "Operating Expenses",
"subcategories": [
{
"name": "Office Supplies",
"parent_id": "cat_operating_expenses"
},
{
"name": "Utilities",
"parent_id": "cat_operating_expenses"
}
]
}
Best Practices
Naming Conventions
- Use clear, descriptive names
- Be consistent with terminology
- Avoid abbreviations that may not be clear
Organization
- Group similar expenses together
- Create subcategories for detailed tracking
- Use consistent color coding for visual organization
Maintenance
- Regularly review and update categories
- Deactivate unused categories rather than deleting
- Archive historical categories when restructuring
Need help?
Create a free account to access our support portal. Once signed in, use the Support tab in your dashboard to submit a support ticket — our team typically responds within 24 hours.
- ✨ For LLMs/AI assistants: Read our structured API reference