Skip to main content

Cost Center

A cost center is an optional dimension you can attach to journal entry lines to track income and expenses by department, project, branch, or any other segment your organisation uses. Cost centers form a small tree — up to three levels deep — and can be activated or deactivated independently of being deleted.

Object overview


Properties

id

Type: string (UUID) The unique identifier of the cost center. Assigned by the server at creation. Use this value wherever the API requires a cost center reference (e.g. on journal entry lines).

name

Type: object The display name of the cost center. name is a bilingual object:
In list and dropdown responses, name is returned as a single localised string — the server picks the language based on the Accept-Language header. In GetById responses, the full bilingual object is returned.

code

Type: string A short identifier for the cost center. Codes can contain any characters and are at most 20 characters long.
Unlike account codes, the code of a cost center is unique across the entire company — not just within a parent. No two cost centers under the same company can share the same code, regardless of where they sit in the tree. The code value is trimmed of leading and trailing whitespace before storage.

path

Type: string The full hierarchical position of the cost center, expressed as the chain of codes from the root down to this cost center, separated by dots.
path is computed by the server automatically — you never set it directly. It is recalculated whenever a cost center’s code or parentCostCenterId changes, and all descendant paths are updated at the same time. Example tree:
Trailing dots are stripped in all responses — the path always ends at the cost center’s own code.

isActive

Type: boolean Whether the cost center is currently active. Only active cost centers can be assigned to journal entry lines.
All cost centers are created with isActive: true. You can toggle this state at any time using the dedicated Activate and Deactivate endpoints rather than through a general update. Deactivation constraint. A cost center cannot be deactivated while it has any active child cost centers. Deactivate the children first, then deactivate the parent. Parent constraint. A cost center cannot be created under, or moved to, an inactive parent. The parent must be active.

parentCostCenterId

Type: string (UUID) | null The id of this cost center’s immediate parent. null for root-level cost centers.
Pass this field on create or update to position the cost center in the tree. Omit it (or pass null) to make the cost center a root.

parentCostCenter

Type: object | null A summary of the immediate parent, returned in GetById responses. null for root-level cost centers.
Contains id, name (localised string), and path. Not returned in list responses — use parentCostCenterId there to identify the parent.

version

Type: uint The concurrency token for this cost center. Include it verbatim in update, activate, deactivate, and delete requests to prevent lost updates.
The server rejects a write if the version you send no longer matches the current row, returning 409 Conflict. Re-fetch the cost center and retry. See Concurrency for a full explanation.

createdAt

Type: string (ISO 8601) The timestamp when the cost center was created.
Read-only, set by the server.

updatedAt

Type: string (ISO 8601) | null The timestamp of the most recent update to the cost center. null if the cost center has never been modified after creation.
Read-only, set by the server on every successful write.

Hierarchy rules

Cost centers form a tree with a maximum depth of three levels.
Example:
Parent must be active. You cannot create a cost center under, or move a cost center to, a parent with isActive: false. No circular references. A cost center cannot be set as a child of itself (CostCenter_CircularSelf) or of any of its own descendants (CostCenter_CircularDescendant). The server detects both cases and rejects the request. Code is company-wide unique. Even within a hierarchy, no two cost centers under the same company can share a code. Codes must be unique across all levels.

Creating a cost center

Minimum required fields:
With optional fields:
The server returns the id of the newly created cost center. All cost centers start as isActive: true. There is no way to create an inactive cost center — create it and then immediately deactivate it if needed. Idempotency. Create requests support the Idempotency-Key header to avoid duplicate creation on retried requests. See Idempotency.

Updating a cost center

Pass the id, current version, and all fields (including ones you are not changing):
A successful update returns 204 No Content. The new version is not returned inline — re-fetch the resource if you need the updated version token. Moving a cost center. Changing parentCostCenterId repositions the cost center (and all its descendants) in the tree. All descendant path values are recomputed automatically. Moving is subject to the same depth and circular-reference checks as creation.

Activating and deactivating

Activation state is managed through two dedicated endpoints rather than through the general update endpoint.

Deactivate

Marks the cost center as inactive. It can no longer be assigned to new journal entry lines.
  • Fails with CostCenter_AlreadyInactive if already inactive.
  • Fails with CostCenter_HasActiveChildren if the cost center has any active child cost centers. Deactivate the children first.

Activate

Marks the cost center as active again.
  • Fails with CostCenter_AlreadyActive if already active.
Both operations advance the version. Re-fetch if you need the updated token.

Deleting a cost center

Pass the id, companyId, and current version:
Deletion is permanent. It fails if:
  • The cost center has any child cost centers (active or inactive) — CostCenter_HasChildren
  • Any journal entry line references this cost center — CostCenter_HasEntries
Unlike accounts, there are no default system cost centers — all cost centers are user-created and can therefore be deleted as long as the above constraints are met.

Filtering and listing

The list endpoint supports the following filters: The dropdown endpoint returns a lighter projection and accepts a single filter:

Common errors