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
GET
/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 }
]
}GET
/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
}
}GET
/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 }
]
}Errors
A missing or invalid API key returns:
{
"ok": false,
"message": "Invalid or missing API key.",
"data": null
}