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

GET/organizations/:organization_id/categories/:id
Auth required
{
  "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

AttributeTypeDescription
idstringUnique identifier with cat_ prefix
organization_idstringThe organization this category belongs to
namestringCategory display name
descriptionstringOptional detailed description
category_typeenumincome, expense, or other
colorstringHex color code for UI display
is_activebooleanWhether the category is active
parent_idstringParent category ID for hierarchical organization
subcategoriesarrayChild categories (if this is a parent)
created_atdatetimeWhen the category was created
updated_atdatetimeWhen the category was last updated

List Categories

GET/organizations/:organization_id/categories
Auth required

Returns a list of categories for the organization with optional filtering.

Path Parameters

ParameterTypeRequiredDescription
organization_idstringYesThe organization ID

Query Parameters

ParameterTypeDescription
category_typeenumFilter by type (income, expense, other)
is_activebooleanFilter by active status (default: true)
parent_idstringFilter by parent category
limitintegerNumber of results (default: 20, max: 100)
offsetintegerPagination 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

POST/organizations/:organization_id/categories
Auth required
1 credits

Creates a new transaction category for organizing financial data.

Path Parameters

ParameterTypeRequiredDescription
organization_idstringYesThe organization ID

Request Body

ParameterTypeRequiredDescription
namestringYesCategory name
descriptionstringNoCategory description
category_typeenumYesincome, expense, or other
colorstringNoHex color code (default: auto-generated)
parent_idstringNoParent 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

GET/organizations/:organization_id/categories/:id
Auth required

Retrieves the details of a specific category.

Path Parameters

ParameterTypeRequiredDescription
organization_idstringYesThe organization ID
idstringYesThe category ID

Response

Returns the complete category object.


Update Category

PUT/organizations/:organization_id/categories/:id
Auth required
1 credits

Updates an existing category.

Path Parameters

ParameterTypeRequiredDescription
organization_idstringYesThe organization ID
idstringYesThe category ID

Request Body

ParameterTypeDescription
namestringUpdated category name
descriptionstringUpdated description
colorstringUpdated color
is_activebooleanActive status

Delete Category

DELETE/organizations/:organization_id/categories/:id
Auth required
1 credits

Deletes a category. Categories with associated transactions cannot be deleted.

Path Parameters

ParameterTypeRequiredDescription
organization_idstringYesThe organization ID
idstringYesThe 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.