DELETE
/
expense-categories
/
{id}
curl -X DELETE "https://api.contazen.ro/v1/expense-categories/25" \
  -H "Authorization: Bearer YOUR_API_KEY"
{
  "success": true,
  "message": "Category deleted successfully",
  "id": 25
}

Overview

The Delete Expense Category endpoint allows you to permanently remove custom expense categories that are no longer needed. This operation has strict safety checks to prevent data loss. Important Restrictions:
  • You can only delete custom categories that you created
  • System default categories cannot be deleted
  • Categories must have no expenses assigned to them
  • Categories must have no subcategories under them
  • Categories must belong to your firm

Path Parameters

id
integer
required
The unique identifier of the expense category to delete

Safety Checks

Before deleting a category, the system performs several validation checks:
  1. System Protection: Cannot delete system/default categories
  2. Usage Check: Cannot delete categories that have expenses assigned
  3. Hierarchy Check: Cannot delete categories that have subcategories
  4. Ownership: Can only delete categories belonging to your firm

Response

message
string
Success message confirming the category deletion
id
integer
The ID of the deleted category

Pre-Deletion Checklist

Before attempting to delete a category:
  1. Move or delete all expenses using this category
  2. Delete or reassign all subcategories under this category
  3. Confirm it’s a custom category (not a system default)
curl -X DELETE "https://api.contazen.ro/v1/expense-categories/25" \
  -H "Authorization: Bearer YOUR_API_KEY"
{
  "success": true,
  "message": "Category deleted successfully",
  "id": 25
}

Best Practices

Before Deleting Categories

  1. Check Dependencies: Use the List Expenses API to find expenses using this category
  2. Reassign Expenses: Move expenses to different categories before deletion
  3. Handle Subcategories: Delete or reassign all subcategories first
  4. Backup Important Data: Export expense data if the category contains historical records

Alternative to Deletion

Instead of deleting categories, consider:
  • Hide Categories: Set is_visible: false to hide unused categories
  • Rename Categories: Update the name for repurposing
  • Archive Approach: Keep historical categories for reporting consistency

Authorizations

Authorization
string
header
required

Use your API key (sk_live_xxx or sk_test_xxx)

Path Parameters

id
integer
required

Category ID

Response

Category deleted

success
boolean
message
string
meta
object