The subscriptions module serves subscription plans and customer subscriptions with activate, pause, resume, renew, cancel, and a sweep. All 20 endpoints sit under /api/v1/subscriptions. For business meaning see the Subscriptions module page.
Group facts¶
| Item | Value | Source |
|---|---|---|
| Base path | /api/v1/subscriptions |
src/cluster_erp/core/module_base.py:37-38, src/cluster_erp/modules/subscriptions/module.py:41 |
| Routers | 2 router objects in 2 files; listed in the section Endpoint summary | src/cluster_erp/modules/subscriptions/module.py:33 |
| Endpoints | 20, counted from the route decorators and add_api_route calls of the routers that register_routes mounts |
src/cluster_erp/modules/subscriptions/customer_subscriptions/routes.py, src/cluster_erp/modules/subscriptions/plans/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 | 20 of 20 routes declare require_permission |
src/cluster_erp/modules/auth/guards.py:205-240 |
| 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 |
|---|---|---|---|
plans |
router (/subscription-plans) |
8 | src/cluster_erp/modules/subscriptions/plans/routes.py:25 |
customer_subscriptions |
router |
12 | src/cluster_erp/modules/subscriptions/customer_subscriptions/routes.py:34 |
Subscription plans endpoints¶
Plan records, activate, and retire.
| Method | Path | Handler | Permission | Request | Query | Response | Status | Source |
|---|---|---|---|---|---|---|---|---|
GET |
/api/v1/subscriptions/subscription-plans/ |
list_plans |
subscription_plan.read |
none | active_only, search |
dict |
200 (default) | src/cluster_erp/modules/subscriptions/plans/routes.py:42 |
POST |
/api/v1/subscriptions/subscription-plans/ |
create_plan |
subscription_plan.create |
PlanCreate |
none | PlanRead |
201 |
src/cluster_erp/modules/subscriptions/plans/routes.py:65 |
GET |
/api/v1/subscriptions/subscription-plans/{plan_id} |
get_plan |
subscription_plan.read |
none | none | PlanRead |
200 (default) | src/cluster_erp/modules/subscriptions/plans/routes.py:74 |
PUT |
/api/v1/subscriptions/subscription-plans/{plan_id} |
update_plan |
subscription_plan.update |
PlanUpdate |
none | PlanRead |
200 (default) | src/cluster_erp/modules/subscriptions/plans/routes.py:86 |
POST |
/api/v1/subscriptions/subscription-plans/{plan_id}/activate |
activate_plan |
subscription_plan.activate |
none | none | PlanRead |
200 (default) | src/cluster_erp/modules/subscriptions/plans/routes.py:99 |
POST |
/api/v1/subscriptions/subscription-plans/{plan_id}/retire |
retire_plan |
subscription_plan.retire |
none | none | PlanRead |
200 (default) | src/cluster_erp/modules/subscriptions/plans/routes.py:111 |
DELETE |
/api/v1/subscriptions/subscription-plans/{plan_id} |
delete_plan |
subscription_plan.delete |
none | none | none | 204 |
src/cluster_erp/modules/subscriptions/plans/routes.py:123 |
POST |
/api/v1/subscriptions/subscription-plans/bulk-delete |
bulk_delete_plans |
subscription_plan.bulk_delete |
BulkDeleteRequest |
none | BulkDeleteResponse |
200 (default) | src/cluster_erp/modules/subscriptions/plans/routes.py:133 |
Customer subscriptions endpoints¶
The router has no prefix, so subscription paths sit directly under the module base path (src/cluster_erp/modules/subscriptions/customer_subscriptions/routes.py:30-34). Four action routes are added with add_api_route and a shared handler factory (src/cluster_erp/modules/subscriptions/customer_subscriptions/routes.py:110-148).
| Method | Path | Handler | Permission | Request | Query | Response | Status | Source |
|---|---|---|---|---|---|---|---|---|
GET |
/api/v1/subscriptions/ |
list_subscriptions |
customer_subscription.read |
none | customer_id, status, search |
dict |
200 (default) | src/cluster_erp/modules/subscriptions/customer_subscriptions/routes.py:51 |
POST |
/api/v1/subscriptions/ |
create_subscription |
customer_subscription.create |
SubscriptionCreate |
none | SubscriptionRead |
201 |
src/cluster_erp/modules/subscriptions/customer_subscriptions/routes.py:76 |
GET |
/api/v1/subscriptions/{sub_id} |
get_subscription |
customer_subscription.read |
none | none | SubscriptionRead |
200 (default) | src/cluster_erp/modules/subscriptions/customer_subscriptions/routes.py:85 |
PUT |
/api/v1/subscriptions/{sub_id} |
update_subscription |
customer_subscription.update |
SubscriptionUpdate |
none | SubscriptionRead |
200 (default) | src/cluster_erp/modules/subscriptions/customer_subscriptions/routes.py:97 |
POST |
/api/v1/subscriptions/{sub_id}/activate |
activate_subscription |
customer_subscription.activate |
none | none | SubscriptionRead |
200 (default) | src/cluster_erp/modules/subscriptions/customer_subscriptions/routes.py:125 |
POST |
/api/v1/subscriptions/{sub_id}/pause |
pause_subscription |
customer_subscription.pause |
none | none | SubscriptionRead |
200 (default) | src/cluster_erp/modules/subscriptions/customer_subscriptions/routes.py:131 |
POST |
/api/v1/subscriptions/{sub_id}/resume |
resume_subscription |
customer_subscription.resume |
none | none | SubscriptionRead |
200 (default) | src/cluster_erp/modules/subscriptions/customer_subscriptions/routes.py:137 |
POST |
/api/v1/subscriptions/{sub_id}/renew |
renew_subscription |
customer_subscription.renew |
none | none | SubscriptionRead |
200 (default) | src/cluster_erp/modules/subscriptions/customer_subscriptions/routes.py:143 |
POST |
/api/v1/subscriptions/{sub_id}/cancel |
cancel_subscription |
customer_subscription.cancel |
CancelRequest \| None |
none | SubscriptionRead |
200 (default) | src/cluster_erp/modules/subscriptions/customer_subscriptions/routes.py:151 |
DELETE |
/api/v1/subscriptions/{sub_id} |
delete_subscription |
customer_subscription.delete |
none | none | none | 204 |
src/cluster_erp/modules/subscriptions/customer_subscriptions/routes.py:164 |
POST |
/api/v1/subscriptions/sweep |
run_sweep |
customer_subscription.renew |
none | as_of |
dict |
200 (default) | src/cluster_erp/modules/subscriptions/customer_subscriptions/routes.py:174 |
POST |
/api/v1/subscriptions/bulk-delete |
bulk_delete_subscriptions |
customer_subscription.bulk_delete |
BulkDeleteRequest |
none | BulkDeleteResponse |
200 (default) | src/cluster_erp/modules/subscriptions/customer_subscriptions/routes.py:190 |
Error codes¶
The table lists the error codes that code under src/cluster_erp/modules/subscriptions/ 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 |
|---|---|---|---|
CONCURRENCY_VERSION_CONFLICT |
409 |
customer_subscriptions, plans |
src/cluster_erp/modules/subscriptions/customer_subscriptions/services.py:215 |
RESOURCE_CONFLICT |
409 |
customer_subscriptions, plans |
src/cluster_erp/modules/subscriptions/customer_subscriptions/services.py:132 |
RESOURCE_NOT_FOUND |
404 |
customer_subscriptions, plans |
src/cluster_erp/modules/subscriptions/customer_subscriptions/routes.py:93 |
Events emitted¶
The table lists the contract classes that code under src/cluster_erp/modules/subscriptions/ 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 |
|---|---|---|
event_cls |
1 | src/cluster_erp/modules/subscriptions/customer_subscriptions/services.py:428 |
Related pages¶
Verified against commit 92f8051 on 2026-11-13.