---
title: "Estimate the altitude the athlete is at today, and whether to propose it"
method: POST
path: "/training/today-altitude/estimate"
tags: ["Today"]
---

# Estimate the altitude the athlete is at today, and whether to propose it

`POST /training/today-altitude/estimate`

## Request

- Base URL: `https://bodylab.lol/api/v1`
- URL: `https://bodylab.lol/api/v1/training/today-altitude/estimate`
- Auth: HTTP bearer

Send the device's or browser's location, or null to use the connection's (when the server can locate one). The location is used for this request only and is never stored or logged. Changes nothing: confirm with PUT /training/today-altitude.

## Headers

- `X-Client-Platform` string
- `X-Client-Version` string

## Request body

- object
  - `location` object, nullable
    - `latitude` number, required
    - `longitude` number, required
    - `horizontalAccuracyM` number, required: How far off the position may be, metres (Core Location's horizontalAccuracy, the Geolocation API's accuracy).
    - `altitudeM` number, nullable: The device's measured altitude, metres above sea level, if it gave one.
    - `verticalAccuracyM` number, nullable: Core Location's verticalAccuracy; zero or negative marks the altitude invalid.
    - `locatedBy` 'device' | 'browser', required

## Response `200`

OK

- object
  - `outcome` string, required: propose: worth asking the athlete (see estimate). already_confirmed: an altitude is already set for today. no_location: no location was sent and none could be found for the connection. too_coarse: the location is too rough to say. ip_disagrees_with_recordings: the connection's location contradicts where recent recordings started. no_reference: no home altitude or recent recordings to compare with. no_elevation: no altitude could be found for the location. no_difference: within 300 m of what today's targets already assume. too_uncertain: the location could be close enough to that altitude. no_power_targets: today has no watt targets for altitude to change. no_effect: different, but not enough to change a watt target. Known values: propose, already_confirmed, no_location, too_coarse, ip_disagrees_with_recordings, no_reference, no_elevation, no_difference, too_uncertain, no_power_targets, no_effect. Treat unknown values as "other".
  - `estimate` object, nullable, required: Null when no altitude was worked out.
    - `altitudeM` integer, required: The best single altitude, metres, rounded to 10. What confirming sets.
    - `lowM` number, required: The lowest altitude the athlete could plausibly be at, given how rough the location is.
    - `highM` number, required: The highest.
    - `source` string, required: How the altitude was worked out: device_altitude (the phone measured it), recordings (the athlete's own activities that started near where they are), elevation_data (a terrain model at their rough location), entered (typed in). Known values: device_altitude, recordings, elevation_data, entered. Treat unknown values as "other".
    - `locatedBy` string, required: What located the athlete. Known values: device, browser, ip. Treat unknown values as "other".
  - `current` object, nullable, required: What today's targets assume without a confirmation.
    - `altitudeM` integer, required
    - `basis` string, required: home, or recent_recordings when the last two days' recordings put the athlete elsewhere. Known values: home, recent_recordings. Treat unknown values as "other".
  - `homeAltitudeM` integer, nullable, required

## Other responses

- `401`: Error: UNAUTHORIZED.

---

[API](https://skmtc.dev/bodylab/apis/body-lab-api.md) · [All operations](https://skmtc.dev/bodylab/apis/body-lab-api/llms.txt) · [OpenAPI document](https://skmtc.dev/bodylab/apis/body-lab-api/revisions/544c201eaf88?raw)
