API Reference

Input Format

Settings schema, data format, and all configuration options.

The request body is a JSON object with three fields: settings, data, and memory. All are stringified JSON strings.

Settings

FieldTypeDefaultDescription
fixedSpeedbooleanrequiredtrue for treadmill/fixed-pace tests, false for variable-speed activities
speedfloatSpeed in m/s (required if fixedSpeed: true)
fitbooleanfalseWhether to fit E, Vmax, P from the data
returnPredictionbooleanfalseInclude predicted HR array in result
returnStatsbooleanfalseInclude derived metrics (energy, recovery, zones, etc.)
returnErrorsbooleanfalseInclude memory error surface

Parameter constraints (when fit: true)

FieldTypeDefaultDescription
Econstraints[min, max, step][0.01, 0.99, 0.01]Endurance search range
V5constraints[min, max, step][3.0, 12.0, 0.07]Internal speed parameter range (m/s). Affects Vmax output.
Pconstraints[min, max, step][140, 220, 1.0]HRmax search range (bpm)

Fixed parameters (when fit: false)

FieldTypeDefaultDescription
Efloat0.5Endurance (0–1)
Vmaxfloat6.2Maximum speed (m/s)
Pfloat180HRmax (bpm)

Demographics (for derived stats)

Required when returnStats: true.

FieldTypeDefaultDescription
weightfloat75Body mass (kg)
heightfloat175Height (cm)
ageint30Age (years)
genderstring"male""male" or "female"

Sport mode

FieldTypeDefaultDescription
sportstring"running""running", "cycling", or "team_sports"
squadMeanEfloatSquad average E (for team archetype classification)
squadMeanVmaxfloatSquad average Vmax in m/s
measuredRHRfloatMeasured resting HR in bpm (for RZI calculation)

Data

An array of timestamped objects. Required fields: time and hr.

FieldTypeRequiredDescription
timefloatYesSeconds from start
hrfloatYesHeart rate (bpm)
speedfloatRequired for variable-speedSpeed (m/s). Required if fixedSpeed: false.

Example

[
  {"time": 0, "hr": 80, "speed": 2.5},
  {"time": 1, "hr": 82, "speed": 2.5},
  {"time": 6, "hr": 91, "speed": 2.6}
]

Data requirements

  • Minimum: ~60 samples for basic fitting, 300+ for reliable results
  • Sample rate: 1 Hz down to once every 6 seconds. Timestamps don't need to be consecutive.
  • Session length: no hard limit — marathons, multi-hour rides, full matches are all supported
  • Speed: in m/s. For cycling, power/100 can be used as a speed proxy.

Memory

The memory field contains the Bayesian prior from previous sessions. Always pass memory between sessions for the same individual — parameter estimates improve significantly with each session, and without prior data the SDK returns single-session fits which may not have fully converged.

For the first session with a new user, omit the memory field. The SDK will initialize a new memory and return it in the response. Store it and pass it back for every subsequent session.

{
  "settings": "...",
  "data": "...",
  "memory": "{\"secsSinceEpoch\":1712000000,\"confidence\":3.5,\"minKey\":\"18504265\",\"keys\":[...],\"errorsX1000\":[...]}"
}

For the first session (no prior data), omit the memory field. The SDK will initialize a new memory and return it in the response.

See Bayesian Memory for details on the memory format, key encoding, and confidence decay.