The records module serves deactivation reasons, the generic record lifecycle (inactive list, label resolution, reactivation), and the retention settings. All 10 endpoints sit under /api/v1/records. For business meaning see the Records module page.
Group facts¶
| Item | Value | Source |
|---|---|---|
| Base path | /api/v1/records |
src/cluster_erp/core/module_base.py:37-38, src/cluster_erp/modules/records/module.py:50 |
| Routers | 3 router objects in 3 files; listed in the section Endpoint summary | src/cluster_erp/modules/records/module.py:39 |
| Endpoints | 10, counted from the route decorators and add_api_route calls of the routers that register_routes mounts |
src/cluster_erp/modules/records/deactivation_reasons/routes.py, src/cluster_erp/modules/records/lifecycle_routes.py, src/cluster_erp/modules/records/retention/routes.py |
| Authentication | Bearer header or session cookie, resolved by get_current_user; see Authentication and headers |
src/cluster_erp/modules/auth/guards.py:85-167 |
| Permission guard | 7 of 10 routes declare require_permission; the other routes show their guard in the tables |
src/cluster_erp/modules/auth/guards.py:205-240 |
| App entitlement gate | None attached in register_routes |
src/cluster_erp/modules/records/module.py:50 |
| Error format | JSON body {"error": {...}}; see Errors |
src/cluster_erp/server/error_handler.py:33-46 |
Endpoint summary¶
One row per sub-module folder. The router prefix is added to the base path.
| Sub-module | Routers | Endpoints | Router source |
|---|---|---|---|
deactivation_reasons |
router (/deactivation-reasons) |
5 | src/cluster_erp/modules/records/deactivation_reasons/routes.py:21 |
lifecycle_routes |
router |
3 | src/cluster_erp/modules/records/lifecycle_routes.py:32 |
retention |
router (/retention) |
2 | src/cluster_erp/modules/records/retention/routes.py:14 |
Deactivation reasons endpoints¶
Deactivation reason records.
| Method | Path | Handler | Permission | Request | Query | Response | Status | Source |
|---|---|---|---|---|---|---|---|---|
GET |
/api/v1/records/deactivation-reasons/ |
list_deactivation_reasons |
deactivation_reason.read |
none | active_only, search |
dict |
200 (default) | src/cluster_erp/modules/records/deactivation_reasons/routes.py:24 |
GET |
/api/v1/records/deactivation-reasons/{reason_id} |
get_deactivation_reason |
deactivation_reason.read |
none | none | DeactivationReasonRead |
200 (default) | src/cluster_erp/modules/records/deactivation_reasons/routes.py:39 |
POST |
/api/v1/records/deactivation-reasons/ |
create_deactivation_reason |
deactivation_reason.create |
DeactivationReasonCreate |
none | DeactivationReasonRead |
201 |
src/cluster_erp/modules/records/deactivation_reasons/routes.py:52 |
PUT |
/api/v1/records/deactivation-reasons/{reason_id} |
update_deactivation_reason |
deactivation_reason.update |
DeactivationReasonUpdate |
none | DeactivationReasonRead |
200 (default) | src/cluster_erp/modules/records/deactivation_reasons/routes.py:64 |
DELETE |
/api/v1/records/deactivation-reasons/{reason_id} |
delete_deactivation_reason |
deactivation_reason.delete |
none | none | none | 204 |
src/cluster_erp/modules/records/deactivation_reasons/routes.py:79 |
Record lifecycle endpoints¶
Generic routes keyed by module and entity: the inactive records of an entity, labels for ids including inactive records, and reactivation. Each handler checks a permission code built from the entity name and calls assert_module_entitled (src/cluster_erp/modules/records/lifecycle_routes.py:125-130).
| Method | Path | Handler | Permission | Request | Query | Response | Status | Source |
|---|---|---|---|---|---|---|---|---|
GET |
/api/v1/records/{module}/{entity}/inactive |
list_inactive |
{entity}.read in handler |
none | search, limit, offset |
dict |
200 (default) | src/cluster_erp/modules/records/lifecycle_routes.py:114 |
GET |
/api/v1/records/{module}/{entity}/labels |
resolve_labels |
{entity}.read in handler |
none | ids |
dict |
200 (default) | src/cluster_erp/modules/records/lifecycle_routes.py:175 |
POST |
/api/v1/records/{module}/{entity}/{record_id}/activate |
activate |
{entity}.delete in handler |
none | none | dict |
200 (default) | src/cluster_erp/modules/records/lifecycle_routes.py:224 |
Retention endpoints¶
Read and update of the retention settings.
| Method | Path | Handler | Permission | Request | Query | Response | Status | Source |
|---|---|---|---|---|---|---|---|---|
GET |
/api/v1/records/retention/ |
get_retention |
retention_config.read |
none | none | RetentionConfigRead |
200 (default) | src/cluster_erp/modules/records/retention/routes.py:17 |
PUT |
/api/v1/records/retention/ |
update_retention |
retention_config.update |
RetentionConfigUpdate |
none | RetentionConfigRead |
200 (default) | src/cluster_erp/modules/records/retention/routes.py:27 |
Error codes¶
The table lists the error codes that code under src/cluster_erp/modules/records/ raises, found by a syntax-tree scan for AppError(...), the factories in src/cluster_erp/core/errors.py (not_found, conflict, protected, permission_denied, privilege_escalation, check_version), and HTTPException(...). A status of 400 is the AppError default (src/cluster_erp/core/errors.py:23). Guard errors (401, 403), the entitlement codes, and validation errors (422) apply to every route and are listed on Errors.
| Code | HTTP status | Raised in | First site |
|---|---|---|---|
AUTH_PERMISSION_DENIED |
403 |
lifecycle_routes |
src/cluster_erp/modules/records/lifecycle_routes.py:84 |
RESOURCE_NOT_FOUND |
404 |
deactivation_reasons, lifecycle_routes |
src/cluster_erp/modules/records/deactivation_reasons/routes.py:48 |
Events emitted¶
The table lists the contract classes that code under src/cluster_erp/modules/records/ passes directly to EventBus.emit, found by a syntax-tree scan. Events built in a variable first are not counted. The contracts are described in Contracts reference.
| Contract | Sites | First site |
|---|---|---|
RecordActivated |
1 | src/cluster_erp/modules/records/lifecycle_routes.py:260 |
Related pages¶
Verified against commit 92f8051 on 2026-11-13.