The Routines API manages the workout routines that belong to the authenticated user. Each routine holds a list of exercises drawn from the global exercise catalog and can be updated at any time. Deleting a routine is non-destructive — it is soft-deleted by settingDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Blackterz2/Proyecto_5to_Semestre/llms.txt
Use this file to discover all available pages before exploring further.
activa = FALSE, so training history linked to it is never lost.
Authorization: Bearer <token>. The usuario_id is always extracted from the token — any usuario_id value in the request body is silently ignored. This prevents ID spoofing.GET /api/rutinas
GET/api/rutinas
Returns all active routines owned by the authenticated user, ordered by creation date descending. Each entry includes a precomputed total_ejercicios count so the frontend can display a summary card without fetching each routine individually.
Auth required: Yes — Authorization: Bearer <token>
Responses
401 Unauthorized — Missing or invalid token
401 Unauthorized — Missing or invalid token
Example
POST /api/rutinas/crear
POST/api/rutinas/crear
Creates a new personalized routine for the authenticated user. An optional array of exercise IDs can be provided to assign exercises at creation time.
Auth required: Yes — Authorization: Bearer <token>
es_recomendada = TRUE, created automatically during onboarding) are excluded from this count. The limit is checked at the moment of each creation request to eliminate race conditions between concurrent tabs or sessions. If the limit is already reached, the server returns 403 Forbidden regardless of how the request was formed.Request body
"Pull Day"). Must be a non-empty string.orden value starting at 1. Non-numeric values are silently filtered out. If omitted, the routine is created with no exercises.Responses
400 Bad Request — Missing or invalid name
400 Bad Request — Missing or invalid name
403 Forbidden — Routine limit reached
403 Forbidden — Routine limit reached
Example
GET /api/rutinas/:id
GET/api/rutinas/:id
Returns a single routine with its complete, ordered exercise list. Uses a single SQL LEFT JOIN across rutinas, ejercicios_rutinas, and ejercicios — one database round-trip regardless of exercise count.
Auth required: Yes — Authorization: Bearer <token>
Path parameters
400.Responses
400 Bad Request — Non-numeric ID
400 Bad Request — Non-numeric ID
404 Not Found — Routine does not exist or does not belong to the user
404 Not Found — Routine does not exist or does not belong to the user
Example
PUT /api/rutinas/:id
PUT/api/rutinas/:id
Updates the name, description, and exercise list of an existing routine. This is a full replacement — the incoming ejercicios_ids array completely replaces every exercise currently in the routine. The replacement is performed atomically inside a SQL transaction (DELETE all current entries, then INSERT the new list), so the routine is never left in a partial state.
Auth required: Yes — Authorization: Bearer <token>
Path parameters
Request body
null or omit to clear.Responses
200 OK — Routine updated
200 OK — Routine updated
400 Bad Request — Missing name or invalid ID
400 Bad Request — Missing name or invalid ID
404 Not Found — Routine not found or not owned by the user
404 Not Found — Routine not found or not owned by the user
Example
DELETE /api/rutinas/:id
DELETE/api/rutinas/:id
Soft-deletes a routine by setting its activa column to FALSE. The row is not removed from the database. All training sessions that reference this routine remain intact and fully queryable — only the routine itself disappears from the user’s active list.
Auth required: Yes — Authorization: Bearer <token>
Path parameters
Responses
200 OK — Routine deactivated
200 OK — Routine deactivated
400 Bad Request — Non-numeric ID
400 Bad Request — Non-numeric ID
404 Not Found — Routine not found or already deactivated
404 Not Found — Routine not found or already deactivated
