Apple Health setup
Post workouts from Apple Watch to Second Line via an iOS Shortcut. Not Strava — direct HealthKit → your server.
Endpoint: https://coach.wagner.band/api/health/workout
Method: POST · JSON body · Authorization: Bearer <Google ID token>
-
Open Shortcuts on iPhone
Install the Shortcuts app if needed. You will run this after each workout (or automate it).
-
Create shortcut: “Second Line Workout”
Add actions in order:
- Find Workouts — filter: most recent, workout type Run (or All)
- Get Details of Workout — start date, duration, distance, heart rate (optional)
- Get Contents of URL — POST to endpoint above
-
Build JSON body
Use Text action with placeholders, then pass to URL action as Request Body (JSON).
-
Set headers
Content-Type: application/jsonAuthorization: Bearer YOUR_ID_TOKEN
Copy your token from this app after Google Sign-In (index page), or use a stored Shortcut variable.
-
Automation (optional)
Shortcuts → Automation → Workout → When workout ends → Run “Second Line Workout”.
-
Verify
Finish a short walk/run on Watch. Check Today page — RUN status should update when the API ingests the workout.
Sample JSON payload
{
"workout_type": "Running",
"start_time": "2026-10-20T07:00:00Z",
"duration_seconds": 1500,
"distance_meters": 3218.0,
"avg_heart_rate": 142,
"source": "apple_health"
}
Field reference
workout_type- Run, Walk, etc. (from Health)
start_time- ISO 8601 UTC, e.g. 2025-06-23T06:15:00Z
duration_sec- Moving time in seconds
distance_m- Distance in meters (optional for off days)
sourceapple_health_shortcutheart_rate_avg- Optional average BPM
Sign in to save
Browsing works without signing in. One Google sign-in keeps your session on this device for 30 days.