NutriGym API
A small read-only API for pulling your NutriGym data into other tools. All endpoints below are versioned under /api/v1 and require an API key.
Authentication
Generate a key from Settings in the app. Send it on every request as a bearer token in the Authorization header:
Authorization: Bearer <your_api_key>Generating a new key revokes any previous key for your account. Requests with a missing or invalid key receive a 401 response.
Response Shape
Every endpoint returns the same envelope:
{
"ok": boolean,
"message": string,
"data": T | null
}Endpoints
/api/v1/weightReturns your logged weight entries over a trailing window of days, oldest first.
Query Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| days | integer | No | Number of trailing days to include. 1–365, defaults to 28. |
Example Request
curl "https://nutrigym.softwarerror.com/api/v1/weight?days=7" \
-H "Authorization: Bearer <your_api_key>"Example Response
{
"ok": true,
"message": "Successfully retrieved weight.",
"data": [
{ "date": "2026-07-04", "weight": 181.2 },
{ "date": "2026-07-06", "weight": 180.8 },
{ "date": "2026-07-11", "weight": 180.1 }
]
}/api/v1/macrosReturns your current active macro goals.
Example Request
curl "https://nutrigym.softwarerror.com/api/v1/macros" \
-H "Authorization: Bearer <your_api_key>"Example Response
{
"ok": true,
"message": "Successfully retrieved macro goals.",
"data": {
"calories": 2400,
"protein": 180,
"carbs": 250,
"fat": 70
}
}/api/v1/macros/trackedReturns your logged (tracked) macros for the trailing 7-day window ending on the given date, oldest first.
Query Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| date | string (YYYY-MM-DD) | No | Anchor date for the 7-day window. Defaults to today (UTC). |
Example Request
curl "https://nutrigym.softwarerror.com/api/v1/macros/tracked?date=2026-07-11" \
-H "Authorization: Bearer <your_api_key>"Example Response
{
"ok": true,
"message": "Successfully retrieved tracked macros.",
"data": [
{ "date": "Sat", "protein": 142, "carbs": 210, "fat": 61 },
{ "date": "Sun", "protein": 155, "carbs": 198, "fat": 58 },
{ "date": "Mon", "protein": 130, "carbs": 220, "fat": 65 },
{ "date": "Tue", "protein": 148, "carbs": 205, "fat": 60 },
{ "date": "Wed", "protein": 160, "carbs": 190, "fat": 55 },
{ "date": "Thu", "protein": 138, "carbs": 215, "fat": 63 },
{ "date": "Fri", "protein": 150, "carbs": 200, "fat": 59 }
]
}/api/v1/workoutsReturns your finished workouts started within a trailing window of days, newest first, with every exercise and set. Weights are in lb, distances in miles, durations in seconds. Warm-up sets are flagged with is_warmup. Exercises that track time or distance leave weight and reps null. superset_with_next is true when an exercise was performed back to back with the next exercise by position; a run of linked exercises forms one superset.
Query Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| days | integer | No | Number of trailing days to include. 1–365, defaults to 28. |
Example Request
curl "https://nutrigym.softwarerror.com/api/v1/workouts?days=7" \
-H "Authorization: Bearer <your_api_key>"Example Response
{
"ok": true,
"message": "Successfully retrieved workouts.",
"data": [
{
"id": 42,
"template_id": 3,
"name": "Push Day A",
"notes": null,
"started_at": "2026-07-11T17:02:11.000Z",
"ended_at": "2026-07-11T18:04:40.000Z",
"exercises": [
{
"id": 118,
"exercise_id": 1,
"exercise_name": "Barbell Bench Press",
"muscle_group": "chest",
"equipment": "barbell",
"tracking_type": "WEIGHT_REPS",
"position": 0,
"target_sets": 3,
"target_reps": 8,
"target_weight": 185,
"target_duration_seconds": null,
"superset_with_next": false,
"sets": [
{
"id": 901,
"session_exercise_id": 118,
"set_number": 1,
"weight": 185,
"reps": 8,
"duration_seconds": null,
"distance": null,
"is_warmup": false,
"created_at": "2026-07-11T17:08:52.000Z"
}
]
}
]
}
]
}Errors
A missing or invalid API key returns:
{
"ok": false,
"message": "Invalid or missing API key.",
"data": null
}