diff --git a/engine-constants-allowlist.txt b/engine-constants-allowlist.txt index 6d3e37e..ee3d67f 100644 --- a/engine-constants-allowlist.txt +++ b/engine-constants-allowlist.txt @@ -19,6 +19,7 @@ rate-adjacent guides/safety.mdx 1500 mL/hr response field: max_safe_fluid_ml_per rate-adjacent guides/safety.mdx 3000 mg/hr response field: max_safe_sodium_mg_per_hr, same block, same reasoning nutrient-ceiling guides/safety.mdx 50 request bound: carb_upper_limit_override below 50 is refused with 400 out_of_range, so a caller must respect it nutrient-ceiling guides/safety.mdx 150 request bound: carb_upper_limit_override above 150 is refused with 400 out_of_range, so a caller must respect it +nutrient-ceiling guides/safety.mdx 10 request bound: a carb_upper_limit_override off its steps of 10 is refused with 400 out_of_range, so a caller must respect it rate-adjacent guides/safety.mdx 150 g/hr the same request bound, with its unit nutrient-ceiling guides/safety.mdx 1500 response field: the fluid advisory threshold again, on the line that states the warning it triggers rate-adjacent guides/athletes.mdx 150 g/hr request bound: carb_upper_limit_override is set BY the caller and rejected with a 400 outside its range, so a partner who does not know the range cannot debug the rejection diff --git a/error-handling.mdx b/error-handling.mdx index a75efa5..4c1f944 100644 --- a/error-handling.mdx +++ b/error-handling.mdx @@ -166,4 +166,4 @@ Every response carries an `X-Request-ID` header, and every error body repeats it ### Error catalog -`GET /v1/errors` (no auth) lists the error codes, leaving out features in STEALTH. +`GET /v1/errors` (no auth) lists the error codes, leaving out features in STEALTH. Each entry's `retryable` says whether you may retry the same call automatically after `Retry-After`: it is `false` for the daily ceilings, which clear only at midnight UTC. A code that appears only on one item of a batch, such as `missing_identifier`, is listed with the status a single request would get. diff --git a/guides/athletes.mdx b/guides/athletes.mdx index 968fe55..cc09d74 100644 --- a/guides/athletes.mdx +++ b/guides/athletes.mdx @@ -100,21 +100,21 @@ Saturday sets `id`, `partner_id`, `created_at`, `updated_at`, `profile_complete` ### Settings: the fueling profile -`settings` holds the fields the engine reads. The 1-9 scales are odd-point selectors, not continuous sliders: send 1, 3, 5, 7, or 9. +`settings` holds the fields the engine reads. The 1-9 scales take only the levels the Saturday app stores: `sweat_level`, `satiety_level` and `fitness_level` take 1, 3, 5, 7 or 9, and `saltiness` takes 1, 5 or 9. `carb_upper_limit_override` takes 50 to 150 g/hr in steps of 10, as the app's Max Carbs slider does, so your athletes get the same answers as members of the app. | Field | Type | Values | Safety-core | |-------|------|--------|-------------| -| `sweat_level` | integer | 1 (light) to 9 (heavy), default 5 | Yes | -| `saltiness` | integer | 1 (not salty) to 9 (very salty), default 5 | Yes | +| `sweat_level` | integer | 1, 3, 5, 7 or 9: 1 light to 9 heavy, default 5 | Yes | +| `saltiness` | integer | 1, 5 or 9: 1 not very salty, 5 somewhat salty, 9 very salty, default 5 | Yes | | `carb_experience` | string | `range_0_30`, `range_40_60`, `range_gt_70` | Yes | | `usual_carb_consumption` | string | `range_lt_60`, `range_60_80`, `range_80_100`, `range_gt_100` | Yes | -| `satiety_level` | integer | 1 (mostly whole food) to 9 (high-octane fuel), default 5 | No | -| `fitness_level` | integer | 1 (beginner) to 9 (elite), default 5 | No | -| `carb_upper_limit_override` | integer | 50 to 150 g/hr, default 150 | No | +| `satiety_level` | integer | 1, 3, 5, 7 or 9: 1 mostly whole food to 9 high-octane fuel, default 5 | No | +| `fitness_level` | integer | 1, 3, 5, 7 or 9: 1 complete novice to 9 elite, default 5 | No | +| `carb_upper_limit_override` | integer | 50 to 150 g/hr in steps of 10, default 150 | No | `carb_experience` is the most carbohydrate per hour the athlete has ever fueled with; `usual_carb_consumption` is what they typically take. Both are stored as range tokens rather than numbers, because a range is what an athlete can answer without guessing. -On create, on update and on `PATCH /v1/athletes/{id}/settings`, a scale outside 1 to 9, a token outside its list, or a `sex` outside the three values is refused with a `400` of code `invalid_value`, naming the field in `param` and the accepted values in the message. Nothing in that request is saved. +On create, on update and on `PATCH /v1/athletes/{id}/settings`, a `sweat_level`, `satiety_level` or `fitness_level` other than 1, 3, 5, 7 or 9, a `saltiness` other than 1, 5 or 9, a token outside its list, or a `sex` outside the three values is refused with a `400` of code `invalid_value`, naming the field in `param` and the accepted values in the message. Nothing in that request is saved. ### Fueling concerns @@ -195,7 +195,7 @@ The settings object is written as a unit. Send the athlete's complete settings o The same replacement rule applies if you send a `settings` object through `PATCH /v1/athletes/{id}`. -On create, on update and on calculate, Saturday rejects `carb_upper_limit_override` outside 50-150 g/hr and `weight_kg` outside 20-250 with a `400` of code `out_of_range` rather than clamping, so a bad value in your data surfaces at the boundary instead of distorting a prescription. Batch create reports the same code per item. +On create, on update and on calculate, Saturday rejects a `carb_upper_limit_override` that is not 50 to 150 g/hr in steps of 10 and `weight_kg` outside 20-250 with a `400` of code `out_of_range` rather than clamping, so a bad value in your data surfaces at the boundary instead of distorting a prescription. Batch create reports the same code per item. Saturday is for athletes 14 and up. On create and on update, a `year_of_birth` that makes the athlete younger than 14 (the current year minus the birth year) is refused with a `400` of code `under_minimum_age` and param `year_of_birth`, and nothing in that request is saved. The message names the minimum age: @@ -254,6 +254,6 @@ Fetch the global settings schema to build dynamic forms: GET /v1/settings/schema ``` -Returns each field's type, valid range or option list, description, and default, so a settings UI does not have to hardcode Saturday's requirements. This is a global schema, identical for every athlete; fetch one athlete's current values with `GET /v1/athletes/{id}/settings`. The schema lists the editable fields; a stored settings object can also carry `concerns_answered`, which sending any concern field sets, so keep it when you write a settings object back. +Returns each field's type, valid range or option list, description, and default, so a settings UI does not have to hardcode Saturday's requirements. `values` lists the only numbers a scale takes (`[1, 3, 5, 7, 9]`, or `[1, 5, 9]` for `saltiness`), and `step` is the spacing of `carb_upper_limit_override` (10). This is a global schema, identical for every athlete; fetch one athlete's current values with `GET /v1/athletes/{id}/settings`. The schema lists the editable fields; a stored settings object can also carry `concerns_answered`, which sending any concern field sets, so keep it when you write a settings object back. For collecting the profile from scratch rather than editing it, `GET /v1/onboarding/questions` returns the same fields as athlete-facing questions with copy, ordering, and answer values. See [Athlete Onboarding](/guides/onboarding). diff --git a/guides/nutrition-calculation.mdx b/guides/nutrition-calculation.mdx index c24e98f..53c4311 100644 --- a/guides/nutrition-calculation.mdx +++ b/guides/nutrition-calculation.mdx @@ -120,7 +120,7 @@ The two lists name inputs only and come with a partner API key on every tier, te An `athlete_id` your account does not hold is refused with `404` and code `athlete_not_found`; leave `athlete_id` out for a range estimate. -Profile fields, at the top level of the request, stand in for a stored athlete or override one stored answer for that call: `sex` (`male`, `female` or `intersex`), `age` (years), `athlete_weight_kg` (20 to 250), `sweat_level`, `saltiness`, `satiety_level` and `fitness_level` (1, 3, 5, 7 or 9), `carb_experience` and `usual_carb_consumption` (the values in [Settings: the fueling profile](/guides/athletes#settings-the-fueling-profile)), `carb_upper_limit_override` (50 to 150 g/hr), and `concerns`, one object of the eight flags `performance`, `gut_distress`, `heat_tolerance`, `muscle_cramps`, `faintness`, `hunger`, `thirst` and `drinking_resistance`. +Profile fields, at the top level of the request, stand in for a stored athlete or override one stored answer for that call: `sex` (`male`, `female` or `intersex`), `age` (years), `athlete_weight_kg` (20 to 250), `sweat_level`, `satiety_level` and `fitness_level` (1, 3, 5, 7 or 9), `saltiness` (1, 5 or 9), `carb_experience` and `usual_carb_consumption` (the values in [Settings: the fueling profile](/guides/athletes#settings-the-fueling-profile)), `carb_upper_limit_override` (50 to 150 g/hr in steps of 10), and `concerns`, one object of the eight flags `performance`, `gut_distress`, `heat_tolerance`, `muscle_cramps`, `faintness`, `hunger`, `thirst` and `drinking_resistance`. The request may carry only the fields on this page. Any other field, at any depth, is refused with `400` and code `unsupported_field`, `param` naming it, and the message naming the field it was probably meant to be: `meal_before_mins` answers `Did you mean "meal_before_min"?`. A field spelled the way the athlete or activity request spells it gets that request's spelling: `weight_kg` (send `athlete_weight_kg`), `year_of_birth` (send `age`), `is_race_event` (send `is_race`), `type` (send `activity_type`), `duration` (send `duration_min`) and `settings` (send the profile fields at the top level, or an `athlete_id`). See [Error Handling](/error-handling#a-field-the-request-does-not-take). diff --git a/guides/safety.mdx b/guides/safety.mdx index 0283228..5cb41ea 100644 --- a/guides/safety.mdx +++ b/guides/safety.mdx @@ -98,8 +98,9 @@ Send values inside these ranges. When the API refuses a value, the error names t | `meal_before_min` | Minutes since the last carb-rich meal; over 180 is a fasted start | | `athlete_weight_kg` | 20 to 250 | | `age` | 1 to 120 | -| `sweat_level`, `saltiness`, `satiety_level`, `fitness_level` | 1 to 9 | -| `carb_upper_limit_override` | 50 to 150 g/hr, a ceiling the athlete sets on their carbohydrate | +| `sweat_level`, `satiety_level`, `fitness_level` | 1, 3, 5, 7 or 9 | +| `saltiness` | 1, 5 or 9 | +| `carb_upper_limit_override` | 50 to 150 g/hr in steps of 10, a ceiling the athlete sets on their carbohydrate | ### Reading the answer