POST
/
expense-categories
curl -X POST "https://api.contazen.ro/v1/expense-categories" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Marketing Expenses",
    "parent_id": 0,
    "is_visible": true
  }'
{
  "success": true,
  "category": {
    "id": 25,
    "name": "Marketing Expenses",
    "parent_id": 0,
    "is_default": false,
    "is_visible": true,
    "type": "custom"
  },
  "message": "Category created successfully"
}

Overview

The Create Expense Category endpoint allows you to create new custom expense categories for your firm. You can create both root-level categories and subcategories under existing parent categories. Note: You can only create custom categories - system default categories are pre-defined and cannot be created via the API.

Request Body

name
string
required
The name of the expense category (must be unique within your firm)
parent_id
integer
default:"0"
Parent category ID. Use 0 for root-level categories, or specify an existing category ID to create a subcategory.
is_visible
boolean
default:"true"
Whether the category should be visible and available for use when creating expenses.

Hierarchy Rules

  • Maximum Depth: Categories can only be 2 levels deep (category → subcategory)
  • Parent Validation: Parent categories must exist and belong to your firm
  • Subcategory Limitation: You cannot create subcategories under existing subcategories
  • Circular Reference: A category cannot be its own parent

Response

category
object
The created expense category object
message
string
Success message confirming the category creation

Validation Rules

  • Name: Required, must be non-empty after trimming
  • Parent Category: Must exist and belong to your firm (if specified)
  • Hierarchy: Cannot create subcategories under existing subcategories
  • Permissions: Requires write permissions for your firm
curl -X POST "https://api.contazen.ro/v1/expense-categories" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Marketing Expenses",
    "parent_id": 0,
    "is_visible": true
  }'
{
  "success": true,
  "category": {
    "id": 25,
    "name": "Marketing Expenses",
    "parent_id": 0,
    "is_default": false,
    "is_visible": true,
    "type": "custom"
  },
  "message": "Category created successfully"
}

Authorizations

Authorization
string
header
required

Use your API key (sk_live_xxx or sk_test_xxx)

Body

application/json
name
string
required
Required string length: 1 - 100
parent_id
integer
default:0

Parent category ID (0 for root)

is_visible
enum<integer>
default:1
Available options:
0,
1

Response

Category created

success
boolean
data
object
meta
object