n8n-nodes-justgains
v0.2.0
Published
n8n node for the JustGains REST API: manage workouts, food, bodyweight and training history
Maintainers
Readme
n8n-nodes-justgains
This is an n8n community node. It lets you use JustGains in your n8n workflows.
JustGains is a training app for lifting, running, food logging and bodyweight tracking. This node calls the JustGains REST API at https://justgains.com/api-proxy/. Workflows can save workout templates, log food and weigh-ins, and read training history and analytics.
n8n is a fair-code licensed workflow automation platform.
Installation · Credentials · Operations · Usage · Example workflows · Compatibility · Resources · Version history
Installation
In n8n, open Settings > Community Nodes, select Install, enter n8n-nodes-justgains and confirm.
For other ways to install, follow the installation guide in the n8n community nodes documentation.
Credentials
The node signs in with a personal API key.
- Sign in at justgains.com and open your profile.
- Select Settings, scroll to API Keys, give the key a name (for example
n8n) and select Create key. - Copy the key. It starts with
jg_and is shown only once. - In n8n, create a JustGains API credential and paste the key into API Key. Leave Base URL as
https://justgains.com.
A key acts as you: it can read and change your JustGains data. Keep it private. To cut off an automation, revoke its key in the same API Keys section; anything using it loses access within an hour.
How it works: n8n exchanges the key for a short-lived access token and exchanges it again whenever the token expires, so the key itself is only ever sent to JustGains to start a session.
Operations
| Resource | Operation | What it does | | --- | --- | --- | | Workout | Generate | Generate and save a workout from a plain-language request ("30 minute leg workout with dumbbells") | | Workout | Create | Save a workout template with typed exercise codes, sets and measurements | | Workout | Get | Get a workout with its exercises and sets | | Workout | Update | Change a workout's title, description or exercises | | Workout Log | Get Many | Get workout logs with exercise data, filtered by completion date or program | | Workout Log | Get Recent | Get recent workouts with their totals (duration, volume, sets, reps) | | Exercise | Search | Search the exercise library by name, muscle group or equipment | | Exercise | Get | Get an exercise's instructions, equipment and muscles worked | | Exercise | Get History | Get your recorded sessions for one exercise | | Program | Search | Search your programs or a creator's public programs | | Program | Get | Get a program with its weeks and days | | Program | Get Enrolled | Get the programs you follow and your progress | | Program | Create | Create a draft program with a title, description and starter week | | Program | Update Enrollment | Start, complete or abandon a program | | Food | Log | Log one catalog food or a quick-add portion with explicit macros | | Food | Remove | Remove a diary entry by ID | | Food | Get Diary | Get a day of your food diary with totals and targets | | Food | Search | Search the food catalog | | Bodyweight | Log | Record a weigh-in in pounds or kilograms | | Bodyweight | Get History | Get weigh-ins filtered by recording date | | Route | Create | Plan a run, ride, walk or hike route and save it to your Routes | | Profile | Get | Get your profile, units, timezone, goals and body details | | Profile | Update | Change profile fields | | Insight | Get Dashboard | Lifetime totals, movement streaks, top exercises and this week compared with last week | | Insight | Get Heatmap | Daily activity counts for a calendar year | | Insight | Get Recovery | Weekly set targets and recovery for each muscle group |
Usage
Units. Bodyweight > Log accepts pounds or kilograms. Route > Create accepts miles or kilometers. Both unit selectors are required. Workout measurement targets use the REST API's canonical units: kilograms for weight, meters for distance and seconds for duration. Reps and RPE are numbers.
Lists. Search, workout log lists, exercise history, bodyweight history and program enrollments return one n8n item per result. Enable Return All to retrieve every result. Otherwise, Limit controls the total number of results. The node follows API pages internally, including when the API caps its page size below your limit. Other operations return a single item containing the native REST result.
Workout inputs. Add exercises by their exact code from Exercise > Search. Add sets, then select each measurement and its numeric target. Workout > Update reads the existing template before applying changes, so a title-only update preserves the exercises. Enable Replace Exercises to replace the complete list.
Food inputs and retries. Food > Log takes one diary entry per input item. Choose Catalog and provide a foodItemId from Search, or choose Quick Add and enter the whole portion's calories, protein, carbohydrates and fat. Set the diary date, meal and quantity in grams. The node sends a stable diaryEntryId on retries within the same execution. Supply Diary Entry ID in Additional Fields when multiple executions should update the same entry. Food > Remove takes the exact entry ID returned by Log or Get Diary.
AI agents. Attach the node to an n8n AI Agent as a tool. Each operation exposes typed fields. For example, use Insight > Get Dashboard for a training recap, or Food > Log with explicit portion macros for a quick-add diary entry.
REST endpoints
Authentication uses POST /auth/api-key-session; the credential test uses GET /user. All paths below are relative to /api-proxy.
| Resource | Endpoints |
| --- | --- |
| Bodyweight | GET/POST /creator-profiles/me/weight-log |
| Exercise | GET /exercises, GET /exercises/{code}, GET /exercises/{code}/history/me |
| Food | GET /foods/search, GET /creator-profiles/me/nutrition/diary/day, POST /creator-profiles/me/nutrition/diary, DELETE /creator-profiles/me/nutrition/diary/{id} |
| Insight | GET /creator-profiles/me/analytics/dashboard, GET /creator-profiles/me/analytics/heatmap, GET /user/analytics/recovery |
| Profile | GET/PATCH /user |
| Program | GET/POST /workout-programs, GET /workout-programs/{id}, GET /user/program-progress, POST /workout-programs/{id}/{start,complete,abandon} |
| Route | POST /routes/generate, then POST /routes to save the returned geometry |
| Workout | POST /workouts, GET/PUT /workouts/{id}, POST /workout-logs/generate with workoutType: Template |
| Workout Log | GET /workout-logs |
The node uses n8n's authenticated HTTP helper for every operation. Programmatic execution handles pagination and dependent requests, such as reading a workout before updating it and planning a route before saving it.
Migrating from 0.1.x
Version 0.2.0 introduces node version 2 with 26 REST operations. Replace existing JustGains steps with new version 2 nodes and reselect their fields. Existing API-key credentials work with this release.
- Workout Create and Update use typed exercise/set/measurement collections in place of the previous JSON lists. Use exact exercise codes and canonical measurement units.
- Program Create creates a draft through the REST API. Plain-text program generation is no longer an operation.
- Food Log saves one typed catalog or quick-add entry per input item. Remove takes one diary entry ID. The previous JSON meal arrays,
requestId, automatic food matching andexpectedUpdatedAtfields are no longer used. - Exercise Get History returns individual sessions. Use Completed After for its REST date filter. Page, Sessions Per Page and the previous Before filter have been removed.
- Program Search uses Creator Profile ID to browse a creator's public programs; leaving it empty searches your own programs. Workout Log filters use Completed After, Completed Before and Program ID. Manual Page, Rank By and Top N fields have been removed.
- Insight Get Dashboard replaces Get Week Summary, Get Consistency, Compare Weeks and Exercise Get Top with the API's current dashboard data. Get Heatmap provides annual activity counts. The previous custom date-window Get Progress action has been removed. Recovery returns current REST analytics.
- Bodyweight Get History returns individual entries. Use Return All or Limit to control their count.
Example workflows
- Weekly recap to Slack or email: Schedule Trigger (Monday 8:00) → JustGains Insight: Get Dashboard → Slack Send Message.
- Smart scale weigh-ins: Webhook from your scale → JustGains Bodyweight: Log with the weight from the webhook body.
- Meal logging from chat: Telegram Trigger → AI Agent with the JustGains node as a tool → the agent logs the meal with Food: Log and replies with the day's totals.
- Program drafts from a coach's sheet: Google Sheets trigger → JustGains Program: Create with the program title and description.
Compatibility
Built with @n8n/node-cli 0.54. Node version 2 uses the JustGains REST API and has no runtime dependencies. Run bun run test for regression tests, bun run lint for n8n verification rules, and bun run build to compile the package. The release workflow runs the tests before publishing with npm provenance.
Resources
Version history
0.2.0
Native REST operations, typed parameters, automatic Return All/Limit pagination, and required bodyweight and route units. See the migration notes above for changes from 0.1.x.
0.1.2
Food > Log saves every distinct meal an AI agent logs in one run; retries of the same meal are still saved once.
0.1.1
Limit parameters default to 50, as in other n8n nodes.
0.1.0
First release: the JustGains API credential and the JustGains node with 29 operations across workouts, workout logs, exercises, programs, food, bodyweight, routes, profile and insights.
