The Plans API manages the membership tiers offered by Spartans Gym. Each plan defines a name, price, billing period, and display color used by the front-end. Because plans are referenced by name when enrolling or renewing clients, they use a soft-delete strategy — deactivated plans remain in the database and on existing client records but are hidden from the active list. All endpoints require a valid Bearer token; onlyDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/azahel79/Spartans-gym/llms.txt
Use this file to discover all available pages before exploring further.
admin users may create, modify, or deactivate plans.
The Plan Object
UUID. Unique identifier for the plan.
Human-readable plan name (e.g.
"Mensual", "Trimestral"). Must be unique across all plans, including inactive ones.Price of the plan in MXN. Returned as a JavaScript
number (the underlying database type is Decimal(10,2)).Billing period string. Common values:
"Mes", "3 Meses", "6 Meses", "Año". The enrollment and renewal logic parses this value to determine how many months to add to the expiry date.Tailwind CSS class used by the front-end to colour-code this plan’s badge (e.g.
"bg-primary").true for available plans; false for soft-deleted plans. The GET /api/plans list endpoint only returns plans where isActive is true.ISO 8601 datetime when the plan was created.
ISO 8601 datetime when the plan was last modified.
Endpoints
List Active Plans
Requires a valid Bearer token. Accessible to all roles (
admin and recepcionista).isActive is true, sorted by price ascending. Inactive (soft-deleted) plans are never included in this response.
200 OK
| Status | Description |
|---|---|
401 | Missing or invalid Bearer token. |
500 | Internal server error. |
Get Plan by ID
Requires a valid Bearer token. Accessible to all roles.
UUID of the plan to retrieve.
200 OK
Returns a single Plan object wrapped in data.
Error Responses
| Status | Description |
|---|---|
401 | Missing or invalid Bearer token. |
404 | No plan found with the given ID. |
500 | Internal server error. |
Create Plan
Creates a new active membership plan. Thename must be unique — if a plan with that name already exists (active or inactive), the request is rejected with 400.
Unique plan name. This value is stored directly on Client records when a member enrolls, so choose something descriptive (e.g.
"Semestral").Plan price in MXN.
Billing period. Defaults to
"Mes" if omitted. The enrollment logic understands numeric prefixes ("3 Meses", "6 Meses") and keywords ("anual", "trimestral", "semestral").Tailwind CSS class for the plan badge. Defaults to
"bg-primary" if omitted.201 Created
| Status | Description |
|---|---|
400 | name or price missing, or a plan with that name already exists. |
401 | Missing or invalid Bearer token. |
403 | User is not an admin. |
500 | Internal server error. |
Update Plan
Partially updates an existing plan. Supply only the fields you wish to change. Ifname is provided and differs from the current name, the server checks for a duplicate before saving.
UUID of the plan to update.
New unique plan name. Returns
400 if a different plan already uses this name.Updated price in MXN.
Updated billing period string (e.g.
"3 Meses", "Año").Updated Tailwind CSS class.
Setting this to
false effectively deactivates the plan (same result as DELETE /api/plans/:id). Setting it to true re-activates a previously deactivated plan.200 OK
Returns the full updated Plan object inside data.
Error Responses
| Status | Description |
|---|---|
400 | Another plan already uses the requested name. |
401 | Missing or invalid Bearer token. |
403 | User is not an admin. |
404 | No plan found with the given ID. |
500 | Internal server error. |
Delete Plan
This is a soft delete. The plan record is not physically removed from the database — its
isActive flag is set to false. Existing client records that reference the plan by name are unaffected. The plan will no longer appear in GET /api/plans (which only returns isActive: true plans), and it will be rejected if passed as a plan value when enrolling or renewing a client. You can reverse a soft delete by calling PUT /api/plans/:id with { "isActive": true }.isActive to false.
UUID of the plan to deactivate.
200 OK
| Status | Description |
|---|---|
401 | Missing or invalid Bearer token. |
403 | User is not an admin. |
404 | No plan found with the given ID. |
500 | Internal server error. |