Skip to main content
Business Hierarchy page showing categories and sub-categories

The Business Hierarchy page where categories live.

Categories form the top level of the business hierarchy. Each category can contain sub-categories, which in turn group offers. Categories also define custom fields (including computed fields with formulas) that are inherited by all offers within the category. All categories support soft-delete (a deletedAt timestamp is set instead of permanent removal), version tracking (the version field auto-increments on every update), and audit logging (before/after snapshots are recorded for every CRUD operation).
See the Business Hierarchy feature page for UI guidance and conceptual overview.

Base path


Categories

List categories

Returns a paginated list of categories for the current tenant, ordered by ordinal ascending. Each category includes its sub-categories with offer counts. By default, soft-deleted categories are excluded.

Query parameters

Response 200

Error codes


Create a category

Request body

Custom field object

Computed fields require both a valid formula and an outputType (number or text). The formula is validated using the formula engine. Supported namespaces: fieldName (sibling fields), customer.* (enriched data), attributes.* (request-time attributes).The formula is compiled at write time, on both POST and PUT. A formula that does not parse is rejected with a 400 naming the field index and the parse error — it is not accepted and deferred. This matters because the alternative is failing once per candidate inside the decision hot path, on live traffic, long after whoever typed it has moved on.
customFields is replaced, not merged. A PUT that includes customFields overwrites the entire array. Send the complete set of fields you want the category to end up with — omitting one deletes it, including a PUT whose only intent was to change a single formula.

Example request

Response 201

Returns the created category with version: 1, deletedAt: null, and sub-categories relation. An audit log entry is created with a create action and a snapshot of the new entity.

Error codes


Update a category

Updates an existing category. Only provided fields are changed. The version field is auto-incremented and a before/after audit snapshot is recorded.

Request body

All other fields from the create schema are accepted as optional.

Response 200

Returns the updated category object with the incremented version.

Error codes


Delete a category (soft-delete)

Soft-deletes a category by setting its deletedAt timestamp. Cascade behavior: all child sub-categories and offers under this category are also soft-deleted. The version is incremented on the category and each cascaded child. An audit log entry is recorded for every affected entity.

Query parameters

Response 200

Error codes

To restore a soft-deleted category, use POST /api/v1/restore?entityType=category&id={categoryId} (admin only). Restoring a category does not automatically restore cascaded children — you must restore sub-categories and offers individually.

Sub-categories

Sub-categories live under a category and group related offers. They also support soft-delete, version tracking, and audit logging.

List sub-categories

Query parameters

Response 200


Create a sub-category

Request body

Response 201

Returns the created sub-category with its parent category relation, version: 1, and deletedAt: null.

Error codes


Update a sub-category

Updates an existing sub-category. The version field is auto-incremented and a before/after audit snapshot is recorded.

Request body

All other fields are optional.

Response 200

Returns the updated sub-category object with the incremented version.

Error codes


Delete a sub-category (soft-delete)

Soft-deletes a sub-category by setting its deletedAt timestamp. The version is incremented.

Query parameters

Response 200

Error codes


Role requirements

Business Hierarchy

Learn more about organising categories and sub-categories in the platform UI.