Skip to main content
An Entity is a legal company with its own books, functional currency, and integrations. Every ledger route in the API scopes by entityId. This page covers the Entity CRUD, ledger-lock date, and accounting policy endpoints.
Source: apps/erp-backend/src/entity/entity.controller.ts.

POST /api/entities

Create a new Entity. The client supplies the idempotency id, so a retried POST collides on the primary key instead of inserting a twin.
  • Staff only
  • Body: CreateEntityDto (from createEntitySchema)
  • Success response: entitySchema (the created Entity)
  • Status: 201

GET /api/entities

List every Entity the caller can access. Staff see all Entities; clients see only the Entities they hold a membership for.
  • Success response: Array of entitySchema
  • Status: 200

GET /api/entities/:entityId/editability

Check whether the identity fields of an Entity (name, country, taxId, currency) are currently editable. Returns a single boolean flag.
  • Path param: entityId (UUID)
  • Success response: entityEditabilitySchema{ identityFieldsEditable: boolean }
  • Status: 200

PATCH /api/entities/:entityId

Update the core identity fields of an Entity. At least one field must be provided. The update canonicalizes Chilean tax registrations and requires both country and taxId when either is supplied.
  • Path param: entityId (UUID)
  • Body: UpdateEntityDto (from updateEntitySchema)
  • Success response: entitySchema
  • Status: 200

PATCH /api/entities/:entityId/ledger-lock-date

Set, move, or clear the ledger lock date. A date freezes the ledger up to and including that date; null clears the lock. The lock date cannot move to a date on or after any Scheduled Entry’s Entry Date.
  • Path param: entityId (UUID)
  • Body: UpdateEntityLedgerLockDateDto (from updateEntityLedgerLockDateSchema)
  • Success response: entitySchema
  • Status: 200

PATCH /api/entities/:entityId/parent

Set or clear the parent Entity that controls this one. An id names the controlling Entity; null makes it a root. The parent must exist, must not be the Entity itself, and must not create a cycle.
  • Staff only
  • Path param: entityId (UUID)
  • Body: UpdateEntityParentDto (from updateEntityParentSchema)
  • Success response: entitySchema
  • Status: 200

PATCH /api/entities/:entityId/accounting-policies

Set or remove the free-text accounting policies of an Entity. Free text sets the rules; null removes them.
  • Staff only
  • Path param: entityId (UUID)
  • Body: UpdateEntityAccountingPoliciesDto (from updateEntityAccountingPoliciesSchema)
  • Success response: entitySchema
  • Status: 200

Response shape

The entitySchema read shape includes:

Domain error codes

Status codes