Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/jaimegayo/KERNDOCUMENTATION/llms.txt

Use this file to discover all available pages before exploring further.

All user endpoints require a valid JWT Bearer token in the Authorization header. See Authentication for how to obtain a token.

GET /users/me

Returns the full profile of the currently authenticated user. Auth required: Yes

Response — 200

id
integer
Auto-incremented user ID.
username
string
required
The user’s display name.
email
string
Email address on file.
full_name
string
Full name. null if not set.
phone
string
Phone number. null if not set.
avatar_url
string
URL of the avatar image. null if not set.
role
string
Account role. Default: "user".
bio
string
Short biography. null if not set.
has_completed_quiz
boolean
Whether the onboarding questionnaire has been completed.
assigned_routine
string
The routine type selected during the quiz: "Full Body", "PPL (Push Pull Leg)", or "Torso-Pierna". null until the quiz is completed.
created_at
string
ISO 8601 account creation timestamp.
disabled
boolean
Whether the account is disabled.

Example

curl --request GET \
  --url https://kern-api.vercel.app/users/me \
  --header "Authorization: Bearer <accessToken>"

POST /users/complete-quiz

Marks the onboarding questionnaire as complete, sets the user’s assigned routine type, and automatically generates an initial routine with exercises selected from the gym catalog. Auth required: Yes

Request body

assigned_routine
string
required
The training plan chosen by the user. Must be one of:
  • "Full Body"
  • "PPL (Push Pull Leg)"
  • "Torso-Pierna"

Response — 200

Returns the updated UserData object with has_completed_quiz set to true and assigned_routine populated.

Example

curl --request POST \
  --url https://kern-api.vercel.app/users/complete-quiz \
  --header "Authorization: Bearer <accessToken>" \
  --header "Content-Type: application/json" \
  --data '{"assigned_routine": "Full Body"}'

PUT /users/avatar

Updates the avatar image URL for the authenticated user. Auth required: Yes

Request body

avatar_url
string
required
Public URL of the new avatar image. Typically a Cloudinary URL obtained after uploading from the Android client.

Response — 200

Returns the updated UserData object with the new avatar_url.

Example

curl --request PUT \
  --url https://kern-api.vercel.app/users/avatar \
  --header "Authorization: Bearer <accessToken>" \
  --header "Content-Type: application/json" \
  --data '{"avatar_url": "https://res.cloudinary.com/demo/image/upload/sample.jpg"}'

PUT /users/update_name

Updates the username of the authenticated user. Because the username is embedded in the JWT payload (sub claim), this endpoint issues a new token and returns a full LoginResponse. Auth required: Yes
Replace your stored token with the accessToken from the response immediately. Continuing to use the old token will result in 401 errors because the sub claim no longer matches the updated username.

Request body

username
string
required
The new username. Must not already be in use by another account.

Response — 200

Returns a full LoginResponse (same shape as login/register) with a fresh JWT token and updated user data.

Errors

StatusdetailCause
400"El nombre de usuario ya está en uso"Another account already uses this username

Example

curl --request PUT \
  --url https://kern-api.vercel.app/users/update_name \
  --header "Authorization: Bearer <accessToken>" \
  --header "Content-Type: application/json" \
  --data '{"username": "jaime_new"}'

GET /users/stats

Returns aggregate training statistics for the authenticated user, calculated from all saved workout sessions. Auth required: Yes

Response — 200

total_workouts
integer
required
Total number of completed workout sessions recorded.
total_steps
integer
required
Sum of all steps recorded across every workout session.
training_days
string[]
required
Sorted list of unique calendar dates ("YYYY-MM-DD") on which at least one workout was completed.

Example

curl --request GET \
  --url https://kern-api.vercel.app/users/stats \
  --header "Authorization: Bearer <accessToken>"

GET /users/my-routines

Returns all workout routines belonging to the authenticated user, each with its full list of exercises and their stored series data. Auth required: Yes

Response — 200

Returns an array of routine objects.
id
integer
Routine ID.
name
string
Routine display name.
created_at
string
ISO 8601 creation timestamp.
exercises
object[]

Example

curl --request GET \
  --url https://kern-api.vercel.app/users/my-routines \
  --header "Authorization: Bearer <accessToken>"

GET /users/my-history

Returns all completed workout sessions for the authenticated user, ordered from most recent to oldest. Auth required: Yes

Response — 200

Returns an array of WorkoutSession objects directly from the database.
id
integer
Session ID.
user_id
integer
The user this session belongs to.
routine_name
string
Name of the routine that was performed.
duration_seconds
integer
Total session duration in seconds.
total_volume
number
Sum of (kilos × reps) for all sets completed in the session.
steps
integer
Steps recorded by the Android StepCounterService during the session.
created_at
string
ISO 8601 timestamp when the session was saved.
data_json
object[]
Full snapshot of all exercises and series performed. Same shape as the POST /workouts/finish request body data_json.

Example

curl --request GET \
  --url https://kern-api.vercel.app/users/my-history \
  --header "Authorization: Bearer <accessToken>"

Build docs developers (and LLMs) love