API usage

The new API v2 provides improved pagination, consistent snake_case JSON fields, and better error handling.

Base URL: /api/v2

Key features:

See API v2 documentation for detailed endpoint documentation and examples.

API v1 (Legacy)

The original API v1 is still available and fully functional at /api/v1.

The API is documented using swagger.

Authentication

You must enable API access for your user, and copy the API key. You can use the API key as a query parameter (?api-key=${API_KEY}) or as a header (Authorization: Bearer ${API_KEY}).

You can configure some tools to automatically upload files to Workout Tracker, using the POST /api/v1/import/$program API endpoint.

Daily measurements

You can set or update a daily measurement record:

curl -sSL -H "Authorization: bearer your-api-key" \
  http://localhost:8080/api/v1/daily \
  --data @- <<EOF
{
  "date": "2025-01-13",
  "weight": 70,
  "weight_unit": "kg",
  "height": 178,
  "height_unit": "cm"
}
EOF

Workouts

Manual creation

You can create a workout manually:

curl -sSL -H "Authorization: bearer your-api-key" \
  http://localhost:8080/api/v1/workouts \
  --data @- <<EOF
{
  "name": "Workout name",
  "date": "2025-02-03T10:26",
  "duration_hours": 1,
  "duration_minutes": 10,
  "distance": 13,
  "type": "running"
}
EOF

Generic upload of a file

The generic upload endpoint takes the recording as body. Prepend the path with @ to tell curl to read the data from a file:

curl -sSL -H "Authorization: bearer your-api-key" \
  http://localhost:8080/api/v1/import/generic \
  --data @path/to/recorded.gpx

FitoTrack automatic GPX export

Read their documentation before you continue.

The path to POST to is: /api/v1/import/fitotrack?api-key=${API_KEY}