SWF

Structured Workout Format

A JSON format for structured endurance workouts. Define a workout once, export to Garmin, Intervals.icu, or other platforms.

An SWF document describes a workout as a tree of content blocks. There are four types:

Intensity values can be absolute (250), a percentage of a parameter ({"percent": 88, "of": "ftp"}), or based on time-to-exhaustion ({"tte": 300}). Three shapes: constant, range, and ramp.

{
  "sport": "cycling",
  "title": "Sweet Spot 2x20",
  "content": [
    {
      "type": "repeat",
      "count": 2,
      "content": [
        {
          "type": "step",
          "volume": { "type": "constant", "quantity": "duration", "value": 1200 },
          "intensity": {
            "type": "range", "quantity": "power",
            "min": { "percent": 88, "of": "ftp" },
            "max": { "percent": 93, "of": "ftp" }
          }
        },
        {
          "type": "step",
          "effort": "rest",
          "volume": { "type": "constant", "quantity": "duration", "value": 300 }
        }
      ]
    }
  ]
}
pip install structured-workouts

Validator

Paste SWF JSON to validate it against the JSON Schema. Or pick a conformance example to start from.

API

Validate programmatically by POSTing SWF JSON to /api/validate.

curl -s -X POST https://structuredworkoutformat.dev/api/validate \
  -H "Content-Type: application/json" \
  -d '{"sport": "cycling", "content": []}'

Returns:

{"valid": true}

If the document is invalid:

{
  "valid": false,
  "errors": [
    {
      "path": "",
      "message": "must have required property 'sport'"
    }
  ]
}