Sign In

Syncing Data

Learn how to sync activities, wellness metrics, and nutrition logs to Coach Watts.

This guide explains how to sync third-party data—including activities, wellness metrics, and nutrition logs—to Coach Watts via our OAuth 2.0 API.

Core Scopes

To write data, your application must request the following scopes during the authorization flow:

ScopeResourceAccess Provided
workout:writeActivitiesUpload .FIT files and manage workouts.
health:writeWellnessLog daily metrics like HRV, Sleep, and Weight.
nutrition:writeNutritionLog calories, macros, and individual meal items.
profile:writeProfileUpdate core athlete metrics (Weight, FTP).

1. Activities (FIT Files)

Coach Watts is built to process high-resolution training data. We recommend uploading original .fit files whenever possible.

  • Endpoint: POST /api/workouts/upload-fit
  • Content-Type: multipart/form-data

Example (cURL)

curl -X POST https://app.coachwatts.com/api/workouts/upload-fit
  -H "Authorization: Bearer YOUR_TOKEN"
  -F "[email protected]"
  -F "name=Sunday Endurance Ride"
  -F "metadata={"app_version": "1.2.0", "device_id": "XYZ-99"}"

2. Wellness Metrics

Use this endpoint to sync daily health indicators. Coach Watts uses these to adjust the athlete's recovery capacity scores.

  • Endpoint: POST /api/wellness
  • Content-Type: application/json

Payload Schema (Partial)

FieldTypeDescription
dateStringRequired. YYYY-MM-DD or ISO 8601.
hrvNumberHeart Rate Variability (ms).
restingHrIntegerResting Heart Rate (bpm).
sleepSecsIntegerTotal sleep duration in seconds.
weightNumberBody weight in kilograms (kg).
vo2maxNumberEstimated VO2 Max.
rawJsonObject(Optional) Your raw payload for historical reference.

3. Nutrition & Fueling

Nutrition sync is critical for our Metabolic Wave engine. We use exact timestamps to calculate glycogen availability for future workouts.

  • Endpoint: POST /api/nutrition
  • Content-Type: application/json

Example Payload

{
  "date": "2026-02-15",
  "items": [
    {
      "name": "Pre-Ride Gel",
      "carbs": 25,
      "logged_at": "2026-02-15T06:00:00Z",
      "absorptionType": "RAPID"
    }
  ],
  "rawJson": { "original_app": "MyFitnessPal" }
}

General Principles

Idempotency

All sync endpoints use an upsert logic based on the date (for wellness/nutrition) or hash (for files). Sending the same data multiple times will update the existing record rather than creating duplicates.

Timezones

Always send timestamps in ISO 8601 with timezone offsets (e.g., 2026-02-15T08:00:00+01:00). For daily aggregates (the date field), use the user's local calendar date.

Back to Index