I am Alive! API

The JSON API used by the I am Alive! mobile app: accounts, the fitness survey, the weekly workout calendar, the workout library, workout history, body measurements for progress tracking, and nutrition tracking.

Overview

All endpoints live under one base URL:

Base URL
https://iama.live/api/v1

Every request should send Accept: application/json. Request bodies are JSON (Content-Type: application/json). All timestamps are ISO 8601 and dates are YYYY-MM-DD.

Heights and weights are always metric (cm, kg). The app converts imperial input before sending it.

Authentication

Register, verify the email, then log in to get a token. Send it with every other request:

Header
Authorization: Bearer 1|Xv9kq2...token

Tokens do not expire on their own. Each device gets its own token (named with device_name), and logging out revokes only the token used for that request. A missing or revoked token returns 401.

Rate limits

  • Register and log in: 6 requests per minute.
  • Resend verification email: 3 requests per minute, and at most one email per address per minute.
  • Everything else: 120 requests per minute per user.

Going over the limit returns 429 with a Retry-After header in seconds.

Errors

Errors are JSON with a message. Validation errors (422) also list the problems per field:

422 Unprocessable Content
{
  "message": "The email field is required. (and 1 more error)",
  "errors": {
    "email": ["The email field is required."],
    "device_name": ["The device name field is required."]
  }
}
StatusMeaning
401Missing, invalid or revoked token.
403The content needs premium, the calendar day is locked, or nutrition tracking was used without premium. On log in, "code": "email_unverified" means the email isn't verified yet.
404Not found, or not published.
409The fitness survey has not been completed yet. Show the survey, then retry.
422Validation failed. See errors.
429Too many requests. Wait for Retry-After seconds.

Pagination

List endpoints return a page of results in data, with links and meta for paging. Pass ?page=2 to get the next page, or just follow links.next until it is null.

Paginated response
{
  "data": [ ... ],
  "links": {
    "first": "https://iama.live/api/v1/workouts?page=1",
    "last": "https://iama.live/api/v1/workouts?page=3",
    "prev": null,
    "next": "https://iama.live/api/v1/workouts?page=2"
  },
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 3,
    "path": "https://iama.live/api/v1/workouts",
    "per_page": 20,
    "to": 20,
    "total": 47
  }
}

Free and premium

A user has premium when subscription.has_premium_access is true on the user. Premium is bought in the app through the App Store and Google Play: 1, 3, 6 or 12 month subscriptions that renew, or lifetime, a one-time purchase that never ends (subscription.ends_at is null).

  • Calendar: free users can open today's workout only. Premium users can open every day of the current week.
  • Premium workouts: free users see them with is_locked: true. A locked workout has its title, duration, target muscles and exercise count, but no description or exercises. Use it as a paywall teaser.
  • Workout customization: focus muscles and the user's own workouts (see customize) need premium. Without it those endpoints return 403 with {"message": "Workout customization requires an active subscription."}, and the calendar ignores any customization saved earlier.
  • Nutrition tracking: every nutrition endpoint needs premium. Without it they return 403 with {"message": "Nutrition tracking requires an active subscription."}.
  • Training mode: everyone can switch anytime. Switching never unlocks more than the user's plan allows. See changing training mode.

Allowed values

FieldValues
training_modecalisthenics, gym
fitness_goals (each)lose_weight, build_muscle, get_fit
fitness_level / levelbeginner, intermediate, advanced
musclechest, back, shoulders, biceps, triceps, forearms, core, glutes, quads, hamstrings, calves
gendermale, female
body_typeectomorph, mesomorph, endomorph
mealbreakfast, lunch, snack, dinner
diet_planketo (20 g net carbs a day), low_carb (50 g), moderate (100 g), or null
fasting16_8 (8-hour eating window), 18_6 (6 h), 20_4 (4 h), omad (one meal a day, 1 h), or null
bmi_categoryunderweight, normal, overweight, obese
subscription.statusfree, trialing, active, past_due, canceled, expired
subscription.planmonthly, quarterly, semiannual, yearly, lifetime, or null

Auth

Register

POST/auth/registerNo token

Creates an account and emails a verification link to it. No token is returned: show a "check your email" screen (with a resend button), and send the user to log in once they have opened the link. After logging in, check user.needs_survey and show the fitness survey.

Body fieldTypeNotes
namerequiredstringUp to 255 characters.
emailrequiredstringLowercase, unique.
passwordrequiredstringAt least 8 characters.
password_confirmationrequiredstringMust match password.
device_namerequiredstringUp to 100 characters, e.g. Pixel 8. Still required, though no token is issued here.
training_modestringcalisthenics (default) or gym. Optional, since the survey asks for it. Does not start the lock.
Request
curl -X POST https://iama.live/api/v1/auth/register \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Alex Cruz",
    "email": "alex@example.com",
    "password": "secret-pass-1",
    "password_confirmation": "secret-pass-1",
    "device_name": "Pixel 8"
  }'
201 Created
{
  "message": "We sent a verification link to alex@example.com. Open it to activate your account, then log in.",
  "email": "alex@example.com",
  "verification_required": true
}

The link opens a page on the website ("Your email is verified") and works for 60 minutes. It does not sign the user in, in the app or on the website.

Log in

POST/auth/loginNo token

Exchanges an email and password for a new token. Wrong credentials return 422 with the error on email. A correct password for an account whose email isn't verified yet returns 403 with code: "email_unverified" and no token. Show the message with a resend button. No email is sent by this call.

Body fieldTypeNotes
emailrequiredstring
passwordrequiredstring
device_namerequiredstringUp to 100 characters.
200 OK
{
  "token": "2|p0Lm7a...",
  "token_type": "Bearer",
  "user": { ...User }
}
403 Forbidden (email not verified)
{
  "message": "Verify your email before logging in. We sent a link to alex@example.com — open it, then log in again.",
  "code": "email_unverified",
  "email": "alex@example.com"
}

Resend verification email

POST/auth/email/resendNo token

Emails a new verification link. It always returns 202 with the same message, whether or not the email has an account, so it can't be used to find accounts. A link is only sent when the account exists and isn't verified yet, and at most once a minute per address.

Body fieldTypeNotes
emailrequiredstringA valid email, otherwise 422.
202 Accepted
{
  "message": "If that account still needs verifying, we've sent a new link. Check your inbox and spam folder."
}

Log out

POST/auth/logout

Revokes the token used for this request. Returns 204 No Content.

Profile

Current user

GET/me

Returns the signed-in user, including survey answers and subscription state. Call it on app start to decide whether to show the survey or the paywall.

200 OK
{ "data": { ...User } }

Update profile

PATCH/me

Send only the fields you want to change.

Body fieldTypeNotes
namestringUp to 255 characters.
emailstringLowercase, unique. A different address has to be verified again: email_verified becomes false and a link is sent to the new address. The current token keeps working, but logging in again needs the new address verified.
training_modestringcalisthenics or gym. Can be changed anytime.
plan_sourcestringrecommended or custom: which workouts the week plan follows. custom needs Premium, otherwise 422.
200 OK
{ "data": { ...User } }

Delete account

DELETE/me

Permanently deletes the account and everything the user logged: survey, their own workouts, workout history, measurements, nutrition and purchase records, plus every sign-in token. Send {"password": "..."} to confirm. A store subscription is not cancelled: tell the user to cancel it in App Store or Google Play settings.

204 No Content

A wrong or missing password returns 422 with errors.password. Admin accounts get 403.

Fitness survey

PUT/me/survey

Saves the first-run fitness survey. The calendar and recommendations are picked from these answers. It can be retaken at any time, and the calendar updates straight away. The weight and height are also saved as today's entry in the progress history.

Body fieldTypeNotes
ageinteger13 to 100. Needed, with gender, for suggested nutrition goals.
genderstringmale or female.
body_typestringectomorph, mesomorph or endomorph.
height_cmrequirednumber100 to 250.
weight_kgrequirednumber25 to 350.
fitness_goalsrequiredarray of strings"What's your main goal? Check all that apply." At least one of lose_weight, build_muscle, get_fit, with no duplicates. An empty or missing list returns 422.
fitness_levelrequiredstringbeginner, intermediate or advanced.
training_moderequiredstringcalisthenics or gym. See the equipment question and the lock below.
Request
curl -X PUT https://iama.live/api/v1/me/survey \
  -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "age": 31,
    "gender": "male",
    "body_type": "mesomorph",
    "height_cm": 172,
    "weight_kg": 68.5,
    "fitness_goals": ["build_muscle", "lose_weight"],
    "fitness_level": "intermediate",
    "training_mode": "gym"
  }'
200 OK
{ "data": { ...User } }

Workouts are picked if they serve any of the checked goals. Two safety rules apply. For a user who is underweight, lose_weight is replaced by get_fit, and their other goals are kept. A user whose BMI is obese gets beginner workouts, whatever level they picked.

Equipment question

The app asks whether the user works out with or without equipment, and turns the answer into training_mode. Only training_mode is sent:

  • Without equipment: send calisthenics.
  • With equipment (goes to the gym): the user picks calisthenics or gym. Send calisthenics or gym.

Changing training mode

Everyone can switch between calisthenics and gym anytime, here or through update profile. Switching re-picks the calendar. Free users stay limited the usual way: today's workout only, and no premium workouts.

Earlier versions locked free users for 7 days after a change. The user still has training_mode_locked (always false) and training_mode_unlocks_at (always null) for apps that read them.

Subscriptions

Verify a purchase

POST/subscriptions/verify

Send every purchase the store reports as purchased or restored. The server checks it with the store and returns the user with the updated subscription. Finish the store transaction only after a 200, 403 or 422. On any other error, leave it unfinished: the store delivers it again the next time the app opens.

Body fieldTypeNotes
platformrequiredstringapp_store or google_play.
product_idrequiredstringlive.iama.app.premium.monthly_v2, .quarterly_v2, .semiannual_v2, .yearly_v2 or .forlife_v2 (lifetime).
verification_datarequiredstringApp Store: the StoreKit 2 signed transaction (JWS). Google Play: the purchase token.
transaction_idstringThe store's transaction or order ID, for support.
200 OK
{ "data": { ...User } }
StatusWhen
200Checked. subscription.has_premium_access is false when the purchase has expired or was refunded.
403The purchase is already linked to another account. A purchase belongs to the first account that sends it.
422The store doesn't confirm it: not signed by Apple, made for another app, unknown to Google Play, or not paid for yet.
503The store can't be reached right now. Try again later.

Renewals, expiries and refunds also reach the server directly from the stores (App Store Server Notifications and Google Play real-time developer notifications), so subscription.ends_at stays current without the app having to open. Lifetime takes priority over any subscription.

Calendar

The app's home screen is a weekly calendar with one workout per day, picked from the fitness survey. Weeks run Monday to Sunday. Each date always gets the same workout, and consecutive days rotate through the user's matching workouts.

Premium users choose where the plan comes from, shown in meta.plan_source. On recommended (everyone's default), every day uses recommended workouts, favouring the user's focus muscles: meta.focus_muscles lists the focus in effect, and meta.focus_applied is false when no recommended workout hits it, so the plain recommendations are used. On custom, only the user's own workouts are used, on the weekdays they picked (workout.is_custom: true); other days have workout: null, and opening one returns 404. When Premium lapses, the plan is recommended again.

Send the device's time zone as timezone (an IANA name such as Asia/Manila) so "today" matches the user's clock. Without it, the server uses UTC.

Both endpoints return 409 until the survey is done.

This week

GET/calendar

Returns all seven days of the current week. Free users can open today only. The other days come back with is_locked: true and a teaser workout, so the app can show what premium unlocks. Premium users get every day unlocked.

QueryTypeNotes
timezonestringIANA time zone. An unknown zone returns 422.
Day fieldTypeNotes
datestringYYYY-MM-DD
weekdaystringMonday to Sunday.
is_todayboolean
is_lockedbooleantrue when the user cannot open this day.
workoutWorkout or nullA workout. On a locked day it is a teaser with no exercises. null when no published workout matches the survey yet.
Request
curl "https://iama.live/api/v1/calendar?timezone=Asia/Manila" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/json"
200 OK (free user, Wednesday)
{
  "data": [
    {
      "date": "2026-09-28",
      "weekday": "Monday",
      "is_today": false,
      "is_locked": true,
      "workout": {
        "id": 4,
        "slug": "upper-body-builder",
        "title": "Upper Body Builder",
        "summary": "Push and pull supersets for chest, back and arms.",
        "mode": "gym",
        "level": "intermediate",
        "goals": ["build_muscle"],
        "duration_minutes": 40,
        "target_muscles": ["chest", "back", "biceps", "triceps"],
        "exercise_count": 5,
        "is_premium": false,
        "is_locked": true,
        "updated_at": "2026-09-27T11:02:14+00:00"
      }
    },
    ...
    {
      "date": "2026-09-30",
      "weekday": "Wednesday",
      "is_today": true,
      "is_locked": false,
      "workout": { ...Workout with exercises }
    },
    ...
  ],
  "meta": {
    "timezone": "Asia/Manila",
    "today": "2026-09-30",
    "week_start": "2026-09-28",
    "week_end": "2026-10-04",
    "has_premium_access": false,
    "plan_source": "recommended",
    "focus_muscles": [],
    "focus_applied": false
  }
}

Open a day

GET/calendar/{date}

Opens one day of the current week, with the full workout and its exercises. Call it when the user taps a day.

ParameterTypeNotes
daterequiredpathYYYY-MM-DD, a day in the current week.
timezonequerySame as on this week. Send the same value.
200 OK
{
  "data": {
    "date": "2026-09-30",
    "weekday": "Wednesday",
    "is_today": true,
    "is_locked": false,
    "workout": { ...Workout with exercises }
  }
}
StatusWhen
403A free user opens a day other than today. The message is "Upgrade to premium to open the whole week." Show the paywall.
404The date is outside the current week, or no workout matches the survey yet.
409The survey has not been completed.

Workouts

The workout library. Only published workouts are returned.

List workouts

GET/workoutsPaginated, 20 per page

All published workouts, sorted by mode, then duration. Premium workouts are included but locked for free users.

QueryTypeNotes
modestringcalisthenics or gym.
levelstringbeginner, intermediate or advanced.
musclestringOnly workouts that train this muscle. See allowed values.
accessstringunlocked hides workouts the user cannot open.
pageintegerDefaults to 1.
Request
curl "https://iama.live/api/v1/workouts?mode=gym&muscle=chest" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/json"

Get a workout

GET/workouts/{slug}

A single workout with its exercises. A free user opening a premium workout gets 403, and an unknown or unpublished workout returns 404.

Request
curl https://iama.live/api/v1/workouts/full-body-starter \
  -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/json"
200 OK
{ "data": { ...Workout with exercises } }

Customize (premium)

By default the plan is the recommended one. Premium users can focus it on chosen muscles and build their own workouts from the exercise library. Every endpoint here returns 403 without premium.

Exercise library

GET/exercises?muscle=chest

Every exercise, A to Z, with id, slug, name, instructions and target_muscles. Filter with muscle (a muscle value) and q (part of the name).

Focus muscles

PUT/me/focus

Sets the muscles the week plan should favour. Send {"muscles": ["chest", "back"]}, or [] to go back to the plain recommendations. Returns the user, whose focus_muscles are listed head to toe.

My workouts

GET/me/workouts

The user's own workouts, oldest first. They have is_custom: true and weekdays. They never appear in /workouts, and only their owner can open them with get a workout or log them.

Build a workout

POST/me/workouts

Creates a workout in the user's training mode and returns it with 201. duration_minutes is estimated as about 45 seconds of work per set plus the rest. A weekday can belong to one workout only: picking it here removes it from the user's other workouts.

Body fieldTypeNotes
titlerequiredstringUp to 60 characters.
descriptionstringUp to 500 characters.
weekdaysinteger[]ISO weekdays it replaces the recommended workout on: 1 Monday to 7 Sunday.
exercisesrequiredobject[]1 to 20, in order: exercise_id (from the library), sets (1–10), reps (e.g. "12" or "45s", up to 20 characters), rest_seconds (0–600).

Edit a workout

PUT/me/workouts/{slug}

Replaces the workout with the same fields as build a workout. Another user's workout returns 404.

Delete a workout

DELETE/me/workouts/{slug}

Deletes the workout and returns 204 No Content. Logged sessions stay in the history without it.

Workout logs

History

GET/logsPaginated, 30 per page

The user's completed sessions, newest first.

200 OK
{
  "data": [ ...Workout log ],
  "links": { ... },
  "meta": { ... }
}

Log a session

POST/logs

Records a finished session. workout_id is optional so free-form sessions can be logged too. Logging a premium workout without premium returns 422 on workout_id.

Body fieldTypeNotes
duration_secondsrequiredinteger1 to 43200 (12 hours).
workout_idintegerA published workout's id.
caloriesinteger0 to 10000.
effortinteger1 to 10.
notesstringUp to 500 characters.
completed_atdatetimeDefaults to now. Cannot be in the future.
Request
curl -X POST https://iama.live/api/v1/logs \
  -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "workout_id": 4,
    "duration_seconds": 2460,
    "calories": 310,
    "effort": 7
  }'
201 Created
{ "data": { ...Workout log } }

Delete a session

DELETE/logs/{id}

Deletes one session from the user's history and returns 204 No Content. Someone else's session returns 404.

Clear history

DELETE/logs

Deletes every session in the user's history and returns 204 No Content. This can't be undone, so confirm with the user first.

Progress

Weight and body measurements over time, for progress charts. Each day has at most one entry. The newest entry is also the user's current weight (and height), so survey.bmi, the calendar and recommendations follow it. Submitting the survey saves today's entry too.

Measurement history

GET/me/measurementsPaginated, 100 per page

The user's body measurements, newest first.

200 OK
{
  "data": [ ...Body measurement ],
  "links": { ... },
  "meta": { ... }
}

Log measurements

POST/me/measurements

Saves a day's measurements. Logging a date that already has an entry updates it and returns 200 instead of 201. On an update, fields you leave out keep their old values, and null clears one. All values are metric.

Body fieldTypeNotes
weight_kgrequirednumber25 to 350.
measured_ondateYYYY-MM-DD, the device's local date. Defaults to today on the server. Can be up to one day ahead of the server, for time zones east of it.
height_cmnumber100 to 250. Defaults to the survey height.
body_fat_percentnumber2 to 75.
waist_cmnumber30 to 250.
chest_cmnumber30 to 250.
hips_cmnumber30 to 250.
arm_cmnumber10 to 100. Upper arm.
thigh_cmnumber20 to 150.
Request
curl -X POST https://iama.live/api/v1/me/measurements \
  -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "measured_on": "2026-10-05",
    "weight_kg": 67.2,
    "waist_cm": 80,
    "body_fat_percent": 19.5
  }'
201 Created
{ "data": { ...Body measurement } }

Call current user afterwards to pick up the new BMI.

Delete an entry

DELETE/me/measurements/{id}

Deletes one entry and returns 204 No Content. If it was the newest, the user's current weight goes back to the newest entry that is left. Someone else's entry returns 404.

Nutrition

A food diary with daily calorie and macro goals. Premium only: every endpoint here returns 403 without premium. Macros are grams. carbs on foods and entries is total carbs; net_carbs is carbs minus fiber (never below 0). The daily carbs goal is net carbs.

Numbers are JSON numbers: macros are rounded to one decimal and calorie totals to whole numbers. Whole values come without a decimal point (12, not 12.0), so parse them as numbers, not doubles only.

Daily goals

GET/nutrition/goals

The goals in force. Until the user sets their own (is_custom: false), they are suggested from the survey. Without age and gender in the survey there is no suggestion (suggested: null) and the defaults apply: 2000 kcal, 100 g protein, 225 g carbs, 67 g fat.

Suggestions use the Mifflin-St Jeor BMR times an activity factor from fitness_level (beginner 1.375, intermediate 1.55, advanced 1.725), adjusted for fitness_goals (lose weight ×0.8, build muscle ×1.1, both ×0.9), at least 1500 kcal for men and 1200 for women. Protein is 1.6 g/kg (2.0 g/kg when building muscle), at most 35% of calories. With a diet_plan, carbs are the plan's net carb limit and fat makes up the rest; without one, 30% of calories come from fat and carbs make up the rest.

200 OK
{ "data": { ...Nutrition goals } }

Set goals

PUT/nutrition/goals

Saves the user's own daily goals, replacing earlier ones. Pre-fill the form from suggested.

Body fieldTypeNotes
caloriesrequiredinteger800 to 6000.
proteinrequiredintegerGrams, 0 to 500.
carbsrequiredintegerNet carb grams, 0 to 1000.
fatrequiredintegerGrams, 0 to 400.
diet_planstringketo, low_carb, moderate or null.
fastingstring16_8, 18_6, 20_4, omad or null for no fasting. Leave it out to keep the saved schedule.
eating_window_startstringWhen the eating window opens, local time HH:MM (24-hour). Defaults to 12:00 for 16_8 and 18_6, 14:00 for 20_4 and 18:00 for omad. Ignored without fasting.
Request
curl -X PUT https://iama.live/api/v1/nutrition/goals \
  -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{ "calories": 2200, "protein": 150, "carbs": 50, "fat": 160, "diet_plan": "low_carb", "fasting": "16_8", "eating_window_start": "12:00" }'
200 OK
{ "data": { ...Nutrition goals } }

Search foods

GET/foods?q=adoboPaginated, 25 per page

The shared catalog (common foods and Filipino dishes) plus the user's own foods. With q (1 to 60 characters), foods whose name or brand contains it, ignoring case, with names that start with it first, then A to Z. Without q, everything A to Z.

200 OK
{
  "data": [ ...Food ],
  "links": { ... },
  "meta": { ... }
}

Add a food

POST/foods

Adds one of the user's own foods. Only they can see it. Macros are per serving.

Body fieldTypeNotes
namerequiredstringUp to 120 characters.
serving_labelrequiredstringUp to 60 characters, e.g. "1 cup (158 g)".
caloriesrequirednumber0 to 5000.
protein, carbs, fatrequirednumber0 to 1000. carbs is total carbs.
fibernumber0 to 1000, no more than carbs. Defaults to 0.
brandstringUp to 80 characters.
201 Created
{ "data": { ...Food } }

Delete a food

DELETE/foods/{id}

Deletes one of the user's own foods and returns 204 No Content. Entries already logged from it keep their name and macros (their food_id becomes null). Catalog foods and other users' foods return 404.

Food diary day

GET/nutrition/days/{YYYY-MM-DD}

One day of the diary: the goals, the day's totals and its entries, ordered breakfast, lunch, snack, dinner, and oldest first within a meal. An invalid date returns 404.

200 OK
{
  "data": {
    "date": "2026-10-12",
    "goals": { ...Nutrition goals },
    "totals": {
      "calories": 1484,
      "protein": 98.5,
      "carbs": 112.4,
      "fiber": 14.2,
      "net_carbs": 98.2,
      "fat": 61
    },
    "entries": [ ...Food entry ]
  }
}

Log food

POST/nutrition/entries

Logs something eaten, in one of two ways. With food_id (a catalog food or the user's own), the food's name, serving and macros are copied into the entry and the quick-add fields are ignored; another user's food returns 422 on food_id. Without food_id, it is a quick add: send name and calories, and any macros you know.

Body fieldTypeNotes
eaten_onrequireddateYYYY-MM-DD, the device's local date. From 2020-01-01 to one day ahead of the server.
mealrequiredstringbreakfast, lunch, snack or dinner.
servingsnumber0.1 to 50. Defaults to 1.
food_idintegerLog this food.
namestringQuick add: required, up to 120 characters.
caloriesnumberQuick add: required, 0 to 5000 per serving.
protein, carbs, fiber, fatnumberQuick add: 0 to 1000 per serving, default 0. fiber can't be more than carbs.
serving_labelstringQuick add: up to 60 characters.
Request
curl -X POST https://iama.live/api/v1/nutrition/entries \
  -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{ "eaten_on": "2026-10-12", "meal": "lunch", "food_id": 1, "servings": 1.5 }'
201 Created
{ "data": { ...Food entry } }

Change an entry

PATCH/nutrition/entries/{id}

Changes servings (0.1 to 50) or meal. Send only what changes. Someone else's entry returns 404.

200 OK
{ "data": { ...Food entry } }

Delete an entry

DELETE/nutrition/entries/{id}

Deletes one entry and returns 204 No Content. Someone else's entry returns 404.

Week summary

GET/nutrition/week?end=2026-10-12&timezone=Asia/Manila

Daily totals for the 7 days ending on end, oldest first, including days with nothing logged (all zeros). end defaults to today; pass timezone so today matches the device. averages only count days with at least one entry, and are all 0 when there are none.

200 OK
{
  "data": {
    "start": "2026-10-06",
    "end": "2026-10-12",
    "goals": { ...Nutrition goals },
    "days": [
      {
        "date": "2026-10-06",
        "calories": 1820,
        "protein": 121.5,
        "carbs": 64,
        "fiber": 18.2,
        "net_carbs": 45.8,
        "fat": 118.3,
        "entries_count": 6
      },
      ...
    ],
    "averages": {
      "calories": 1764,
      "protein": 118.2,
      "net_carbs": 48.9,
      "fat": 112
    }
  }
}

Objects

User

survey is null until the survey is done, and needs_survey is true until then. age, gender and body_type are null for surveys taken before they were asked.

User
{
  "id": 42,
  "name": "Alex Cruz",
  "email": "alex@example.com",
  "email_verified": true,
  "training_mode": "gym",
  "training_mode_locked": false,
  "training_mode_unlocks_at": null,
  "focus_muscles": ["chest", "back"],
  "plan_source": "recommended",
  "needs_survey": false,
  "survey": {
    "age": 31,
    "gender": "male",
    "body_type": "mesomorph",
    "height_cm": 172.0,
    "weight_kg": 68.5,
    "bmi": 23.2,
    "bmi_category": "normal",
    "fitness_goals": ["build_muscle", "lose_weight"],
    "fitness_level": "intermediate",
    "completed_at": "2026-09-28T09:41:03+00:00"
  },
  "subscription": {
    "status": "active",
    "plan": "monthly",
    "ends_at": "2026-10-28T09:45:00+00:00",
    "has_premium_access": true
  },
  "created_at": "2026-09-28T09:40:12+00:00"
}

email_verified is false after the email was changed and before the new address is verified.

training_mode_locked is always false and training_mode_unlocks_at always null: the training mode can be changed anytime. Both are kept for apps that still read them.

Use subscription.has_premium_access to decide what to unlock, not status. It also accounts for ends_at, and a past_due subscription still has access. A lifetime plan has ends_at: null.

Workout

When is_locked is true, description and exercises are left out. target_muscles are listed head to toe.

Workout
{
  "id": 7,
  "slug": "full-body-starter",
  "title": "Full Body Starter",
  "summary": "A gentle full-body session to build the habit.",
  "description": "Three rounds of simple compound moves...",
  "mode": "gym",
  "level": "beginner",
  "goals": ["get_fit", "lose_weight"],
  "duration_minutes": 30,
  "target_muscles": ["chest", "core", "glutes", "quads"],
  "exercise_count": 3,
  "exercises": [ ...Exercise ],
  "is_premium": false,
  "is_locked": false,
  "is_custom": false,
  "updated_at": "2026-09-27T11:02:14+00:00"
}

The user's own workouts have is_custom: true and also include weekdays (ISO, 1 Monday to 7 Sunday).

Exercise

An exercise as it appears inside a workout, in order. reps is a string because it can be a count ("12"), a range ("8-10") or a time ("30s").

Exercise
{
  "id": 3,
  "slug": "push-up",
  "name": "Push-up",
  "instructions": "Keep your body in a straight line...",
  "target_muscles": ["chest", "triceps"],
  "sets": 3,
  "reps": "12",
  "rest_seconds": 60
}

Workout log

workout is null for a free-form session, or when the workout was deleted later.

Workout log
{
  "id": 118,
  "workout": {
    "id": 4,
    "slug": "upper-body-builder",
    "title": "Upper Body Builder",
    "mode": "gym"
  },
  "duration_seconds": 2460,
  "calories": 310,
  "effort": 7,
  "notes": null,
  "completed_at": "2026-09-30T07:15:00+00:00"
}

Body measurement

Everything except weight_kg can be null. bmi and bmi_category are worked out from that day's weight and height.

Body measurement
{
  "id": 31,
  "measured_on": "2026-10-05",
  "weight_kg": 67.2,
  "height_cm": 172.0,
  "bmi": 22.7,
  "bmi_category": "normal",
  "body_fat_percent": 19.5,
  "waist_cm": 80.0,
  "chest_cm": null,
  "hips_cm": null,
  "arm_cm": null,
  "thigh_cm": null
}

Nutrition goals

Daily targets in whole kcal and grams; carbs is net carbs. is_custom is false while the suggested (or default) goals apply. suggested is the survey's suggestion for the chosen diet_plan (a balanced split without one), or null until the survey has age and gender. fasting is the intermittent fasting schedule; eating_window_start and eating_window_end are local times (HH:MM), both null without a schedule. The end can be earlier than the start when the window runs past midnight.

limits are daily minimums and maximums (null = none) for members whose fitness_goals include lose_weight or build_muscle, worked out from these goals; null for other goals. Losing weight caps calories at the goal with a safe floor of 1500 kcal for men or 1200 for women (never above the goal), and caps carbs and fat. Building muscle alone needs at least the goal's calories and at most 10% over. Protein is always a minimum. Draw them as limit lines and flag days that cross them.

Nutrition goals
{
  "calories": 2200,
  "protein": 150,
  "carbs": 50,
  "fat": 160,
  "diet_plan": "low_carb",
  "fasting": "16_8",
  "eating_window_start": "12:00",
  "eating_window_end": "20:00",
  "is_custom": true,
  "suggested": {
    "calories": 2510,
    "protein": 140,
    "carbs": 50,
    "fat": 194
  },
  "limits": {
    "calories": { "min": 1500, "max": 2200 },
    "protein": { "min": 150, "max": null },
    "carbs": { "min": null, "max": 50 },
    "fat": { "min": null, "max": 160 }
  }
}

Food

Macros are per serving. is_custom is true for the user's own foods, which they can delete.

Food
{
  "id": 1,
  "name": "White rice, cooked",
  "brand": null,
  "serving_label": "1 cup (158 g)",
  "calories": 205,
  "protein": 4.3,
  "carbs": 44.5,
  "fiber": 0.6,
  "net_carbs": 43.9,
  "fat": 0.4,
  "is_custom": false
}

Food entry

Calories and macros are totals for the servings eaten (per serving × servings). The name and macros were copied when it was logged, so they don't change if the food does. food_id is null for a quick add, or once the food is deleted.

Food entry
{
  "id": 512,
  "food_id": 1,
  "name": "White rice, cooked",
  "serving_label": "1 cup (158 g)",
  "servings": 1.5,
  "meal": "lunch",
  "eaten_on": "2026-10-12",
  "calories": 308,
  "protein": 6.5,
  "carbs": 66.8,
  "fiber": 0.9,
  "net_carbs": 65.9,
  "fat": 0.6,
  "created_at": "2026-10-12T04:31:09+00:00"
}