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(fromcreateEntitySchema)
- 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 bothcountry and taxId when either is supplied.
- Path param:
entityId(UUID) - Body:
UpdateEntityDto(fromupdateEntitySchema)
- 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(fromupdateEntityLedgerLockDateSchema)
- 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(fromupdateEntityParentSchema)
- 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(fromupdateEntityAccountingPoliciesSchema)
- Success response:
entitySchema - Status: 200
Response shape
TheentitySchema read shape includes: