diff --git a/.env.production.example b/.env.production.example index 5843492102..0801ad0183 100644 --- a/.env.production.example +++ b/.env.production.example @@ -81,6 +81,12 @@ API_TOKEN_HMAC_KEY="" # Dawarich instance needs nothing here. # DAWARICH_PRIVATE_ORIGINS="" +# WebDAV / Nextcloud servers on your own network that the scheduled Health +# Connect fetch may reach, comma-separated exact origins (e.g. +# "https://cloud.lan"). Each entry is one scheme://host[:port], never a suffix +# or a range. A public server needs nothing here. +# HEALTH_CONNECT_WEBDAV_PRIVATE_ORIGINS="" + # ----------------------------------------------------------------------------- # Notification targets on a private network -- optional @@ -228,6 +234,20 @@ API_TOKEN_HMAC_KEY="" # APNS_PRODUCTION="" # "true" forces the production APNs gateway; normally derived from NODE_ENV +# ----------------------------------------------------------------------------- +# Push relay -- notifications to the App Store app without an Apple account +# ----------------------------------------------------------------------------- +# A server without its own APNs key can offer the HealthLog push relay to its +# users; the admin turns it on in Admin > Push and channels and each person +# opts in in the app. Content is sealed on this server for each device; the relay cannot +# read it. See docs/integrations/push-relay.md. All four are optional; +# PUSH_RELAY_URL and PUSH_RELAY_KEYS go together, for a relay of your own. +# PUSH_RELAY_MODE="" # "off" hides the relay entirely; default "allowed" (off until the admin turns it on) +# PUSH_RELAY_URL="" # https origin of another relay; default https://push.healthlog.dev +# PUSH_RELAY_KEYS="" # that relay's identity public keys (Ed25519, base64url, comma separated) +# PUSH_RELAY_LIVE_ACTIVITY="" # "on" allows Live Activity start/update over the relay (per-device consent); default off + + # ----------------------------------------------------------------------------- # SMTP -- email notification channel (optional, all-or-none) # ----------------------------------------------------------------------------- @@ -747,7 +767,8 @@ API_TOKEN_HMAC_KEY="" # Server-side prefetch -- diagnostics escape hatch # ----------------------------------------------------------------------------- # The dashboard, insights, coach and checkups pages prefetch their data on the -# server so the first paint arrives filled in. Set "false" to fall back to -# pure client fetching. Reach for it only when a prefetch is misbehaving on -# your host and you want to see whether the client path is healthy. +# server, and every signed-in page its account, so the first paint arrives +# filled in. Set "false" to fall back to pure client fetching. Reach for it +# only when a prefetch is misbehaving on your host and you want to see whether +# the client path is healthy. # DASHBOARD_SSR_PREFETCH="false" diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 59217031ed..1825de1afd 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -45,6 +45,21 @@ updates: # address bar and a step waits for the layer. Measured after both fixes: # 200 of 200 repeated runs of the three journeys, and another 80 of 80 # each for the `?doc=` and day-key journeys. + # The Dockerfile's `prisma-cli` stage installs from its own npm lockfile + # under docker/prisma-cli, which the root entry above never reads. Versions + # there move with the app's `prisma` and `dotenv` entries, and + # release-workflows.test.ts fails when they part, so a bump here usually + # arrives together with the matching root bump. + - package-ecosystem: "npm" + directory: "/docker/prisma-cli" + schedule: + interval: "weekly" + open-pull-requests-limit: 3 + groups: + prisma-cli-weekly: + update-types: + - "patch" + - "minor" - package-ecosystem: "github-actions" directory: "/" schedule: diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index e75beb9ee0..738e392f4b 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -12,7 +12,8 @@ name: Build & Publish Docker Image # the metadata-action (`type=raw,value=latest,...`) now keys on # the v* tag presence so each release still refreshes the `latest` # alias in the same run. PR + workflow_dispatch triggers stay so -# the image still builds on PR validation and manual reruns. +# the image still builds on PR validation and manual reruns. Pushes to +# `main` build the amd64 `:edge` image in edge-image.yml instead. on: push: tags: ["v*"] @@ -44,6 +45,8 @@ jobs: permissions: actions: read contents: read + outputs: + off_schedule: ${{ steps.calendar.outputs.off_schedule }} steps: - name: Checkout full history uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -88,6 +91,44 @@ jobs: echo "Release policy passed for $GITHUB_REF_NAME at $GITHUB_SHA." + # The release calendar (docs/contributing/release-policy.md). The + # push time comes from the event payload, so a re-run days later + # judges the tag by when it was pushed, not by when it was re-run. + # A tag outside the calendar needs an `Out of schedule:` line in its + # changelog section and sets off_schedule=true, which holds the + # build for the maintainer's approval below. + - name: Check release calendar + id: calendar + if: github.event_name != 'pull_request' + env: + TAG: ${{ github.ref_name }} + PUSHED_AT: ${{ github.event.repository.pushed_at }} + run: | + now_args=() + if [ "$GITHUB_EVENT_NAME" = "push" ] && [ -n "$PUSHED_AT" ]; then + now_args=(--now "$PUSHED_AT") + fi + node scripts/release-policy.mjs check "$TAG" "${now_args[@]}" --github-output "$GITHUB_OUTPUT" + + # An out-of-schedule tag (security, data loss, broken install) waits + # here until the maintainer approves the `off-schedule-release` + # environment, which lists him as the required reviewer. A scheduled + # tag skips this job and builds without a click. + off-schedule-approval: + name: Approve out-of-schedule release + needs: [release-policy] + if: needs.release-policy.outputs.off_schedule == 'true' + runs-on: ubuntu-24.04 + timeout-minutes: 5 + environment: off-schedule-release + permissions: + contents: read + steps: + - name: Record approval + env: + TAG: ${{ github.ref_name }} + run: echo "::notice::Out-of-schedule release $TAG approved." + # ── Stage 1 ──────────────────────────────────────────────────────── # Build each architecture on its own native GitHub-hosted runner so # Next.js's static-page workers run on real silicon instead of QEMU @@ -105,7 +146,14 @@ jobs: # manifest in a third step, so consumers see a single tag that # auto-selects on `docker pull` per local platform. build: - needs: [release-policy] + needs: [release-policy, off-schedule-approval] + # Runs when the policy passed and the approval either passed or was not + # needed. A refused or pending approval keeps every build job waiting. + if: >- + !cancelled() && + needs.release-policy.result == 'success' && + (needs.off-schedule-approval.result == 'success' || + needs.off-schedule-approval.result == 'skipped') name: Build ${{ matrix.platform }} runs-on: ${{ matrix.runner }} # 25 min wall clock — native amd64 build finished inside 12 min @@ -446,6 +494,176 @@ jobs: build_sha: ${{ needs.merge.outputs.build_sha }} secrets: inherit + # ── Release assets ───────────────────────────────────────────────── + # Every release tag attaches three files to its GitHub release, so the + # release can be verified without trusting the registry alone: + # + # healthlog--image.txt the image refs with the index + # digest and the per-platform digests + # healthlog--image.sigstore.json keyless cosign bundle for that file + # healthlog-.intoto.jsonl SLSA v1 provenance for that file + # + # Three jobs, so each holds only what it needs: the manifest job signs + # (id-token) but cannot write to the repository, the SLSA generator signs + # under its own identity, and the upload job writes the release but holds + # no signing token. Tags only: `:edge` is built by edge-image.yml and pull + # requests never reach `merge`. + release-manifest: + name: Sign release manifest + needs: [merge, verify-published-image] + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-24.04 + timeout-minutes: 10 + permissions: + contents: read + packages: read + id-token: write + outputs: + hashes: ${{ steps.hashes.outputs.hashes }} + env: + IMAGE_REF: ${{ needs.merge.outputs.image_ref }} + IMAGE_TAG: ${{ needs.merge.outputs.image_tag }} + IMAGE_DIGEST: ${{ needs.merge.outputs.image_digest }} + steps: + - name: Log in to GitHub Container Registry + uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # The index the merge job signed, plus its two platform manifests. + # BuildKit's attestation manifests (platform unknown/unknown) are + # left out; anything other than exactly amd64 + arm64 fails. + - name: Write image manifest + shell: bash + run: | + set -euo pipefail + if [[ ! "$IMAGE_DIGEST" =~ ^sha256:[0-9a-f]{64}$ ]]; then + echo "::error::Index digest '$IMAGE_DIGEST' is not a sha256 digest." >&2 + exit 1 + fi + raw="$(docker buildx imagetools inspect --raw "${IMAGE_REF}@${IMAGE_DIGEST}")" + platforms="$(jq -r '.manifests[] | select(.platform.os != "unknown") | "\(.platform.os)/\(.platform.architecture) \(.digest)"' <<< "$raw" | sort)" + if [ "$(cut -d' ' -f1 <<< "$platforms" | paste -sd' ' -)" != "linux/amd64 linux/arm64" ]; then + echo "::error::Index ${IMAGE_DIGEST} lists platforms '$(cut -d' ' -f1 <<< "$platforms" | paste -sd' ' -)', expected linux/amd64 and linux/arm64." >&2 + exit 1 + fi + manifest="healthlog-${IMAGE_TAG}-image.txt" + { + echo "# HealthLog ${IMAGE_TAG} container image, built from commit ${GITHUB_SHA}" + echo "${IMAGE_REF}:${IMAGE_TAG}@${IMAGE_DIGEST} index" + echo "${IMAGE_REF}:${IMAGE_TAG#v}@${IMAGE_DIGEST} index" + while read -r platform digest; do + if [[ ! "$digest" =~ ^sha256:[0-9a-f]{64}$ ]]; then + echo "::error::Platform $platform has no sha256 digest." >&2 + exit 1 + fi + echo "${IMAGE_REF}@${digest} ${platform}" + done <<< "$platforms" + } > "$manifest" + cat "$manifest" + + - name: Install cosign + uses: sigstore/cosign-installer@756fe2d284c7292c4e9b62c8a28f1e5629c59532 # v4.1.3 + + - name: Sign image manifest (keyless) + run: | + cosign sign-blob --yes \ + --bundle "healthlog-${IMAGE_TAG}-image.sigstore.json" \ + "healthlog-${IMAGE_TAG}-image.txt" + + - name: Hash image manifest + id: hashes + run: | + echo "hashes=$(sha256sum "healthlog-${IMAGE_TAG}-image.txt" | base64 -w0)" >> "$GITHUB_OUTPUT" + + - name: Upload signed manifest + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: release-manifest + path: | + healthlog-${{ env.IMAGE_TAG }}-image.txt + healthlog-${{ env.IMAGE_TAG }}-image.sigstore.json + if-no-files-found: error + retention-days: 7 + + # SLSA v1 provenance for the image manifest, signed by the SLSA generator + # under its own workflow identity. The one action in this file that is + # not pinned by commit SHA: slsa-verifier checks the builder's ref, and + # the generator refuses to run from a SHA (slsa-framework/slsa-verifier#12), + # so it must be referenced by its release tag. v2.1.0 is commit + # f7dd8c54c2067bafc12ca7a55595d5ee9b75204a. + # + # `contents: write` is required by the generator's nested upload job, + # which GitHub checks when the workflow loads even though it is skipped + # here (`upload-assets: false`): the generator never sees a draft + # release, so the upload stays in release-assets below. + release-provenance: + name: SLSA provenance for the release manifest + needs: [release-manifest] + permissions: + actions: read + id-token: write + contents: write + uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.1.0 + with: + base64-subjects: ${{ needs.release-manifest.outputs.hashes }} + provenance-name: healthlog-${{ github.ref_name }}.intoto.jsonl + upload-assets: false + + # Attaches the three files to the release for the tag. The maintainer + # writes the notes and publishes after the deploy; when this job runs + # first, it creates the release as a DRAFT with no notes. It never + # publishes. `--clobber` makes a re-run replace the files. + release-assets: + name: Attach signed manifest to the GitHub release + needs: [release-manifest, release-provenance] + runs-on: ubuntu-24.04 + timeout-minutes: 10 + permissions: + contents: write + steps: + - name: Download signed manifest + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: release-manifest + path: release-assets + + - name: Download provenance + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: ${{ needs.release-provenance.outputs.provenance-name }} + path: release-assets + + - name: Upload release assets + shell: bash + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ github.ref_name }} + run: | + set -euo pipefail + files=( + "release-assets/healthlog-${TAG}-image.txt" + "release-assets/healthlog-${TAG}-image.sigstore.json" + "release-assets/healthlog-${TAG}.intoto.jsonl" + ) + for file in "${files[@]}"; do + if [ ! -s "$file" ]; then + echo "::error::Release asset $file is missing or empty." >&2 + exit 1 + fi + done + if gh release view "$TAG" --repo "$GITHUB_REPOSITORY" > /dev/null 2>&1; then + echo "Release $TAG exists; attaching the assets." + else + echo "Release $TAG does not exist yet; creating it as a draft." + gh release create "$TAG" --repo "$GITHUB_REPOSITORY" \ + --draft --verify-tag --title "$TAG" --notes "" + fi + gh release upload "$TAG" --repo "$GITHUB_REPOSITORY" --clobber "${files[@]}" + echo "::notice::Signed manifest, bundle and provenance attached to release $TAG." + promote: name: Promote verified image to Coolify needs: [merge, verify-published-image] diff --git a/.github/workflows/edge-image.yml b/.github/workflows/edge-image.yml new file mode 100644 index 0000000000..0bcc09db44 --- /dev/null +++ b/.github/workflows/edge-image.yml @@ -0,0 +1,108 @@ +name: Edge image + +# Every push to `main` publishes `:edge` and `:edge-` (amd64 only). +# `main` is the fix line between the Saturday releases +# (docs/contributing/release-policy.md), and `:edge` is how a fix can be +# checked before it is released. It is not a release: no `:latest`, no +# semver tags, no signature, no promotion. Release images come from +# docker-publish.yml on a `v*` tag. +on: + push: + branches: [main] + paths-ignore: + - "docs/**" + - "**/*.md" + workflow_dispatch: + +permissions: + contents: read + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +# A newer push supersedes a build still running for an older one. +concurrency: + group: edge-image + cancel-in-progress: true + +jobs: + edge: + name: Build and push :edge + runs-on: ubuntu-24.04 + timeout-minutes: 25 + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1 + + # GHCR rejects uppercase repository refs; see docker-publish.yml. + - name: Lowercase image ref + run: | + echo "IMAGE_REF=${REGISTRY}/${IMAGE_NAME,,}" >> "$GITHUB_ENV" + + - name: Log in to GitHub Container Registry + uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Same two paths as the release build: with the licence key the + # offline GeoLite2 tier is baked in, without it the image ships the + # `.empty` marker and the runtime falls back. + - name: Fetch GeoLite2 databases + env: + MAXMIND_LICENSE_KEY: ${{ secrets.MAXMIND_LICENSE_KEY }} + run: | + if [ -z "$MAXMIND_LICENSE_KEY" ]; then + echo "::warning::MAXMIND_LICENSE_KEY secret is unset. The edge image ships without the offline GeoLite2 databases." + mkdir -p assets/geolite2 + touch assets/geolite2/.empty + exit 0 + fi + ./scripts/fetch-geolite2.sh + + # The version reads as the release it builds on plus `-edge.`, + # so /api/version tells an edge build from a release, and a client + # that compares version numbers still sees the release line. + - name: Resolve build provenance + id: provenance + run: | + package_version="$(node -p "require('./package.json').version")" + { + echo "version=v${package_version}-edge.${GITHUB_SHA::12}" + echo "build_sha=${GITHUB_SHA::12}" + echo "built_at=$(date -u +%Y-%m-%dT%H:%M:%SZ)" + } >> "$GITHUB_OUTPUT" + + # Writes the `-main` cache scope the release build warm-starts from. + - name: Build & push + uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64 + push: true + tags: | + ${{ env.IMAGE_REF }}:edge + ${{ env.IMAGE_REF }}:edge-${{ steps.provenance.outputs.build_sha }} + labels: | + org.opencontainers.image.title=HealthLog (edge) + org.opencontainers.image.description=Unreleased build of main, for checking fixes + org.opencontainers.image.licenses=PolyForm-Noncommercial-1.0.0 + org.opencontainers.image.source=https://github.com/${{ github.repository }} + org.opencontainers.image.revision=${{ github.sha }} + build-args: | + NEXT_PUBLIC_APP_VERSION=${{ steps.provenance.outputs.version }} + NEXT_PUBLIC_APP_BUILD_SHA=${{ steps.provenance.outputs.build_sha }} + NEXT_PUBLIC_APP_BUILT_AT=${{ steps.provenance.outputs.built_at }} + cache-from: type=gha,scope=build-amd64-main + cache-to: type=gha,mode=max,scope=build-amd64-main + provenance: true + sbom: true diff --git a/.github/workflows/release-branch-policy.yml b/.github/workflows/release-branch-policy.yml new file mode 100644 index 0000000000..04595525a6 --- /dev/null +++ b/.github/workflows/release-branch-policy.yml @@ -0,0 +1,36 @@ +name: Release branch policy + +# `main` is the fix line; features collect on `release/vX.Y.0` and reach +# `main` with the monthly minor (docs/contributing/release-policy.md). A +# pull request to `main` from any other branch fails when it carries a +# `feat` commit or grows `## [Unreleased]` in CHANGELOG.md by a heading a +# patch cannot have. +on: + pull_request: + branches: [main] + +permissions: + contents: read + +concurrency: + group: release-branch-policy-${{ github.ref }} + cancel-in-progress: true + +jobs: + fix-line: + name: Features go to the release branch + runs-on: ubuntu-24.04 + timeout-minutes: 5 + steps: + - name: Checkout full history + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + + - name: Check commits and changelog + env: + BASE_SHA: ${{ github.event.pull_request.base.sha }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + SOURCE_BRANCH: ${{ github.head_ref }} + run: | + node scripts/release-policy.mjs pr --base "$BASE_SHA" --head "$HEAD_SHA" --source "$SOURCE_BRANCH" diff --git a/.prettierignore b/.prettierignore index 8c2ba3c75d..276414de7c 100644 --- a/.prettierignore +++ b/.prettierignore @@ -39,3 +39,9 @@ tests/fixtures/golden-backups/*.json # project settings when its CLI or SDK runs; only settings.json is tracked. project.inlang/* !project.inlang/settings.json + +# Fixtures shared byte for byte with the push relay and the iOS app. Their +# tests pin each file's SHA-256 against the copy in the other repository, so +# prettier must never rewrite them. +src/lib/push-relay/__tests__/fixtures/relay-vectors-v1.json +src/lib/notifications/__tests__/fixtures/app-medication-content-state.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c31deb5f5..f5b0870ba1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,236 @@ # Changelog +## [Unreleased] + +## [1.49.0] — 2026-11-23 + +### Added + +- Push relay for the iPhone app: a server without the App Store app's Apple key can reach the app through the optional, voluntary HealthLog push relay, run on a server in Germany. Off until an admin turns it on under Admin > Push and channels; then each person decides on their iPhone. Alerts and silent pushes are sealed for their one device, so the relay sees when a device gets something and of which kind, never what it says. For private and household use only, not a medical service. Source in `MBombeck/healthlog-push` (Apache-2.0); details in `docs/integrations/push-relay.md`. +- An admin is asked once, for the whole server, whether to send push notifications through the relay: on the dashboard after signing in, on the admin start page and in the server setup. No keeps it off and nobody is asked again; it can still be turned on under Admin > Push and channels. Yes opens the relay's confirmations, and the answer counts once the registration succeeded. A server with its own Apple key, or with `PUSH_RELAY_MODE=off`, is not asked. Backups carry the answer. +- Admin relay card with a test push to your own devices, a relay key rotation that asks before it acts, the relay's deliveries of the last seven days, and an invite code field for when the relay asks for one; erasing an account removes its devices at the relay. +- The relay card says how the relay is doing. The server asks the relay for its status once an hour and shows the last check, the relay's own notice and how many of this server's devices the relay holds. A disruption or maintenance at the relay, an Apple key the relay cannot use, and a relay that refuses this server's signature show as disrupted, with the reason. The card also lists device unbinds still waiting for the relay and a registration the current settings can no longer reach, also with `PUSH_RELAY_MODE=off`. +- Hand-off time on the relay card: median and 95th percentile over the pushes accepted in the last 24 hours, from queueing on this server to the relay's answer, which comes once Apple has accepted the push, and how many needed a retry. +- The relay keeps a device reachable without anyone's help: a newly bound device gets one silent sync, which makes its binding active at the relay; a binding the relay could not take just now, or a conflict left unsettled for 30 minutes, asks the app for a fresh one; a dose sync dropped at its deadline is sent again by the minute pass; and a device unbind counts only on the relay's answer. +- Medication reminders go over the relay to every iPhone the server is meant to remind: a device set to server delivery, a device that follows an account set to it, and a device whose own reminder plan has run out. A device that still reminds itself gets none. +- Live Activity start and update over the relay, behind `PUSH_RELAY_LIVE_ACTIVITY=on` and a second consent per device, off by default. Its content carries only state and countdown, never a medication name, so the relay and Apple can see when a dose is due. It follows the medication's own dose windows. A start or an update counts once the relay has accepted it: a start that failed is tried again after 30 minutes, and an end the relay did not take is sent again by the five-minute job. +- An undone take or skip reaches the person's other devices as "Dose updated", so a phone that is not running the app shows the dose as open again instead of answered, for doses of the last 36 hours. It travels like the dose confirmation: the same switch, the same devices, sealed. A deletion in Apple Health stays silent. +- Silent wakes when a server-side sync stores new readings and when the app's Apple Health upload is six hours behind, rationed per device. +- Security notifications when a passkey is added or removed, an access or connector token is revoked, or a device is signed out by refresh token reuse; time-sensitive on the iPhone. +- Emergency card at `/emergency-card`: offline HTML copy, wallet card PDF, and a QR link that shows only the ticked items, can expire, can be revoked, and logs every opening. It has its own entry in the navigation (under More on a phone), a button under Medical history and a card under Settings > Health record. (`docs/using/emergency-card.md`) +- Pregnancy and the weeks after a birth as a cycle state: predictions and their reminders pause, the timeline and doctor report show the week, and the emergency card can show it. While it holds, no page rates the weight: no goal, no BMI category, no trend direction, no Coach hint, no BMI in the doctor report. "Delete all cycle data" clears it. (`docs/using/pregnancy.md`) +- "Find leaflet" on a medication opens the official medicine registry of the chosen country (Poland, Germany, Spain, France, United Kingdom, Belgium, Netherlands, United States, Canada, Australia, Brazil, EU) in a new tab, with the name already searched for where the registry allows it. The server sends nothing to any registry. The registry is a setting of its own under Settings > Modules > Medications, independent of the app language, and can be picked right on the medication. A medication can keep the link to its official leaflet (https only), which shows as "Official leaflet" and travels with backups and the export. Thanks to @ferges123 for the idea and the registry research. ([#1430](https://github.com/MBombeck/HealthLog/issues/1430)) +- A short server setup for the first admin: who may sign up, how notifications leave the server (with the push relay off unless switched on), what AI may do, what else leaves the server, and a setup check. Every step can be skipped; it is offered once on the admin start page and stays reachable from Admin > System status. Servers that already had accounts are not asked. +- A setup check on Admin > System status: encryption keys loaded, the secure-cookie setting against how the page was reached, the nightly database dump, and the public address. +- Personal setup: "Region & units" confirms the time zone and, with medication, the medicine registry; two optional screens after the summary, only for people they concern, say where reminders reach you and ask a plain yes or no to the Coach. +- Getting started: a collapsed "More you can set up" group with the emergency card, the care calendar, sharing, imports, a regular doctor report and the iPhone app. None of it counts towards the list. +- Gadgetbridge database import (steps, pulse, SpO2, resting heart rate, sleep, weight), read without stalling the server on a large file. (`docs/integrations/gadgetbridge.md`) +- FHIR R4 Bundle import: labs, vital signs, conditions, vaccinations, medications without reminders, and visits; a second import writes nothing twice, also after a restore. (`docs/integrations/fhir-bundle-import.md`) +- Scheduled Health Connect export fetched from a WebDAV or Nextcloud folder about every six hours, several folders at a time, with the app password stored encrypted. A download that breaks off shows the reason on the source and waits before the next try. A private network folder needs its origin in `HEALTH_CONNECT_WEBDAV_PRIVATE_ORIGINS`. +- A managed profile uses the AI provider its guardian picks for it: the server's AI key, one of the guardian's own chains, or none. Picking one of their chains counts as the guardian's consent for the profile; the server's key and reading documents still ask for the profile's consent, and "No AI provider" switches AI off for it. Thanks to @ch3funio. ([#1403](https://github.com/MBombeck/HealthLog/issues/1403)) +- A managed profile's activity can be read from the guardian's own account, on the managed profile card. Thanks to @ch3funio. ([#1403](https://github.com/MBombeck/HealthLog/issues/1403)) +- The admin audit log picks its actions by family (sign-ins, documents, sharing and managed profiles, medications), so a guardian's upload into a managed profile is one pick away. Thanks to @ch3funio. ([#1403](https://github.com/MBombeck/HealthLog/issues/1403)) +- Background AI work that stops says why, on the document and on a card in the AI settings: provider not reachable, timeout, a refused key, a chain with no provider set up, a spent daily allowance, a model that reasoned without answering. "Try again" sits beside it and the entry goes once the work succeeds. Only a fixed reason code is stored. Thanks to @ch3funio. ([#1404](https://github.com/MBombeck/HealthLog/issues/1404)) +- Medication list grouped by category, with search, category and treatment period filters, and the group open mode and category order in Settings. Thanks to @ferges123. ([#1425](https://github.com/MBombeck/HealthLog/issues/1425)) +- Night timeline on the sleep page; WHOOP and Polar, which report only stage totals, get a note. Thanks to @kruemelro. ([#1419](https://github.com/MBombeck/HealthLog/issues/1419)) +- FIT import reads training effect, training load, recovery time, sweat loss and running dynamics, fills them into workouts already stored, and synced Garmin runs gain recovery time and running dynamics. Thanks to @kruemelro. ([#1343](https://github.com/MBombeck/HealthLog/issues/1343)) +- Apple Health cycling and rowing distance, rowing speed, running speed, power, ground contact time, vertical oscillation and stride length, and workout effort separate from estimated effort. Thanks to @camiracode. ([#1415](https://github.com/MBombeck/HealthLog/issues/1415), [#1416](https://github.com/MBombeck/HealthLog/issues/1416)) +- Energy balance on the nutrients page (intake against resting and active energy, seven-day trend), in the correlations, and as a two-week line for the Coach. ([#1116](https://github.com/MBombeck/HealthLog/discussions/1116)) +- Scheduled doctor report filed into documents monthly, quarterly or yearly, off by default. ([#1116](https://github.com/MBombeck/HealthLog/discussions/1116)) +- Coach limits for local providers and OpenAI-compatible gateways (data read, tokens, steps, time per answer), on the "Coach budget for self-hosted models" card. A turn that falls back to the operator's key is held to the built-in limits. ([#1116](https://github.com/MBombeck/HealthLog/discussions/1116)) +- Day view shows a symptom's distance in time from the nearest dose. Thanks to @2q2code. ([#1116](https://github.com/MBombeck/HealthLog/discussions/1116)) +- Day view shows the day's seizures, each with its distance from the nearest dose, when the seizure diary is on. +- Calendar feed for booked visits, check-ups coming due and vaccination boosters, with neutral titles by default. +- Notification for a lasting change in a vital (held ten days, at most weekly, off by default). A notice no channel could deliver is tried again the next morning instead of using up the week. +- Capture menu: most-used types as rows, "Save and next", the last reading under the field; the save receipt has Undo and Edit. +- Biomarker page lists its five newest values under the chart. +- Time zone per reading from the iPhone; the Day view, list and daily charts follow it. +- The sidebar and the More sheet sort their entries under Tracking, Health record and Analysis. Medications and Checkups show a small number when a dose or a check-up is due. No address changes. Thanks to @Cnote43 for the sketch it follows. ([#1113](https://github.com/MBombeck/HealthLog/discussions/1113)) +- The search finds every page and every settings card, in every language also by keyword ("snooze", "dark mode", "Nextcloud", "ICE"). +- Settings > Notifications has an "Alerts" group with account security and lasting change in a vital, visible before any channel is set up. +- Settings > Data & privacy opens with "Who can reach your record": accounts and guardians, clinician links, the emergency card link, the care and cycle calendars, API tokens, MCP and sign-ins, each with its link. +- The theme can be chosen under Settings > Account > Display as well as in the avatar menu. +- Checkups, Vaccinations and Documents link to the care calendar and the report schedule under their page header. +- Admin > System status has a "Version and database" card: the version, the channel (release, edge or development), and the migrations applied, pending or failed. +- An app can read the push state of its own device (`GET /api/devices/me/push-diagnostics`, feature `push.device-diagnostics`): route, relay binding, the hourly budget for silent pushes with a sync still owed, the last delivery of each kind, the last receipt, a masked APNs token, and whether the server or the app reminds the device of a dose. Only that device, no content. +- API: `GET /api/version` lists `features`; `POST /api/measurements/batch` takes `timeZone` per entry; workouts carry `performance`; `GET /api/nutrients/energy-balance`; dose rows carry their resolved state and `alreadyTaken`; `medications.lastUpdatedAt` in `/api/sync/state`; `notificationPrefs.medication.snoozeMinutes`; questionnaire history rows carry `source` and `itemsUnavailable`; `push.device.liveActivityStarted` names the dose of a server-started Live Activity. +- API, added late: `extraDose` on `POST /api/medications/{id}/intake`; `leafletUrl` and `leafletSearch` on medications and `medicineRegistry` on `/api/auth/me` (`PATCH /api/auth/me/medicine-registry`); a `seizures` section and a `seizure` event on `GET /api/day/{date}`; `expected30` on the medications of `GET /api/insights/comprehensive`; `GET /api/nav/counts`; `GET /api/ai/job-failures` and `aiFailures` on a document; the setup steps `reminders` and `ai`, `onboarding.offers.ai` and `GET /api/onboarding/extras`. +- A GLP-1 titration step can be removed by its client id: `DELETE /api/medications/{id}/glp1/dose-changes?clientId=` answers 204 whether or not the step reached the server, and spends the id so a late upload of the same step answers 410. +- API, for the relay and the dose answers: `push.relay.operatorDecision` (`undecided`, `on`, `off`) and `push.relay.canDecide` on `/api/auth/me`, and `POST /api/admin/push-relay/decision` (admin, signed in through the browser); `slotInstant` on every dose answer of `POST /api/medications/{id}/intake` and `POST /api/medications/intake/bulk` and on the medication reminder push; a pin refused because the slot is taken names the take that holds it (`slotInstant`, `takenAt`, `takenVia`); `GET /api/medications/resolved-slots` returns the scheduled doses of every medication in one read; `GET /api/medications/intake?scope=today` answers with a `HealthLog-As-Of` header; a dose confirmation carries `asOf` and knows `outcome: "reopened"`; intake tombstones in `GET /api/sync/changes` carry `externalId` and `source`; a sample deleted in HealthLog answers `skipped` with `reason: "deleted_in_healthlog"` on the bulk routes, an older day total `skipped` with `stale`; the admin relay status carries `relayCheck`, `handoff`, `termsConfirmationNeeded`, `unbindsPending` and `unreachableRegistrations`. + +### Changed + +- Releases follow a calendar: a minor on the first Saturday of the month, fixes on other Saturdays, and off-schedule only for security, data loss or a broken install. Every push to `main` publishes an `:edge` image (amd64). See `docs/contributing/release-policy.md`. +- The theme follows the system setting unless light or dark was chosen, and switches with it live. Until now a device with no stored choice got the dark theme. Anyone who never chose a theme and whose device is set to light sees HealthLog turn light with this update; choosing Dark once keeps it dark. The offline page follows the same rule. +- The 90-day chart range draws weekly averages again, for measurements and mood, with the number of readings per week in the table. A week or month point names the days it covers, so the first week of the window and the week still running read as the shorter stretches they are. +- The 7-day moving average is drawn on daily points only. On weekly and monthly points (90 days, All) it is left out instead of showing a seven-week average under a 7-day label, the range band spans the week's days, and the comparison period compares each week with the shifted week's average. +- One vocabulary for doses: Take and Skip on dose cards; pending, due, overdue, taken, taken late, skipped and missed as states, also in Telegram and the doctor report. In Russian and Polish the states skipped and missed have separate words. +- One snooze length per person under Settings > Notifications (10 minutes to two hours, 30 by default) on every surface, Telegram's reminder keyboard included, in the person's language. +- One intake form for the medications page, the history and the capture menu, which names the dose it counts for; the medication page offers take, skip and snooze for the next dose. +- The reminder card says in words what will happen; the reminder steps are offered for every scheduled medication. +- Deleting a dose happens at once with an Undo; "Take all due" has one Undo for the batch. +- Dose times follow the 12 or 24 hour setting. +- The medication setup asks less: the category is optional (Other by default), the dose step asks nothing twice, a disabled Next says what is missing, and the summary says from when each dose counts as missed. +- One word per dose state and action in every language, push and Telegram included; the extra dose sentence says it does not count toward adherence. +- The relay opt-in asks for the terms and the privacy notice separately and shows what the relay sees. It says plainly that medication reminders go over the relay to every device that gets its reminders from the server, so the relay and Apple can see when a dose is due. +- Every file import shares one size limit, one "too large" message and five uploads a minute. +- A Health Connect folder is set up under Settings > Integrations, no longer under Export & import, and is marked there when its password was refused. +- Admin keeps push in one place: "Push and channels" holds the channel switches, the Web Push keys, the relay and the delivery health with its test push. The sections are regrouped (System, Notifications, AI, Connectivity, Account, Server data) and "Integrations" is now "Monitoring". +- The page with the switch per kind and channel is called "Notifications per channel" and lists the kinds also when no channel is set up yet. "Manage notification channels" on a medication leads to the channels. +- Settings cards look alike: the button at the bottom of a card sits on the right at one size, also on a phone, most switches stand to the right of their name, field names have one shape, and status messages stand above the buttons. This covers the emergency card, "Create profile", the guardian's settings, the push relay card, the import cards and the notification rows on a phone. +- The tabs on Cycle, Checkups, a medication and the recovery kit look like the other view switches; on Checkups the title comes first, then the tabs; the admin's section strip on a phone works like the Insights pills. +- Every settings save confirms. Cycle settings, the scheduled doctor report, the Health Connect folder, calendar feed options, a guardian's settings, withdrawing AI consent, disconnecting Garmin or Nightscout, the delivery test message and "Forget all devices" used to save without a word. +- Getting started: with a medication schedule, the notification row comes right after the medication row. +- The add form opens on the type last saved by hand, read from the account's own readings, instead of browser storage. +- Ages count on the person's own calendar everywhere. +- A search for "doctor" or "report" lands on the page that makes the report. +- A seizure cluster notification opens the seizure that formed it, and a lasting change notification opens its vital's insights page where there is one. +- The timeline's Add button matches the other pages. +- A 422 names the bounds a value missed in `details.issues[]`; `GET /api/analytics/range` answers in the account's units with `unit`. +- Protected pages arrive with the account in the first HTML; the dashboard's largest paint on a slow phone connection went from 4.3 s to about 1 s. +- The onboarding tour loads on demand, the translation script is cached for good, and the recovery kit banner no longer shifts the dashboard. +- Scanner probes such as `/.env` get a 9-byte 404, and the quarter-hour jobs start minutes apart. +- After a sync the dashboard and daily overview load about three times faster; the today list reads every medication's doses in one batch and answers an unchanged list with an ETag and 304; independent launch reads start together. +- With a dense source (a Fitbit through Google Health writes about 35,000 pulse readings a day), the daily overview, the dashboard and the targets load in 0.1 to 0.3 s after a sync instead of 1 to 4 s, a pulse chart over 30 to 90 days in about 0.5 s instead of 1.5 to 2.5 s, and the insights overview in milliseconds instead of seconds. +- Six duplicate indexes dropped and indexes added for retention purges and external id prefix lookups; Telegram reminder messages are kept 30 days and Coach usage 180 days. + +### Fixed + +- The "Pulse through the day" chart and the heart rate curve on a workout page show the whole day and the whole workout again with a dense source. With about 35,000 readings a day they broke off after roughly four hours. Thanks to @sdrburgess. ([#1429](https://github.com/MBombeck/HealthLog/issues/1429)) +- With dense data the live step and energy profile, strain, stress, readiness, the deviation hint, the glucose and SpO2 safety limits, the 30-day figures on the status cards and the mood correlations count every reading instead of a capped slice, and the resting pulse baseline matures again. +- The image ships the PostgreSQL 19 client tools. An install that runs its own database on PostgreSQL 19 no longer stops before a migration because the bundled `pg_dump` refused the newer server, and its nightly dumps work again. The client reads 16, 18 and 19 alike, and the upgrade guide now names the ceiling. Thanks to @aw23edfr4. ([#1431](https://github.com/MBombeck/HealthLog/issues/1431), [#1432](https://github.com/MBombeck/HealthLog/issues/1432)) +- The dump before a migration and the nightly dump write the archive and its listing straight to files instead of through a pipe, so a dump no longer depends on that pipe staying writable. The pre-migration dump gates the start, so a dump that fails for no reason of its own would hold up a healthy update. +- A Take button that names a time counts for that dose, also when taken early. More than six hours ahead the button says "Take an extra dose" and says it will not count for the named dose. The confirmation names what the take counted for. +- The intake form and the server share that six-hour rule, switching off "count for the dose" is honoured, and a take bound ahead of its time reads as taken early, not late. +- A medication card shows a dose with its own window the same window as the Today list. +- A medication without a dose behind it shows "No doses yet" instead of 100 % adherence, and no streak before the first answered dose. +- A take logged on the web in the first minute after the page loaded, "Take an extra dose" included, is stored. It could be answered with the open dose and never written. A take logged for an earlier time, or right after an undo, is a dose of its own, and a real double tap answers that the dose was already taken. +- An extra dose logged on the exact minute of a scheduled dose is stored instead of failing, and two Apple Health doses in the same minute both arrive. +- The seizure diary and the doctor report count from the day the diary began and name that day. +- Layout, module, notification, Coach and score settings save at once, also right after another change to the account. A save could answer "reloaded, try again" for up to five minutes. +- A portable export carries everything a medication and a dose say: form and class of the drug, as-needed and one-time, the reminder and Live Activity switches, injection sites, codes and reorder lead time, every schedule field, and for each dose the injection site, the amount taken, a slot assigned by hand and the missed marker. Restored on another instance, an injection used to come back as a tablet and a plan without its times. +- Restoring a portable file keeps each visit's lab results attached, and an illness day keeps its time zone. +- Restoring the instance settings brings back the AI usage bounds and the regeneration gap instead of defaults. A backup no longer carries this server's error-report delivery state, applied pulse method or backfill positions. +- Background runs that carry on past a failed item (push wakes, Live Activity updates, scheduled reports, nightly measurement folds, workout routes and rollups after an import, off-host backups, relay unbinds, Health Connect folders) appear on the admin failing-jobs card with how many items failed, instead of reading as successful. +- A Telegram dose reminder sent without a keyboard of its own had German buttons with fixed one and three hour snoozes. It gets the same keyboard as every other reminder, in the person's language and with their snooze length. +- An OpenAI-compatible gateway that has no `seed` field, such as Google Gemini, no longer fails the briefing, status and summary calls: the request goes out again without it, and the endpoint is remembered. A model listing that names models as `models/` counts the bare name as listed. (`docs/integrations/ai-providers.md`) +- Postponing a check-up to tomorrow in the last hour before the clocks go forward no longer fails, and postponing to today in the first hour after they go back is refused as on every other day. +- "Yesterday" on Coach messages, the "Updated yesterday" caption, the medication card's last intake and the GLP-1 card's last injection name the right day around a clock change and in a browser set to another zone than the profile. Coach conversations are grouped by the profile's days, and the medication setup starts on today in the profile's calendar. +- Doses recorded by several sources land on one slot: a second take changes nothing, an undo cannot remove another device's take, and existing duplicates are merged (a take wins over a skip). +- A late take or a skip after a dose was marked missed left it missed in the timeline, streak and achievements. +- An undone dose comes back as pending in the Today list and on the dashboard. +- A snooze holds only the dose it answers; skipping in Telegram no longer snoozes the medication for the day. +- The streak breaks on a missed day. +- Marking a missed dose as taken in the history records when it was reported, not the scheduled time. +- An extra dose no longer counts as a scheduled dose on the dashboard. +- An older schedule stored with a range was reminded and scored an hour off. +- A card whose dose time had just passed showed no due or overdue badge. +- A dose recorded anywhere reaches every relay device as a silent sync, and as a confirmation as well when those are on. +- A take more than two hours after the recorded one counts for the next open dose instead of being dropped as a repeat. +- The web intake form offers only the slots that exist on the chosen day, read from the server; a weekly medication's off day no longer offers its time and then answers 422. +- Paired iPhones refresh when the server marks a dose missed, and the end of a Live Activity reaches the app in a form it decodes. +- The medication hook matches names regardless of case and spacing, answers 404 for an unknown name, and folds two box openings within a minute into one dose; the copied examples no longer send a fixed key. +- Withings readings that reach the cloud late are imported, because incremental syncs ask by upload time. +- A device signed itself out when two refreshes raced; the second now gets `409 auth.refresh.superseded`. +- With the cycle module off, a paired app no longer rebuilds every 75 days, and deleting all cycle data reaches paired apps. +- A portable restore keeps each dose on its own medication when two share a name. +- Entering a reading again after deleting it no longer answers 409, and the delete dialog says when a sync will bring it back. +- Editing a managed profile's time zone, birth date or sex refreshes its day grid and targets at once. +- Lab results stored at midnight UTC show on their own day west of UTC. +- Glucose imported from Apple Health in mmol/L reads back as entered. +- The hour after a clock change no longer shifts yesterday and tomorrow in the morning refresh, the target strip, the Google Health day total, the integration card and the symptom severity chart. +- Symptoms: a new one of your own sorts last, the limit holds when several are added at once, and moving an occurrence checks its episode. +- Editing a walking distance or speed in metric units seeds the value in the unit the label shows. +- The FHIR endpoint and the MCP doctor visit read the saved report selection again instead of an empty one. +- A relay outage no longer counts toward switching the iPhone channel off. +- Every change to a dose or a medication (a moved time, a pause, an ended course, a deletion or restore) reaches paired devices and a guardian's devices at once; an intake sync over the hourly push budget is sent later instead of dropped. Over the relay a guardian's device is left out, so the relay does not learn when another person's doses are recorded; the app refreshes a managed profile when it opens. +- A phone woken by a dose change is answered with the state after the change. After a Telegram snooze, a course ending or restarting, or the automatic miss pass it could be answered with the state before. +- A take or skip recorded by a person replaces one filled in automatically, and the skip gives back the stock. +- Restoring a backup made before 1.49.0 failed when it held a dose recorded twice; duplicates are merged and their stock refunded, as on the update. +- A dose, reading, mood entry, symptom or cycle day deleted in HealthLog stays deleted when the iPhone app reads the whole Apple Health history again, and a deleted dose takes no stock a second time, also when it had been recorded on a scheduled dose. One deleted in Apple Health is removed in HealthLog too, also on a scheduled dose, and is written again when it comes back there, workouts and ECGs included. Deletions the iPhone reported before this release are recognised where the audit log proves them. +- A day whose Apple Health values were all deleted shows 0, and a late older daily total no longer overwrites a newer one (from the app version that sends `computedAt`); `oldestSeenAt` lets the app fill old history faster. +- Hand-logged cycle symptoms survive Apple Health day writes. +- The pregnancy state holds only within its dates, so earlier reports and a card after the birth no longer show it; the lasting change notice stays quiet while it holds, and every AI text knows about it. +- The Coach knows the seizure diary; with medications excluded from the Coach, it leaves the rescue doses out. +- The doctor report and the blood pressure status place a reading on the day of its own time zone. +- A guardian can create and manage a managed profile's emergency card, care calendar feed and report schedule, and their pages open inside the profile. Someone who shares an adult's record with manage rights can make the doctor report. +- The emergency card lists only medications running today, and the report shows no deleted dose as the last one. +- First SSO sign-in failed when a username existed in other case; changing the e-mail to such an address says it is taken instead of a server error. +- "Delete all data" unbinds the account's devices at the relay. +- A device that signs out, is revoked or moves to another account loses its push credentials and its Live Activities; a phone that signed out and moves to another account receives the new account's pushes instead of a refusal. +- Live Activity updates over the relay go only to Activities the server started. +- Sender key rotation takes each step once, after its notice period. +- The import cards and the snooze setting show a failed read with a retry, and a failed folder removal says so. +- Undo and Edit toasts stay in front of achievement toasts. +- Reading a Health Connect export no longer blocks the server. +- A phone's first Apple Health sync no longer runs a small server out of memory. The bulk sync routes take a bounded number of uploads at once, two per signed-in client and four per server process, let the rest wait up to five seconds and then ask them to retry (429 with `Retry-After`). +- A large sync queues one personal-record scan and one reminder check per account every few seconds instead of one per batch. +- The server caches are held to a share of the heap by size, not only by entry count, and no entry lives longer than fifteen minutes. With a separate worker process, the resting pulse and long timeline ranges show new imports within fifteen minutes instead of up to six hours. +- Every sentence with a count agrees with its number in all ten languages ("Opened once", "1 device bound"), with the Russian and Polish forms for 2 to 4 and for 5 and more. French and Russian address the reader formally throughout. +- A share link opened in a browser that refuses cookies shows a page saying the link needs cookies instead of failing with too many redirects. +- The documentation link on the relay card and in its dialog leads to the push relay page. +- The admin relay card shows a failed status read instead of nothing. + +- A dose change on another device always reaches a phone whose silent-push budget at the relay is spent: the relay's refusal is no longer counted as delivered, the sync is owed and goes out the first minute the relay takes one again. +- A Live Activity started from the server through the push relay appears only for a medication with Live Activity turned on and only for a dose coming up or currently due, never for one that is long overdue or already answered; the earliest such dose gets it. +- A dose the iOS app names by its slot binds to that slot on the bulk route exactly as on the single route, also when it is taken early and the windows of two doses overlap. +- Posting a single entry again that was deleted in HealthLog (mood, measurement, cycle day, AUDIT-C) answers `410` with the reason `deleted_in_healthlog` instead of bringing it back; a mood entry deleted in Apple Health comes back when Apple Health sends it again. + +- The iOS app's "sync with your other devices is disturbed" notice only appears for a real, current problem: a silent push iOS chose not to deliver no longer counts, and the next confirmed alert clears it. + +### Security + +- Pages rendered for a signed-in request are `private, no-store` on every path, public ones included, and the service worker caches only pages answered to an anonymous request. The account data in a page's first HTML leaves out name, birth date, insurance and saved report fields; `/api/auth/me` answers `private, no-store`. +- Account lookups by e-mail or username (sign-in, registration, invites, single sign-on) compare exactly, regardless of case; `_` and `%` no longer act as wildcards. Not an account takeover path: single sign-on never links on e-mail alone and sign-in still needs the password. Case-insensitive search filters escape `_` and `%`. +- E-mail address and username are unique regardless of case; new and changed addresses are stored in lower case. +- Moving a Health Connect WebDAV folder to another server requires the password again, saving a password asks for a fresh confirmation, and a public folder must use https. +- Another account can take over a device only when the previous account is signed out on it. While it is still signed in there, the registration is refused (409 `devices.register.signed_in_elsewhere`) with an audit entry on both accounts, so knowing a phone's APNs token or install id is not enough to steer its pushes. After a takeover the previous account gets a `device_reassigned` security alert on its other devices and channels. +- A dead, revoked or expired emergency card or clinician share link answers one identical not-found page with a real 404, and the card's QR page installs no service worker. The card can no longer be locked by repeated openings. +- The pregnancy state and its dates are stored encrypted. +- Pushes to an iPhone that registered a key are sealed for that device, also when the server sends with its own Apple key, and the test pushes from the settings and the admin panel are sealed the same way. +- Over the relay every alert is sealed with one lifetime (15 minutes) and every silent push with another (one hour), at one size per class, so the relay cannot tell a reminder from a dose confirmation or a security alert. An iPhone that is offline for longer does not get the older alert through the relay. With the server's own Apple key each kind keeps its own lifetime. +- The relay switch and both key rotations are rate limited. The emergency sender-key rotation asks for a fresh proof of sign-in: a second factor where one is set up, otherwise the password or a passkey. +- APNs tokens are compared and stored in lower case, so one token cannot be held by two accounts in different spellings. +- The calendar feed and emergency card links are stored only as a hash, rate limited, need a fresh sign-in to create, and stay out of backups; a link a guardian made ends with their access. +- The server pins a third identity key of the hosted relay, held offline, so the relay can recover if its current and next key are both lost, without waiting for a server and app release. +- A saved leaflet link must be https, is never fetched or embedded by the server, and one that is not https in a hand-edited backup is dropped on restore. +- From this release on, every GitHub release carries a signed image manifest (`healthlog--image.txt` with its Sigstore bundle) and SLSA v1 provenance, so the image a release names can be checked without asking the registry. `SECURITY.md` and `docs/ops/deploy.md`, "Verify a release from its assets", have the commands. +- `glob` and `minimatch`, which arrive through other packages, are lifted past their advisories, and the image installs its migration CLI from a committed lockfile with pinned hashes. + +### Updating + +- Take a backup first. With the `backups` volume the container writes a pre-migration dump before it migrates; without it, run `pg_dump` yourself. `docs/ops/deploy.md`, "v1.49.0 notes", has the operator detail. +- Thirty-six migrations, 0514 to 0558 (0516, 0523, 0527, 0528, 0541, 0548, 0550, 0552 and 0555 do not exist); the boot log says `36 database migrations pending`. Seven touch existing data: + - 0515 merges dose rows recorded twice for one slot (take, then skip, then the oldest pending row; the rest soft-deleted), refunds the stock of a merged take, clears the auto-miss mark on taken or skipped doses, and rewrites legacy single-time schedules into dose windows. + - 0517 makes e-mail and username unique regardless of case. On a clash it stops, changes nothing, and the container does not start: list the accounts with the query in `docs/ops/deploy.md` ("Accounts that differ only in case"), ideally before the update, rename one of each pair, run `prisma migrate resolve --rolled-back 0517_case_insensitive_identity_and_retention_indexes` as shown there, and start again. It also drops six duplicate indexes, builds four retention indexes (bounded to five minutes) and checks the shape of text day keys, `NOT VALID` with a warning where old rows do not fit. + - 0529 lowers APNs tokens; where two devices held one token in different case, the most recently seen keeps it and the other registers again on its next launch. + - 0543 adds and backfills the source of each cycle symptom link. + - 0546 records who deleted a synced row and drops the workout and ECG deletion ledger of 0511. + - 0551 marks the first-admin server setup as finished on a server that already has accounts, so an update never offers it. A fresh install offers it to its first admin. + - 0557 stamps Apple Health rows that were deleted before the update as deleted in Apple Health, where the audit log proves it: the rows lie in the window of one delete request from the phone and their number matches what that request deleted. Any other count leaves them refused, as 0546 set them. It writes only `apple_health_deleted_at` on `measurements`, `mood_entries`, `symptom_events`, `medication_intake_events` and `cycle_day_logs`, in one transaction with a ten-minute statement timeout, locks only the rows it stamps, and sends no tombstone down the sync feed again. +- 0539 (pregnancy state encrypted), 0540 (maker of a guardian's link), 0556 and 0558 change data only on a host that ran a 1.49 pre-release. 0556 adds `app_settings.push_relay_decision` with a CHECK and stamps `on` where the server was already registered at the relay, so its admin is not asked again. 0558 adds two nullable columns to `devices` and three columns to `push_relay_registrations` for what the relay reports, and gives a device in a binding conflict the full 30 minutes from the migration. Neither rewrites a table; both wait at most 5 s for their lock and are retried on a timeout. +- 0553 adds the table behind the background AI reasons. 0554 gives each settings document its own lock token: nine columns and two triggers on `users` and `user_health_profiles`, without a rewrite. A browser or app that read such a setting before the update gets one 409 on its next save and reads again. +- 0517 and 0529 hold writes to `users` and `devices` until they commit, so a 1.48.5 container still running cannot add a clashing row. +- 0518 builds an index on `measurements` `CONCURRENTLY` during the start, before the app serves; on a large instance the first start takes longer. Do not restart it midway; if it fails, see "A concurrent index build that failed" in `docs/ops/deploy.md`. +- Going back to 1.48.5 means restoring the pre-migration dump with the 1.48.5 image (`HEALTHLOG_IMAGE_REF=:v1.48.5`; `docs/ops/disaster-recovery.md`, "Going back to before a migration"), not starting the old image on the migrated database. +- The image carries `pg_dump` and `pg_restore` of PostgreSQL 19. The bundled database stays on 18 and nothing moves on disk. With your own PostgreSQL, 16, 18 and 19 work; keep the server at or below the client major of the image you run, which `docker run --rm --entrypoint pg_dump ghcr.io/mbombeck/healthlog:latest --version` prints (`docs/ops/postgres-major-upgrade.md`). +- A server that turned the relay on under a 1.49 pre-release is asked once, on the relay card, to read and confirm the updated relay text. The relay keeps working until then. +- New optional environment variables, all on the compose whitelist and reported by `pnpm check-env`: `PUSH_RELAY_MODE` (`off` hides the relay), `PUSH_RELAY_URL` and `PUSH_RELAY_KEYS` (another relay), `PUSH_RELAY_LIVE_ACTIVITY` (`on` allows Live Activity start and update over the relay; default off), `HEALTH_CONNECT_WEBDAV_PRIVATE_ORIGINS` (exact origins of private WebDAV folders). +- The iPhone app 1.7 is the version the relay and the new dose behaviour on the phone need. + +### Thanks + +- @camiracode for the cycling, rowing and running types and the workout effort code. ([#1415](https://github.com/MBombeck/HealthLog/issues/1415), [#1416](https://github.com/MBombeck/HealthLog/issues/1416)) +- @kruemelro for the night timeline and FIT requests and real files to test against. ([#1419](https://github.com/MBombeck/HealthLog/issues/1419), [#1343](https://github.com/MBombeck/HealthLog/issues/1343)) +- @2q2code for the notes on daily medication and symptom tracking. ([#1116](https://github.com/MBombeck/HealthLog/discussions/1116)) +- @ljcasaai for the Coach limits, energy balance, scheduled report and lasting change requests. ([#1116](https://github.com/MBombeck/HealthLog/discussions/1116)) +- @ferges123 for the grouped and filtered medication list and for the leaflet idea with its registry research. ([#1425](https://github.com/MBombeck/HealthLog/issues/1425), [#1430](https://github.com/MBombeck/HealthLog/issues/1430)) +- @ch3funio for the guardian requests behind the profile activity feed and the audit log families, and for pointing out that background AI work stopped without a word. ([#1403](https://github.com/MBombeck/HealthLog/issues/1403), [#1404](https://github.com/MBombeck/HealthLog/issues/1404)) +- @Cnote43 for the sidebar sketch the new grouping follows, and @mills1975 for the discussion around it. ([#1113](https://github.com/MBombeck/HealthLog/discussions/1113)) +- @sdrburgess for the precise report of the pulse chart that broke off. ([#1429](https://github.com/MBombeck/HealthLog/issues/1429)) +- @aw23edfr4 for finding why an install on PostgreSQL 19 stopped booting and sending the fix. ([#1431](https://github.com/MBombeck/HealthLog/issues/1431), [#1432](https://github.com/MBombeck/HealthLog/issues/1432)) +- Everyone who donated or supported the project, among them @ljcasaai and @ch3funio; the push relay runs on that support. + ## [1.48.5] — 2026-11-21 ### Fixed diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index b76348f4b6..768c1f9c83 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -36,7 +36,7 @@ This Code of Conduct applies within all community spaces, and also applies when ## Enforcement -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at conduct@bombeck.io. All complaints will be reviewed and investigated promptly and fairly. +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at conduct@healthlog.dev. All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the reporter of any incident. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 85127130cd..60fb434af6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -90,34 +90,35 @@ Always include the migration file in your PR. ## Branch Model -HealthLog is trunk-based: `main` is the single long-lived branch and is always releasable. There is no `develop` branch. +HealthLog is trunk-based: `main` is the single long-lived branch and is always releasable. There is no `develop` branch. Releases follow a calendar, described in [docs/contributing/release-policy.md](docs/contributing/release-policy.md): a minor on the first Saturday of the month, patches with fixes only on the other Saturdays. ``` - feature/* ──┐ - fix/* ──┼──► PR ──► main ──► tag vX.Y.Z ──► GHCR build ──► deploy - │ - release/vX.Y.Z ──► PR (merge-commit) ──► main ──► tag vX.Y.Z ──► GHCR build ──► deploy + fix/* ──► PR ──► main ──► tag vX.Y.Z on a Saturday ──► GHCR build + │ + └──► every push: :edge image + + feat/* ──► PR ──► release/vX.Y.0 ──► PR (merge commit) on the first Saturday ──► main ──► tag vX.Y.0 ``` The rules: -- **`main` always builds, passes CI, and is deployable.** Every commit on it is a release commit (`chore(release): vX.Y.Z`), a release-branch merge, or a maintenance commit (docs, gitignore, audit findings) applied directly. -- **A release** is built on a short-lived `release/vX.Y.Z` branch cut off `main`, then opened as a PR `release/vX.Y.Z` → `main` with green CI, merged as a merge-commit, and tagged `vX.Y.Z`. The tag push triggers the GHCR multi-arch image build (and `:latest`). Deploy is manual. Delete the release branch after merge. -- **Small standalone changes** (a single fix, a docs touch) go through a short-lived `fix/X` / `feat/X` branch + PR targeting `main`. -- **Hotfixes** branch from `main` and merge straight back to `main`. There is no second long-lived line to forward-port to. +- **`main` is the fix line.** It always builds, passes CI, and is deployable. Fixes, docs and maintenance land there through pull requests; each user-visible fix adds its line under `## [Unreleased]` in `CHANGELOG.md`. A merge to `main` is not a release; the release is the tag. +- **Features go to `release/vX.Y.0`**, the branch that collects the next minor. It is cut from `main` the day the previous minor ships and merges back with a merge commit on the first Saturday of the month. A pull request to `main` from any other branch fails when it carries a `feat` commit. +- **A release** is a `chore(release): vX.Y.Z` commit on `main` and its tag. The tag push triggers the GHCR multi-arch image build (and `:latest`). Deploy is manual. +- **Hotfixes** outside the calendar are for security problems, data loss and broken installs only. They branch from `main` as `hotfix/vX.Y.Z`, carry one fix, and the publish workflow waits for the maintainer's approval. - Never force-push `main` or any release branch. -End users: track the latest `v*` tag (or `:latest` on GHCR). The `main` branch always equals the latest release. +End users: track the latest `v*` tag (or `:latest` on GHCR). `main` carries fixes that are merged but not yet released, so do not deploy `main` itself; the `:edge` image is there to check a fix before its release. -Contributors: branch off `main`; PRs target `main`. +Contributors: branch off `main` for a fix and target `main`; branch off the current `release/vX.Y.0` for a feature and target it. Not sure which one? Open the PR against `main` and the check will say. ## Pull Requests 1. Fork the repository -2. Create a feature branch off `main` (`git checkout -b feat/your-feature main`) +2. Create a branch: a fix off `main` (`git checkout -b fix/your-fix main`), a feature off the current `release/vX.Y.0` 3. Make your changes 4. Ensure all checks pass (`pnpm typecheck && pnpm lint && pnpm test && pnpm format:check && pnpm build`) -5. Submit a PR against `main` with a clear description of the changes +5. Submit a PR against `main` (fix) or the release branch (feature) with a clear description of the changes ## Translations @@ -189,7 +190,7 @@ Fink covers browser editing today. It edits the files in this repository directl ## Code of Conduct -This project follows the [Contributor Covenant 2.1](CODE_OF_CONDUCT.md). By participating, you agree to uphold its standards. Reports of unacceptable behavior go to `conduct@bombeck.io`. +This project follows the [Contributor Covenant 2.1](CODE_OF_CONDUCT.md). By participating, you agree to uphold its standards. Reports of unacceptable behavior go to `conduct@healthlog.dev`. ## Security diff --git a/Dockerfile b/Dockerfile index bc313c3807..deea66c434 100644 --- a/Dockerfile +++ b/Dockerfile @@ -95,49 +95,42 @@ RUN node scripts/verify-message-catalogs.mjs --dir messages \ # and the runner copies `/opt/prisma-cli` over, so npm never reaches the # runtime image. # -# The `allowScripts` field is for npm 12 and later, which runs no dependency -# install scripts unless package.json lists the package there. Three packages -# here have one: `@prisma/engines` downloads the schema engine `migrate -# deploy` runs, `prisma` checks its environment, and `esbuild` (under tsx) -# checks its binary. The npm in this image still runs them without the field; -# keeping it means a later npm major cannot drop the schema engine quietly. -# Either way the runner asks for the engine file after the copy. +# The install is `npm ci` against the committed `docker/prisma-cli/package.json` +# and `package-lock.json`: every package in the tree arrives at the version and +# integrity hash the lockfile records, and `npm ci` refuses to start when the +# two files disagree. Bump a version there, regenerate the lockfile on this +# base image (`npm install --package-lock-only --omit=dev` inside +# `docker/prisma-cli`), and commit both. Dependabot watches that directory. +# The CLI versions move with the app's `prisma` and `dotenv` entries in +# `package.json`; `scripts/__tests__/release-workflows.test.ts` holds that. +# +# The `allowScripts` field in that package.json is for npm 12 and later, +# which runs no dependency install scripts unless package.json lists the +# package there. Three packages here have one: `@prisma/engines` downloads the +# schema engine `migrate deploy` runs, `prisma` checks its environment, and +# `esbuild` (under tsx) checks its binary. The npm in this image still runs +# them without the field; keeping it means a later npm major cannot drop the +# schema engine quietly. Either way the runner asks for the engine file after +# the copy. # # This install belongs to npm, not pnpm, so the `overrides` block in # `pnpm-workspace.yaml` does not reach it: a package pinned there for the app # tree still arrives here at whatever version Prisma asks for. That is not -# hypothetical. `prisma@7.8.0` resolves `@prisma/config@7.8.0`, which resolves +# hypothetical. `prisma@7.8.0` resolved `@prisma/config@7.8.0`, which resolved # `deepmerge-ts@7.1.5`, and the image scan reported CVE-2026-40345 (HIGH, # stack exhaustion on recursive merges) against `/opt/prisma-cli` on a commit -# whose dependency audit over the app tree was green. Two installs, two -# override mechanisms, one of them set. `overrides` is npm's own mechanism and -# `npm pkg set` writes it into the package.json that `npm init -y` just -# created, before anything resolves. -# -# Measured by rebuilding this exact install both ways: without the field -# `deepmerge-ts@7.1.5` lands, with it `8.0.1` lands and `prisma --version` -# still reports 7.8.0. Keep the range in step with the entry in -# `pnpm-workspace.yaml` — they are one decision applied to two package -# managers, and a fix that lands in only one of them is the defect above. -# -# The same class recurred on 2026-09-02: the image scan reported -# `@hono/node-server@1.19.11` (GHSA-frvp-7c67-39w9, CVE-2026-39406) and -# `valibot@1.2.0` (CVE-2026-59952) under this path, both reached through -# `prisma -> @prisma/dev`, while the app tree carried 1.19.17 and a pin the -# npm install never reads. Rebuilding this install both ways confirms it: -# without the two fields below npm resolves 1.19.11 and 1.2.0, with them it -# resolves 1.19.17 and 1.4.2, and `prisma --version` still reports 7.8.0. +# whose dependency audit over the app tree was green. The same class recurred +# on 2026-09-02 with `@hono/node-server@1.19.11` (GHSA-frvp-7c67-39w9, +# CVE-2026-39406) and `valibot@1.2.0` (CVE-2026-59952), both reached through +# `prisma -> @prisma/dev`. So the stage's package.json carries its own +# `overrides`, and each range there stays in step with the entry in +# `pnpm-workspace.yaml`: they are one decision applied to two package +# managers, and `dependency-override-lockstep-guard.test.ts` fails when they +# part. FROM node:22-trixie-slim@sha256:68c76cfad89921b927eae28ba21407475e29d0ce450afcdbe70c1532db042b64 AS prisma-cli -RUN mkdir -p /opt/prisma-cli && \ - cd /opt/prisma-cli && \ - npm init -y && \ - npm pkg set 'overrides.deepmerge-ts=^8.0.0' && \ - npm pkg set 'overrides.mysql2=^3.22.0' && \ - npm pkg set 'overrides.@hono/node-server=^2.1.3' && \ - npm pkg set 'overrides.valibot=^1.4.2' && \ - npm pkg set 'overrides.effect=^3.22.1' && \ - npm pkg set 'allowScripts.@prisma/engines=true' 'allowScripts.prisma=true' 'allowScripts.esbuild=true' --json && \ - npm install --omit=dev prisma@7.10.1 @prisma/engines@7.10.1 tsx@4.23.1 dotenv@18.0.10 --no-fund --no-audit +WORKDIR /opt/prisma-cli +COPY docker/prisma-cli/package.json docker/prisma-cli/package-lock.json ./ +RUN npm ci --omit=dev --no-fund --no-audit # ── Stage 4: PostgreSQL client ───────────────────────────── # pg_dump and pg_restore of the newest PostgreSQL major this project diff --git a/README.md b/README.md index 20cffd9b60..ddd3d9d8ff 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,13 @@ iOS TestFlight

-HealthLog dashboard in dark theme: a lead sentence on the latest vitals, today's medications, sleep and cycle, the health score ring, worth-a-look cards, and metric tiles with 7-day trends +HealthLog is a health record you run yourself. It collects weight, blood pressure, pulse, glucose, sleep, mood, cycle, labs and medications from the devices and apps you already use, puts them on one timeline, and keeps them in a Postgres database on a NAS, homelab or small VPS of yours. It is a web app you can install on any phone or desktop, with a native iPhone and iPad app beside it. + +It is for people who track their health over years, often with a condition and several devices, and who would rather not hand that history to a vendor cloud. One `docker compose up` starts it, there is no subscription, and you can export everything. + +The [live demo](https://demo.healthlog.dev) is a working install with sample data. Sign in with `demo` / `demo123demo123`. + +The HealthLog dashboard split diagonally between the dark theme (top left) and the light theme (bottom right): today's medications and cycle, the health score ring, worth-a-look cards, and metric tiles with 7-day trends

Timeline: life events, conditions, medications, vaccinations, labs and cycles on one time axis, above blood pressure, weight and resting heart rate Blood pressure insights with the day panel open: what was running that day, its values and scores @@ -36,114 +42,101 @@ Coach: a conversation about the week's recovery, grounded in the recorded data

-## What HealthLog is +## What it does -HealthLog is a self-hosted health tracking app (PWA + native iOS client) that runs from a single `docker compose up` on a NAS, homelab, or small VPS. It brings weight, blood pressure, pulse, blood glucose, body composition, sleep, mood, menstrual cycle, and medications onto one timeline, synced from the devices you already own, and keeps it in a Postgres database on hardware you control. It needs no vendor cloud or subscription and sends no usage telemetry. The few requests the server makes on its own (an update check, a password breach check, an IP geolocation lookup for logins) can each be switched off. +| Area | What is there | +| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Vitals | Weight, blood pressure, pulse, glucose, body composition, SpO₂, respiratory rate, HRV, sleep with a night timeline, workouts, nutrients and energy balance, and metrics you define yourself. Charts use published reference ranges (ESH 2023, ADA 2024) that you can replace with your clinician's targets. | +| Diaries | Mood, symptoms, illness episodes, a seizure diary, cycle tracking with pregnancy and the weeks after a birth, and validated questionnaires (WHO-5, PHQ-9, GAD-7, Sleep Condition Indicator) in their official wording. | +| Health record | Labs typed in or read from a scanned report (you confirm every value before it is saved), vaccinations, allergies, family history, conditions, visits and an encrypted document vault. | +| Medications | Weekly, weekday, interval, as-needed and cyclic schedules, a dose window per dose, and one answer per dose on every device. The list groups by category. Reminders go out over APNs, Telegram, ntfy, Web Push, email or a webhook, with one snooze setting for all of them. | +| Sync and import | Withings, WHOOP, Oura, Polar and Strava over OAuth, Garmin, Google Health (Fitbit, Pixel Watch), Nightscout, Apple Health live from the iOS app or as `export.zip`, Health Connect as a file or fetched from a WebDAV or Nextcloud folder, Gadgetbridge, FHIR R4 bundles from patient portals, FIT and CSV. | +| Sharing | A doctor-report PDF rendered on your server, on demand or filed every month, quarter or year. An emergency card with an offline copy and a QR link. Time-limited clinician share links, a calendar feed for visits and check-ups, a read-only FHIR R4 API and an MCP server. | +| Households | Invites, and managed profiles for someone without a login of their own (a child, a parent) that a guardian keeps, including where that profile's AI comes from. | +| Insights | Health scores, trends and correlations computed on your server without a model. Optionally a daily briefing and a coach that read your data against guideline ranges, with your own OpenAI or Anthropic key, a ChatGPT subscription, or a local model (Ollama, LM Studio, vLLM). | -HealthLog is a personal health record-keeping and wellness tool. It is not a medical device and does not diagnose, treat, cure, or prevent any disease. It helps you log, visualise, and export your own data, and leaves clinical judgement to a clinician. +The app speaks English, German, Spanish, French, Italian, Polish, Korean, Dutch, Brazilian Portuguese and Russian. The [feature tour](https://docs.healthlog.dev/features/) and the [integration guides](https://docs.healthlog.dev/guides/integrations/) have the detail. -Try the [live demo](https://demo.healthlog.dev) to see a working install. Sign in with `demo` / `demo123demo123`. +### What it is not -## Features +HealthLog is not a medical device. It records, charts and exports what you give it, and it does not diagnose, treat or advise treatment; the AI texts say where a value sits, never what you have. It is not a hosted service: there is no HealthLog cloud, no account with us, no ads and no tracking. And it is not built to sell or run a clinic on; the license is noncommercial. -- **Vitals and trends.** Weight, blood pressure, pulse, glucose, body composition, sleep, SpO₂, respiratory rate, mood, and cycle tracking, charted with trends, moving averages, and clinical reference ranges (ESH 2023, ADA 2024) that you can override with the targets your clinician set. Health scores and correlations between your metrics are computed on your server without an AI model. -- **Questionnaires and self-checks.** Optional validated self-checks for mental wellbeing and sleep (WHO-5, PHQ-9, GAD-7 and the Sleep Condition Indicator, in their official wording, with crisis resources when an answer calls for them), grip strength, a pain score from 0 to 10, waist and body measurements, and a longevity lab panel. Each comes from one signal registry, so a new signal reaches charts, correlations, the coach, the FHIR map, and the API together. -- **Allergies, family history, labs and vaccinations.** Allergies and family history are structured records that flow into the doctor report (reactions and notes are encrypted, the substance and condition names are not). Lab values are keyed in or scanned from a printed report: OCR reads the stated values, units, and dates for you to review and confirm before anything is saved. HealthLog transcribes what a report says; it never interprets or diagnoses from it. A vaccination record keeps a lifetime immunization log, doses grouped under the disease they protect against, and prints in the doctor report. -- **Documents.** An opt-in module stores letters, reports, and scans encrypted at rest. PDFs and photos preview inline, Office and text files stay download-only, and nothing a user uploads can execute in the app. One searchable timeline with type, condition, and year filters, drag-and-drop and paste-to-upload, bulk filing, a delete you can undo within 30 days, and per-file and per-account limits the operator sets. -- **Weather and environment.** An environmental module adds weather, daylight, temperature, air quality, and pollen as possible influences (winter darkness and mood, heat and blood pressure), based on a home location you set. It is on by default, and nothing leaves the host until someone sets that location. -- **Devices and integrations.** Withings, WHOOP, Oura, Polar and Strava sync over OAuth2, Garmin through a Personal API key, Google Health connects Fitbit and Pixel Watch through your own Google Cloud client, Nightscout streams CGM glucose, an Apple Health `export.zip` or a Health Connect export folds your full history in, and the native iOS app streams HealthKit live. A per-metric source priority decides which reading is canonical when wearables overlap. -- **Medications.** Flexible schedules (weekly injections, weekday-only, intervals, PRN, cyclic), a configurable intake window per dose, and a dose history where every slot reads taken, late, skipped, or missed. The compliance rate is computed from the same ledger, so the percentage always matches the timeline. -- **AI features (optional).** A daily briefing and a conversational coach grounded in your own measurements and read against cited guideline reference bands: where a value sits and what that means, never a diagnosis. The coach proposes concrete if-then plans you accept or decline, and skips a proactive check-in when there is nothing new to say. Bring your own OpenAI or Anthropic key, or point at a local endpoint (Ollama, LM Studio, vLLM) so AI requests stay on your network. -- **Doctor report and FHIR.** A doctor-report PDF rendered on your server, a read-only HL7 FHIR R4 API, and scoped, time-limited share links you revoke after the visit. -- **Encryption and privacy.** AES-256-GCM encryption at rest for notes and other free text, documents, questionnaire answers, AI-written text and credentials, with zero-downtime key rotation. Measurement values, lab values, medication names and mood scores are stored unencrypted in the database, so the database volume and its backups need the same protection as the host. Passkey login, server-side sessions, strict CSP, and no third-party tracking anywhere. -- **PWA, reminders and languages.** Installable PWA that keeps the open page readable when the connection drops, reminders over APNs, Telegram, ntfy, Web Push, email and a webhook, and a dashboard that stays fast on years of imported history. The app is available in English, German, Spanish, French, Italian, Polish, Korean, Dutch, Brazilian Portuguese and Russian. +## How it works -The full feature tour, integration guides, and API reference live at [docs.healthlog.dev](https://docs.healthlog.dev). +Two containers: the Next.js app, which also runs the background jobs, and Postgres 18. Notes, documents, questionnaire answers, AI texts and every stored credential are encrypted with AES-256-GCM before they reach the database. AI is off until someone configures a provider, and a local endpoint keeps those requests on your network. The iOS app talks to the same API as the browser, and your server stays the only database. The [diagrams](docs/diagrams/README.md) show the data flow, the self-hosting topology and the security model. ## Quick start (Docker Compose) +You need Docker with Compose. On the host: + ```bash git clone https://github.com/MBombeck/HealthLog.git && cd HealthLog cp .env.example .env -# Generate the three secrets (each a 64-char hex string = 32 bytes): +# Three secrets, each 32 random bytes as hex: echo "POSTGRES_PASSWORD=$(openssl rand -hex 32)" >> .env echo "ENCRYPTION_KEY=$(openssl rand -hex 32)" >> .env echo "API_TOKEN_HMAC_KEY=$(openssl rand -hex 32)" >> .env -# Required on a LAN or plain-HTTP host (NAS, homelab, Tailscale), or login fails: +# Only if you open it over plain HTTP (LAN, NAS, Tailscale), or login fails: echo "SESSION_COOKIE_SECURE=false" >> .env docker compose up -d ``` -Open **http://localhost:3000** (or `http://:3000`). The first registered user becomes admin. The compose file pulls a pre-built multi-arch image (`amd64` + `arm64`) from [GHCR](https://github.com/MBombeck/HealthLog/pkgs/container/healthlog); no build step required. +Open `http://:3000`. The first account you register becomes the admin, and onboarding walks you through the rest. The image comes pre-built for `amd64` and `arm64` from [GHCR](https://github.com/MBombeck/HealthLog/pkgs/container/healthlog). `curl -s http://localhost:3000/api/version` shows which version is running. -Verify the running version: - -```bash -curl -s http://localhost:3000/api/version # returns version + buildSha + builtAt -``` +Keep a copy of `ENCRYPTION_KEY` somewhere other than this host. Without it the encrypted data cannot be read, and a database backup does not contain it. -`SESSION_COOKIE_SECURE=false` is the one setting plain-HTTP self-hosts must set: without it the session cookie carries the `Secure` flag, the browser drops it over HTTP, and login silently fails. Leave it unset (or `true`) only when a TLS reverse proxy serves HTTPS, and in that case set `NEXT_PUBLIC_APP_URL` and `APP_URL` to the public URL first (see the [self-hosting guide](https://docs.healthlog.dev/getting-started/self-host-in-10-minutes/)). +Behind a TLS reverse proxy (Caddy, Traefik, Nginx, Coolify), leave `SESSION_COOKIE_SECURE` unset and set `NEXT_PUBLIC_APP_URL` and `APP_URL` to the public address. The [self-hosting guide](https://docs.healthlog.dev/getting-started/self-host-in-10-minutes/) covers that, and Unraid, Portainer and TrueNAS have [their own pages](https://docs.healthlog.dev/self-hosting/portainer-and-unraid/). Every variable is in the [environment reference](https://docs.healthlog.dev/reference/environment-variables/). -Persistent state lives in the database volume (`postgres-data`) and in `backups`, which holds the nightly database dumps; the app container is stateless. An install from v1.45 or earlier moves its Postgres 16 database from `pgdata` into the new volume on the first start ([details](docs/ops/postgres-major-upgrade.md)); recovering a lost server is in [disaster-recovery.md](docs/ops/disaster-recovery.md). +Your data lives in the `postgres-data` volume. The app takes a database dump every night and before every migration into the `backups` volume, and can also send encrypted backups to an S3-compatible bucket. [Backups](https://docs.healthlog.dev/guides/backups/) explains both and how to restore. -NAS and homelab users have ready-made paths: [Unraid Community Applications](docs/self-hosting/unraid.md), [Portainer app templates](docs/self-hosting/portainer/README.md) and [TrueNAS](docs/self-hosting/truenas.md) (the Community train app is pending catalog review). +## Updating -## Self-hosting +From 1.49.0 on, releases follow a calendar: a feature release on the first Saturday of every month, fixes on the other Saturdays when there are any. Only a security problem, data loss or a broken install gets a release in between. `:latest` is the newest release; `:edge` is built from every push to `main` (amd64 only) for anyone who wants a fix before its Saturday. -One container hosts both the web server and the job worker by default; split them via `HEALTHLOG_PROCESS_TYPE=web|worker` for horizontal scale. Encrypted nightly backups to any S3-compatible bucket are opt-in through five `BACKUP_*` environment variables (the admin panel shows their status), new users join by invite link or QR code, and the stack works out of the box behind Caddy, Traefik, Nginx, or [Coolify](https://coolify.io/). +To update, take a backup, run `docker compose pull && docker compose up -d`, and check `/api/version`. Migrations run on start and only go forward. Read the [release notes](https://github.com/MBombeck/HealthLog/releases) first, and see [Updates and deploy](https://docs.healthlog.dev/guides/updates-and-deploy/) for pinning a version and going back. The full rule is in [docs/contributing/release-policy.md](docs/contributing/release-policy.md). -HealthLog ships often. Pin a tag, back up before upgrades, and read the [release notes](https://github.com/MBombeck/HealthLog/releases) before pulling `latest`. The operator manual (reverse proxy, migrations, encryption-key rotation, backup and restore) lives at [docs.healthlog.dev](https://docs.healthlog.dev). +## Privacy and security -## Native iOS app +HealthLog sends no telemetry. The server makes three requests on its own (an update check, a password breach check and a geolocation lookup for sign-ins), and each can be switched off. Anything else leaving the host is something you set up: a sync, an AI provider, a weather location, the push relay. Measurement values, lab values, medication names and mood scores are stored unencrypted so the server can chart and search them, so the database volume and its backups need the same care as the host. Sign-in works with passkeys and a second factor or through your own OIDC provider, sessions stay on the server, and you get a notification when a passkey, token or device changes. The [security overview](https://docs.healthlog.dev/security/overview/) has the rest, and [SECURITY.md](SECURITY.md) says how to report a vulnerability. -A SwiftUI companion on the [App Store](https://apps.apple.com/app/id6769501341), built on the same API as the web client: live HealthKit two-way sync, medication reminders with action buttons that work without opening the app, and an on-device coach on Apple-Intelligence-capable iPhones. Code lives in [MBombeck/healthlog-iOS](https://github.com/MBombeck/healthlog-iOS). +## iPhone and iPad -The App Store listing carries a small price, which exists to cover Apple's yearly developer fee rather than to earn anything; write to marc@healthlog.dev for a free code if that price is in your way. [TestFlight](https://testflight.apple.com/join/bucuTBpa) stays free and carries the newest builds, and the source builds on your own machine. +The [HealthLog Companion App](https://apps.apple.com/app/id6769501341) is on the App Store, built on the same API as the web app: two-way Apple Health sync, medication reminders you can answer from the lock screen, and an on-device coach on iPhones with Apple Intelligence. The source is at [MBombeck/healthlog-iOS](https://github.com/MBombeck/healthlog-iOS). -## Tech stack +App 1.7 is in [TestFlight](https://testflight.apple.com/join/bucuTBpa) and moves to the App Store once it has been tested against server 1.49.0. It adds an iPad layout with a sidebar, a timeline with a lane each for medications, symptoms, seizures, labs and measurements, and Spanish. It also works with the optional push relay. Apple only delivers pushes to the App Store app when they are signed with the publisher's key, which a self-hosted server does not have. The relay fills that gap: your server seals each notification for one device, the relay passes it to Apple and cannot read it. It is run by the project on donations, free for private and household use, off until an admin turns it on, and open source at [MBombeck/healthlog-push](https://github.com/MBombeck/healthlog-push). The [push relay guide](https://docs.healthlog.dev/guides/push-relay/) and the relay's [privacy notice](https://push.healthlog.dev/privacy) list what it sees. -Next.js 16 (App Router, React Server Components), TypeScript strict, PostgreSQL 18 with Prisma, pg-boss for jobs, Tailwind CSS 4 + shadcn/ui, Recharts, WebAuthn passkeys, Vitest + Playwright, multi-stage Docker image on the official Node 22 Debian slim base. The OpenAPI 3.1 contract for native clients is generated from the Zod schemas at [`docs/api/openapi.yaml`](docs/api/openapi.yaml). +The App Store price is there to cover Apple's yearly developer fee. TestFlight is free and gets new builds first, and you can build the app from source. -## Documentation +## Help and contributing -| | | -| ---------------------- | --------------------------------------------------------------- | -| User and operator docs | [docs.healthlog.dev](https://docs.healthlog.dev) | -| Release history | [Release notes](https://github.com/MBombeck/HealthLog/releases) | -| API contract | [`docs/api/openapi.yaml`](docs/api/openapi.yaml) | -| Security policy | [SECURITY.md](SECURITY.md) | -| Contributing | [CONTRIBUTING.md](CONTRIBUTING.md) | -| Translating | [CONTRIBUTING.md#translations](CONTRIBUTING.md#translations) | +Questions go to [Discussions](https://github.com/MBombeck/HealthLog/discussions), bugs to [Issues](https://github.com/MBombeck/HealthLog/issues). [Reporting a problem](https://docs.healthlog.dev/support/) shows how to copy the redacted support info that makes a report useful. Pull requests are welcome; [CONTRIBUTING.md](CONTRIBUTING.md) covers the setup, the branch model and [translations](CONTRIBUTING.md#translations). The API contract for clients is [`docs/api/openapi.yaml`](docs/api/openapi.yaml). -## Status +Anything that does not fit a public thread can go to `hello@healthlog.dev`; security problems go to `security@healthlog.dev` as described in [SECURITY.md](SECURITY.md). -Actively developed, with frequent releases. Issue reports and pull requests are welcome. Behaviour and schema can change between versions; migrations are forward-only. +If HealthLog is useful to you, [GitHub Sponsors](https://github.com/sponsors/MBombeck) and [Buy Me a Coffee](https://buymeacoffee.com/mbombeck) pay for the servers, the push relay and the Apple developer account. ## Thanks HealthLog started as something I built for myself. That it has turned into a project other people use, care about and help shape still surprises me, and I am grateful for every part of it. -Thank you to everyone who sent code that shipped: [@TimonBed](https://github.com/TimonBed), [@Antiheld86](https://github.com/Antiheld86), [@BernhardBuckel](https://github.com/BernhardBuckel), [@balajiv113](https://github.com/balajiv113), [@aucun6352](https://github.com/aucun6352), [@mathewcsims](https://github.com/mathewcsims) and [@muhdusama](https://github.com/muhdusama). +Thank you to everyone who sent code that shipped: [@TimonBed](https://github.com/TimonBed), [@Antiheld86](https://github.com/Antiheld86), [@BernhardBuckel](https://github.com/BernhardBuckel), [@balajiv113](https://github.com/balajiv113), [@aucun6352](https://github.com/aucun6352), [@mathewcsims](https://github.com/mathewcsims), [@muhdusama](https://github.com/muhdusama) and [@ferges123](https://github.com/ferges123). Thank you to everyone who opened an issue, asked a question in the discussions or wrote me an email, and especially to [@lutzkind](https://github.com/lutzkind), [@HercoGC](https://github.com/HercoGC), [@mills1975](https://github.com/mills1975), [@sreeramachandramurthy](https://github.com/sreeramachandramurthy), [@CritLoren](https://github.com/CritLoren), [@mbreitkreuz](https://github.com/mbreitkreuz), [@k-nacion](https://github.com/k-nacion), [@NebuPookins](https://github.com/NebuPookins), [@Nazza01](https://github.com/Nazza01), [@Cnote43](https://github.com/Cnote43) and [@juliaanvaneijndt](https://github.com/juliaanvaneijndt), whose reports shaped HealthLog again and again. Most of what got better in the last months started with someone describing what went wrong for them, often with a log, a screenshot and a second try when the first fix was not enough. -And thank you to everyone who supported the project with a coffee or by buying the iPhone app. I don't name anyone here, but I read every message that comes with it. It pays for the servers and the Apple developer account, and it tells me that HealthLog is worth the evenings. +And thank you to everyone who supported the project with a coffee or by buying the iPhone app. I don't name anyone here, but I read every message that comes with it. It tells me that HealthLog is worth the evenings. Contributors to HealthLog -Every merged pull request keeps its author's name on the commit, so the -[contributor graph](https://github.com/MBombeck/HealthLog/graphs/contributors) -is the full list. Release notes name the people whose work is in that release, -including anyone who found the defect without sending the fix. +Every merged pull request keeps its author's name on the commit, so the [contributor graph](https://github.com/MBombeck/HealthLog/graphs/contributors) is the full list. Release notes name the people whose work is in that release, including anyone who found the defect without sending the fix. ## License -HealthLog is licensed under the [PolyForm Noncommercial License 1.0.0](LICENSE): free to use, self-host, and modify for noncommercial purposes. Commercial use requires a separate agreement; open an issue or reach out via [healthlog.dev](https://healthlog.dev). Releases up to and including v1.15.18 were published under AGPL-3.0 and remain available under that license. +HealthLog is licensed under the [PolyForm Noncommercial License 1.0.0](LICENSE): free to use, self-host and modify for noncommercial purposes. Commercial use needs a separate agreement; open an issue or get in touch through [healthlog.dev](https://healthlog.dev). Releases up to and including v1.15.18 were published under AGPL-3.0 and remain available under that license. The push relay is a separate project under Apache-2.0. --- diff --git a/SECURITY.md b/SECURITY.md index 5210c4ba89..0d7b22a999 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -15,7 +15,7 @@ If you discover a security vulnerability, please report it responsibly. **Do not open a public GitHub issue for security vulnerabilities.** -Instead, send an email to **security@bombeck.io** with: +Instead, send an email to **security@healthlog.dev** with: - A description of the vulnerability - Steps to reproduce @@ -28,6 +28,8 @@ Instead, send an email to **security@bombeck.io** with: - **Initial assessment**: Within 1 week - **Fix and disclosure**: Coordinated with reporter, typically within 30 days +A high or critical security fix does not wait for the release calendar. It ships as an out-of-schedule patch release as soon as it is ready, with a GitHub Security Advisory published alongside; lower ratings ship with the next Saturday patch. See [docs/contributing/release-policy.md](docs/contributing/release-policy.md). + ## Scope The following are in scope: @@ -68,8 +70,35 @@ HealthLog Docker images are built and published from this repository's CI: - **Registry**: [`ghcr.io/mbombeck/healthlog`](https://github.com/MBombeck/HealthLog/pkgs/container/healthlog) - **Architectures**: `linux/amd64` and `linux/arm64` - **Provenance attestation**: each image carries a [SLSA build provenance](https://slsa.dev/spec/v1.0/provenance) statement linking it back to the GitHub Actions run, the commit SHA, and the workflow definition +- **Signature**: the multi-arch image index is signed keyless with [cosign](https://docs.sigstore.dev/) by the release workflow; no long-lived signing key exists +- **Release assets** (from v1.49.0): every GitHub release carries `healthlog--image.txt` (the image refs with the index and per-platform digests), its Sigstore bundle `healthlog--image.sigstore.json`, and SLSA v1 provenance `healthlog-.intoto.jsonl` - **SBOM**: each image includes a [Software Bill of Materials](https://docs.docker.com/build/metadata/attestations/sbom/) you can inspect with `docker buildx imagetools inspect ghcr.io/mbombeck/healthlog:latest --format '{{ json .SBOM }}'` To pin to a specific version in production, replace `:latest` with the released tag in your `docker-compose.yml`, e.g. `ghcr.io/mbombeck/healthlog:1.3.2`. Pinning is recommended for self-hosters who want explicit control over upgrades. +### Verifying a release + +```sh +TAG=v1.49.0 +gh release download "$TAG" --repo MBombeck/HealthLog --pattern "healthlog-$TAG*" + +cosign verify-blob \ + --bundle "healthlog-$TAG-image.sigstore.json" \ + --certificate-identity-regexp '^https://github\.com/MBombeck/HealthLog/\.github/workflows/docker-publish\.yml@refs/tags/v' \ + --certificate-oidc-issuer https://token.actions.githubusercontent.com \ + "healthlog-$TAG-image.txt" + +slsa-verifier verify-artifact "healthlog-$TAG-image.txt" \ + --provenance-path "healthlog-$TAG.intoto.jsonl" \ + --source-uri github.com/MBombeck/HealthLog \ + --source-tag "$TAG" + +cosign verify \ + --certificate-identity-regexp '^https://github\.com/MBombeck/HealthLog/\.github/workflows/docker-publish\.yml@refs/tags/v' \ + --certificate-oidc-issuer https://token.actions.githubusercontent.com \ + "$(awk '$2 == "index" { print $1; exit }' "healthlog-$TAG-image.txt")" +``` + +The last command checks the image the manifest names, pinned by its digest. Older releases have no assets; verify their image with `cosign verify` alone. Details: [docs/ops/deploy.md](docs/ops/deploy.md#verify-a-release-from-its-assets). + If you discover a tampered or unexpected image, please report it as a vulnerability via the email above. diff --git a/bundle-budget.json b/bundle-budget.json index 0e8a81072c..cb592693b2 100644 --- a/bundle-budget.json +++ b/bundle-budget.json @@ -1,125 +1,128 @@ { - "$comment": "Client-bundle budgets, enforced by scripts/check-bundle-budget.mjs --check after `pnpm build` in CI; the script header describes the method. Numbers are KB gzip. routeBaselineKbGz is the measured first load of every page (the shared rootMainFiles plus the page's client-reference chunks, each file counted once by content hash), written with --write-baselines; a page fails when it is more than routeDriftAllowanceKbGz over its baseline, and a page without a baseline fails until one is written in the same change. firstLoadP95KbGz and firstLoadMaxKbGz cap the distribution across pages. uniqueClientKbGz caps the distinct client code: every module counted once by its module id, the lazy message catalogs excluded. maxCatalogKbGz holds each catalog, maxRechartsChunks the one shared chart chunk. The summed-chunk aggregate the gate used up to v1.44.0 (3875 KB there, capped at 3900) is still printed but no longer gated: it counted a module once per chunk group it landed in, so it rose whenever a page moved code into on-demand chunks and needed a raise in most releases while no reader downloaded more. Re-based at v1.45.0 from the v1.44.0 build, measured on a local arm64 machine: 110 pages, first load p50 336, p95 437, max 451 KB; unique client code 1904 KB in 1224 modules. The five pages watched before keep their numbers within a kilobyte (/ 359, /measurements 339, /insights/mood 337, /insights 323, /settings/[section] 311), and the metric pages that no watched route covered before are gated now too (/insights/weight 339, /insights/pulse 339). Caps: p95 447 and max 461 KB (10 KB over the measurement), unique client code 1930 KB (about 25 KB, roughly two releases of new client code). A raise or a re-base is a reviewed change with the measured numbers and the reason written here; earlier re-bases are in the history of this file. v1.47.0 raised maxCatalogKbGz from 210 to 250 for the Russian catalog: Cyrillic is two bytes per letter in UTF-8, so the same key set is 1.12 MB raw against about 0.8 MB for the Latin-script locales, 240 KB gz as an emitted chunk where the largest Latin one is under 210. A reader downloads one catalog, once; nothing else in the budget moved. v1.48.0 raised maxCatalogKbGz from 250 to 275: the release adds the seizure diary, the nutrient catalogue and the per-task provider chains to every locale, and the Russian catalog measured 256 KB gz in the CI build (the largest Latin-script one stays under 240). Still one catalog per reader, loaded once. The two new pages got their baselines from the same CI measurement: /seizures 346 and /auth/native-return 289.", + "$comment": "Client-bundle budgets, enforced by scripts/check-bundle-budget.mjs --check after `pnpm build` in CI; the script header describes the method. Numbers are KB gzip. routeBaselineKbGz is the measured first load of every page (the shared rootMainFiles plus the page's client-reference chunks, each file counted once by content hash), written with --write-baselines; a page fails when it is more than routeDriftAllowanceKbGz over its baseline, and a page without a baseline fails until one is written in the same change. firstLoadP95KbGz and firstLoadMaxKbGz cap the distribution across pages. uniqueClientKbGz caps the distinct client code: every module counted once by its module id, the lazy message catalogs excluded. maxCatalogKbGz holds each catalog, maxRechartsChunks the one shared chart chunk. The summed-chunk aggregate the gate used up to v1.44.0 (3875 KB there, capped at 3900) is still printed but no longer gated: it counted a module once per chunk group it landed in, so it rose whenever a page moved code into on-demand chunks and needed a raise in most releases while no reader downloaded more. Re-based at v1.45.0 from the v1.44.0 build, measured on a local arm64 machine: 110 pages, first load p50 336, p95 437, max 451 KB; unique client code 1904 KB in 1224 modules. The five pages watched before keep their numbers within a kilobyte (/ 359, /measurements 339, /insights/mood 337, /insights 323, /settings/[section] 311), and the metric pages that no watched route covered before are gated now too (/insights/weight 339, /insights/pulse 339). Caps: p95 447 and max 461 KB (10 KB over the measurement), unique client code 1930 KB (about 25 KB, roughly two releases of new client code). A raise or a re-base is a reviewed change with the measured numbers and the reason written here; earlier re-bases are in the history of this file. v1.47.0 raised maxCatalogKbGz from 210 to 250 for the Russian catalog: Cyrillic is two bytes per letter in UTF-8, so the same key set is 1.12 MB raw against about 0.8 MB for the Latin-script locales, 240 KB gz as an emitted chunk where the largest Latin one is under 210. A reader downloads one catalog, once; nothing else in the budget moved. v1.48.0 raised maxCatalogKbGz from 250 to 275: the release adds the seizure diary, the nutrient catalogue and the per-task provider chains to every locale, and the Russian catalog measured 256 KB gz in the CI build (the largest Latin-script one stays under 240). Still one catalog per reader, loaded once. The two new pages got their baselines from the same CI measurement: /seizures 346 and /auth/native-return 289. v1.49.0 raised uniqueClientKbGz from 1930 to 1962: the CI build of the release measured 1937 KB gz in 1331 distinct modules (1224 at the v1.45.0 re-base), four releases of new client code against the two the cap was sized for; the new cap again leaves about 25 KB. The distribution kept falling meanwhile (p95 437 to 386, max 451 to 408 KB). The two new pages got their baselines from the same CI measurement: /emergency-card 332 and /e/[token] 288. Later in 1.49.0 /e/[token] became a route that answers a self-contained document with no client code at all, so its page baseline is gone. The streams that landed after that cap took the CI build of d7a4d19ad to 1965.4 KB gz of distinct client code and the Russian catalog to 282 KB gz, both over their caps. Measured on a local arm64 build against the commit of the 1962 cap (86b9d1a34) with the Turbopack analyzer: plus 34 KB gz of src client code in about sixty modules, none over 1.6 KB gz (the server setup steps, the admin setup-health, notification-health and migrations cards, the relay question, dialog, check and handoff, the medication leaflet section and medicine registry card, the regrouped navigation), no new dependency and no npm package grown, styled-jsx gone (minus 2.7 KB); the catalogs grew by 369 keys and 384 rewritten strings in every locale, none orphaned (i18n-reverse-coverage). Lazy-loading does not lower this number (each module counts once wherever it loads), and the code is the release's own, so 1.49.0 raises uniqueClientKbGz from 1962 to 1990 (about 25 KB over the CI measurement again) and maxCatalogKbGz from 275 to 300 (the largest Latin-script catalog, Polish, measures about 246). The distribution held: p95 391 and max 419 KB locally, against caps of 447 and 461.", "routeDriftAllowanceKbGz": 20, "firstLoadP95KbGz": 447, "firstLoadMaxKbGz": 461, - "uniqueClientKbGz": 1930, + "uniqueClientKbGz": 1990, "maxRechartsChunks": 1, - "maxCatalogKbGz": 275, + "maxCatalogKbGz": 300, "routeBaselineKbGz": { - "/_global-error/page": 133, - "/_not-found/page": 282, - "/about/page": 282, - "/achievements/page": 292, - "/admin/[section]/page": 451, - "/admin/page": 297, - "/auth/claim/page": 298, - "/auth/login/page": 290, + "/_global-error/page": 134, + "/_not-found/page": 288, + "/about/page": 288, + "/achievements/page": 297, + "/admin/[section]/page": 409, + "/admin/page": 302, + "/auth/claim/page": 303, + "/auth/login/page": 296, "/auth/native-return/page": 289, - "/auth/register/page": 288, - "/c/[token]/page": 284, - "/checkups/page": 365, - "/checkups/practitioners/page": 289, - "/claim/[token]/page": 282, - "/coach/conversations/page": 294, - "/coach/page": 355, - "/coach/plans/page": 288, - "/confirm-access/page": 287, - "/custom-metrics/[id]/page": 303, - "/custom-metrics/[id]/values/page": 311, - "/cycle/page": 412, - "/documents/deleted/page": 291, - "/documents/page": 378, - "/enroll-mfa/page": 305, - "/illness/[id]/page": 447, - "/illness/page": 421, - "/insights/active-energy/page": 336, + "/auth/register/page": 294, + "/c/[token]/view/page": 290, + "/checkups/page": 373, + "/checkups/practitioners/page": 295, + "/claim/[token]/page": 288, + "/coach/conversations/page": 299, + "/coach/page": 362, + "/coach/plans/page": 293, + "/confirm-access/page": 293, + "/custom-metrics/[id]/page": 309, + "/custom-metrics/[id]/values/page": 317, + "/cycle/page": 368, + "/documents/deleted/page": 294, + "/documents/page": 387, + "/emergency-card/page": 333, + "/enroll-mfa/page": 310, + "/illness/[id]/page": 394, + "/illness/page": 370, + "/insights/active-energy/page": 337, "/insights/audio-events/page": 337, "/insights/blood-glucose/page": 340, - "/insights/blood-pressure/page": 336, + "/insights/blood-pressure/page": 340, "/insights/bmi/page": 331, - "/insights/body-fat/page": 336, - "/insights/body-temperature/page": 336, - "/insights/body-water/page": 336, - "/insights/bone-mass/page": 336, + "/insights/body-fat/page": 337, + "/insights/body-temperature/page": 337, + "/insights/body-water/page": 337, + "/insights/bone-mass/page": 337, "/insights/breathing-disturbances/page": 337, - "/insights/cardio-fitness/page": 336, + "/insights/cardio-fitness/page": 337, "/insights/cardio-recovery/page": 337, - "/insights/catalog/page": 317, - "/insights/daylight/page": 336, - "/insights/double-support-time/page": 336, - "/insights/ecg/[id]/page": 316, - "/insights/ecg/page": 316, + "/insights/catalog/page": 319, + "/insights/daylight/page": 337, + "/insights/double-support-time/page": 337, + "/insights/ecg/[id]/page": 317, + "/insights/ecg/page": 317, "/insights/environmental-audio/page": 337, - "/insights/falls/page": 336, - "/insights/fat-free-mass/page": 336, - "/insights/fat-mass/page": 336, - "/insights/flights-climbed/page": 336, + "/insights/falls/page": 337, + "/insights/fat-free-mass/page": 337, + "/insights/fat-mass/page": 337, + "/insights/flights-climbed/page": 337, "/insights/grip-strength/page": 337, - "/insights/headphone-audio/page": 336, - "/insights/health-score/page": 315, - "/insights/hrv/page": 337, - "/insights/ketones/page": 339, - "/insights/lean-body-mass/page": 336, - "/insights/medications/page": 338, - "/insights/mood/page": 337, + "/insights/headphone-audio/page": 337, + "/insights/health-score/page": 316, + "/insights/hrv/page": 338, + "/insights/ketones/page": 338, + "/insights/lean-body-mass/page": 337, + "/insights/medications/page": 339, + "/insights/mood/page": 338, "/insights/muscle-mass/page": 337, - "/insights/nutrients/page": 319, + "/insights/nutrients/page": 326, "/insights/oxygen/page": 337, - "/insights/page": 323, - "/insights/pain/page": 336, - "/insights/pulse-wave-velocity/page": 336, + "/insights/page": 324, + "/insights/pain/page": 337, + "/insights/pulse-wave-velocity/page": 337, "/insights/pulse/page": 339, - "/insights/recovery/page": 330, - "/insights/respiratory-rate/page": 336, - "/insights/resting-pulse/page": 337, - "/insights/scores/[metric]/page": 328, - "/insights/six-minute-walk/page": 336, + "/insights/recovery/page": 331, + "/insights/respiratory-rate/page": 337, + "/insights/resting-pulse/page": 338, + "/insights/scores/[metric]/page": 329, + "/insights/six-minute-walk/page": 337, "/insights/skin-temperature/page": 338, - "/insights/sleep/page": 337, - "/insights/sources/page": 321, - "/insights/stair-ascent-speed/page": 336, - "/insights/stair-descent-speed/page": 336, - "/insights/step-length/page": 336, + "/insights/sleep/page": 339, + "/insights/sources/page": 323, + "/insights/stair-ascent-speed/page": 337, + "/insights/stair-descent-speed/page": 337, + "/insights/step-length/page": 337, "/insights/steps/page": 337, - "/insights/values/[type]/page": 350, + "/insights/values/[type]/page": 352, "/insights/vascular-age/page": 337, - "/insights/visceral-fat/page": 336, - "/insights/waist-to-height/page": 336, - "/insights/waist/page": 336, - "/insights/walking-asymmetry/page": 336, - "/insights/walking-distance/page": 336, + "/insights/visceral-fat/page": 337, + "/insights/waist-to-height/page": 337, + "/insights/waist/page": 337, + "/insights/walking-asymmetry/page": 337, + "/insights/walking-distance/page": 337, "/insights/walking-heart-rate/page": 337, - "/insights/walking-speed/page": 336, - "/insights/walking-steadiness/page": 336, + "/insights/walking-speed/page": 337, + "/insights/walking-steadiness/page": 337, "/insights/weight/page": 339, - "/insights/workouts/[id]/page": 437, - "/insights/workouts/page": 437, - "/insights/wrist-temperature/page": 336, - "/invite/[token]/page": 282, - "/labs/[biomarkerId]/page": 327, - "/labs/[biomarkerId]/values/page": 335, - "/labs/page": 423, - "/measurements/page": 339, - "/medications/[id]/history/page": 283, - "/medications/[id]/page": 402, - "/medications/new/page": 282, - "/medications/page": 355, - "/mental-wellbeing/page": 297, - "/mood/page": 438, - "/notifications/page": 289, - "/onboarding/[step]/page": 445, - "/onboarding/handover/page": 295, - "/onboarding/page": 286, - "/page": 359, - "/privacy/page": 282, - "/profile/page": 285, - "/seizures/page": 346, - "/settings/[section]/page": 311, - "/settings/layout/[module]/page": 380, - "/settings/modules/[module]/page": 374, - "/settings/page": 282, - "/timeline/page": 331, - "/vaccinations/page": 327 + "/insights/workouts/[id]/page": 382, + "/insights/workouts/page": 378, + "/insights/wrist-temperature/page": 337, + "/invite/[token]/page": 288, + "/labs/[biomarkerId]/page": 338, + "/labs/[biomarkerId]/values/page": 339, + "/labs/page": 379, + "/measurements/page": 347, + "/medications/[id]/history/page": 288, + "/medications/[id]/page": 408, + "/medications/new/page": 288, + "/medications/page": 366, + "/mental-wellbeing/page": 307, + "/mood/page": 382, + "/notifications/page": 294, + "/onboarding/[step]/page": 397, + "/onboarding/handover/page": 300, + "/onboarding/page": 292, + "/onboarding/server/[step]/page": 318, + "/onboarding/server/page": 290, + "/page": 368, + "/privacy/page": 288, + "/profile/page": 291, + "/seizures/page": 348, + "/settings/[section]/page": 316, + "/settings/layout/[module]/page": 387, + "/settings/modules/[module]/page": 378, + "/settings/page": 288, + "/timeline/page": 341, + "/vaccinations/page": 330 } } diff --git a/docker-compose.yml b/docker-compose.yml index 29a7284e4c..ba5c901137 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -272,6 +272,10 @@ x-healthlog-env: &healthlog_env # "http://dawarich.lan:3000"). Without it a LAN/private Dawarich URL is # refused as an SSRF target; a public instance needs nothing here. DAWARICH_PRIVATE_ORIGINS: "${DAWARICH_PRIVATE_ORIGINS:-}" + # WebDAV / Nextcloud servers on your own network that the scheduled Health + # Connect fetch may reach, comma-separated exact origins (e.g. + # "https://cloud.lan"); a public server needs nothing here. + HEALTH_CONNECT_WEBDAV_PRIVATE_ORIGINS: "${HEALTH_CONNECT_WEBDAV_PRIVATE_ORIGINS:-}" # Webhook (Gotify, Home Assistant, n8n) and ntfy targets on your own # network, comma-separated exact origins (e.g. "https://gotify.example.com, # http://ntfy.lan:8080"). Without it a target that resolves to a private @@ -441,6 +445,17 @@ x-healthlog-env: &healthlog_env # Set "true" only if your own iOS build carries Apple's Critical Alerts # entitlement; otherwise urgent alerts use the time-sensitive level. APNS_CRITICAL_ENTITLEMENT: "${APNS_CRITICAL_ENTITLEMENT:-}" + # Push relay for the App Store app (docs/integrations/push-relay.md). + # PUSH_RELAY_MODE "off" hides the admin switch and the one-time notice; + # unset or "allowed" leaves the choice to the admin. PUSH_RELAY_URL and + # PUSH_RELAY_KEYS point a server at a relay other than the hosted one. + PUSH_RELAY_MODE: "${PUSH_RELAY_MODE:-}" + PUSH_RELAY_URL: "${PUSH_RELAY_URL:-}" + PUSH_RELAY_KEYS: "${PUSH_RELAY_KEYS:-}" + # PUSH_RELAY_LIVE_ACTIVITY "on" lets Live Activity start and update go over + # the relay for devices whose owner gave the separate Live Activity consent; + # off by default until the app's device test passed. + PUSH_RELAY_LIVE_ACTIVITY: "${PUSH_RELAY_LIVE_ACTIVITY:-}" # Structured logging. LOG_LEVEL is one of debug/info/warn/error (default # info) — drop to debug while chasing a problem, raise to warn on a busy # instance. LOG_SAMPLE_RATE keeps that fraction of successful events diff --git a/docker/prisma-cli/package-lock.json b/docker/prisma-cli/package-lock.json new file mode 100644 index 0000000000..a17ee1c56a --- /dev/null +++ b/docker/prisma-cli/package-lock.json @@ -0,0 +1,2007 @@ +{ + "name": "healthlog-prisma-cli", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "healthlog-prisma-cli", + "version": "0.0.0", + "license": "UNLICENSED", + "dependencies": { + "@prisma/engines": "7.10.1", + "dotenv": "18.0.10", + "prisma": "7.10.1", + "tsx": "4.23.1" + } + }, + "node_modules/@electric-sql/pglite": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@electric-sql/pglite/-/pglite-0.4.3.tgz", + "integrity": "sha512-ichuWTgtd4mOM1G4SpyGJa5trT03lWbMypDV0fUXUCXg5hiHqVAz/bZyV68NqmkLB7WcYmj1RMJVSp8HV/v/ZQ==", + "license": "Apache-2.0" + }, + "node_modules/@electric-sql/pglite-socket": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@electric-sql/pglite-socket/-/pglite-socket-0.1.3.tgz", + "integrity": "sha512-LAciWM0M1dCL8hlsxu2venbVZcdxema0BtDfpWYVqr+Y468UADw0pFWidhKw1M8sfJ8rdLT71tjMmnirf/IZRQ==", + "license": "Apache-2.0", + "bin": { + "pglite-server": "dist/scripts/server.js" + }, + "peerDependencies": { + "@electric-sql/pglite": "0.4.3" + } + }, + "node_modules/@electric-sql/pglite-tools": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@electric-sql/pglite-tools/-/pglite-tools-0.3.3.tgz", + "integrity": "sha512-AlzLJTRJ8+UFgK8CmxIpyIpJ0+YaFw02IiOSdYrqxwPXdSyeIShz8aa9Tq+tYFXdPwcaMp/Fc80mQZ1dkOQ/wg==", + "license": "Apache-2.0", + "peerDependencies": { + "@electric-sql/pglite": "0.4.3" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz", + "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz", + "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz", + "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz", + "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz", + "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz", + "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz", + "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz", + "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz", + "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz", + "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz", + "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz", + "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==", + "cpu": [ + "loong64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz", + "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==", + "cpu": [ + "mips64el" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz", + "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz", + "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz", + "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz", + "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz", + "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz", + "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz", + "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz", + "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz", + "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz", + "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz", + "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz", + "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz", + "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@prisma/config": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@prisma/config/-/config-7.10.1.tgz", + "integrity": "sha512-+0swF5ELUa3P/9cIR26+gpYjjCbGE0qvEBZhV4zMDkYsrtHjZ884MQbOnWFWXj600N0sSJNnHbtBqe12yDngWg==", + "license": "Apache-2.0", + "dependencies": { + "c12": "3.3.4", + "deepmerge-ts": "8.0.2", + "effect": "3.20.0", + "empathic": "2.0.0" + } + }, + "node_modules/@prisma/debug": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-7.10.1.tgz", + "integrity": "sha512-eFCAkGZ13D/qPg48JBlG5IWi9cSBBOC7oG3abDPcAkYioDWlIjh0YJJLK2J7qo5S+xWWD8I6egAN/8KbCaiMCA==", + "license": "Apache-2.0" + }, + "node_modules/@prisma/dev": { + "version": "0.24.17", + "resolved": "https://registry.npmjs.org/@prisma/dev/-/dev-0.24.17.tgz", + "integrity": "sha512-UvdZzmpFwknnfreh6Jije84ekkYGPYEJhXG1tFzCsCfQyzJifrOo38eZc0qajzvaC6OLUOrN9ML5XfCnEZL9DA==", + "license": "ISC", + "dependencies": { + "@electric-sql/pglite": "0.4.3", + "@electric-sql/pglite-socket": "0.1.3", + "@electric-sql/pglite-tools": "0.3.3", + "@prisma/get-platform": "7.2.0", + "@prisma/query-plan-executor": "7.2.0", + "@prisma/streams-local": "0.1.11", + "find-my-way": "9.7.0", + "foreground-child": "3.3.1", + "get-port-please": "3.2.0", + "pathe": "2.0.3", + "proper-lockfile": "4.1.2", + "remeda": "2.33.4", + "std-env": "3.10.0", + "valibot": "1.4.2", + "zeptomatch": "2.1.0" + } + }, + "node_modules/@prisma/dev/node_modules/@prisma/debug": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-7.2.0.tgz", + "integrity": "sha512-YSGTiSlBAVJPzX4ONZmMotL+ozJwQjRmZweQNIq/ER0tQJKJynNkRB3kyvt37eOfsbMCXk3gnLF6J9OJ4QWftw==", + "license": "Apache-2.0" + }, + "node_modules/@prisma/dev/node_modules/@prisma/get-platform": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-7.2.0.tgz", + "integrity": "sha512-k1V0l0Td1732EHpAfi2eySTezyllok9dXb6UQanajkJQzPUGi3vO2z7jdkz67SypFTdmbnyGYxvEvYZdZsMAVA==", + "license": "Apache-2.0", + "dependencies": { + "@prisma/debug": "7.2.0" + } + }, + "node_modules/@prisma/engines": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-7.10.1.tgz", + "integrity": "sha512-R6/ghv1Bu36FhCdQLFof1pNtyoWoeDzJLYeTKjgqb4eGtOAJx7ZqJtcm4pzkahLfZ9rYz8AkmsMDwkyiYbXPCQ==", + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "@prisma/debug": "7.10.1", + "@prisma/engines-version": "8.1.0-1.d1b3f377ca835d73fd50954a5e22128b9ebdd6b8", + "@prisma/fetch-engine": "7.10.1", + "@prisma/get-platform": "7.10.1" + } + }, + "node_modules/@prisma/engines-version": { + "version": "8.1.0-1.d1b3f377ca835d73fd50954a5e22128b9ebdd6b8", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-8.1.0-1.d1b3f377ca835d73fd50954a5e22128b9ebdd6b8.tgz", + "integrity": "sha512-XjXmwjN2NE340RpXoXv8ZF8aNAvr0FE+7gNfkKeW6vyjXs7F8uxvEbWQoVrhioXDQoIsnNmv7r+wxvzfdEZaWA==", + "license": "Apache-2.0" + }, + "node_modules/@prisma/fetch-engine": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-7.10.1.tgz", + "integrity": "sha512-qZezeaExLWG2ptbHOrMxdiWluKHgqEclTdJbvY6pk6+Wg7EiVkeq5U3cXz9ti8nd0bngNvsDgledLHVRg5LF1w==", + "license": "Apache-2.0", + "dependencies": { + "@prisma/debug": "7.10.1", + "@prisma/engines-version": "8.1.0-1.d1b3f377ca835d73fd50954a5e22128b9ebdd6b8", + "@prisma/get-platform": "7.10.1" + } + }, + "node_modules/@prisma/get-platform": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-7.10.1.tgz", + "integrity": "sha512-iVnghHne5vcaobBjPVCMEjh5r/1UCj394EIGTUclasFRatpR/MQwcM2veLv5kgoFSyYP54nch/lNFCQRYcDxvg==", + "license": "Apache-2.0", + "dependencies": { + "@prisma/debug": "7.10.1" + } + }, + "node_modules/@prisma/query-plan-executor": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@prisma/query-plan-executor/-/query-plan-executor-7.2.0.tgz", + "integrity": "sha512-EOZmNzcV8uJ0mae3DhTsiHgoNCuu1J9mULQpGCh62zN3PxPTd+qI9tJvk5jOst8WHKQNwJWR3b39t0XvfBB0WQ==", + "license": "Apache-2.0" + }, + "node_modules/@prisma/streams-local": { + "version": "0.1.11", + "resolved": "https://registry.npmjs.org/@prisma/streams-local/-/streams-local-0.1.11.tgz", + "integrity": "sha512-0TcebL559MByKqTJ+SsrFIEg228iw8UCVRFckzgfRSiJqczhs+MuAgWOF9lnOIV/IVqvu+KMnFTH0eDeTQMpUg==", + "license": "Apache-2.0", + "dependencies": { + "ajv": "^8.12.0", + "better-result": "^2.7.0", + "env-paths": "^3.0.0", + "proper-lockfile": "^4.1.2" + }, + "engines": { + "bun": ">=1.2.0", + "node": ">=22.0.0" + } + }, + "node_modules/@prisma/studio-core": { + "version": "0.33.0", + "resolved": "https://registry.npmjs.org/@prisma/studio-core/-/studio-core-0.33.0.tgz", + "integrity": "sha512-V2fX/nKEymNTrHXwfP26PGjoLStO35Ogu+ex7CFJbLrMYEcZxxZpiSNOs7px23Hk5mzLWvM5RsqG6Ka+rha+wg==", + "license": "Apache-2.0", + "dependencies": { + "@radix-ui/react-toggle": "1.1.10", + "@visx/curve": "4.0.1-alpha.0", + "@visx/event": "4.0.1-alpha.0", + "@visx/grid": "4.0.1-alpha.0", + "@visx/group": "4.0.1-alpha.0", + "@visx/responsive": "4.0.1-alpha.0", + "@visx/scale": "4.0.1-alpha.0", + "@visx/shape": "4.0.1-alpha.0", + "d3-array": "3.2.4", + "d3-shape": "3.2.0", + "elkjs": "0.11.1" + }, + "engines": { + "node": "^20.19 || ^22.12 || >=24.0", + "pnpm": "8" + }, + "peerDependencies": { + "@types/react": "^18.0.0 || ^19.0.0", + "react": "^18.0.0 || ^19.0.0", + "react-dom": "^18.0.0 || ^19.0.0" + } + }, + "node_modules/@radix-ui/primitive": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.3.tgz", + "integrity": "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg==", + "license": "MIT" + }, + "node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.2.tgz", + "integrity": "sha512-z4eqJvfiNnFMHIIvXP3CY57y2WJs5g2v3X0zm9mEJkrkNv4rDxu+sg9Jh8EkXyeqBkB7SOcboo9dMVqhyrACIg==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-primitive": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz", + "integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.2.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-slot": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.2.3.tgz", + "integrity": "sha512-aeNmHnBxbi2St0au6VBVC7JXFlhLlOnvIIlePNniyUNAClzmtAUEY8/pBiK3iHjufOlwA+c20/8jngo7xcrg8A==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.2" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-toggle": { + "version": "1.1.10", + "resolved": "https://registry.npmjs.org/@radix-ui/react-toggle/-/react-toggle-1.1.10.tgz", + "integrity": "sha512-lS1odchhFTeZv3xwHH31YPObmJn8gOg7Lq12inrr0+BH/l3Tsq32VfjqH1oh80ARM3mlkfMic15n0kg4sD1poQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.3", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-use-controllable-state": "1.2.2" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-controllable-state": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.2.2.tgz", + "integrity": "sha512-BjasUjixPFdS+NKkypcyyN5Pmg83Olst0+c6vGov0diwTEo6mgdqVR6hxcEgFuh4QrAs7Rc+9KuGJ9TVCj0Zzg==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-effect-event": "0.0.2", + "@radix-ui/react-use-layout-effect": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-effect-event": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-effect-event/-/react-use-effect-event-0.0.2.tgz", + "integrity": "sha512-Qp8WbZOBe+blgpuUT+lw2xheLP8q0oatc9UpmiemEICxGvFLYmHm9QowVZGHtJlGbS6A6yJ3iViad/2cVjnOiA==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-layout-effect": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-layout-effect": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.1.1.tgz", + "integrity": "sha512-RbJRS4UWQFkzHTTwVymMTUv8EqYhOp8dOOviLj2ugtTiXRaRQS7GLGxZTLL1jWhMeoSCf5zmcZkqTl9IiYfXcQ==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@standard-schema/spec": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", + "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", + "license": "MIT" + }, + "node_modules/@types/d3-array": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.0.3.tgz", + "integrity": "sha512-Reoy+pKnvsksN0lQUlcH6dOGjRZ/3WRwXR//m+/8lt1BXeI4xyaUZoqULNjyXXRuh0Mj4LNpkCvhUpQlY3X5xQ==", + "license": "MIT" + }, + "node_modules/@types/d3-color": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.0.tgz", + "integrity": "sha512-HKuicPHJuvPgCD+np6Se9MQvS6OCbJmOjGvylzMJRlDwUXjKTTXs6Pwgk79O09Vj/ho3u1ofXnhFOaEWWPrlwA==", + "license": "MIT" + }, + "node_modules/@types/d3-delaunay": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-delaunay/-/d3-delaunay-6.0.1.tgz", + "integrity": "sha512-tLxQ2sfT0p6sxdG75c6f/ekqxjyYR0+LwPrsO1mbC9YDBzPJhs2HbJJRrn8Ez1DBoHRo2yx7YEATI+8V1nGMnQ==", + "license": "MIT" + }, + "node_modules/@types/d3-format": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-format/-/d3-format-3.0.1.tgz", + "integrity": "sha512-5KY70ifCCzorkLuIkDe0Z9YTf9RR2CjBX1iaJG+rgM/cPP+sO+q9YdQ9WdhQcgPj1EQiJ2/0+yUkkziTG6Lubg==", + "license": "MIT" + }, + "node_modules/@types/d3-geo": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@types/d3-geo/-/d3-geo-3.1.0.tgz", + "integrity": "sha512-856sckF0oP/diXtS4jNsiQw/UuK5fQG8l/a9VVLeSouf1/PPbBE1i1W852zVwKwYCBkFJJB7nCFTbk6UMEXBOQ==", + "license": "MIT", + "dependencies": { + "@types/geojson": "*" + } + }, + "node_modules/@types/d3-interpolate": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.1.tgz", + "integrity": "sha512-jx5leotSeac3jr0RePOH1KdR9rISG91QIE4Q2PYTu4OymLTZfA3SrnURSLzKH48HmXVUru50b8nje4E79oQSQw==", + "license": "MIT", + "dependencies": { + "@types/d3-color": "*" + } + }, + "node_modules/@types/d3-path": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.1.1.tgz", + "integrity": "sha512-VMZBYyQvbGmWyWVea0EHs/BwLgxc+MKi1zLDCONksozI4YJMcTt8ZEuIR4Sb1MMTE8MMW49v0IwI5+b7RmfWlg==", + "license": "MIT" + }, + "node_modules/@types/d3-scale": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.2.tgz", + "integrity": "sha512-Yk4htunhPAwN0XGlIwArRomOjdoBFXC3+kCxK2Ubg7I9shQlVSJy/pG/Ht5ASN+gdMIalpk8TJ5xV74jFsetLA==", + "license": "MIT", + "dependencies": { + "@types/d3-time": "*" + } + }, + "node_modules/@types/d3-shape": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.1.7.tgz", + "integrity": "sha512-VLvUQ33C+3J+8p+Daf+nYSOsjB4GXp19/S/aGo60m9h1v6XaxjiT82lKVWJCfzhtuZ3yD7i/TPeC/fuKLLOSmg==", + "license": "MIT", + "dependencies": { + "@types/d3-path": "*" + } + }, + "node_modules/@types/d3-time": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.0.tgz", + "integrity": "sha512-sZLCdHvBUcNby1cB6Fd3ZBrABbjz3v1Vm90nysCQ6Vt7vd6e/h9Lt7SiJUoEX0l4Dzc7P5llKyhqSi1ycSf1Hg==", + "license": "MIT" + }, + "node_modules/@types/d3-time-format": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/d3-time-format/-/d3-time-format-2.1.0.tgz", + "integrity": "sha512-/myT3I7EwlukNOX2xVdMzb8FRgNzRMpsZddwst9Ld/VFe6LyJyRp0s32l/V9XoUzk+Gqu56F/oGk6507+8BxrA==", + "license": "MIT" + }, + "node_modules/@types/geojson": { + "version": "7946.0.16", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.16.tgz", + "integrity": "sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==", + "license": "MIT" + }, + "node_modules/@types/lodash": { + "version": "4.17.27", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.27.tgz", + "integrity": "sha512-VenMRv/eKNrspX9v3H4dbmjsrnCOYdYBG3kxXKk3dG6X+urBGcj2Prww3xw1U5K4FV/mE4h5GbWd0szEKf+9ew==", + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "26.6.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.6.tgz", + "integrity": "sha512-MzQj+8Kx3XI40OmUAE6Qoh58ZMNstNNMwn2nfd3qWsfe7nDNSqJNzes4njhz6AHwrSHOffSLwXU6yb474Q4aog==", + "license": "MIT", + "peer": true, + "dependencies": { + "undici-types": "~8.9.0" + } + }, + "node_modules/@types/react": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz", + "integrity": "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==", + "license": "MIT", + "dependencies": { + "csstype": "^3.2.2" + } + }, + "node_modules/@visx/curve": { + "version": "4.0.1-alpha.0", + "resolved": "https://registry.npmjs.org/@visx/curve/-/curve-4.0.1-alpha.0.tgz", + "integrity": "sha512-jRu61Uz274pV1zyioXmboyrLutYbnKsgjj4njSGCnhdXj5GkZvZbg+ThDb6oOzoAnJOBRLz4rzPlWvNJOzuVMg==", + "license": "MIT", + "dependencies": { + "@visx/vendor": "4.0.0-alpha.0" + } + }, + "node_modules/@visx/event": { + "version": "4.0.1-alpha.0", + "resolved": "https://registry.npmjs.org/@visx/event/-/event-4.0.1-alpha.0.tgz", + "integrity": "sha512-EQqCMSv/s8NbFjo+hz3FKsvvYfP+2QslsFJ/24/O5l/W+7UC6J6aAvO0ujVwrTwdYbuQ+vhxKi1xdPdKR/qj1g==", + "license": "MIT", + "dependencies": { + "@types/react": "*", + "@visx/point": "4.0.1-alpha.0" + } + }, + "node_modules/@visx/grid": { + "version": "4.0.1-alpha.0", + "resolved": "https://registry.npmjs.org/@visx/grid/-/grid-4.0.1-alpha.0.tgz", + "integrity": "sha512-rycutGmTHO+znNdPumheWMglm7YfpffvRwUkVy5zy4WoORIuKTMkDxwnOzHG2xMxU3EE/YCd37xFV5AxA30yeg==", + "license": "MIT", + "dependencies": { + "@types/react": "*", + "@visx/curve": "4.0.1-alpha.0", + "@visx/group": "4.0.1-alpha.0", + "@visx/point": "4.0.1-alpha.0", + "@visx/scale": "4.0.1-alpha.0", + "@visx/shape": "4.0.1-alpha.0", + "classnames": "^2.3.1" + }, + "peerDependencies": { + "react": "^16.14.0 || ^17.0.0-0 || ^18.0.0-0 || ^19.0.0-0" + } + }, + "node_modules/@visx/group": { + "version": "4.0.1-alpha.0", + "resolved": "https://registry.npmjs.org/@visx/group/-/group-4.0.1-alpha.0.tgz", + "integrity": "sha512-V19l7iQ7jccBv8kao/EByuI6o4xtxzzLV9nqVI1hRvmdzTVsuLpqlwzYCZUXJaTVvUWf8s4D2SQFjGkj/Nw+0w==", + "license": "MIT", + "dependencies": { + "@types/react": "*", + "classnames": "^2.3.1" + }, + "peerDependencies": { + "react": "^16.14.0 || ^17.0.0-0 || ^18.0.0-0 || ^19.0.0-0" + } + }, + "node_modules/@visx/point": { + "version": "4.0.1-alpha.0", + "resolved": "https://registry.npmjs.org/@visx/point/-/point-4.0.1-alpha.0.tgz", + "integrity": "sha512-ijTfr/Nx09f03vIj9nyTr3z4Xth4Y75427UaogJh6dnIRLMEFHQOwNu791sbfiNj0a+ZXuaE32h0vKrFe4/8Qg==", + "license": "MIT" + }, + "node_modules/@visx/responsive": { + "version": "4.0.1-alpha.0", + "resolved": "https://registry.npmjs.org/@visx/responsive/-/responsive-4.0.1-alpha.0.tgz", + "integrity": "sha512-o+1zGywQZY0+yOx3Iw87wc4bbPJRr/HnIukTwfOz4UVyj9pB1OQNVHB7OORO1+LBHJceWpB31co/ZV9KHncKrA==", + "license": "MIT", + "dependencies": { + "@types/lodash": "^4.17.13", + "@types/react": "*", + "lodash": "^4.17.21" + }, + "peerDependencies": { + "react": "^16.14.0 || ^17.0.0-0 || ^18.0.0-0 || ^19.0.0-0" + } + }, + "node_modules/@visx/scale": { + "version": "4.0.1-alpha.0", + "resolved": "https://registry.npmjs.org/@visx/scale/-/scale-4.0.1-alpha.0.tgz", + "integrity": "sha512-nzjeE87vFSAXGWFiiNfBpNLAf0Q8Qmf6syvKLjqNi4kGZkdhbUll3E/59YsgWXmjM8+llPLWzGsP+JPvo5eq1A==", + "license": "MIT", + "dependencies": { + "@visx/vendor": "4.0.0-alpha.0" + } + }, + "node_modules/@visx/shape": { + "version": "4.0.1-alpha.0", + "resolved": "https://registry.npmjs.org/@visx/shape/-/shape-4.0.1-alpha.0.tgz", + "integrity": "sha512-62QeiVNmPlterQGwhkEDcbq7M0MqY0lBsK5QKXtM9ZoPZWkuGV3aykA3+Xu20B2FAvyJq4LqJzBc7Sxr+EAdbA==", + "license": "MIT", + "dependencies": { + "@types/lodash": "^4.17.13", + "@types/react": "*", + "@visx/curve": "4.0.1-alpha.0", + "@visx/group": "4.0.1-alpha.0", + "@visx/scale": "4.0.1-alpha.0", + "@visx/vendor": "4.0.0-alpha.0", + "classnames": "^2.3.1", + "lodash": "^4.17.21" + }, + "peerDependencies": { + "react": "^16.14.0 || ^17.0.0-0 || ^18.0.0-0 || ^19.0.0-0" + } + }, + "node_modules/@visx/vendor": { + "version": "4.0.0-alpha.0", + "resolved": "https://registry.npmjs.org/@visx/vendor/-/vendor-4.0.0-alpha.0.tgz", + "integrity": "sha512-6I+MuqXBcv9jnlcVowHoHKSdk9gXTWkHLKyqBwRWg7LY6A3Ei8SHfubpqGV5rBUSppxMq2RszPJUS6w+H0YgmQ==", + "license": "MIT and ISC", + "dependencies": { + "@types/d3-array": "3.0.3", + "@types/d3-color": "3.1.0", + "@types/d3-delaunay": "6.0.1", + "@types/d3-format": "3.0.1", + "@types/d3-geo": "3.1.0", + "@types/d3-interpolate": "3.0.1", + "@types/d3-path": "3.1.1", + "@types/d3-scale": "4.0.2", + "@types/d3-shape": "3.1.7", + "@types/d3-time": "3.0.0", + "@types/d3-time-format": "2.1.0", + "d3-array": "3.2.1", + "d3-color": "3.1.0", + "d3-delaunay": "6.0.2", + "d3-format": "3.1.0", + "d3-geo": "3.1.0", + "d3-interpolate": "3.0.1", + "d3-path": "3.1.0", + "d3-scale": "4.0.2", + "d3-shape": "3.2.0", + "d3-time": "3.1.0", + "d3-time-format": "4.1.0", + "internmap": "2.0.3" + } + }, + "node_modules/@visx/vendor/node_modules/d3-array": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.1.tgz", + "integrity": "sha512-gUY/qeHq/yNqqoCKNq4vtpFLdoCdvyNpWoC/KNjhGbhDuQpAM9sIQQKkXSNpXa9h5KySs/gzm7R88WkUutgwWQ==", + "license": "ISC", + "dependencies": { + "internmap": "1 - 2" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/ajv": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz", + "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/aws-ssl-profiles": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/aws-ssl-profiles/-/aws-ssl-profiles-1.1.2.tgz", + "integrity": "sha512-NZKeq9AfyQvEeNlN0zSYAaWrmBffJh3IELMZfRpJVWgrpEbtEpnjvzqBPf+mxoI287JohRDoa+/nsfqqiZmF6g==", + "license": "MIT", + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/better-result": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/better-result/-/better-result-2.10.0.tgz", + "integrity": "sha512-oQhh0y1qo2/ZKdAAEvHZAqKKiHOFU5k/bW96fE2ScgQOVkJRiHwB+nOS1SgFsYqRlxMDWvefXi9Q3px7QvgNDw==", + "license": "MIT" + }, + "node_modules/c12": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/c12/-/c12-3.3.4.tgz", + "integrity": "sha512-cM0ApFQSBXuourJejzwv/AuPRvAxordTyParRVcHjjtXirtkzM0uK2L9TTn9s0cXZbG7E55jCivRQzoxYmRAlA==", + "license": "MIT", + "dependencies": { + "chokidar": "^5.0.0", + "confbox": "^0.2.4", + "defu": "^6.1.6", + "dotenv": "^17.3.1", + "exsolve": "^1.0.8", + "giget": "^3.2.0", + "jiti": "^2.6.1", + "ohash": "^2.0.11", + "pathe": "^2.0.3", + "perfect-debounce": "^2.1.0", + "pkg-types": "^2.3.0", + "rc9": "^3.0.1" + }, + "peerDependencies": { + "magicast": "*" + }, + "peerDependenciesMeta": { + "magicast": { + "optional": true + } + } + }, + "node_modules/c12/node_modules/dotenv": { + "version": "17.4.2", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.4.2.tgz", + "integrity": "sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/chokidar": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-5.0.0.tgz", + "integrity": "sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==", + "license": "MIT", + "dependencies": { + "readdirp": "^5.0.0" + }, + "engines": { + "node": ">= 20.19.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/classnames": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.5.1.tgz", + "integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==", + "license": "MIT" + }, + "node_modules/confbox": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.2.4.tgz", + "integrity": "sha512-ysOGlgTFbN2/Y6Cg3Iye8YKulHw+R2fNXHrgSmXISQdMnomY6eNDprVdW9R5xBguEqI954+S6709UyiO7B+6OQ==", + "license": "MIT" + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/csstype": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.4.tgz", + "integrity": "sha512-PoKaoPzQapnEoqUSnHx1u6W6ku8CVEgKsnpmmzU3m1nwkidpPBQ8V/Zq2+bWNrsOKoKLwTGdbx6xF7BXP1zLVQ==", + "license": "MIT" + }, + "node_modules/d3-array": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz", + "integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==", + "license": "ISC", + "dependencies": { + "internmap": "1 - 2" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-color": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz", + "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-delaunay": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/d3-delaunay/-/d3-delaunay-6.0.2.tgz", + "integrity": "sha512-IMLNldruDQScrcfT+MWnazhHbDJhcRJyOEBAJfwQnHle1RPh6WDuLvxNArUju2VSMSUuKlY5BGHRJ2cYyoFLQQ==", + "license": "ISC", + "dependencies": { + "delaunator": "5" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-format": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.0.tgz", + "integrity": "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-geo": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-3.1.0.tgz", + "integrity": "sha512-JEo5HxXDdDYXCaWdwLRt79y7giK8SbhZJbFWXqbRTolCHFI5jRqteLzCsq51NKbUoX0PjBVSohxrx+NoOUujYA==", + "license": "ISC", + "dependencies": { + "d3-array": "2.5.0 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-interpolate": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz", + "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==", + "license": "ISC", + "dependencies": { + "d3-color": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-path": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz", + "integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-scale": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz", + "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==", + "license": "ISC", + "dependencies": { + "d3-array": "2.10.0 - 3", + "d3-format": "1 - 3", + "d3-interpolate": "1.2.0 - 3", + "d3-time": "2.1.1 - 3", + "d3-time-format": "2 - 4" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-shape": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz", + "integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==", + "license": "ISC", + "dependencies": { + "d3-path": "^3.1.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz", + "integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==", + "license": "ISC", + "dependencies": { + "d3-array": "2 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time-format": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz", + "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==", + "license": "ISC", + "dependencies": { + "d3-time": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/deepmerge-ts": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/deepmerge-ts/-/deepmerge-ts-8.0.2.tgz", + "integrity": "sha512-uqbvqLUMrc6p0MO+WBRtTxY55hmyh94WRwI5a++PZe54X+bfVh59FSN7uWCBCW1CCVjzjnrwzfI8zidE2obMMw==", + "funding": [ + { + "type": "ko-fi", + "url": "https://ko-fi.com/rebeccastevens" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/deepmerge-ts" + } + ], + "license": "BSD-3-Clause", + "engines": { + "node": ">=16.9.0" + } + }, + "node_modules/defu": { + "version": "6.1.7", + "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.7.tgz", + "integrity": "sha512-7z22QmUWiQ/2d0KkdYmANbRUVABpZ9SNYyH5vx6PZ+nE5bcC0l7uFvEfHlyld/HcGBFTL536ClDt3DEcSlEJAQ==", + "license": "MIT" + }, + "node_modules/delaunator": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/delaunator/-/delaunator-5.1.0.tgz", + "integrity": "sha512-AGrQ4QSgssa1NGmWmLPqN5NY2KajF5MqxetNEO+o0n3ZwZZeTmt7bBnvzHWrmkZFxGgr4HdyFgelzgi06otLuQ==", + "license": "ISC", + "dependencies": { + "robust-predicates": "^3.0.2" + } + }, + "node_modules/destr": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/destr/-/destr-2.0.5.tgz", + "integrity": "sha512-ugFTXCtDZunbzasqBxrK93Ik/DRYsO6S/fedkWEMKqt04xZ4csmnmwGDBAb07QWNaGMAmnTIemsYZCksjATwsA==", + "license": "MIT" + }, + "node_modules/dotenv": { + "version": "18.0.10", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-18.0.10.tgz", + "integrity": "sha512-89FAA1xchzK2mxVWdr5F/0rldwiueXs6zJM86rO66EzekR1iBdiXRthyG+m5GvkJaFH3C2LESzamTkgndmLT2A==", + "license": "BSD-2-Clause", + "bin": { + "dotenv": "dist/cli.cjs" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/effect": { + "version": "3.22.5", + "resolved": "https://registry.npmjs.org/effect/-/effect-3.22.5.tgz", + "integrity": "sha512-AdIU4llI19BzhJ4xUBZix7kS8oiYSlCsJ61j3UM3UyJw9ecDrsrrweDFm/Ku1nHbJWMLoynK+1Me4it3Zkmjpw==", + "license": "MIT", + "dependencies": { + "@standard-schema/spec": "^1.0.0", + "fast-check": "^3.23.1" + } + }, + "node_modules/elkjs": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/elkjs/-/elkjs-0.11.1.tgz", + "integrity": "sha512-zxxR9k+rx5ktMwT/FwyLdPCrq7xN6e4VGGHH8hA01vVYKjTFik7nHOxBnAYtrgYUB1RpAiLvA1/U2YraWxyKKg==", + "license": "EPL-2.0" + }, + "node_modules/empathic": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/empathic/-/empathic-2.0.0.tgz", + "integrity": "sha512-i6UzDscO/XfAcNYD75CfICkmfLedpyPDdozrLMmQc5ORaQcdMoc21OnlEylMIqI7U8eniKrPMxxtj8k0vhmJhA==", + "license": "MIT", + "engines": { + "node": ">=14" + } + }, + "node_modules/env-paths": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-3.0.0.tgz", + "integrity": "sha512-dtJUTepzMW3Lm/NPxRf3wP4642UWhjL2sQxc+ym2YMj1m/H2zDNQOlezafzkHwn6sMstjHTwG6iQQsctDW/b1A==", + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/esbuild": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz", + "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==", + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.2", + "@esbuild/android-arm": "0.28.2", + "@esbuild/android-arm64": "0.28.2", + "@esbuild/android-x64": "0.28.2", + "@esbuild/darwin-arm64": "0.28.2", + "@esbuild/darwin-x64": "0.28.2", + "@esbuild/freebsd-arm64": "0.28.2", + "@esbuild/freebsd-x64": "0.28.2", + "@esbuild/linux-arm": "0.28.2", + "@esbuild/linux-arm64": "0.28.2", + "@esbuild/linux-ia32": "0.28.2", + "@esbuild/linux-loong64": "0.28.2", + "@esbuild/linux-mips64el": "0.28.2", + "@esbuild/linux-ppc64": "0.28.2", + "@esbuild/linux-riscv64": "0.28.2", + "@esbuild/linux-s390x": "0.28.2", + "@esbuild/linux-x64": "0.28.2", + "@esbuild/netbsd-arm64": "0.28.2", + "@esbuild/netbsd-x64": "0.28.2", + "@esbuild/openbsd-arm64": "0.28.2", + "@esbuild/openbsd-x64": "0.28.2", + "@esbuild/openharmony-arm64": "0.28.2", + "@esbuild/sunos-x64": "0.28.2", + "@esbuild/win32-arm64": "0.28.2", + "@esbuild/win32-ia32": "0.28.2", + "@esbuild/win32-x64": "0.28.2" + } + }, + "node_modules/exsolve": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/exsolve/-/exsolve-1.2.0.tgz", + "integrity": "sha512-h1pQPR9XoeSMdntRNCjyTznaume4UpfXrULBnlkZ2CUM/G5eSa+pBByGldO5uR8dxbPC+OuJXsPPNf+JZ81ADg==", + "license": "MIT" + }, + "node_modules/fast-check": { + "version": "3.23.2", + "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-3.23.2.tgz", + "integrity": "sha512-h5+1OzzfCC3Ef7VbtKdcv7zsstUQwUDlYpUTvjeUsJAssPgLn7QzbboPtL5ro04Mq0rPOsMzl7q5hIbRs2wD1A==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ], + "license": "MIT", + "dependencies": { + "pure-rand": "^6.1.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/fast-decode-uri-component": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fast-decode-uri-component/-/fast-decode-uri-component-1.0.1.tgz", + "integrity": "sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg==", + "license": "MIT" + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "license": "MIT" + }, + "node_modules/fast-querystring": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/fast-querystring/-/fast-querystring-1.1.2.tgz", + "integrity": "sha512-g6KuKWmFXc0fID8WWH0jit4g0AGBoJhCkJMb1RmbsSEUNvQ+ZC8D6CUZ+GtF8nMzSPXnhiePyyqqipzNNEnHjg==", + "license": "MIT", + "dependencies": { + "fast-decode-uri-component": "^1.0.1" + } + }, + "node_modules/fast-uri": { + "version": "3.1.9", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.9.tgz", + "integrity": "sha512-hS/0Wt3Ya043oKXs0sIxrMpKQITXhMLIrVAKKXi4gozGC9v7YRWVnXIZzjNPTO02M9BdxLCWqK1yRXgNziVyJQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/find-my-way": { + "version": "9.7.0", + "resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-9.7.0.tgz", + "integrity": "sha512-f2JHn75x2JlwUwLenZypgczR7YWMb/uO9BvUXtus+JMgkbIkLADd38cI4EiV+OQqrGo1Zlq6V8wnqMJ8e62wUQ==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-querystring": "^1.0.0", + "safe-regex2": "^5.0.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/foreground-child": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/generate-function": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz", + "integrity": "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==", + "license": "MIT", + "dependencies": { + "is-property": "^1.0.2" + } + }, + "node_modules/get-port-please": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/get-port-please/-/get-port-please-3.2.0.tgz", + "integrity": "sha512-I9QVvBw5U/hw3RmWpYKRumUeaDgxTPd401x364rLmWBJcOQ753eov1eTgzDqRG9bqFIfDc7gfzcQEWrUri3o1A==", + "license": "MIT" + }, + "node_modules/giget": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/giget/-/giget-3.3.1.tgz", + "integrity": "sha512-r+mvuDjrjMpsdw46Kmeydb8bdHm7wOKw8wNBtTndkjbPjgAp5oUJUxRE76wZFknxIPokfWvep2qSXK37aXE6zg==", + "license": "MIT", + "bin": { + "giget": "dist/cli.mjs" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.12", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.12.tgz", + "integrity": "sha512-iuyGF2E4oafQfPsRrG2wtY2ILupMhvtdrhzrxB+0VcjsPpSPttpfYdjnGFGsTi5MaJFjI1jOKHPQ6UTbTj9TAw==", + "license": "BlueOak-1.0.0" + }, + "node_modules/grammex": { + "version": "3.1.13", + "resolved": "https://registry.npmjs.org/grammex/-/grammex-3.1.13.tgz", + "integrity": "sha512-LnPnhOBLEJEVKS8WFDVaA397L9Kq55Q9oSITJiVLHVdhAclfUkWzQv74KhvZHKL2Q09Pb1XdsrOsZ4LfTFFTEg==", + "license": "MIT" + }, + "node_modules/graphmatch": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/graphmatch/-/graphmatch-1.1.1.tgz", + "integrity": "sha512-5ykVn/EXM1hF0XCaWh05VbYvEiOL2lY1kBxZtaYsyvjp7cmWOU1XsAdfQBwClraEofXDT197lFbXOEVMHpvQOg==", + "license": "MIT" + }, + "node_modules/iconv-lite": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.3.tgz", + "integrity": "sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/internmap": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz", + "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/is-property": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", + "integrity": "sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g==", + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC" + }, + "node_modules/jiti": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.7.0.tgz", + "integrity": "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==", + "license": "MIT", + "bin": { + "jiti": "lib/jiti-cli.mjs" + } + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT" + }, + "node_modules/lodash": { + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz", + "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==", + "license": "MIT" + }, + "node_modules/long": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz", + "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==", + "license": "Apache-2.0" + }, + "node_modules/lru.min": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/lru.min/-/lru.min-1.1.5.tgz", + "integrity": "sha512-5J9ysMYUpYIg9RF2vJpy9SinEmSviFSe0GyPpCQ4L5QSkLAgeLXlTAOu2ZwWUU5m+0SBl6gUU1R1ZQB3aKypfA==", + "license": "MIT", + "engines": { + "bun": ">=1.0.0", + "deno": ">=1.30.0", + "node": ">=8.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wellwelwel" + } + }, + "node_modules/mysql2": { + "version": "3.24.6", + "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.24.6.tgz", + "integrity": "sha512-enu73KhbAua2L3dIxjc6qg6ZJ7H3pt1BImZASWNWY5xSsmJ1ZuUPULTDGXgmJbI61vb+nJAG19IZclIq19UidQ==", + "license": "MIT", + "dependencies": { + "aws-ssl-profiles": "^1.1.2", + "generate-function": "^2.3.1", + "iconv-lite": "^0.7.3", + "long": "^5.3.2", + "lru.min": "^1.1.4", + "named-placeholders": "^1.1.6", + "sql-escaper": "^1.5.1" + }, + "engines": { + "node": ">= 8.0" + }, + "peerDependencies": { + "@types/node": ">= 8" + } + }, + "node_modules/named-placeholders": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/named-placeholders/-/named-placeholders-1.1.6.tgz", + "integrity": "sha512-Tz09sEL2EEuv5fFowm419c1+a/jSMiBjI9gHxVLrVdbUkkNUUfjsVYs9pVZu5oCon/kmRh9TfLEObFtkVxmY0w==", + "license": "MIT", + "dependencies": { + "lru.min": "^1.1.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/ohash": { + "version": "2.0.12", + "resolved": "https://registry.npmjs.org/ohash/-/ohash-2.0.12.tgz", + "integrity": "sha512-65S/5gk9YSsaRjcyf7Nfa6h/d3E8/1gslpXfI4W7Dxn/oap8IKRuNT5VXkLQ1YFKIEg4apRY4Pj6aiwFzrDdmw==", + "license": "MIT" + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "license": "MIT" + }, + "node_modules/perfect-debounce": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/perfect-debounce/-/perfect-debounce-2.1.0.tgz", + "integrity": "sha512-LjgdTytVFXeUgtHZr9WYViYSM/g8MkcTPYDlPa3cDqMirHjKiSZPYd6DoL7pK8AJQr+uWkQvCjHNdiMqsrJs+g==", + "license": "MIT" + }, + "node_modules/pkg-types": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-2.4.0.tgz", + "integrity": "sha512-07Fys7iVx0X6TcviMOgogM1Lk33ZyqOezMnU79S+kffWqwolG/5W9V8EgQSeYCIfFTYVgssRbnH630Oa2+soBA==", + "license": "MIT", + "dependencies": { + "confbox": "^0.3.1", + "exsolve": "^1.1.3", + "pathe": "^2.0.3" + } + }, + "node_modules/pkg-types/node_modules/confbox": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.3.2.tgz", + "integrity": "sha512-ZUAKhKlkCOrIGKc8cj7zek9s9z1mveHif/25nUshI2BzCRzF7KH7KHa+Lnh2ubq+e1tIlaFuP763mzW4qVoehg==", + "license": "MIT" + }, + "node_modules/postgres": { + "version": "3.4.7", + "resolved": "https://registry.npmjs.org/postgres/-/postgres-3.4.7.tgz", + "integrity": "sha512-Jtc2612XINuBjIl/QTWsV5UvE8UHuNblcO3vVADSrKsrc6RqGX6lOW1cEo3CM2v0XG4Nat8nI+YM7/f26VxXLw==", + "license": "Unlicense", + "engines": { + "node": ">=12" + }, + "funding": { + "type": "individual", + "url": "https://github.com/sponsors/porsager" + } + }, + "node_modules/prisma": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-7.10.1.tgz", + "integrity": "sha512-GoVeErHGGtsSjsflQ1r2BA3RKTXtxNraQJz8OLkLhoLr7OgCscdx4qw4WMM4HnERYc+a1cq2VnMNbep+vOjNcQ==", + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "@prisma/config": "7.10.1", + "@prisma/dev": "0.24.17", + "@prisma/engines": "7.10.1", + "@prisma/studio-core": "0.33.0", + "mysql2": "3.24.4", + "postgres": "3.4.7" + }, + "bin": { + "prisma": "build/index.js" + }, + "engines": { + "node": "^20.19 || ^22.12 || >=24.0" + }, + "peerDependencies": { + "better-sqlite3": ">=9.0.0", + "typescript": ">=5.4.0" + }, + "peerDependenciesMeta": { + "better-sqlite3": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/proper-lockfile": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz", + "integrity": "sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.4", + "retry": "^0.12.0", + "signal-exit": "^3.0.2" + } + }, + "node_modules/proper-lockfile/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "license": "ISC" + }, + "node_modules/pure-rand": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz", + "integrity": "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ], + "license": "MIT" + }, + "node_modules/rc9": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/rc9/-/rc9-3.1.0.tgz", + "integrity": "sha512-ufjkNVzbRHKcCOmTahZkmVsyc3W+MSk3jY03m+a7tGHkIsdVMG9l10/3HvFbWkkKzY5VFp3pkRsIo/UYgmFL7Q==", + "license": "MIT", + "dependencies": { + "defu": "^6.1.7", + "destr": "^2.0.5" + } + }, + "node_modules/react": { + "version": "19.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-19.3.1.tgz", + "integrity": "sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.3.1.tgz", + "integrity": "sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "scheduler": "^0.28.0" + }, + "peerDependencies": { + "react": "^19.3.1" + } + }, + "node_modules/readdirp": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-5.1.1.tgz", + "integrity": "sha512-Kko+Y5XQ6fM+Ce3dq3m9YGxnacYZYl9cA1wZjaF3Vbry2L3i1qVg8+CAgNPsXRArPMUMCaOR7oa9Nqntc43JKA==", + "license": "MIT", + "engines": { + "node": ">= 20.19.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/remeda": { + "version": "2.33.4", + "resolved": "https://registry.npmjs.org/remeda/-/remeda-2.33.4.tgz", + "integrity": "sha512-ygHswjlc/opg2VrtiYvUOPLjxjtdKvjGz1/plDhkG66hjNjFr1xmfrs2ClNFo/E6TyUFiwYNh53bKV26oBoMGQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/remeda" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ret": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.5.1.tgz", + "integrity": "sha512-Z/nyvABwcRnRD2mMP7Kz6G1dFZZqX1mNErOnxF42OCQKE07b9k9hK9SQxHL3LFEZUdzQaLM4dId1E/E6Vm4WhA==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/robust-predicates": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/robust-predicates/-/robust-predicates-3.0.3.tgz", + "integrity": "sha512-NS3levdsRIUOmiJ8FZWCP7LG3QpJyrs/TE0Zpf1yvZu8cAJJ6QMW92H1c7kWpdIHo8RvmLxN/o2JXTKHp74lUA==", + "license": "Unlicense" + }, + "node_modules/safe-regex2": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-regex2/-/safe-regex2-5.1.2.tgz", + "integrity": "sha512-tAtCGFPPP02VroDVzp4daGi6bC7jWG+41D47GKf18FeH/ubvKQHT9VmhAkvtjNOmJwqtApzWeUpEhkyEYULvmw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "ret": "~0.5.0" + }, + "bin": { + "safe-regex2": "bin/safe-regex2.js" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/scheduler": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz", + "integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==", + "license": "MIT", + "peer": true + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/sql-escaper": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/sql-escaper/-/sql-escaper-1.9.1.tgz", + "integrity": "sha512-4p522TVYaJXTbMlYgAwacjyg3EJyYe9KYWYlYJVwZG1YjtzxU5m5iSzsZoGI69Po7j3i/2tKlpZQi7uvhTL+WA==", + "license": "MIT", + "engines": { + "bun": ">=1.0.0", + "deno": ">=2.0.0", + "node": ">=12.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/mysqljs/sql-escaper?sponsor=1" + } + }, + "node_modules/std-env": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.10.0.tgz", + "integrity": "sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==", + "license": "MIT" + }, + "node_modules/tsx": { + "version": "4.23.1", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.23.1.tgz", + "integrity": "sha512-GQHnkIfxyx1wYCOS/wonik5MVRZU9hi1TEZmzGZSCJB1y9YgoZ8H6itNE/u4suE+yLmOzuE4E5S4TZ/ZX2wcWQ==", + "license": "MIT", + "dependencies": { + "esbuild": "~0.28.0" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/undici-types": { + "version": "8.9.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz", + "integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==", + "license": "MIT", + "peer": true + }, + "node_modules/valibot": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/valibot/-/valibot-1.5.0.tgz", + "integrity": "sha512-nil6AkP2TChWL43Z5uJ6GTxX01CUA+g8LWUM+N/rB9NBbkUMaUsi9PUNzlUPgoKASgmx9f7eGOYpJ04/fSa6FQ==", + "license": "MIT", + "peerDependencies": { + "typescript": ">=5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/zeptomatch": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/zeptomatch/-/zeptomatch-2.1.0.tgz", + "integrity": "sha512-KiGErG2J0G82LSpniV0CtIzjlJ10E04j02VOudJsPyPwNZgGnRKQy7I1R7GMyg/QswnE4l7ohSGrQbQbjXPPDA==", + "license": "MIT", + "dependencies": { + "grammex": "^3.1.11", + "graphmatch": "^1.1.0" + } + } + } +} diff --git a/docker/prisma-cli/package.json b/docker/prisma-cli/package.json new file mode 100644 index 0000000000..1c905f4564 --- /dev/null +++ b/docker/prisma-cli/package.json @@ -0,0 +1,25 @@ +{ + "name": "healthlog-prisma-cli", + "version": "0.0.0", + "private": true, + "description": "The migration CLI and script launcher installed into /opt/prisma-cli by the Dockerfile's prisma-cli stage.", + "license": "UNLICENSED", + "dependencies": { + "@prisma/engines": "7.10.1", + "dotenv": "18.0.10", + "prisma": "7.10.1", + "tsx": "4.23.1" + }, + "overrides": { + "deepmerge-ts": "^8.0.0", + "mysql2": "^3.22.0", + "@hono/node-server": "^2.1.3", + "valibot": "^1.4.2", + "effect": "^3.22.1" + }, + "allowScripts": { + "@prisma/engines": true, + "prisma": true, + "esbuild": true + } +} diff --git a/docs/README.md b/docs/README.md index eac3abd0c2..f0ddcd2575 100644 --- a/docs/README.md +++ b/docs/README.md @@ -46,15 +46,37 @@ notes, and machine-readable specs that ship alongside the source: record search: opening it, what it finds, how matching works, and its limits on very large and shared records. [`using/cycle-calendar-feed.md`](./using/cycle-calendar-feed.md) covers - subscribing to the cycle forecast from Google, Apple or Outlook. + subscribing to the cycle forecast from Google, Apple or Outlook, and + [`using/care-calendar-feed.md`](./using/care-calendar-feed.md) the same for + booked visits, check-ups and vaccination boosters coming due. + [`using/pregnancy.md`](./using/pregnancy.md) covers the pregnancy and + postpartum state of cycle tracking, and + [`using/emergency-card.md`](./using/emergency-card.md) the emergency card, + its offline copy, the wallet card and its QR link. + [`using/energy-balance.md`](./using/energy-balance.md) explains the daily + energy balance, when a day has none, and how it reaches the correlations + and the Coach. + [`using/scheduled-doctor-report.md`](./using/scheduled-doctor-report.md) + covers filing the doctor report into the documents every month, quarter + or year. + [`using/lasting-change-notification.md`](./using/lasting-change-notification.md) + covers the opt-in notification about a vital that settled at a new level. + [`using/seizure-diary.md`](./using/seizure-diary.md) covers the seizure + diary. + [`using/medication-leaflets.md`](./using/medication-leaflets.md) covers + finding a medication's official leaflet and saving its link. - [`migration/`](./migration/) — migration notes. Currently only v1.3 to v1.4; later releases are covered by `CHANGELOG.md` and . - [`integrations/`](./integrations/) — per-integration reference: Withings, WHOOP, Google Health, Strava, Nightscout, Dawarich and Garmin; - the Apple Health, Health Connect, document and data imports; AI - providers; and Home Assistant with its blueprint. Oura and Polar are - covered on the docs site only. + the Apple Health, Health Connect (upload or a WebDAV folder), Gadgetbridge + ([`gadgetbridge.md`](./integrations/gadgetbridge.md)), FHIR R4 Bundle + ([`fhir-bundle-import.md`](./integrations/fhir-bundle-import.md)), + document and data imports; AI providers; the push relay for the App Store + iPhone app ([`push-relay.md`](./integrations/push-relay.md)); and Home + Assistant with its blueprint. Oura and Polar are covered on the docs site + only. - [`adr/`](./adr/) — architecture decision records. - [`security/`](./security/) — threat-model notes. - [`diagrams/`](./diagrams/) — architecture diagrams rendered through @@ -64,6 +86,9 @@ notes, and machine-readable specs that ship alongside the source: — the iOS submission gate. - [`codex-protocol-spec.md`](./codex-protocol-spec.md) — Codex / ChatGPT OAuth protocol reverse-engineering notes. +- [`contributing/release-policy.md`](./contributing/release-policy.md): when + a release happens, what a patch may contain, and the out-of-schedule + exceptions. - [`contributing/ui-standards.md`](./contributing/ui-standards.md) — the binding UI standards: card anatomy, spacing, text colour, tokens and which primitive to use where. Read before touching any surface. diff --git a/docs/api/cycle-healthkit-mapping.md b/docs/api/cycle-healthkit-mapping.md index bf827824f7..87d1e0a7ff 100644 --- a/docs/api/cycle-healthkit-mapping.md +++ b/docs/api/cycle-healthkit-mapping.md @@ -62,10 +62,21 @@ the cross-source source-priority ladder) and is mirrored onto temperature already flows to `WRIST_TEMPERATURE` / `SKIN_TEMPERATURE` and feeds the temperature-trend ovulation method directly from `Measurement`. +## Pregnancy and lactation status + +`Pregnancy` and `Lactation` are status samples, read from `export.xml` only, +and never become a day log. They set the `CycleProfile` pregnancy state, and +only while the profile holds none and its owner never set or cleared one in +the cycle settings: an ongoing `Pregnancy` sample sets `PREGNANT` with +its first day as `pregnancyStartDate`; an ongoing `Lactation` sample sets +`POSTPARTUM` only when a `Pregnancy` sample ended at most 14 days before it +began, that end becoming `deliveryDate`. An ended pregnancy alone sets nothing. +Every state set this way is audited (`cycle.profile.pregnancy-imported`). See +`docs/using/pregnancy.md`. + ## Deferred -| HealthKit category type | Status | -| ------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------- | -| `Pregnancy`, `Lactation` | Deferred — no `CycleProfile` column yet (pregnancy-mode is a later release). | -| `BleedingDuringPregnancy`, `BleedingAfterPregnancy` | Deferred — pregnancy-mode. | -| `IrregularMenstrualCycles`, `InfrequentMenstrualCycles`, `ProlongedMenstrualPeriods`, `PersistentIntermenstrualBleeding` | Server-derived from the cycle engine, never ingested. | +| HealthKit category type | Status | +| ------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------- | +| `BleedingDuringPregnancy`, `BleedingAfterPregnancy` | Not read yet: the pregnancy state stores no bleeding. | +| `IrregularMenstrualCycles`, `InfrequentMenstrualCycles`, `ProlongedMenstrualPeriods`, `PersistentIntermenstrualBleeding` | Server-derived from the cycle engine, never ingested. | diff --git a/docs/api/openapi.yaml b/docs/api/openapi.yaml index bfe7924fe8..52f0ef9ec2 100644 --- a/docs/api/openapi.yaml +++ b/docs/api/openapi.yaml @@ -1,7 +1,7 @@ openapi: 3.1.0 info: title: HealthLog API - version: 1.48.5 + version: 1.49.0 description: >- Self-hosted personal-health-tracking PWA — public API surface for the iOS native client and external ingest. @@ -373,7 +373,9 @@ paths: - Cycle summary: Capture a single cycle day-log (v1.15.0) description: "Upserts on `(userId, source, externalId)` when externalId present, else `(userId, date)`. `note` encrypts - at rest. 201 on insert, 200 on update. Gated: `cycle.disabled` 403 when the feature is off." + at rest. 201 on insert, 200 on update. An `APPLE_HEALTH` re-post whose `externalId` names a day the person + deleted in HealthLog answers 410 (`cycle.day-log.deleted_in_healthlog`) and writes nothing; a `MANUAL` write + revives the day from empty fields. Gated: `cycle.disabled` 403 when the feature is off." parameters: - *a6 requestBody: @@ -398,6 +400,16 @@ paths: "401": *a1 "403": *a2 "409": *a7 + "410": + description: "The `externalId` names an entry the person deleted in HealthLog. Nothing was written, and a re-post gets + the same answer: treat it as final and drop the entry from the outbox. `meta.errorCode` = + `cycle.day-log.deleted_in_healthlog`, `meta.reason` = `deleted_in_healthlog` (the word the bulk routes use + per entry), `meta.id` = the deleted row. An entry the app reported deleted in Apple Health (`DELETE + …/by-external-ids`) is written again instead." + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" "422": *a4 "429": &a12 description: "Rate limit exceeded. This route shares one per-account bucket with every other authenticated write — @@ -755,8 +767,11 @@ paths: tags: - Cycle summary: Update cycle preferences (v1.15.0) - description: Deep-merges the supplied fields. `enabled` flips `cycleTrackingEnabled`. Returns the merged - CycleProfileDTO. NOT gated. + description: "Deep-merges the supplied fields. `enabled` flips `cycleTrackingEnabled`. `pregnancy` sets or clears the + pregnancy / postpartum state (v1.49): `state: null` clears every pregnancy date with it; a date omitted keeps + its stored value; the merged result is checked as a whole and answers 422 with `cycle-prefs.pregnancy.*` when a + first day or delivery lies in the future, the due date is not after the first day, or POSTPARTUM has no delivery + date. Returns the merged CycleProfileDTO. NOT gated." requestBody: required: true content: @@ -987,6 +1002,427 @@ paths: $ref: "#/components/schemas/ErrorEnvelope" "422": *a4 "429": *a5 + /api/care/feed/{token}: + get: + tags: + - Records + summary: Booked visits and care dates as iCalendar (public) + description: "Anonymous: a calendar provider polls this URL, so the raw `hlf_` token in the path (optionally followed by + `.ics`) is the ONLY credential. Rate-limited per source address before any lookup and per token after it. Every + gate is re-read on each fetch: the record is not pending deletion and the operator's external-access switch is + on. Every miss is the same 404. The body is RFC 5545: booked visits as one-hour events at their UTC time, + check-ups and vaccination boosters as all-day events on the day they come due (the reminder engine's own + next-due day, in the record's zone), from 30 days back to 400 days ahead, at most 300 events. Boosters follow + the vaccinations module. Titles are one dot by default; descriptive titles name the practitioner or the + check-up's label, never a visit's reason, outcome or body site. `ETag` is the content hash; a matching + `If-None-Match` answers 304." + security: [] + parameters: + - in: path + name: token + schema: + type: string + description: Raw `hlf_` feed token, optionally with `.ics`. + required: true + description: Raw `hlf_` feed token, optionally with `.ics`. + responses: + "200": + description: "The calendar. `Cache-Control: private, no-cache, max-age=0`, `ETag`." + content: + text/calendar: + schema: + type: string + "304": + description: The body is unchanged since the `If-None-Match` ETag. + "404": + description: Flat 404 for every miss class (errorCode `care.feed.notFound`). + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "429": + description: The source-address or per-token bucket is exhausted. + headers: *a8 + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + /api/care/feed-subscription: + get: + tags: + - Records + summary: Care calendar subscription status + description: The caller's live care calendar subscription without its secret (prefix, options, fetch statistics). Never + the hash, never the URL. + responses: + "200": + description: The status; `feed` is null while the subscription is off. + content: + application/json: + schema: + $ref: "#/components/schemas/CareFeedStatus" + "401": *a1 + "403": &a15 + description: >- + `meta.errorCode` = `auth.scope.insufficient` when a Bearer token's scope does not reach this route; the + generic auth gate answers it before the route's own checks run. Otherwise: A Bearer caller + (`care.feed.cookie_only`): the subscription is managed over a browser session, on the caller's own record or + on a managed profile the caller is guardian of. Turning it on while the operator's external-access switch is + off answers `care.feed.api_disabled`. + + + Refused: this request named a record the caller may not act on (`meta.errorCode` = `sharing.access.denied`). + Byte-identical for an account that does not exist, an account that granted nothing, a grant whose sections + do not reach this surface, and a read grant on a request that writes — the response carries no reason, so it + is not an account-enumeration oracle. The reason reaches the record owner's activity feed and the operator's + audit trail instead. On the cookie transport the same code answers one further case: a session that has + entered a shared record and sends a request without its record-context assertion, which is a client older + than the fence — leave the record and reload. A request that names no record but the caller's own never + reaches this response, so a client that never switches and never sends the per-request account selector will + not see it. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "422": *a4 + "429": *a5 + post: + tags: + - Records + summary: Turn the care calendar subscription on + description: "Mints an `hlf_` token (192-bit), stores only its HMAC, and returns the URL EXACTLY ONCE. One live + subscription per record: a second answers 409 `care.feed.exists` (turn it off for a new link). Defaults: visits, + check-ups and boosters, discreet titles. Needs a fresh proof (401 `auth.reproof.required`). Rate-limited per + account (`care-feed:mint:`, 10/h)." + responses: + "201": + description: The new link, returned exactly once. + content: + application/json: + schema: + $ref: "#/components/schemas/CareFeedMinted" + "401": *a1 + "403": *a15 + "409": + description: A subscription is already on (`care.feed.exists`). + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "422": *a4 + "429": *a5 + patch: + tags: + - Records + summary: Change the care calendar subscription's options + description: Field-by-field update of the options. The URL does not change; the feed's next fetch serves the new content. + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/CareFeedOptionsPatch" + responses: + "200": + description: The status after the change. + content: + application/json: + schema: + $ref: "#/components/schemas/CareFeedStatusAfterPatch" + "400": *a11 + "401": *a1 + "403": *a15 + "404": &a16 + description: No subscription is on (`care.feed.none`). + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "422": *a4 + "429": *a5 + delete: + tags: + - Records + summary: Turn the care calendar subscription off + description: Revokes the link; calendars holding it stop updating on their next poll. Copies a calendar provider already + holds are beyond the app's reach. + responses: + "200": + description: Revoked. + content: + application/json: + schema: + $ref: "#/components/schemas/CareFeedRevoked" + "401": *a1 + "403": *a15 + "404": *a16 + "422": *a4 + "429": *a5 + /api/emergency-card: + get: + tags: + - Records + summary: The caller's emergency card + description: "Every item of the caller's own emergency card: blood type, active allergies (severe first), ongoing + conditions, current medications, the pregnancy or postpartum state, implants, contacts, the declarations, the + note and the birth date. The caller's own record, or the managed profile a guardian switched into; a delegate on + an adult's record is refused with 403 at every grant level." + responses: + "200": + description: The card. + content: + application/json: + schema: + $ref: "#/components/schemas/EmergencyCardRead" + "401": *a1 + "403": &a18 + description: "`meta.errorCode` = `auth.scope.insufficient` when a Bearer token's scope does not reach this route; the + generic auth gate answers it before the route's own checks run. Otherwise: Refused: this request named a + record the caller may not act on (`meta.errorCode` = `sharing.access.denied`). Byte-identical for an account + that does not exist, an account that granted nothing, a grant whose sections do not reach this surface, and + a read grant on a request that writes — the response carries no reason, so it is not an account-enumeration + oracle. The reason reaches the record owner's activity feed and the operator's audit trail instead. On the + cookie transport the same code answers one further case: a session that has entered a shared record and + sends a request without its record-context assertion, which is a client older than the fence — leave the + record and reload. A request that names no record but the caller's own never reaches this response, so a + client that never switches and never sends the per-request account selector will not see it." + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "422": *a4 + "429": *a5 + /api/emergency-card/offline: + get: + tags: + - Records + summary: Download the emergency card for offline use + description: The card as one self-contained HTML file (inline styles, no script, no external request), sent as an attachment. + responses: + "200": + description: The HTML file. + content: + text/html: + schema: + type: string + "401": *a1 + "403": &a17 + description: >- + `meta.errorCode` = `auth.scope.insufficient` when a Bearer token's scope does not reach this route; the + generic auth gate answers it before the route's own checks run. Otherwise: A Bearer caller + (`emergency-card.cookie_only`): the link and the downloads are managed over a browser session, on the + caller's own record or on a managed profile the caller is guardian of. Making a link while the operator's + external-access switch is off answers `emergency-card.api_disabled`. + + + Refused: this request named a record the caller may not act on (`meta.errorCode` = `sharing.access.denied`). + Byte-identical for an account that does not exist, an account that granted nothing, a grant whose sections + do not reach this surface, and a read grant on a request that writes — the response carries no reason, so it + is not an account-enumeration oracle. The reason reaches the record owner's activity feed and the operator's + audit trail instead. On the cookie transport the same code answers one further case: a session that has + entered a shared record and sends a request without its record-context assertion, which is a client older + than the fence — leave the record and reload. A request that names no record but the caller's own never + reaches this response, so a client that never switches and never sends the per-request account selector will + not see it. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "422": *a4 + "429": *a5 + /api/emergency-card/wallet: + post: + tags: + - Records + summary: Download the emergency card as a wallet card PDF + description: One A4 page with both sides at credit-card size and a fold line. With `token` (the raw token of the + caller's own live link, held only right after it was made) the back carries the link's QR code; a token that is + not the caller's live link answers 422 `emergency-card.wallet.token`. + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/EmergencyWalletRequest" + responses: + "200": + description: The PDF. + content: + application/pdf: + schema: + type: string + "400": *a11 + "401": *a1 + "403": *a17 + "422": *a4 + "429": *a5 + /api/emergency-card/link: + get: + tags: + - Records + summary: Emergency card link status + description: "The caller's live link without its secret: prefix, the items it shows, its expiry and how often it was opened." + responses: + "200": + description: The status; `link` is null while no link is on. + content: + application/json: + schema: + $ref: "#/components/schemas/EmergencyCardLinkStatus" + "401": *a1 + "403": *a17 + "422": *a4 + "429": *a5 + post: + tags: + - Records + summary: Make the emergency card link + description: "Mints an `hlm_` token (192-bit), stores only its HMAC, freezes the ticked items and the optional expiry, + and returns the URL EXACTLY ONCE. The link serves `/e/{token}`: a read-only page with the ticked items only, + every access audited on the owner's trail. One live link per record: a second answers 409 + `emergency-card.exists`. Needs a fresh proof (401 `auth.reproof.required`). Rate-limited per account (10/h)." + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/EmergencyCardLinkCreate" + responses: + "201": + description: The new link, returned exactly once. + content: + application/json: + schema: + $ref: "#/components/schemas/EmergencyCardLinkMinted" + "400": *a11 + "401": *a1 + "403": *a17 + "409": + description: A link is already on (`emergency-card.exists`). + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "422": *a4 + "429": *a5 + delete: + tags: + - Records + summary: Revoke the emergency card link + description: Revokes the link; a scanned card answers 404 from then on. + responses: + "200": + description: Revoked. + content: + application/json: + schema: + $ref: "#/components/schemas/EmergencyCardLinkRevoked" + "401": *a1 + "403": *a17 + "404": + description: No link is on (`emergency-card.none`). + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "422": *a4 + "429": *a5 + /api/nav/counts: + get: + tags: + - Dashboard + summary: The counts the navigation shows + description: Doses and check-ups due now for the caller's own record, read in a fixed number of statements; nothing is + written. Cookie session or a full-scope token; a switched record is refused. + responses: + "200": + description: The counts. + content: + application/json: + schema: + $ref: "#/components/schemas/NavCountsResponse" + "401": *a1 + "403": *a9 + "422": *a4 + "429": *a5 + /api/settings/report-schedule: + get: + tags: + - Records + summary: Scheduled doctor report status + description: The schedule of the record the caller manages; `schedule` is null while it is off (the default). + responses: + "200": + description: The status. + content: + application/json: + schema: + $ref: "#/components/schemas/ReportScheduleStatus" + "401": *a1 + "403": *a18 + "422": *a4 + "429": *a5 + put: + tags: + - Records + summary: Turn the scheduled doctor report on or change it + description: "`cadence` is MONTHLY, QUARTERLY or YEARLY; `window` is the closed period itself (PERIOD) or the last 90 or + 365 days up to its end. A changed cadence clears the stamps, so the latest closed period of the new cadence is + filed on the next hourly run; an unchanged one keeps them. Refused with 403 `module.disabled` while the + `doctorReport` module is off." + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ReportSchedulePut" + responses: + "200": + description: The status after the change. + content: + application/json: + schema: + $ref: "#/components/schemas/ReportScheduleStatusAfterPut" + "400": *a11 + "401": *a1 + "403": + description: >- + `meta.errorCode` = `auth.scope.insufficient` when a Bearer token's scope does not reach this route; the + generic auth gate answers it before the route's own checks run. Otherwise: `module.disabled` while the + `doctorReport` module is off. + + + Refused: this request named a record the caller may not act on (`meta.errorCode` = `sharing.access.denied`). + Byte-identical for an account that does not exist, an account that granted nothing, a grant whose sections + do not reach this surface, and a read grant on a request that writes — the response carries no reason, so it + is not an account-enumeration oracle. The reason reaches the record owner's activity feed and the operator's + audit trail instead. On the cookie transport the same code answers one further case: a session that has + entered a shared record and sends a request without its record-context assertion, which is a client older + than the fence — leave the record and reload. A request that names no record but the caller's own never + reaches this response, so a client that never switches and never sends the per-request account selector will + not see it. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "422": *a4 + "429": *a5 + delete: + tags: + - Records + summary: Turn the scheduled doctor report off + description: Reports already filed stay in the vault. + responses: + "200": + description: Off; `schedule` is null. + content: + application/json: + schema: + $ref: "#/components/schemas/ReportScheduleStatusAfterDelete" + "401": *a1 + "403": *a18 + "422": *a4 + "429": *a5 /api/measurement-categories: get: tags: @@ -1188,21 +1624,7 @@ paths: type: string format: binary "401": *a1 - "403": &a20 - description: "`meta.errorCode` = `auth.scope.insufficient` when a Bearer token's scope does not reach this route; the - generic auth gate answers it before the route's own checks run. Otherwise: Refused: this request named a - record the caller may not act on (`meta.errorCode` = `sharing.access.denied`). Byte-identical for an account - that does not exist, an account that granted nothing, a grant whose sections do not reach this surface, and - a read grant on a request that writes — the response carries no reason, so it is not an account-enumeration - oracle. The reason reaches the record owner's activity feed and the operator's audit trail instead. On the - cookie transport the same code answers one further case: a session that has entered a shared record and - sends a request without its record-context assertion, which is a client older than the fence — leave the - record and reload. A request that names no record but the caller's own never reaches this response, so a - client that never switches and never sends the per-request account selector will not see it." - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorEnvelope" + "403": *a18 "422": *a4 "429": *a5 /api/share-links: @@ -1514,7 +1936,7 @@ paths: schema: type: string format: binary - "400": &a15 + "400": &a19 description: A search parameter the server cannot honour, such as an `_offset` above 9007199254740991. The body is an `OperationOutcome` (`issue[0].code` = `invalid`, the reason in `diagnostics`) served as `application/fhir+json`. @@ -1524,7 +1946,7 @@ paths: type: string format: binary "401": *a1 - "403": &a16 + "403": &a20 description: "`meta.errorCode` = `auth.scope.insufficient` when a Bearer token's scope does not reach this route; the generic auth gate answers it before the route's own checks run. Otherwise: Module disabled for this account: the user (or operator) has the module turned off. `meta.errorCode` = `module.disabled` and `meta.module` @@ -1535,7 +1957,7 @@ paths: schema: $ref: "#/components/schemas/ErrorEnvelope" "422": *a4 - "429": &a17 + "429": &a21 description: "Rate limit exceeded: the per-account `fhir:` bucket, 120 requests per hour, shared by every `/api/fhir/*` data route. The body is an `OperationOutcome` (`issue[0].code` = `throttled`) served as `application/fhir+json`, not the JSON error envelope. The `Retry-After`, `X-RateLimit-Limit`, @@ -1589,11 +2011,11 @@ paths: schema: type: string format: binary - "400": *a15 + "400": *a19 "401": *a1 - "403": *a16 + "403": *a20 "422": *a4 - "429": *a17 + "429": *a21 /api/fhir/MedicationStatement: get: tags: @@ -1620,11 +2042,11 @@ paths: schema: type: string format: binary - "400": *a15 + "400": *a19 "401": *a1 - "403": *a16 + "403": *a20 "422": *a4 - "429": *a17 + "429": *a21 /api/fhir/MedicationAdministration: get: tags: @@ -1651,11 +2073,11 @@ paths: schema: type: string format: binary - "400": *a15 + "400": *a19 "401": *a1 - "403": *a16 + "403": *a20 "422": *a4 - "429": *a17 + "429": *a21 /api/fhir/Coverage: get: tags: @@ -1683,11 +2105,11 @@ paths: schema: type: string format: binary - "400": *a15 + "400": *a19 "401": *a1 - "403": *a16 + "403": *a20 "422": *a4 - "429": *a17 + "429": *a21 /api/fhir/Patient/{id}: get: tags: @@ -1711,7 +2133,7 @@ paths: type: string format: binary "401": *a1 - "403": *a16 + "403": *a20 "404": description: OperationOutcome (application/fhir+json). content: @@ -1720,7 +2142,7 @@ paths: type: string format: binary "422": *a4 - "429": *a17 + "429": *a21 /api/fhir/Coverage/{id}: get: tags: @@ -1744,7 +2166,7 @@ paths: type: string format: binary "401": *a1 - "403": *a16 + "403": *a20 "404": description: OperationOutcome (application/fhir+json). content: @@ -1753,7 +2175,7 @@ paths: type: string format: binary "422": *a4 - "429": *a17 + "429": *a21 /api/fhir/Observation/{id}: get: tags: @@ -1778,7 +2200,7 @@ paths: type: string format: binary "401": *a1 - "403": *a16 + "403": *a20 "404": description: OperationOutcome (application/fhir+json). content: @@ -1787,7 +2209,7 @@ paths: type: string format: binary "422": *a4 - "429": *a17 + "429": *a21 /api/fhir/MedicationStatement/{id}: get: tags: @@ -1811,7 +2233,7 @@ paths: type: string format: binary "401": *a1 - "403": *a16 + "403": *a20 "404": description: OperationOutcome (application/fhir+json). content: @@ -1820,7 +2242,7 @@ paths: type: string format: binary "422": *a4 - "429": *a17 + "429": *a21 /api/fhir/MedicationAdministration/{id}: get: tags: @@ -1844,7 +2266,7 @@ paths: type: string format: binary "401": *a1 - "403": *a16 + "403": *a20 "404": description: OperationOutcome (application/fhir+json). content: @@ -1853,7 +2275,7 @@ paths: type: string format: binary "422": *a4 - "429": *a17 + "429": *a21 /api/fhir/Patient/$everything: get: tags: @@ -1887,11 +2309,11 @@ paths: schema: type: string format: binary - "400": *a15 + "400": *a19 "401": *a1 - "403": *a16 + "403": *a20 "422": *a4 - "429": *a17 + "429": *a21 /api/export: get: tags: @@ -2424,7 +2846,7 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "409": &a18 + "409": &a22 description: 'Refused before anything was checked or spent: the request stated `clientTransport.protocol: "http"` on a non-loopback host while this server issues `Secure` session cookies, so the browser would drop the session. `meta.errorCode` = `auth.session.insecure_transport`, `meta.sessionCookieSecure` = `true`. No password was @@ -2460,7 +2882,7 @@ paths: $ref: "#/components/schemas/MfaVerifyResponse" "401": *a1 "403": *a9 - "409": *a18 + "409": *a22 "422": *a4 "429": *a5 /api/auth/oidc/native/token: @@ -2770,7 +3192,7 @@ paths: application/json: schema: $ref: "#/components/schemas/TotpSetupEnvelope" - "401": &a19 + "401": &a23 description: No session or elevation; or, on the cookie path, `auth.reproof.required` (no recent sign-in and no proof in the body) or `auth.reproof.failed` (the proof did not verify). content: @@ -2923,7 +3345,7 @@ paths: application/json: schema: $ref: "#/components/schemas/MfaWebauthnRegisterOptionsEnvelope" - "401": *a19 + "401": *a23 "403": *a9 "422": *a4 "429": *a5 @@ -3077,7 +3499,7 @@ paths: $ref: "#/components/schemas/MfaWebauthnVerifyResponse" "401": *a1 "403": *a9 - "409": *a18 + "409": *a22 "422": *a4 "429": *a5 /api/auth/passkey/login-verify: @@ -3145,6 +3567,12 @@ paths: blip without parsing the prose `error`: `auth.refresh.reuse` (a consumed token was replayed — device family revoked, re-pair required), `auth.refresh.revoked` (family revoked out-of-band — re-pair required), `auth.refresh.invalid` (not found / expired — drop the token and re-authenticate). + + + A 409 with `meta.errorCode` = `auth.refresh.superseded` (v1.49.0) answers the loser of two concurrent refreshes + with the same token: the other request rotated it, nothing is revoked, and its pair is live. Not terminal: read + the credentials the winning request stored and continue. Do not present this refresh token again, since that is + a replay and revokes the device family. Before v1.49.0 this case answered 401 `auth.refresh.reuse`. requestBody: required: true content: @@ -3163,6 +3591,13 @@ paths: - $ref: "#/components/schemas/RefreshRevokeResponse" "401": *a1 "403": *a9 + "409": + description: "`meta.errorCode` = `auth.refresh.superseded`: a concurrent refresh with the same token won. Nothing is + revoked; read the newest stored credentials and do not retry with this token." + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" "422": *a4 "429": *a5 /api/auth/passkeys: @@ -3368,6 +3803,14 @@ paths: through the refresh endpoint's `revoke: true` arm. + Since v1.49.0 a native sign-out also ends the device's pushes: once the device (the `X-Device-Id` it signed in + with) has no live sign-in of the account left, its APNs token, push key, relay consent and binding (unbound at + the relay) and Live Activity state are dropped, so none of the account's reminders or confirmations reach it. + The device row and its delivery choice stay; the next sign-in's `POST /api/devices` registers the push + credentials again. The same holds for every other way a sign-in ends: the refresh endpoint's `revoke: true`, + reuse detection, sign out everywhere, a password change, and a sign-in that expired (swept nightly). + + Takes no body and needs no credential: an unauthenticated call answers 200 exactly like an authenticated one. Whether the Bearer revocation actually found a row is recorded server-side and is deliberately absent from the response — a caller that could read it would learn whether a token it presented was live. @@ -3443,7 +3886,7 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "409": *a18 + "409": *a22 "429": *a5 /api/auth/passkeys/{id}: patch: @@ -4138,7 +4581,7 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "429": &a23 + "429": &a27 description: "Too many email-address changes, and the request asked for nothing else. The address change shares one per-account bucket across both profile routes — `profile-email:`, 10 requests per 3600 seconds — keyed on the ACTING account, so an account cannot collect a fresh allowance by probing a different address. @@ -4527,9 +4970,26 @@ paths: tags: - Sync summary: Sync handshake + window metadata - description: Cheap 'should I sync?' summary. Returns the `lastSyncedAt` checkpoint, which the batch ingest endpoints - advance when a client push lands; this route is a read and writes nothing. The `sync` block carries the - incremental-delta window + tombstone retention so the client reads them rather than hardcoding. + description: "Cheap 'should I sync?' summary. Returns the `lastSyncedAt` checkpoint, which the batch ingest endpoints + advance when a client push lands; the handshake does not move it. The `sync` block carries the incremental-delta + window + tombstone retention so the client reads them rather than hardcoding. v1.49: the app reports the newest + push envelope id it opened per class in `openedAlert` and `openedSilent`, for the device named by `X-Device-Id`; + that is the one thing this request writes, and it confirms the relay pushes that arrived." + parameters: + - in: query + name: openedAlert + schema: + description: The newest alert envelope id (ULID) this device opened. + type: string + pattern: ^[0-9A-HJKMNP-TV-Z]{26}$ + description: The newest alert envelope id (ULID) this device opened. + - in: query + name: openedSilent + schema: + description: The newest silent envelope id (ULID) this device opened. + type: string + pattern: ^[0-9A-HJKMNP-TV-Z]{26}$ + description: The newest silent envelope id (ULID) this device opened. responses: "200": description: Sync state summary. @@ -4631,7 +5091,7 @@ paths: schema: $ref: "#/components/schemas/GetBloodPressureTimeOfDayResponse" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/measurements/series-batch: @@ -4681,7 +5141,7 @@ paths: schema: $ref: "#/components/schemas/GetMeasurementsSeriesBatchResponse" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/measurements/series: @@ -4738,7 +5198,7 @@ paths: schema: $ref: "#/components/schemas/GetMeasurementsSeriesResponse" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/measurements: @@ -4867,6 +5327,17 @@ paths: - FEV1 - FVC - PEAK_EXPIRATORY_FLOW + - WORKOUT_EFFORT_SCORE + - ESTIMATED_WORKOUT_EFFORT_SCORE + - PHYSICAL_EFFORT + - CYCLING_DISTANCE + - ROWING_DISTANCE + - ROWING_SPEED + - RUNNING_SPEED + - RUNNING_POWER + - RUNNING_GROUND_CONTACT_TIME + - RUNNING_VERTICAL_OSCILLATION + - RUNNING_STRIDE_LENGTH - in: query name: from schema: @@ -4997,7 +5468,7 @@ paths: schema: $ref: "#/components/schemas/ListMeasurementsResponse" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 post: @@ -5013,7 +5484,9 @@ paths: Sleep stages by name (since v1.39.1): an object with `type: SLEEP_DURATION`, a `sleepStage` of `IN_BED`, `ASLEEP`, `AWAKE`, `CORE`, `DEEP` or `REM`, and the segment as `startDate` + `endDate` or as `measuredAt` (its end) + `value` (minutes). It is stored and deduplicated exactly as the batch route stores a HealthKit sleep - sample, so a bridge can send stages without the HealthKit codepoints. See `NamedSleepStageEntry`. + sample, so a bridge can send stages without the HealthKit codepoints. A segment whose `externalId` names one the + person deleted in HealthLog answers 410 (`measurement.deleted_in_healthlog`) and stays deleted. See + `NamedSleepStageEntry`. Also reachable with a narrow `measurements:write` Bearer, which is the supported way to push readings from a @@ -5053,7 +5526,7 @@ paths: schema: $ref: "#/components/schemas/CreateMeasurementResponse" "401": *a1 - "403": *a20 + "403": *a18 "409": description: A measurement with this data already exists — the `(userId, type, source, externalId)` dedup index rejected the write. Never for a named sleep-stage body, which answers a re-post with 200 instead. @@ -5061,6 +5534,16 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" + "410": + description: "The `externalId` names an entry the person deleted in HealthLog. Nothing was written, and a re-post gets + the same answer: treat it as final and drop the entry from the outbox. `meta.errorCode` = + `measurement.deleted_in_healthlog`, `meta.reason` = `deleted_in_healthlog` (the word the bulk routes use per + entry), `meta.id` = the deleted row. An entry the app reported deleted in Apple Health (`DELETE + …/by-external-ids`) is written again instead." + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" "422": description: Validation failed, or (`measurement.create.source_not_permitted`) a narrow `measurements:write` credential named a source — any source. Refused rather than relabelled, so the caller can fix the payload instead of @@ -5090,7 +5573,7 @@ paths: schema: $ref: "#/components/schemas/GetMeasurementResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Measurement not found (or owned by another user). content: @@ -5149,7 +5632,7 @@ paths: schema: $ref: "#/components/schemas/UpdateMeasurementResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Measurement not found (or owned by another user). content: @@ -5188,7 +5671,7 @@ paths: schema: $ref: "#/components/schemas/DeleteMeasurementResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Measurement not found (or owned by another user). content: @@ -5302,7 +5785,7 @@ paths: schema: $ref: "#/components/schemas/MeasurementsBulkDeleteResponse" "401": *a1 - "403": *a20 + "403": *a18 "409": *a7 "422": *a4 "429": *a5 @@ -5334,7 +5817,7 @@ paths: schema: $ref: "#/components/schemas/MeasurementsRestoreResponse" "401": *a1 - "403": *a20 + "403": *a18 "409": *a7 "422": *a4 "429": *a5 @@ -5367,7 +5850,7 @@ paths: schema: $ref: "#/components/schemas/SleepNightResponse" "401": *a1 - "403": &a21 + "403": &a24 description: >- `meta.errorCode` = `auth.scope.insufficient` when a Bearer token's scope does not reach this route; the generic auth gate answers it before the route's own checks run. Otherwise: Module disabled for this account: @@ -5410,7 +5893,7 @@ paths: schema: $ref: "#/components/schemas/SleepRhythmResponse" "401": *a1 - "403": *a21 + "403": *a24 "422": *a4 "429": *a5 /api/workouts: @@ -5461,7 +5944,7 @@ paths: schema: $ref: "#/components/schemas/ListWorkoutsResponse" "401": *a1 - "403": *a21 + "403": *a24 "422": *a4 "429": *a5 /api/workouts/{id}: @@ -5497,7 +5980,7 @@ paths: schema: $ref: "#/components/schemas/GetWorkoutResponse" "401": *a1 - "403": *a16 + "403": *a20 "404": description: Workout not found (or owned by another user). content: @@ -5617,13 +6100,12 @@ paths: - Measurements summary: Delete Apple Health workouts by external ID description: "Removes the workouts whose externalId is listed, with the personal records they set; the records are - re-derived afterwards. The rows go outright, and since v1.48.2 every listed id is remembered: a later re-post of - the same externalId to `POST /api/workouts/batch` answers `duplicate` and writes nothing, including an id that - had not landed yet when the delete arrived. An id is remembered for 75 days, the tombstone retention every Apple - Health delete shares; after that a re-post lands again. Only the caller's own rows with `source = APPLE_HEALTH` - are matched; an id naming anything else is a no-op, never an error. Idempotent. Cookie session or a wildcard - Bearer token (the native login); a narrow-scope token is refused 403. Metered by the shared per-account write - bucket." + re-derived afterwards. The rows go outright. Since v1.49.0 nothing remembers the ids: a person cannot delete an + Apple Health workout in HealthLog, so every deletion is the phone's, and a later re-post of the same externalId + to `POST /api/workouts/batch` writes the workout again (it is back in Apple Health). From v1.48.2 to v1.48.x + such a re-post answered `duplicate`. Only the caller's own rows with `source = APPLE_HEALTH` are matched; an id + naming anything else is a no-op, never an error. Idempotent. Cookie session or a wildcard Bearer token (the + native login); a narrow-scope token is refused 403. Metered by the shared per-account write bucket." requestBody: required: true content: @@ -5647,12 +6129,12 @@ paths: - Insights summary: Delete Apple Health ECG recordings by external ID description: "Removes the ECG recordings whose `externalRecordingId` (the id `POST /api/insights/ecg` stored) is listed, - waveform included. A paired rhythm notification is a measurement of its own and stays. The rows go outright, and - since v1.48.2 every listed id is remembered: a later re-post of the same id to `POST /api/insights/ecg` answers - `duplicate` and writes nothing. An id is remembered for 75 days, the tombstone retention every Apple Health - delete shares; after that a re-post lands again. Only the caller's own rows with `source = APPLE_HEALTH` are - matched; an id naming anything else is a no-op, never an error. Idempotent. Cookie session or a wildcard Bearer - token (the native login); a narrow-scope token is refused 403. Metered by the shared per-account write bucket." + waveform included. A paired rhythm notification is a measurement of its own and stays. The rows go outright. + Since v1.49.0 nothing remembers the ids: a recording cannot be deleted in HealthLog, so a later re-post of the + same id writes it again (`inserted`). From v1.48.2 to v1.48.x such a re-post answered `duplicate`. Only the + caller's own rows with `source = APPLE_HEALTH` are matched; an id naming anything else is a no-op, never an + error. Idempotent. Cookie session or a wildcard Bearer token (the native login); a narrow-scope token is refused + 403. Metered by the shared per-account write bucket." requestBody: required: true content: @@ -5677,10 +6159,14 @@ paths: summary: Delete Apple Health cycle day-logs by external ID description: "Soft-deletes the day-logs whose externalId is listed, each as `DELETE /api/cycle/day-logs/{id}` does: the tombstone reaches `/api/sync/changes`, and a day that opened a cycle takes that cycle with it, the cycle before - it re-anchored. A later re-post of the same externalId through `POST /api/cycle/day-logs/bulk` brings the day - back. Only the caller's own rows with `source = APPLE_HEALTH` are matched; an id naming anything else is a - no-op, never an error. Idempotent. Cookie session or a wildcard Bearer token (the native login); a narrow-scope - token is refused 403. Metered by the shared per-account write bucket." + it re-anchored. A later re-post of the same externalId through `POST /api/cycle/day-logs/bulk` writes the day + again, since a day is fed by many samples; since v1.49.0 it starts from empty fields and no symptoms, so nothing + the deleted day held comes back. A day the person deleted in HealthLog is the other case: since v1.49.0 an + `APPLE_HEALTH` re-post of its externalId is refused per entry, `skipped` with `reason: + \"deleted_in_healthlog\"`, and the person writing the day again in HealthLog brings it back. Only the caller's + own rows with `source = APPLE_HEALTH` are matched; an id naming anything else is a no-op, never an error. + Idempotent. Cookie session or a wildcard Bearer token (the native login); a narrow-scope token is refused 403. + Metered by the shared per-account write bucket." requestBody: required: true content: @@ -5712,10 +6198,12 @@ paths: summary: Delete Apple Health State of Mind entries by external ID description: "Soft-deletes the mood entries posted with `source = APPLE_HEALTH` whose externalId is listed, each as `DELETE /api/mood-entries/{id}` does; the tombstone reaches `/api/sync/changes`. A mood logged in HealthLog - itself is never touched. A later re-post of a deleted externalId stays deleted: `POST /api/mood-entries/bulk` - answers `duplicate`. Only the caller's own rows with `source = APPLE_HEALTH` are matched; an id naming anything - else is a no-op, never an error. Idempotent. Cookie session or a wildcard Bearer token (the native login); a - narrow-scope token is refused 403. Metered by the shared per-account write bucket." + itself is never touched. Since v1.49.0 the tombstone records that the phone deleted it, so a later re-post + through `POST /api/mood-entries/bulk` (the entry is back in Apple Health) writes it again, `inserted`; an entry + the person deleted in HealthLog stays deleted, `skipped` with `reason: \"deleted_in_healthlog\"`. Only the + caller's own rows with `source = APPLE_HEALTH` are matched; an id naming anything else is a no-op, never an + error. Idempotent. Cookie session or a wildcard Bearer token (the native login); a narrow-scope token is refused + 403. Metered by the shared per-account write bucket." requestBody: required: true content: @@ -5739,13 +6227,14 @@ paths: - Symptoms summary: Delete Apple Health symptom occurrences by external ID description: "Tombstones the symptom occurrences posted through `POST /api/symptoms/events/batch` whose externalId is - listed. One logged in HealthLog is never touched. A later re-post of a deleted externalId stays deleted: the - batch answers `duplicate`. The tombstone is kept for 75 days, the retention every Apple Health delete shares. - Owner-only: a session switched into another record is refused 403 `sharing.not_permitted`. Served when `GET - /api/auth/me` reports `features.appleHealthSymptoms: true`. Only the caller's own rows with `source = - APPLE_HEALTH` are matched; an id naming anything else is a no-op, never an error. Idempotent. Cookie session or - a wildcard Bearer token (the native login); a narrow-scope token is refused 403. Metered by the shared - per-account write bucket." + listed. One logged in HealthLog is never touched. Since v1.49.0 the tombstone records that the phone deleted it, + so a later re-post through the batch writes it again (`inserted`); an occurrence the person deleted in HealthLog + stays deleted, `skipped` with `reason: \"deleted_in_healthlog\"`. The tombstone is kept for 75 days, the + retention every Apple Health delete shares. Owner-only: a session switched into another record is refused 403 + `sharing.not_permitted`. Served when `GET /api/auth/me` reports `features.appleHealthSymptoms: true`. Only the + caller's own rows with `source = APPLE_HEALTH` are matched; an id naming anything else is a no-op, never an + error. Idempotent. Cookie session or a wildcard Bearer token (the native login); a narrow-scope token is refused + 403. Metered by the shared per-account write bucket." requestBody: required: true content: @@ -5782,14 +6271,20 @@ paths: tags: - Medications summary: Delete Apple Health dose records by external ID - description: "Soft-deletes the intake events posted with `source = APPLE_HEALTH` whose externalId (the HealthKit - dose-event UUID) is listed, each as `DELETE /api/medications/{id}/intake/{eventId}` does: the stock it consumed - is refunded, the tombstone reaches `/api/sync/changes`, and a one-shot medication whose only dose it was becomes + description: "Soft-deletes the intake events whose externalId (the HealthKit dose-event UUID) is listed, including a + dose that landed on a pending slot row (since v1.49.0; only an Apple Health entry of the bulk route sets the + externalId of an intake), each as `DELETE /api/medications/{id}/intake/{eventId}` does: the stock it consumed is + refunded, the tombstone reaches `/api/sync/changes`, and a one-shot medication whose only dose it was becomes active again. The caller's other devices get one silent intake-sync push (the device named by `x-device-id` is - skipped). A later re-post of the same externalId through `POST /api/medications/intake/bulk` inserts a new dose: - a tombstone never blocks the ledger. Only the caller's own rows with `source = APPLE_HEALTH` are matched; an id - naming anything else is a no-op, never an error. Idempotent. Cookie session or a wildcard Bearer token (the - native login); a narrow-scope token is refused 403. Metered by the shared per-account write bucket." + skipped). Since v1.49.0 the tombstone records that the phone deleted the dose, so a later re-post of the same + externalId through `POST /api/medications/intake/bulk` (the dose is back in Apple Health) lands as a new dose + and takes its stock again. The re-post of an Apple Health dose the person deleted in HealthLog is refused per + entry, `skipped` with `reason: \"deleted_in_healthlog\"`, writes nothing and takes no stock, whatever row the + dose had landed on. A fresh install that reads the whole Apple Health history therefore needs no list of deleted + ids to skip. The tombstone is kept for 75 days, the retention every Apple Health delete shares. Only the + caller's own rows with `source = APPLE_HEALTH` are matched; an id naming anything else is a no-op, never an + error. Idempotent. Cookie session or a wildcard Bearer token (the native login); a narrow-scope token is refused + 403. Metered by the shared per-account write bucket." requestBody: required: true content: @@ -5848,7 +6343,7 @@ paths: schema: $ref: "#/components/schemas/ActivityCalendarEnvelope" "401": *a1 - "403": *a21 + "403": *a24 "422": *a4 "429": *a5 /api/activity/goals: @@ -6009,6 +6504,17 @@ paths: - FEV1 - FVC - PEAK_EXPIRATORY_FLOW + - WORKOUT_EFFORT_SCORE + - ESTIMATED_WORKOUT_EFFORT_SCORE + - PHYSICAL_EFFORT + - CYCLING_DISTANCE + - ROWING_DISTANCE + - ROWING_SPEED + - RUNNING_SPEED + - RUNNING_POWER + - RUNNING_GROUND_CONTACT_TIME + - RUNNING_VERTICAL_OSCILLATION + - RUNNING_STRIDE_LENGTH description: The metric. required: true description: The metric. @@ -6031,7 +6537,7 @@ paths: schema: $ref: "#/components/schemas/DayProvenanceEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/measurements/provenance/compare: @@ -6149,6 +6655,17 @@ paths: - FEV1 - FVC - PEAK_EXPIRATORY_FLOW + - WORKOUT_EFFORT_SCORE + - ESTIMATED_WORKOUT_EFFORT_SCORE + - PHYSICAL_EFFORT + - CYCLING_DISTANCE + - ROWING_DISTANCE + - ROWING_SPEED + - RUNNING_SPEED + - RUNNING_POWER + - RUNNING_GROUND_CONTACT_TIME + - RUNNING_VERTICAL_OSCILLATION + - RUNNING_STRIDE_LENGTH description: The metric. required: true description: The metric. @@ -6226,7 +6743,7 @@ paths: schema: $ref: "#/components/schemas/SourceComparisonEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/devices: @@ -6234,8 +6751,20 @@ paths: tags: - Devices summary: Register native device + APNs token - description: Idempotent upsert by `token`. APNs token + environment are paired — supplying one without the other returns - 422. Cross-user re-registration of either identifier returns 409. + description: "Idempotent upsert by `token`. APNs token + environment are paired — supplying one without the other + returns 422. A `token` (the `X-Device-Id`) or `apnsToken` another account holds is taken over when that account + is signed out of the device: its device row goes, with its push key, relay binding (unbound at the relay before + this request's binding is forwarded) and Live Activity state, so nothing sealed for it reaches the device. Both + accounts get an audit row, and the previous one a security alert on its other devices and channels. Since + v1.49.0 a device still signed in to the other account is not taken over: while that account holds a live refresh + token for this `X-Device-Id` (or one naming no device), or the access token of a rotation's short sunset, the + answer is 409 `devices.register.signed_in_elsewhere` and nothing changes. Signing out there, or that sign-in + running out, frees the device; the app can then register again. A refused push field (push key, relay binding, + consent) returns 422 with `meta.errorCode` `devices.push.` and changes nothing; more than 10 new relay + bindings for one account in 24 hours return 429 `devices.push.relay_daily_limit`. When the device's APNs token + changes, the old token's relay binding is removed and the device has to bind the new token (`relayState: + rebind_needed` unless the request carries the new `relayBinding`). The answer's `push` block is the device's + push state after the call." requestBody: required: true content: @@ -6252,7 +6781,42 @@ paths: "401": *a1 "403": *a9 "409": - description: Device or APNs token already registered to another user. + description: "`devices.register.signed_in_elsewhere`: the `token` or `apnsToken` belongs to a device still signed in to + another account. Nothing changed; both accounts get an audit row." + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "422": *a4 + "429": *a5 + /api/devices/me/push-diagnostics: + get: + tags: + - Devices + summary: The calling device's push diagnostics + description: "v1.49.0. The push state of the device named by `X-Device-Id` (the same header `push.device` on + `/api/auth/me` reads): route, relay binding, silent budget, owed sync, last delivery per kind, last receipt and + the masked APNs token. A cookie session or a wildcard token; a narrow token is refused with 403. A header that + is missing or names none of the caller's devices answers 404, the same for another account's device as for one + that does not exist. 10 requests a minute per account. `Cache-Control: private, no-store`." + parameters: + - name: X-Device-Id + in: header + required: true + schema: + type: string + description: The device's registration `token`. + responses: + "200": + description: The device's push diagnostics. + content: + application/json: + schema: + $ref: "#/components/schemas/DevicePushDiagnosticsEnvelope" + "401": *a1 + "403": *a9 + "404": + description: The header names none of the caller's devices. content: application/json: schema: @@ -6295,6 +6859,256 @@ paths: $ref: "#/components/schemas/ErrorEnvelope" "422": *a4 "429": *a5 + /api/admin/push-relay: + get: + tags: + - Admin + summary: Push relay state for the admin switch + description: Admin-only, cookie-only. + responses: + "200": + description: The relay state. + content: + application/json: + schema: + $ref: "#/components/schemas/AdminPushRelayStatusEnvelope" + "401": *a1 + "403": &a25 + description: The session is valid but its account is not an administrator. `meta.errorCode` = `auth.admin.required`. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "422": *a4 + "429": *a5 + put: + tags: + - Admin + summary: Offer the push relay to this server's users, or stop + description: "Turning it on needs `acceptTerms` and `householdOnly`, registers the instance at the relay and creates its + key; `invite` carries the relay's one-time code when the relay is invite-only. The answer is the state after the + registration attempt: a refusal reads `offered: true`, `instanceId: null` and a `reason` (`invite_required`, + `invite_rejected`, `registration_paused`, or a transport code). `operatorDecision` becomes `on` once the + registration succeeded. Turning it off deletes the instance at the relay, every device binding with it, and the + key, and sets `operatorDecision` to `off`. On a relay that is on and registered, turning it on again records the + operator's acceptance of the current terms text and changes nothing else. Admin-only, cookie-only, audit-logged, + 10 per 15 minutes (429 `admin.pushRelay.rateLimited`)." + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/AdminPushRelaySwitch" + responses: + "200": + description: The new relay state. + content: + application/json: + schema: + $ref: "#/components/schemas/AdminPushRelaySwitchEnvelope" + "401": *a1 + "403": *a25 + "409": + description: The relay is not available on this server. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "422": *a4 + "429": *a5 + /api/admin/push-relay/decision: + post: + tags: + - Admin + summary: Answer the relay question for the whole server + description: "The admin's answer to \"Send push notifications through the HealthLog relay?\", only while + `operatorDecision` is `undecided` (409 `admin.pushRelay.decisionNotOpen` otherwise; the switch under `PUT + /api/admin/push-relay` changes it later). `enabled: false` sets `off`, and nobody is asked again; an unfinished + registration goes with it. `enabled: true` takes the switch's confirmations and invite code and turns the relay + on through the same path; `operatorDecision` becomes `on` only once the registration succeeded, and a refusal + leaves the question open with its `reason`. Admin-only and cookie-only: a Bearer token never reaches it, so a + native client opens the web admin page (`/admin`) instead. Audit-logged (`admin.push_relay.declined`, + `admin.push_relay.enabled`), rate limited with the switch (10 per 15 minutes, 429 + `admin.pushRelay.rateLimited`)." + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/AdminPushRelaySwitch" + responses: + "200": + description: The relay state after the answer. + content: + application/json: + schema: + $ref: "#/components/schemas/AdminPushRelayDecisionEnvelope" + "401": *a1 + "403": *a25 + "409": + description: The question is not open (`admin.pushRelay.decisionNotOpen`), or the relay is not available on this server + (`admin.pushRelay.unavailable`). + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "422": *a4 + "429": *a5 + /api/admin/push-relay/test: + post: + tags: + - Admin + summary: Send a test push through the relay to the admin's own devices + description: One harmless sealed alert (`RELAY_TEST`) to each relay-bound device of the calling admin, with the relay's + signed answer and the delivery state per device. Admin-only, cookie-only, 5 per 15 minutes. + responses: + "200": + description: What the relay answered. + content: + application/json: + schema: + $ref: "#/components/schemas/AdminPushRelayTestEnvelope" + "401": *a1 + "403": *a25 + "422": *a4 + "429": *a5 + /api/admin/push-relay/rotate-key: + post: + tags: + - Admin + summary: Rotate the instance signing key at the relay now + description: Outside the 30-day schedule. The relay allows one rotation per UTC day. Admin-only, cookie-only, + audit-logged, 5 per hour (429 `admin.pushRelay.rateLimited`). + responses: + "200": + description: The rotation's outcome. + content: + application/json: + schema: + $ref: "#/components/schemas/AdminPushRelayRotateEnvelope" + "401": *a1 + "403": *a25 + "409": + description: The relay is not registered on this server. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "422": *a4 + "429": *a5 + /api/admin/push-relay/rotate-sender-key: + post: + tags: + - Admin + summary: Emergency rotation of the envelope sender key + description: "For a sender key known to be exposed: a new current key at once, without the 7-day announcement, and the + previous key dropped. Devices that have not fetched the new key show the neutral placeholder until the app is + opened. Admin-only, cookie-only, audit-logged, 5 per hour (429 `admin.pushRelay.rateLimited`). Needs a fresh + proof: a second factor confirmed in the last five minutes on an admin who has one, otherwise a password + re-entry, a passkey or a sign-in in the same window (401 `auth.reproof.required` with `meta.methods`)." + responses: + "200": + description: Rotated. + content: + application/json: + schema: + $ref: "#/components/schemas/AdminPushRelaySenderRotateEnvelope" + "401": *a1 + "403": *a25 + "409": + description: This server seals no envelopes yet. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "422": *a4 + "429": *a5 + /api/admin/server-setup: + get: + tags: + - Admin + summary: The first-admin server setup's state + description: The steps (accounts, notifications, ai, privacy, health), the finish stamp, whether the start-page notice + shows for this admin, and the environment facts the steps show. Admin-only, cookie-only. + responses: + "200": + description: The setup state. + content: + application/json: + schema: + $ref: "#/components/schemas/AdminServerSetupStateEnvelope" + "401": *a1 + "403": *a25 + "422": *a4 + "429": *a5 + patch: + tags: + - Admin + summary: Record one server setup step + description: Marks one step done or skipped. The settings themselves are saved by each step's own admin routes; this + records the step. When every step is settled the setup is stamped finished, once. Refused on a demo deploy (409 + `admin.serverSetup.notOffered`). Rate-limited to 60 writes per 10 minutes per admin. Admin-only, cookie-only, + audit-logged. + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/AdminServerSetupStepRequest" + responses: + "200": + description: The setup state after the write. + content: + application/json: + schema: + $ref: "#/components/schemas/AdminServerSetupStateEnvelope" + "401": *a1 + "403": *a25 + "409": + description: The setup is not offered on this server (demo). + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "422": *a4 + "429": *a5 + /api/admin/server-setup/notice: + post: + tags: + - Admin + summary: Dismiss the server setup notice + description: Hides the start-page notice for the calling admin. The setup stays reachable from Admin, System status. + Admin-only, cookie-only. + responses: + "200": + description: Dismissed. + content: + application/json: + schema: + $ref: "#/components/schemas/AdminServerSetupNoticeEnvelope" + "401": *a1 + "403": *a25 + "422": *a4 + "429": *a5 + /api/admin/setup-health: + get: + tags: + - Admin + summary: The setup health check list + description: "Read-only signals: encryption keys present, the secure-cookie setting against how this request arrived, + the database dump schedule, the public URL. Closed reason codes, key ids and counts only. Admin-only, + cookie-only." + responses: + "200": + description: The signals and the worst state. + content: + application/json: + schema: + $ref: "#/components/schemas/AdminSetupHealthEnvelope" + "401": *a1 + "403": *a25 + "422": *a4 + "429": *a5 /api/medications/intake: get: tags: @@ -6305,8 +7119,11 @@ paths: trailing `days`. The `today` scope WRITES before it reads: it projects the pending intake rows for every active schedule whose window opens today and idempotently backfills the missing ones, because a daily schedule has no row to read until the reminder worker reaches the end of its dose window — so a plain read would return an empty - morning. The `compliance` scope is cached per (record, days, timezone). Delegable at READ level over the - `medications` section. Not module-gated. Cookie or Bearer auth." + morning. The `compliance` scope is cached per (record, days, timezone). v1.49.0: the `today` scope answers with + an `ETag`, a hash of the exact body, which changes on any change to the rows (an edit, a new row, a tombstoned + row that leaves the list, a dose whose resolved state moved with the clock) and on nothing else; a request whose + `If-None-Match` names it answers 304 with no body, so a client confirms its cached rows in one round trip. + Delegable at READ level over the `medications` section. Not module-gated. Cookie or Bearer auth." parameters: - in: query name: scope @@ -6329,16 +7146,48 @@ paths: minimum: 1 maximum: 365 description: Trailing window for the `compliance` scope, 1..365, default 30. Ignored by the `today` scope. + - in: header + name: if-none-match + schema: + description: "`scope=today` only: the `ETag` of the rows the client holds. A match answers 304." + type: string + description: "`scope=today` only: the `ETag` of the rows the client holds. A match answers 304." responses: "200": description: "`TodayIntakeEntry[]` for `scope=today`, `MedicationComplianceDayBucket[]` for `scope=compliance`. The - array is the whole payload — there is no wrapper object inside `data`." + array is the whole payload — there is no wrapper object inside `data`. `scope=today` carries `ETag`, + `HealthLog-As-Of` and `Cache-Control: private, no-cache`." + headers: + ETag: + description: "`scope=today` only: the strong content tag of the body, for `If-None-Match`." + schema: + type: string + HealthLog-As-Of: + description: "v1.49.0, `scope=today` only: the server instant the rows were read at (ISO 8601, UTC, milliseconds). + Compare it with `asOf` of a `MEDICATION_INTAKE_RECORDED` push: a push newer than the list holds a change + the list does not show yet. A header, not a body field, so it does not move the `ETag`." + schema: + type: string + format: date-time content: application/json: schema: $ref: "#/components/schemas/MedicationIntakeAggregateEnvelope" + "304": + description: "`scope=today` only: the rows are unchanged since the `If-None-Match` ETag. No body; the `ETag` is + repeated, and `HealthLog-As-Of` names the instant they were confirmed current." + headers: + ETag: + description: The same tag as the request's `If-None-Match`. + schema: + type: string + HealthLog-As-Of: + description: The server instant the rows were read and found unchanged (ISO 8601, UTC, milliseconds). + schema: + type: string + format: date-time "401": *a1 - "403": *a20 + "403": *a18 "422": description: The query failed validation — a missing or unknown `scope`, or a `days` outside 1..365. Multi-issue envelope; an audit breadcrumb is filed under the RECORD as `medications.intake.list.validation-failed` with @@ -6388,8 +7237,10 @@ paths: format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ snoozedUntil: - description: How long to defer. Defaults to 30 minutes from now. Deliberately UNBOUNDED — nothing here caps how far out - it may sit. Ignored unless the status is `snoozed`. + description: How long to defer. Defaults to now plus the user's `notificationPrefs.medication.snoozeMinutes` (30 unless + set), the same length the web card and Telegram use; a client that offers the setting's "Remind me + later" may omit it. Deliberately UNBOUNDED — nothing here caps how far out it may sit. Ignored + unless the status is `snoozed`. type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ @@ -6460,10 +7311,11 @@ paths: `medications.intake.update.validation-failed`), or `meta.errorCode` = `medications.intake.injection_site.disallowed` when the site is outside the medication's effective allowed set, or `medications.intake.force_slot.invalid` when `forceSlotInstant` is not a real slot of the - medication, or (v1.42.0) `medication.intake.notTracked` when the event is still open and its medication is - kept as a record only (`trackIntake: false`): resolving or snoozing it would record a new dose that is - counted nowhere. Correcting an event that is already taken or skipped stays open. The coded refusals carry - no issue list — branch on the code." + medication, or `medications.intake.force_slot.occupied` when a take would move onto a slot that already + holds a take (nothing changes; the dose stays on its row), or (v1.42.0) `medication.intake.notTracked` when + the event is still open and its medication is kept as a record only (`trackIntake: false`): resolving or + snoozing it would record a new dose that is counted nowhere. Correcting an event that is already taken or + skipped stays open. The coded refusals carry no issue list — branch on the code." content: application/json: schema: @@ -6493,7 +7345,7 @@ paths: schema: $ref: "#/components/schemas/Glp1DetailResponseEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication not found (or owned by another account). content: @@ -6599,7 +7451,7 @@ paths: schema: $ref: "#/components/schemas/Glp1PostResponseEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication not found (or owned by another account). content: @@ -6745,7 +7597,7 @@ paths: schema: $ref: "#/components/schemas/ReminderPhaseConfigEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication not found (or owned by another account). content: @@ -6863,7 +7715,7 @@ paths: schema: $ref: "#/components/schemas/ListMedicationSideEffectsEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication not found (or owned by another account). content: @@ -6902,7 +7754,7 @@ paths: schema: $ref: "#/components/schemas/CreateMedicationSideEffectEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication not found (or owned by another account). content: @@ -6917,6 +7769,53 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" + /api/medications/{id}/glp1/dose-changes: + delete: + tags: + - Medications + summary: Remove one GLP-1 titration step by its client id + description: "For a step a device removed before its upload answered: the device knows the `clientId` but not the server + id, and not whether the step reached the server. Idempotent: removes the step under this `clientId` when one + exists, and spends the client id either way, so a create under it that arrives later answers 410 + `glp1.doseChange.deleted` and writes nothing. Answers 204 whether or not a step was found. A create that was + already past its own check when this delete ran can still land; a client that sees that create answer 200 or 201 + sends this delete once more. Audits `medication.glp1.doseChange.delete` when a step was removed. Rate-limited + 30/min keyed on the ACTOR, shared with the step's other writes. Delegable at MANAGE level over the `medications` + section. Cookie or Bearer auth." + parameters: + - in: path + name: id + schema: + type: string + required: true + - in: query + name: clientId + schema: + type: string + minLength: 1 + maxLength: 128 + pattern: ^[A-Za-z0-9._:-]+$ + description: The client id the step was (or may have been) uploaded under. + required: true + description: The client id the step was (or may have been) uploaded under. + responses: + "204": + description: The client id is spent, and the step under it, if there was one, is removed. No body. + "401": *a1 + "403": *a18 + "404": + description: No such medication for this record. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "422": + description: "`clientId` is missing or malformed." + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "429": *a5 /api/medications/{id}/glp1/dose-changes/{doseChangeId}: patch: tags: @@ -6953,7 +7852,7 @@ paths: schema: $ref: "#/components/schemas/Glp1DoseChangePatchEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: No such step for this medication and this record. An unknown id, another medication's step and another record's step are indistinguishable. @@ -6973,7 +7872,9 @@ paths: tags: - Medications summary: Remove one GLP-1 titration step - description: "A HARD delete: the step is removed, not tombstoned, and its client id is free again. The audit row + description: "A HARD delete: the step is removed. Its client id is spent with it, so a later create under the same + `clientId` answers 410 `glp1.doseChange.deleted` instead of bringing the step back. A step known only by its + client id is removed at `DELETE /api/medications/{id}/glp1/dose-changes?clientId=`. The audit row (`medication.glp1.doseChange.delete`) carries the step's dose, unit, date and client id, so the removal is reconstructable from the trail. Rate-limited 30/min keyed on the ACTOR. Delegable at MANAGE level over the `medications` section. Cookie or Bearer auth." @@ -6996,7 +7897,7 @@ paths: schema: $ref: "#/components/schemas/DeleteGlp1DoseChangeEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: No such step for this medication and this record. An unknown id, another medication's step and another record's step are indistinguishable. @@ -7036,7 +7937,7 @@ paths: schema: $ref: "#/components/schemas/DeleteMedicationSideEffectEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: No such entry for this medication and this record. An unknown id, another medication's entry and another record's entry are indistinguishable. @@ -7086,7 +7987,7 @@ paths: schema: $ref: "#/components/schemas/UpdateMedicationIntakeEventEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: No live event with that id under this medication and record. An unknown id and an already-tombstoned one are indistinguishable. @@ -7098,7 +7999,10 @@ paths: description: "Body validation failed (multi-issue), or one of three coded refusals: `medications.intake.taken_at.before_start` when the edited take predates the medication's start day in the record's timezone, `medications.intake.force_slot.invalid` when the pinned instant is not a real slot, and - `medications.intake.force_slot.occupied` when it is a real slot that another live dose already holds." + `medications.intake.force_slot.occupied` when it is a real slot that another live dose already holds (since + v1.49.0 with `meta.slotInstant`, `meta.takenAt` and `meta.takenVia` of the dose that holds it), or when the + corrected dose would move onto a slot that already holds a take (nothing changes; the dose stays where it + was)." content: application/json: schema: @@ -7108,13 +8012,15 @@ paths: tags: - Medications summary: Undo one dose - description: "A SOFT delete: the row stays, `deletedAt` is stamped and the sync counter bumps, so a client that was - offline when it happened receives a tombstone keyed on the server id rather than silently keeping the dose - forever. Every today, compliance and list read filters tombstones out, so it is invisible from here on. The - inventory stamp is REFUNDED — undoing a dose puts the units back in the container — and the day's compliance - rollup is recomputed, dropping the row entirely when the day now holds nothing. Undoing the single live dose of - a one-shot medication reactivates that medication so the lists and the worker pick it back up. Re-deleting is - harmless. Delegable at MANAGE level over the `medications` section. Cookie or Bearer auth." + description: "Undo is serialised with every take of the slot and re-reads the row under the slot lock. Send + `expectedSyncVersion` (and, for a take recorded with a key, `expectedIdempotencyKey`) so an undo never removes a + dose another writer recorded. A SOFT delete: the row stays, `deletedAt` is stamped and the sync counter bumps, + so a client that was offline when it happened receives a tombstone keyed on the server id rather than silently + keeping the dose forever. Every today, compliance and list read filters tombstones out, so it is invisible from + here on. The inventory stamp is REFUNDED — undoing a dose puts the units back in the container — and the day's + compliance rollup is recomputed, dropping the row entirely when the day now holds nothing. Undoing the single + live dose of a one-shot medication reactivates that medication so the lists and the worker pick it back up. + Re-deleting is harmless. Delegable at MANAGE level over the `medications` section. Cookie or Bearer auth." parameters: - in: path name: id @@ -7126,6 +8032,30 @@ paths: schema: type: string required: true + - in: query + name: expectedSyncVersion + schema: + description: "The row's `syncVersion` as this client last saw it (the take's response carries it). When the row has + changed since, the undo is refused with 409 and nothing is deleted. Sent but not a whole number from 0 + (e.g. `-1`, `1.5`, empty): 422 `medications.intake.invalidPrecondition`, nothing deleted." + type: string + pattern: ^\d{1,9}$ + description: "The row's `syncVersion` as this client last saw it (the take's response carries it). When the row has + changed since, the undo is refused with 409 and nothing is deleted. Sent but not a whole number from 0 (e.g. + `-1`, `1.5`, empty): 422 `medications.intake.invalidPrecondition`, nothing deleted." + - in: query + name: expectedIdempotencyKey + schema: + description: "The idempotency key of the take this client recorded. When the row carries another key it holds someone + else's take (a take that answered `alreadyTaken` keeps the first writer's key), so the undo is refused + with 409. Sent but empty or over 128 characters: 422 `medications.intake.invalidPrecondition`, nothing + deleted." + type: string + minLength: 1 + maxLength: 128 + description: "The idempotency key of the take this client recorded. When the row carries another key it holds someone + else's take (a take that answered `alreadyTaken` keeps the first writer's key), so the undo is refused with + 409. Sent but empty or over 128 characters: 422 `medications.intake.invalidPrecondition`, nothing deleted." responses: "200": description: The dose was tombstoned and its inventory refunded. @@ -7134,14 +8064,28 @@ paths: schema: $ref: "#/components/schemas/DeleteMedicationIntakeEventEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: No event with that id under this medication and record. content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "422": *a4 + "409": + description: "`medications.intake.changedSinceSeen`: the row changed since the client read it, or holds another writer's + take. Nothing was deleted; re-read the slot." + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "422": + description: "`medications.intake.invalidPrecondition`: `expectedSyncVersion` or `expectedIdempotencyKey` was sent but + is not readable. Nothing was deleted; an absent precondition is allowed, a broken one never skips the + check." + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" "429": *a5 /api/medications/{id}/intake/bulk-delete: post: @@ -7177,7 +8121,7 @@ paths: schema: $ref: "#/components/schemas/BulkDeleteMedicationIntakeEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication not found (or owned by another account). content: @@ -7219,7 +8163,7 @@ paths: schema: $ref: "#/components/schemas/PurgeMedicationIntakeEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication not found (or owned by another account). content: @@ -7264,7 +8208,7 @@ paths: schema: $ref: "#/components/schemas/MedicationIntakeImportAcceptedEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication not found (or owned by another account). content: @@ -7345,7 +8289,7 @@ paths: schema: $ref: "#/components/schemas/ListMedicationsResponse" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 post: @@ -7384,7 +8328,7 @@ paths: schema: $ref: "#/components/schemas/CreateMedicationResponse" "401": *a1 - "403": *a20 + "403": *a18 "409": *a7 "422": *a4 "429": *a5 @@ -7404,7 +8348,7 @@ paths: schema: $ref: "#/components/schemas/ListMedicationCategoriesResponse" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 post: @@ -7431,7 +8375,7 @@ paths: schema: $ref: "#/components/schemas/CreateMedicationCategoryResponse" "401": *a1 - "403": *a20 + "403": *a18 "409": *a7 "422": *a4 "429": *a5 @@ -7526,7 +8470,7 @@ paths: schema: $ref: "#/components/schemas/MedicationCoursesResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication not found (or another user's). content: @@ -7565,7 +8509,7 @@ paths: schema: $ref: "#/components/schemas/CreateMedicationCourseResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication not found (or another user's). content: @@ -7604,7 +8548,7 @@ paths: schema: $ref: "#/components/schemas/EndMedicationCourseResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication not found (`medications.course.notFound`), or another user's. content: @@ -7651,7 +8595,7 @@ paths: schema: $ref: "#/components/schemas/UpdateMedicationCourseResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Course not found (`medications.course.notFound`), or another user's. content: @@ -7686,7 +8630,7 @@ paths: schema: $ref: "#/components/schemas/DeleteMedicationCourseResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Course not found (`medications.course.notFound`), or another user's. content: @@ -7711,7 +8655,7 @@ paths: schema: $ref: "#/components/schemas/MedicationListLayoutResponse" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 put: @@ -7746,7 +8690,7 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "422": &a22 + "422": &a26 description: Request validation failed. When the body carried a `baseUpdatedAt` that could not be parsed as an ISO-8601 timestamp — including an explicit `null` — `meta.errorCode` = `invalid_base_updated_at` and nothing was written. Omit the key entirely for the unconditional write; do not send `null` for it. @@ -7792,7 +8736,7 @@ paths: schema: $ref: "#/components/schemas/GetMedicationResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication not found (or owned by another user). content: @@ -7833,7 +8777,7 @@ paths: schema: $ref: "#/components/schemas/UpdateMedicationResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication not found (or owned by another user). content: @@ -7877,8 +8821,10 @@ paths: - Medications summary: Log an intake event for a medication description: Records a taken or skipped dose. Idempotent via the `Idempotency-Key` header AND the optional - `idempotencyKey` body field (the route walks both paths); a re-post inside the 60 s server-side dedup window - returns the original event. Non-skipped intakes auto-decrement pen inventory (best-effort), refresh the per-day + `idempotencyKey` body field (the route walks both paths). Without a key, a dose no slot answers that repeats a + recorded one within a minute (a take of the same kind with its `takenAt` within 60 s, a skip anchored within 60 + s) is answered with that row; the check reads what rows record, so a pending slot, a deleted row or a take at + another time never counts. Non-skipped intakes auto-decrement pen inventory (best-effort), refresh the per-day compliance rollup, and — for `oneShot:true` medications — flip `active` to false. parameters: - in: path @@ -7895,19 +8841,29 @@ paths: $ref: "#/components/schemas/MedicationIntakeRequest" responses: "200": - description: Idempotent replay — the original event is returned without creating a new row. + description: "Idempotent replay — the original event is returned without creating a new row (a key replay with + `alreadyTaken: false`, a keyless skip within a minute of a recorded skip the same way). A keyless take that + no slot answers, within a minute of a recorded take of the same kind on its own instant (an extra dose of an + extra dose, a plain take of a plain take), is a double tap: that row with `alreadyTaken: true`, nothing + written. Also a repeat: a take that names no slot, for a slot already holding a take recorded within two + hours, returns that row with `alreadyTaken: true` and writes nothing (one further away is a dose of its own + and answers the nearest open slot, 201). A take or a skip that names a slot already holding a take answers + the same way: the first take is never overwritten from here, and a deliberate change of a recorded take goes + through the row (`POST /api/medications/intake`, `PUT /api/medications/{id}/intake/{eventId}`)." content: application/json: schema: $ref: "#/components/schemas/ReplayMedicationIntakeResponse" "201": - description: Intake event created. + description: Intake event created. A dose no slot answers is stored on its own instant (`scheduledFor = takenAt`); when + another live row of the medication holds that exact instant (an extra dose logged on the minute of a slot), + it is stored on the next free millisecond, both fields moved together. content: application/json: schema: $ref: "#/components/schemas/CreateMedicationIntakeResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication not found (or owned by another user). content: @@ -7917,7 +8873,10 @@ paths: "409": *a7 "422": description: "Body validation failed (multi-issue envelope), or `meta.errorCode` names the refusal: - `medications.intake.injection_site.disallowed`, `medications.intake.force_slot.invalid`, or (v1.42.0) + `medications.intake.injection_site.disallowed`, `medications.intake.force_slot.invalid`, + `medications.intake.force_slot.occupied` (the pinned slot already holds a recorded take or skip; since + v1.49.0 `meta.slotInstant`, `meta.takenAt` and `meta.takenVia` name the slot and the take that holds it, + both null when a skip holds it, the way an `alreadyTaken` answer does), or (v1.42.0) `medication.intake.notTracked` when the medication is kept as a record only (`trackIntake: false`). Its stored history stays; a new dose is refused rather than stored and counted nowhere. The check runs after ownership, so a foreign medication is still a 404." @@ -7990,7 +8949,7 @@ paths: schema: $ref: "#/components/schemas/ListMedicationIntakeEventsResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication not found (or owned by another user). content: @@ -8023,7 +8982,7 @@ paths: schema: $ref: "#/components/schemas/ListMedicationInventoryResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication not found (or owned by another user). content: @@ -8059,7 +9018,7 @@ paths: schema: $ref: "#/components/schemas/CreateMedicationInventoryItemResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication not found (or owned by another user). content: @@ -8103,7 +9062,7 @@ paths: schema: $ref: "#/components/schemas/UpdateMedicationInventoryItemResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Inventory item not found (or owned by another user / medication). content: @@ -8138,7 +9097,7 @@ paths: schema: $ref: "#/components/schemas/DeleteMedicationInventoryItemResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Inventory item not found (or owned by another user / medication). content: @@ -8236,7 +9195,7 @@ paths: schema: $ref: "#/components/schemas/GetMedicationCadenceResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication not found (or owned by another user). content: @@ -8285,7 +9244,7 @@ paths: schema: $ref: "#/components/schemas/ListMedicationComplianceResponse" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/medications/{id}/compliance: @@ -8312,7 +9271,7 @@ paths: schema: $ref: "#/components/schemas/GetMedicationComplianceResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication not found (or owned by another user). content: @@ -8345,7 +9304,7 @@ paths: schema: $ref: "#/components/schemas/GetMedicationEfficacyResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication not found (or owned by another user). content: @@ -8383,7 +9342,7 @@ paths: schema: $ref: "#/components/schemas/SetMedicationEfficacyTargetResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication or biomarker not found. content: @@ -8441,7 +9400,7 @@ paths: schema: $ref: "#/components/schemas/GetDoseHistoryResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication not found (or owned by another user). content: @@ -8450,6 +9409,56 @@ paths: $ref: "#/components/schemas/ErrorEnvelope" "422": *a4 "429": *a5 + /api/medications/resolved-slots: + get: + tags: + - Medications + summary: Resolved slots of every medication over a window + description: "Since v1.49.0. Every scheduled dose of the record's medications that can be due (active, not as-needed, + intake tracked) with its slot time in [from, to], each with its resolved state. One request for what a client + otherwise reads per medication from `GET /api/medications/{id}/dose-history`: the slots and states come from the + same dose ledger and resolver as the dose history, the today list and the medication card, over the same window, + so they never disagree. The statement count does not grow with the number of medications. The window is at most + 14 days; without `from` and `to` it runs from two days back to eight days ahead. Auth, scope and rate limit as + `dose-history`: a read of the `medications` section of the record the request resolves (cookie, or a Bearer + token that reads medications), 60 requests a minute per caller, no server cache." + parameters: + - in: query + name: from + schema: + description: Window start (inclusive). Defaults to two days before now, or to ten days before `to` when only `to` is + given. + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + description: Window start (inclusive). Defaults to two days before now, or to ten days before `to` when only `to` is + given. + - in: query + name: to + schema: + description: Window end (inclusive). Defaults to eight days after now, or to ten days after `from` when only `from` is + given. Must be ≥ `from` and at most 14 days after it, else 422. + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + description: Window end (inclusive). Defaults to eight days after now, or to ten days after `from` when only `from` is + given. Must be ≥ `from` and at most 14 days after it, else 422. + responses: + "200": + description: Resolved slots per medication. + content: + application/json: + schema: + $ref: "#/components/schemas/GetResolvedMedicationSlotsResponse" + "401": *a1 + "403": *a18 + "422": + description: "Query validation failed: an instant that is not ISO 8601, `to` before `from`, or a window over 14 days." + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "429": *a5 /api/medications/{id}/schedule-revisions: get: tags: @@ -8472,7 +9481,7 @@ paths: schema: $ref: "#/components/schemas/ListScheduleRevisionsResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication not found (or owned by another user). content: @@ -8510,7 +9519,7 @@ paths: schema: $ref: "#/components/schemas/CreateScheduleRevisionResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication not found (or owned by another user). content: @@ -8554,7 +9563,7 @@ paths: schema: $ref: "#/components/schemas/UpdateScheduleRevisionResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication or revision not found (or owned by another user). content: @@ -8595,7 +9604,7 @@ paths: schema: $ref: "#/components/schemas/DeleteScheduleRevisionResponse" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Medication or revision not found (or owned by another user). content: @@ -8658,7 +9667,7 @@ paths: schema: $ref: "#/components/schemas/MedicationDoseHistoryImportQueuedEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "409": description: A dose-history import is already in progress. content: @@ -8720,7 +9729,7 @@ paths: schema: $ref: "#/components/schemas/MedicationIntakeImportJobStatusEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: No such job for this medication (or owned by another user). content: @@ -8754,7 +9763,7 @@ paths: schema: $ref: "#/components/schemas/MedicationIntakeImportJobStatusEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: No such job for this account (or owned by another user). content: @@ -8784,7 +9793,7 @@ paths: schema: $ref: "#/components/schemas/ProfileSummaryEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/ai/test: @@ -8981,7 +9990,7 @@ paths: summary: Replace per-user Coach prompt-tuning preferences description: "Persists the supplied prefs. Body is validated against `CoachPrefs`; missing keys fall back to the documented defaults. Supports optimistic concurrency: echo the `updatedAt` from the last read as `baseUpdatedAt` - and the write is refused with 409 if the row changed since; omit it for the legacy unconditional write." + and the write is refused with 409 if the prefs changed since; omit it for the legacy unconditional write." requestBody: required: true content: @@ -9006,7 +10015,7 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "422": *a22 + "422": *a26 "429": *a5 /api/auth/me/disable-coach: get: @@ -9217,7 +10226,7 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "422": *a22 + "422": *a26 "429": *a5 /api/auth/me/source-priority: get: @@ -10553,7 +11562,7 @@ paths: schema: $ref: "#/components/schemas/ErrorEnvelope" "422": *a4 - "429": *a23 + "429": *a27 /api/auth/me/notification-prefs: get: tags: @@ -10581,8 +11590,8 @@ paths: the siblings intact. Always returns the fully-resolved next state so clients can hard-set their optimistic update. `medication.clientManaged: true` (or `deliveryDefault: "client"`) keeps the MEDICATION_REMINDER that announces a dose off APNs and leaves the follow-ups for a dose still open on it (v1.42.0); - `medication.lowStockRunwayDays` (1–60, nullable, default 7) tunes the low-stock alert — null switches it off. - Rate-limit 60/min per user.' + `medication.lowStockRunwayDays` (1–60, nullable, default 7) tunes the low-stock alert — null switches it off; + `medication.snoozeMinutes` (5–240, default 30) is the snooze length. Rate-limit 60/min per user.' requestBody: required: true content: @@ -10607,7 +11616,7 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "422": *a22 + "422": *a26 "429": *a5 /api/auth/me/report-selection: get: @@ -10699,7 +11708,7 @@ paths: application/json: schema: $ref: "#/components/schemas/PatchUnitPreferenceEnvelope" - "400": &a24 + "400": &a28 description: The request body is not parseable JSON. Nothing was written. content: application/json: @@ -10707,13 +11716,13 @@ paths: $ref: "#/components/schemas/ErrorEnvelope" "401": *a1 "403": *a9 - "413": &a25 + "413": &a29 description: Request body exceeds 1024 bytes. Nothing was written. content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "415": &a26 + "415": &a30 description: "The request did not carry `Content-Type: application/json`. Nothing was read and nothing was written." content: application/json: @@ -10769,11 +11778,11 @@ paths: application/json: schema: $ref: "#/components/schemas/PatchGlucoseUnitEnvelope" - "400": *a24 + "400": *a28 "401": *a1 "403": *a9 - "413": *a25 - "415": *a26 + "413": *a29 + "415": *a30 "422": *a4 "429": *a5 /api/auth/me/documents-auto-ai-read: @@ -10829,11 +11838,11 @@ paths: application/json: schema: $ref: "#/components/schemas/PatchDocumentsAutoAiReadEnvelope" - "400": *a24 + "400": *a28 "401": *a1 "403": *a9 - "413": *a25 - "415": *a26 + "413": *a29 + "415": *a30 "422": *a4 "429": *a5 /api/auth/me/injection-site-prefs: @@ -11135,11 +12144,11 @@ paths: application/json: schema: $ref: "#/components/schemas/PatchLabsLocalOcrEnvelope" - "400": *a24 + "400": *a28 "401": *a1 "403": *a9 - "413": *a25 - "415": *a26 + "413": *a29 + "415": *a30 "422": *a4 "429": *a5 /api/auth/me/workout-routes: @@ -11180,11 +12189,11 @@ paths: application/json: schema: $ref: "#/components/schemas/PatchWorkoutRoutesEnvelope" - "400": *a24 + "400": *a28 "401": *a1 "403": *a9 - "413": *a25 - "415": *a26 + "413": *a29 + "415": *a30 "422": *a4 "429": *a5 /api/auth/me/use-central-codex: @@ -11230,11 +12239,11 @@ paths: application/json: schema: $ref: "#/components/schemas/PatchUseCentralCodexEnvelope" - "400": *a24 + "400": *a28 "401": *a1 "403": *a9 - "413": *a25 - "415": *a26 + "413": *a29 + "415": *a30 "422": *a4 "429": *a5 /api/auth/me/locale: @@ -11441,7 +12450,7 @@ paths: $ref: "#/components/schemas/ErrorEnvelope" "422": *a4 "429": *a5 - "503": &a29 + "503": &a32 description: "The AI capability could not be resolved (its inputs could not be read) and the answer failed closed: `meta.errorCode` = `ai.unavailable`, `meta.reason` = `check_failed`. Retry later; no data depends on it." content: @@ -11835,8 +12844,8 @@ paths: summary: Replace the calling user's Insights tile layout description: "Persists the full tile layout. The normalised layout plus the advanced `updatedAt` token is returned. Optimistic concurrency (v1.32.21): send `baseUpdatedAt` (the token from a prior read) and the write 409s if the - stored row changed since; omit it for the legacy unconditional write. Invalid bodies return the multi-issue 422 - envelope, matching the dashboard-widgets route." + stored layout changed since; omit it for the legacy unconditional write. Invalid bodies return the multi-issue + 422 envelope, matching the dashboard-widgets route." requestBody: required: true content: @@ -11860,7 +12869,7 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "422": *a22 + "422": *a26 "429": *a5 delete: tags: @@ -12042,7 +13051,7 @@ paths: schema: $ref: "#/components/schemas/CoachNudgeStatus" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/coach/seen: @@ -12100,7 +13109,8 @@ paths: deterministic completion hints otherwise, with no provider call) and returns them as `pendingQuestions`. Rate-limited per user. Optimistic concurrency (v1.32.21): send `baseUpdatedAt` (the `updatedAt` from a prior read) and the write 409s if the stored self-context changed since; omit it for the legacy unconditional write. - The token is per-surface (`UserHealthProfile.updatedAt`), so it is not perturbed by unrelated account writes." + The token is the about-me document's own revision, so it is not perturbed by unrelated account or + emergency-profile writes." requestBody: required: true content: @@ -12137,11 +13147,11 @@ paths: baseUpdatedAt: description: "Optimistic-concurrency base token: the `updatedAt` the client last read for this resource. Omit it for the legacy unconditional write (older clients are unaffected). When present, the write is guarded on the - stored row still carrying this exact value — a stale token fails with 409 and changes nothing. A - present-but-unparseable value fails with 422 and `meta.errorCode` = `invalid_base_updated_at` — note - that this is NOT the unconditional write: sending `null` or a malformed string is rejected rather - than treated as an omitted token. Treat as opaque: only ever echo a server-returned value, never - parse or synthesise it." + stored resource still carrying this exact value — a stale token fails with 409 and changes nothing. + A present-but-unparseable value fails with 422 and `meta.errorCode` = `invalid_base_updated_at` — + note that this is NOT the unconditional write: sending `null` or a malformed string is rejected + rather than treated as an omitted token. Treat as opaque: only ever echo a server-returned value, + never parse or synthesise it." type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ @@ -12163,7 +13173,7 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "422": *a22 + "422": *a26 "429": *a5 /api/anamnesis/facts: get: @@ -12182,7 +13192,7 @@ paths: schema: $ref: "#/components/schemas/GetAnamnesisFactsResponse" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 post: @@ -12657,7 +13667,7 @@ paths: $ref: "#/components/schemas/CorrectAnamnesisFactResponse" "401": *a1 "403": *a9 - "404": &a27 + "404": &a31 description: No current revision with this id exists for the authenticated account. content: application/json: @@ -12694,7 +13704,7 @@ paths: $ref: "#/components/schemas/RemoveAnamnesisFactResponse" "401": *a1 "403": *a9 - "404": *a27 + "404": *a31 "409": description: Anamnesis fact changed since it was loaded (optimistic-concurrency conflict). No write happened. Re-read the resource, re-apply the user's change against the fresh state, and resend with the new token. @@ -13065,7 +14075,7 @@ paths: schema: $ref: "#/components/schemas/CoachRemindersList" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 post: @@ -13233,12 +14243,7 @@ paths: schema: $ref: "#/components/schemas/AdminInviteList" "401": *a1 - "403": &a28 - description: The session is valid but its account is not an administrator. `meta.errorCode` = `auth.admin.required`. - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorEnvelope" + "403": *a25 "422": *a4 "429": *a5 post: @@ -13274,7 +14279,7 @@ paths: schema: $ref: "#/components/schemas/AdminInviteCreated" "401": *a1 - "403": *a28 + "403": *a25 "422": *a4 "429": *a5 /api/admin/invites/{id}: @@ -13299,7 +14304,7 @@ paths: schema: $ref: "#/components/schemas/AdminInviteRevoked" "401": *a1 - "403": *a28 + "403": *a25 "422": *a4 "429": *a5 /api/insights/chat/messages/{id}/feedback: @@ -13339,6 +14344,24 @@ paths: $ref: "#/components/schemas/ErrorEnvelope" "422": *a4 "429": *a5 + /api/admin/migrations: + get: + tags: + - Admin + summary: "Database migrations: applied, pending, failed" + description: "Compares the migrations this image ships (`prisma/migrations`) with the finished rows of + `_prisma_migrations`. Read-only. Cookie auth only: `requireAdmin()` refuses every Bearer caller." + responses: + "200": + description: The status. + content: + application/json: + schema: + $ref: "#/components/schemas/AdminMigrationStatusResponse" + "401": *a1 + "403": *a25 + "422": *a4 + "429": *a5 /api/admin/maintenance/measurements: get: tags: @@ -13355,7 +14378,7 @@ paths: schema: $ref: "#/components/schemas/AdminMeasurementMaintenanceStatusResponse" "401": *a1 - "403": *a28 + "403": *a25 "422": *a4 "429": *a5 post: @@ -13485,7 +14508,7 @@ paths: schema: $ref: "#/components/schemas/DashboardSnapshotResponseEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/comprehensive: @@ -13507,7 +14530,7 @@ paths: schema: $ref: "#/components/schemas/InsightsComprehensiveResponseEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/presence: @@ -13528,7 +14551,7 @@ paths: schema: $ref: "#/components/schemas/InsightsPresenceEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/cards: @@ -13549,7 +14572,7 @@ paths: schema: $ref: "#/components/schemas/InsightsCardsEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/pregenerate: @@ -13687,7 +14710,7 @@ paths: schema: $ref: "#/components/schemas/ErrorEnvelope" "429": *a5 - "503": *a29 + "503": *a32 post: tags: - Insights @@ -13959,7 +14982,7 @@ paths: schema: $ref: "#/components/schemas/CoachReadStripEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/narrative: @@ -14008,7 +15031,7 @@ paths: schema: $ref: "#/components/schemas/NarrativeEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/glp1-timeline: @@ -14045,7 +15068,7 @@ paths: schema: $ref: "#/components/schemas/Glp1TimelineEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/pulse/intraday: @@ -14081,7 +15104,7 @@ paths: schema: $ref: "#/components/schemas/IntradayPulseEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/settings: @@ -14157,7 +15180,7 @@ paths: schema: $ref: "#/components/schemas/TargetsEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/analytics/range: @@ -14239,7 +15262,7 @@ paths: schema: $ref: "#/components/schemas/BloodPressureStatusResponseEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/pulse-status: @@ -14279,7 +15302,7 @@ paths: schema: $ref: "#/components/schemas/PulseStatusResponseEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/weight-status: @@ -14319,7 +15342,7 @@ paths: schema: $ref: "#/components/schemas/WeightStatusResponseEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/bmi-status: @@ -14359,7 +15382,7 @@ paths: schema: $ref: "#/components/schemas/BmiStatusResponseEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/mood-status: @@ -14399,7 +15422,7 @@ paths: schema: $ref: "#/components/schemas/MoodStatusResponseEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/medication-compliance-status: @@ -14440,7 +15463,7 @@ paths: schema: $ref: "#/components/schemas/MedicationComplianceStatusResponseEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/metric-status: @@ -14547,7 +15570,7 @@ paths: schema: $ref: "#/components/schemas/MetricStatusResponseEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/biomarker-assessment: @@ -14600,7 +15623,7 @@ paths: schema: $ref: "#/components/schemas/BiomarkerAssessmentResponseEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/derived: @@ -14712,7 +15735,7 @@ paths: schema: $ref: "#/components/schemas/DerivedMetricResponseEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/derived/batch: @@ -14752,7 +15775,7 @@ paths: schema: $ref: "#/components/schemas/DerivedBatchResponseEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/score-history: @@ -14802,7 +15825,7 @@ paths: schema: $ref: "#/components/schemas/ScoreHistoryResponseEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/glp1-plateau: @@ -14822,7 +15845,7 @@ paths: schema: $ref: "#/components/schemas/InsightsGlp1PlateauResponseEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/ecg: @@ -14844,7 +15867,7 @@ paths: schema: $ref: "#/components/schemas/EcgListResponseEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 post: @@ -14922,7 +15945,7 @@ paths: schema: $ref: "#/components/schemas/EcgDetailResponseEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: No ECG recording with that id for the authenticated user (existence sealed — a foreign id is indistinguishable from a missing one). @@ -14954,7 +15977,7 @@ paths: schema: $ref: "#/components/schemas/RhythmEventsResponseEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/correlations: @@ -14976,7 +15999,7 @@ paths: schema: $ref: "#/components/schemas/CorrelationDiscoveryResponseEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/patterns: @@ -14994,7 +16017,7 @@ paths: schema: $ref: "#/components/schemas/CorrelationPatternListResponseEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/patterns/{id}: @@ -15024,7 +16047,7 @@ paths: schema: $ref: "#/components/schemas/UpdateCorrelationPatternResponseEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: No current pattern with that id for this account. content: @@ -15049,7 +16072,7 @@ paths: schema: $ref: "#/components/schemas/InsightsHealthStatusEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/breathing-screening: @@ -15068,7 +16091,7 @@ paths: schema: $ref: "#/components/schemas/InsightsBreathingScreeningEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/insights/labs-changes: @@ -15087,7 +16110,7 @@ paths: schema: $ref: "#/components/schemas/InsightsLabsChangesEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/mood/analytics: @@ -15110,7 +16133,7 @@ paths: schema: $ref: "#/components/schemas/MoodDailySeriesEnvelope" "401": *a1 - "403": *a16 + "403": *a20 "422": *a4 "429": *a5 /api/mood/insights: @@ -15145,7 +16168,7 @@ paths: schema: $ref: "#/components/schemas/MoodAggregatesEnvelope" "401": *a1 - "403": *a16 + "403": *a20 "422": *a4 "429": *a5 /api/mood/prognosis: @@ -15168,7 +16191,7 @@ paths: schema: $ref: "#/components/schemas/MoodPrognosisEnvelope" "401": *a1 - "403": *a21 + "403": *a24 "422": *a4 "429": *a5 /api/mood-entries/bulk: @@ -15282,7 +16305,7 @@ paths: $ref: "#/components/schemas/MoodCustomTagPatchEnvelope" "401": *a1 "403": *a9 - "404": &a30 + "404": &a33 description: Not found / not owned by the caller. content: application/json: @@ -15318,7 +16341,7 @@ paths: $ref: "#/components/schemas/MoodCustomTagDeleteEnvelope" "401": *a1 "403": *a9 - "404": *a30 + "404": *a33 "422": *a4 "429": *a5 /api/mood/tags/{key}/hidden: @@ -15355,7 +16378,7 @@ paths: $ref: "#/components/schemas/ErrorEnvelope" "401": *a1 "403": *a9 - "404": *a30 + "404": *a33 "422": *a4 "429": *a5 /api/mood/tags/groups: @@ -15410,7 +16433,7 @@ paths: $ref: "#/components/schemas/MoodTagGroupPatchEnvelope" "401": *a1 "403": *a9 - "404": *a30 + "404": *a33 "422": *a4 "429": *a5 delete: @@ -15442,7 +16465,7 @@ paths: $ref: "#/components/schemas/MoodTagGroupDeleteEnvelope" "401": *a1 "403": *a9 - "404": *a30 + "404": *a33 "422": *a4 "429": *a5 /api/mood/tags/layout: @@ -15492,7 +16515,7 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "422": *a22 + "422": *a26 "429": *a5 /api/mood-entries: get: @@ -15577,7 +16600,7 @@ paths: schema: $ref: "#/components/schemas/MoodEntryListEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 post: @@ -15592,7 +16615,9 @@ paths: `externalId` (422, `meta.errorCode` = `mood.create.external_id_not_delegable`) — it is a device's contract with its own rows. A rated factor outside its catalog scale 422s (`mood.ratedFactor.out_of_range`); a malformed body 422s (`mood.create.invalid`). An unstable `externalId` (an object description or memory address that rotates per - launch) is refused at validation. + launch) is refused at validation. An `externalId` that names an entry the person deleted in HealthLog answers + 410 (`mood.deleted_in_healthlog`) and writes nothing; one the app reported deleted in Apple Health is written + back as a live entry. parameters: - *a6 requestBody: @@ -15610,8 +16635,8 @@ paths: schema: $ref: "#/components/schemas/MoodEntryEnvelope" "401": *a1 - "403": *a20 - "409": &a31 + "403": *a18 + "409": &a34 description: A mood entry with the same `(date, moodLoggedAt)` instant already exists. `meta.errorCode` = `mood.duplicate_timestamp`. Only a request without `externalId` can answer this — with one, the write upserts in place. @@ -15619,6 +16644,16 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" + "410": + description: "The `externalId` names an entry the person deleted in HealthLog. Nothing was written, and a re-post gets + the same answer: treat it as final and drop the entry from the outbox. `meta.errorCode` = + `mood.deleted_in_healthlog`, `meta.reason` = `deleted_in_healthlog` (the word the bulk routes use per + entry), `meta.id` = the deleted row. An entry the app reported deleted in Apple Health (`DELETE + …/by-external-ids`) is written again instead." + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" "422": *a4 "429": *a12 /api/mood-entries/{id}: @@ -15642,8 +16677,8 @@ paths: schema: $ref: "#/components/schemas/MoodEntryEnvelope" "401": *a1 - "403": *a20 - "404": *a30 + "403": *a18 + "404": *a33 "422": *a4 "429": *a5 put: @@ -15677,9 +16712,9 @@ paths: schema: $ref: "#/components/schemas/MoodEntryEnvelope" "401": *a1 - "403": *a20 - "404": *a30 - "409": *a31 + "403": *a18 + "404": *a33 + "409": *a34 "422": *a4 "429": *a5 delete: @@ -15704,8 +16739,8 @@ paths: schema: $ref: "#/components/schemas/MoodEntryDeleteEnvelope" "401": *a1 - "403": *a20 - "404": *a30 + "403": *a18 + "404": *a33 "422": *a4 "429": *a5 /api/mood-entries/restore: @@ -15734,7 +16769,7 @@ paths: schema: $ref: "#/components/schemas/MoodEntriesRestoreEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "409": *a7 "422": *a4 "429": *a5 @@ -15763,7 +16798,7 @@ paths: schema: $ref: "#/components/schemas/MoodEntriesBulkDeleteEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "409": *a7 "422": *a4 "429": *a5 @@ -15807,7 +16842,7 @@ paths: schema: $ref: "#/components/schemas/MoodLinkedContextEnvelope" "401": *a1 - "403": *a21 + "403": *a24 "422": *a4 "429": *a5 /api/settings/ntfy: @@ -15856,7 +16891,7 @@ paths: application/json: schema: $ref: "#/components/schemas/PutNtfySettingsResponse" - "400": &a32 + "400": &a35 description: Body is not parseable JSON. content: application/json: @@ -15871,13 +16906,13 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "413": &a33 + "413": &a36 description: Body exceeds 64 KiB. content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "415": &a34 + "415": &a37 description: Content-Type is not `application/json`. content: application/json: @@ -15938,7 +16973,7 @@ paths: application/json: schema: $ref: "#/components/schemas/PutTelegramSettingsResponse" - "400": *a32 + "400": *a35 "401": *a1 "403": description: "`meta.errorCode` = `auth.scope.insufficient` when a Bearer token's scope does not reach this route; the @@ -15954,8 +16989,8 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "413": *a33 - "415": *a34 + "413": *a36 + "415": *a37 "422": description: Body matched neither accepted shape; or `enabled` is true without both a bot token and a chat id; or the deployment's `APP_URL` is not a public HTTPS host on port 80/88/443/8443; or Telegram refused the webhook @@ -16010,11 +17045,11 @@ paths: application/json: schema: $ref: "#/components/schemas/PutWebhookSettingsResponse" - "400": *a32 + "400": *a35 "401": *a1 "403": *a9 - "413": *a33 - "415": *a34 + "413": *a36 + "415": *a37 "422": description: Body matched neither accepted shape, or `enabled` is true while no webhook URL is stored; or the URL is on a private network the operator has not listed in `NOTIFICATION_PRIVATE_ORIGINS` (`meta.errorCode` = @@ -16041,7 +17076,7 @@ paths: schema: $ref: "#/components/schemas/GetReminderThresholdsResponse" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/settings/global-services: @@ -16662,7 +17697,7 @@ paths: anyOf: - $ref: "#/components/schemas/ConsentLatestForKindEnvelope" - $ref: "#/components/schemas/ConsentLatestByKindEnvelope" - "400": &a35 + "400": &a38 description: "`kind` was present but is not one of `ai_full`, `ai_insights_only`, `ai_coach`, `ai_extraction`. Multi-issue envelope; nothing was read or revoked. The consent family answers 400 here where the rest of the API answers 422." @@ -16723,7 +17758,7 @@ paths: anyOf: - $ref: "#/components/schemas/ConsentRevokeForKindEnvelope" - $ref: "#/components/schemas/ConsentRevokeAllEnvelope" - "400": *a35 + "400": *a38 "401": *a1 "403": *a9 "422": *a4 @@ -16737,7 +17772,8 @@ paths: a background worker. The response is **202 with a `jobId`**; poll `GET /api/import/health-connect-export/status`. Body is `multipart/form-data` with the file under `file`, streamed to disk after authentication like the Apple Health upload. Re-uploading the same bytes resolves to the still-viable - job and returns `idempotent: true`. Imported rows carry `source = HEALTH_CONNECT`. Cookie or wildcard Bearer." + job and returns `idempotent: true`. Imported rows carry `source = HEALTH_CONNECT`. Five uploads a minute per + account. Cookie or wildcard Bearer." requestBody: required: true content: @@ -16766,29 +17802,45 @@ paths: "401": *a1 "403": *a9 "409": - description: An import for this account (Health Connect or Apple Health) is already queued or running. The upload was - discarded. `errorCode` is `import.apple_health.busy` for either kind, `jobId` names the running job. + description: An import for this account (of any kind) is already queued or running. The upload was discarded. + `meta.errorCode` is `import.apple_health.busy` for every kind, `meta.jobId` names the running job; poll it, + then upload again. content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" "413": - description: The declared `Content-Length` exceeds the 1 GiB upload cap. + description: The file is larger than 1 GiB. Answered alike whether the declared `Content-Length` says so (beyond a 64 + KiB allowance for the multipart envelope) or the stream finds it while reading; `meta.errorCode` is + `import.file.too_large`. Nothing was kept. content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" "422": - description: "The multipart body could not be read: no `file` part, a malformed body, or more bytes than the cap. - Whether the ZIP is a readable Health Connect export is decided by the worker and reported on the job - (`status: failed`, `failureReason`)." + description: "The multipart body could not be read: no `file` part, a malformed boundary, or a dropped connection. The + message names the failure. Whether the file itself is readable is decided by the worker and reported on the + job (`status: failed`, `failureReason`)." + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "429": + description: More than five uploads of this kind in a minute by this account (the bucket `import::`, + spent before the body is read). Rate limit exceeded. The response carries `Retry-After` (whole seconds, + rounded up and never below 1 — wait at least that long before retrying), `X-RateLimit-Limit` (the bucket's + cap), `X-RateLimit-Remaining` and `X-RateLimit-Reset` (the reset instant, ISO-8601, not epoch seconds). Back + off on `Retry-After` rather than guessing. A 429 raised by a ceiling that is not one of these buckets — a + daily AI budget, an upstream provider's own refusal relayed onward — carries none of them, because there is + no bucket to describe. + headers: *a8 content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "429": *a5 "503": - description: No background worker is bound, or the queue did not take the job, so nothing would run the import. + description: No background worker is bound, or the queue did not take the job (the job is then marked failed), so + nothing would run the import. The upload was discarded; retry once a worker runs. content: application/json: schema: @@ -16825,7 +17877,7 @@ paths: start within the duplicate window) adds its series and track to that workout instead of being stored twice. New rows carry `source = IMPORT` and the external id `fit::`, so re-importing the same file changes nothing. Re-uploading the same bytes resolves to the still-viable job and - returns `idempotent: true`. Ten uploads a minute per account. Cookie or wildcard Bearer." + returns `idempotent: true`. Five uploads a minute per account. Cookie or wildcard Bearer." requestBody: required: true content: @@ -16855,27 +17907,44 @@ paths: "403": *a9 "409": description: An import for this account (of any kind) is already queued or running. The upload was discarded. - `errorCode` is `import.apple_health.busy`, `jobId` names the running job. + `meta.errorCode` is `import.apple_health.busy` for every kind, `meta.jobId` names the running job; poll it, + then upload again. content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" "413": - description: The file is larger than 10 MB. + description: The file is larger than 10 MB. Answered alike whether the declared `Content-Length` says so (beyond a 64 + KiB allowance for the multipart envelope) or the stream finds it while reading; `meta.errorCode` is + `import.file.too_large`. Nothing was kept. content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" "422": - description: "The multipart body could not be read: no `file` part or a malformed body. Whether the file is a readable - activity is decided by the worker and reported on the job (`status: failed`, `failureReason`)." + description: "The multipart body could not be read: no `file` part, a malformed boundary, or a dropped connection. The + message names the failure. Whether the file itself is readable is decided by the worker and reported on the + job (`status: failed`, `failureReason`)." + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "429": + description: More than five uploads of this kind in a minute by this account (the bucket `import::`, + spent before the body is read). Rate limit exceeded. The response carries `Retry-After` (whole seconds, + rounded up and never below 1 — wait at least that long before retrying), `X-RateLimit-Limit` (the bucket's + cap), `X-RateLimit-Remaining` and `X-RateLimit-Reset` (the reset instant, ISO-8601, not epoch seconds). Back + off on `Retry-After` rather than guessing. A 429 raised by a ceiling that is not one of these buckets — a + daily AI budget, an upstream provider's own refusal relayed onward — carries none of them, because there is + no bucket to describe. + headers: *a8 content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "429": *a5 "503": - description: No background worker is bound, or the queue did not take the job, so nothing would run the import. + description: No background worker is bound, or the queue did not take the job (the job is then marked failed), so + nothing would run the import. The upload was discarded; retry once a worker runs. content: application/json: schema: @@ -17420,7 +18489,8 @@ paths: Body is `multipart/form-data` with the file under the field name `file`, capped at 1.5 GB. The upload is streamed straight to disk rather than buffered, computing a SHA-256 in the same pass; the declared `Content-Length` is checked first as a cheap pre-flight, but the streaming sink enforces the cap independently, - so a missing or lying header does not get past it. + so a missing or lying header does not get past it. Either way a file past the cap is a 413 with `meta.errorCode` + = `import.file.too_large`. **Idempotency is by CONTENT, not by an `Idempotency-Key`.** A 1 GB upload has no stable client-side key, so @@ -17430,7 +18500,7 @@ paths: tombstoned by its own failure. - Rate-limited to 3 uploads per minute per user, checked before the body is touched. Cookie or wildcard Bearer. + Rate-limited to 5 uploads per minute per user, checked before the body is touched. Cookie or wildcard Bearer. requestBody: required: true content: @@ -17461,36 +18531,45 @@ paths: "401": *a1 "403": *a9 "409": - description: An import for this account is already queued or running, and these bytes are not the ones it carries (the - same bytes resolve to that job as a 202). `meta.errorCode` is `import.apple_health.busy` and `meta.jobId` - names the running job; poll it, then upload again. The upload was discarded. + description: An import for this account (of any kind) is already queued or running. The upload was discarded. + `meta.errorCode` is `import.apple_health.busy` for every kind, `meta.jobId` names the running job; poll it, + then upload again. content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" "413": - description: The declared `Content-Length` exceeds 1.5 GB. A body that exceeds the cap without declaring it is refused - by the streaming sink instead, which surfaces as the 422 below. + description: The file is larger than 1.5 GB. Answered alike whether the declared `Content-Length` says so (beyond a 64 + KiB allowance for the multipart envelope) or the stream finds it while reading; `meta.errorCode` is + `import.file.too_large`. Nothing was kept. content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" "422": - description: The multipart body could not be streamed to disk — no `file` part, a malformed boundary, or the size cap - tripped mid-stream. The message names the failure. + description: "The multipart body could not be read: no `file` part, a malformed boundary, or a dropped connection. The + message names the failure. Whether the file itself is readable is decided by the worker and reported on the + job (`status: failed`, `failureReason`)." content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" "429": - description: More than 3 uploads in a minute for this user. + description: More than five uploads of this kind in a minute by this account (the bucket `import::`, + spent before the body is read). Rate limit exceeded. The response carries `Retry-After` (whole seconds, + rounded up and never below 1 — wait at least that long before retrying), `X-RateLimit-Limit` (the bucket's + cap), `X-RateLimit-Remaining` and `X-RateLimit-Reset` (the reset instant, ISO-8601, not epoch seconds). Back + off on `Retry-After` rather than guessing. A 429 raised by a ceiling that is not one of these buckets — a + daily AI budget, an upstream provider's own refusal relayed onward — carries none of them, because there is + no bucket to describe. + headers: *a8 content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" "503": - description: No background worker is bound to this process, or the queue did not accept the job, so nothing will run it. - The staged upload is discarded (and a created job is marked failed); retry once a worker is running. + description: No background worker is bound, or the queue did not take the job (the job is then marked failed), so + nothing would run the import. The upload was discarded; retry once a worker runs. content: application/json: schema: @@ -17537,6 +18616,342 @@ paths: $ref: "#/components/schemas/ErrorEnvelope" "422": *a4 "429": *a5 + /api/import/gadgetbridge: + post: + tags: + - Import + summary: Upload a Gadgetbridge database export for background import + description: "Takes the SQLite file Gadgetbridge's \"Export database\" writes, at most 512 MB. Tables are found by name + and columns, so the importer reads every device family's schema version: activity samples become one + ACTIVITY_STEPS total per local day (the device with the most steps that day) and one PULSE mean per local hour; + SpO2 samples OXYGEN_SATURATION; resting and manual heart rate RESTING_HEART_RATE and PULSE; sleep sessions + SLEEP_DURATION in minutes; weight samples WEIGHT. Rows carry `source = IMPORT` and a stable identity, so a + second import writes nothing twice; a later export's larger day total replaces the earlier one. Every other + table with rows is named in the result's `skips`. Body is `multipart/form-data` with the file under `file`, + streamed to disk after authentication. The response is **202 with a `jobId`**; poll the status route. + Re-uploading the same bytes resolves to the still-viable job. One import per account at a time, whatever its + kind. Five uploads a minute per account and kind. A run stops at a ten-minute budget, keeps what it wrote and + fails with `time_budget`; uploading the same file again continues. Cookie or wildcard Bearer." + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + file: + type: string + description: The Gadgetbridge database file, under the field `file`. + required: + - file + responses: + "202": + description: "Accepted and queued, or matched to a job already carrying these bytes (`idempotent: true`)." + content: + application/json: + schema: + $ref: "#/components/schemas/GadgetbridgeImportKickoffEnvelope" + "400": + description: The request carried no body at all. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "401": *a1 + "403": *a9 + "409": + description: An import for this account (of any kind) is already queued or running. The upload was discarded. + `meta.errorCode` is `import.apple_health.busy` for every kind, `meta.jobId` names the running job; poll it, + then upload again. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "413": + description: The file is larger than 512 MB. Answered alike whether the declared `Content-Length` says so (beyond a 64 + KiB allowance for the multipart envelope) or the stream finds it while reading; `meta.errorCode` is + `import.file.too_large`. Nothing was kept. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "422": + description: "The multipart body could not be read: no `file` part, a malformed boundary, or a dropped connection. The + message names the failure. Whether the file itself is readable is decided by the worker and reported on the + job (`status: failed`, `failureReason`)." + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "429": + description: More than five uploads of this kind in a minute by this account (the bucket `import::`, + spent before the body is read). Rate limit exceeded. The response carries `Retry-After` (whole seconds, + rounded up and never below 1 — wait at least that long before retrying), `X-RateLimit-Limit` (the bucket's + cap), `X-RateLimit-Remaining` and `X-RateLimit-Reset` (the reset instant, ISO-8601, not epoch seconds). Back + off on `Retry-After` rather than guessing. A 429 raised by a ceiling that is not one of these buckets — a + daily AI budget, an upstream provider's own refusal relayed onward — carries none of them, because there is + no bucket to describe. + headers: *a8 + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "503": + description: No background worker is bound, or the queue did not take the job (the job is then marked failed), so + nothing would run the import. The upload was discarded; retry once a worker runs. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + /api/import/gadgetbridge/status: + get: + tags: + - Import + summary: The caller's latest Gadgetbridge import + description: The caller's most recent import of this kind, or `null` when there has never been one. Counts and closed + reasons only. + responses: + "200": + description: The latest job, or null. + content: + application/json: + schema: + $ref: "#/components/schemas/GadgetbridgeImportStatusEnvelope" + "401": *a1 + "403": *a9 + "422": *a4 + "429": *a5 + /api/import/fhir-bundle: + post: + tags: + - Import + summary: Upload a FHIR R4 Bundle for background import + description: Takes a FHIR R4 Bundle (JSON) from a patient portal, at most 32 MB and 50 000 entries. Laboratory + Observations go through the Health Records lab mapping (marker matching, unit normalisation, panels) under + `source = IMPORT`; vital-sign Observations become measurements by a closed LOINC table and are refused in a unit + it does not list; Conditions become illness entries, Immunizations vaccinations, MedicationStatements + medications (no schedule, reminders off), Encounters visits. Every resource is deduplicated by its issuer and + id, so the same Bundle imported again writes nothing. Other resource types are counted in `skips`. C-CDA + documents are not read. Body is `multipart/form-data` with the file under `file`, streamed to disk after + authentication. The response is **202 with a `jobId`**; poll the status route. Re-uploading the same bytes + resolves to the still-viable job. One import per account at a time, whatever its kind. Five uploads a minute per + account and kind. A run stops at a ten-minute budget, keeps what it wrote and fails with `time_budget`; + uploading the same file again continues. Cookie or wildcard Bearer. + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + file: + type: string + description: The Bundle as a JSON file, under the field `file`. + required: + - file + responses: + "202": + description: "Accepted and queued, or matched to a job already carrying these bytes (`idempotent: true`)." + content: + application/json: + schema: + $ref: "#/components/schemas/FhirBundleImportKickoffEnvelope" + "400": + description: The request carried no body at all. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "401": *a1 + "403": *a9 + "409": + description: An import for this account (of any kind) is already queued or running. The upload was discarded. + `meta.errorCode` is `import.apple_health.busy` for every kind, `meta.jobId` names the running job; poll it, + then upload again. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "413": + description: The file is larger than 32 MB. Answered alike whether the declared `Content-Length` says so (beyond a 64 + KiB allowance for the multipart envelope) or the stream finds it while reading; `meta.errorCode` is + `import.file.too_large`. Nothing was kept. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "422": + description: "The multipart body could not be read: no `file` part, a malformed boundary, or a dropped connection. The + message names the failure. Whether the file itself is readable is decided by the worker and reported on the + job (`status: failed`, `failureReason`)." + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "429": + description: More than five uploads of this kind in a minute by this account (the bucket `import::`, + spent before the body is read). Rate limit exceeded. The response carries `Retry-After` (whole seconds, + rounded up and never below 1 — wait at least that long before retrying), `X-RateLimit-Limit` (the bucket's + cap), `X-RateLimit-Remaining` and `X-RateLimit-Reset` (the reset instant, ISO-8601, not epoch seconds). Back + off on `Retry-After` rather than guessing. A 429 raised by a ceiling that is not one of these buckets — a + daily AI budget, an upstream provider's own refusal relayed onward — carries none of them, because there is + no bucket to describe. + headers: *a8 + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "503": + description: No background worker is bound, or the queue did not take the job (the job is then marked failed), so + nothing would run the import. The upload was discarded; retry once a worker runs. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + /api/import/fhir-bundle/status: + get: + tags: + - Import + summary: The caller's latest FHIR Bundle import + description: The caller's most recent import of this kind, or `null` when there has never been one. Counts and closed + reasons only. + responses: + "200": + description: The latest job, or null. + content: + application/json: + schema: + $ref: "#/components/schemas/FhirBundleImportStatusEnvelope" + "401": *a1 + "403": *a9 + "422": *a4 + "429": *a5 + /api/import/health-connect-remote: + get: + tags: + - Import + summary: The folder a scheduled Health Connect export is fetched from + description: "The account's WebDAV or Nextcloud folder and its last attempt, or `source: null`. The credentials are + never returned. Owner-only." + responses: + "200": + description: The folder, or null. + content: + application/json: + schema: + $ref: "#/components/schemas/HealthConnectRemoteEnvelope" + "401": *a1 + "403": *a9 + "422": *a4 + "429": *a5 + put: + tags: + - Import + summary: Save the folder a scheduled Health Connect export is fetched from + description: "Saves the folder (`folderUrl`, a WebDAV address such as Nextcloud's + `remote.php/dav/files//`), the export's `fileName` in it (default `Health Connect.zip`), the + WebDAV `username` and, on the first save, on a move to another origin, or to change it, the `password` (sealed + at rest, never returned). The stored password only goes to the origin it was given for, so moving the folder to + another server without a new one is a 422. A save that carries a `password` asks for a fresh proof: a cookie + session that signed in or re-proved within five minutes, else 401 `auth.reproof.required`; a Bearer caller + presents an `X-Step-Up` elevation. A public folder must use `https:`; plain `http:` is accepted only for a + private origin listed exactly, scheme included. HealthLog then fetches the file about every six hours, through + `safeFetch` with no redirects followed, and hands a file it has not seen (by SHA-256) to the Health Connect + import queue, the same importer an upload uses. A failure backs off from thirty minutes to a day. A private + address needs its exact origin in `HEALTH_CONNECT_WEBDAV_PRIVATE_ORIGINS`. Ten saves an hour." + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + folderUrl: + type: string + minLength: 8 + maxLength: 2048 + fileName: + default: Health Connect.zip + type: string + minLength: 1 + maxLength: 200 + username: + type: string + minLength: 1 + maxLength: 200 + password: + type: string + minLength: 1 + maxLength: 500 + enabled: + default: true + type: boolean + required: + - folderUrl + - username + additionalProperties: false + responses: + "200": + description: Saved; the folder as it now reads. + content: + application/json: + schema: + $ref: "#/components/schemas/HealthConnectRemoteSavedEnvelope" + "401": *a1 + "403": *a9 + "422": + description: "The folder cannot be used: `import.health_connect.remote.invalid_url` (not a URL, or one with credentials, + a query or a fragment), `import.health_connect.remote.private_origin_not_approved` (a private address not + listed in `HEALTH_CONNECT_WEBDAV_PRIVATE_ORIGINS`), `import.health_connect.remote.https_required` (a public + address over plain `http:`; the password travels in a Basic header), + `import.health_connect.remote.origin_config_invalid`, or `import.health_connect.remote.password_required` on + a first save, or a save that moves the folder to another origin, without a password." + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "429": *a5 + delete: + tags: + - Import + summary: Forget the Health Connect folder + description: Deletes the folder and its sealed credentials. Imports already made stay. + responses: + "200": + description: Whether a folder was removed. + content: + application/json: + schema: + $ref: "#/components/schemas/HealthConnectRemoteDeletedEnvelope" + "401": *a1 + "403": *a9 + "422": *a4 + "429": *a5 + /api/import/health-connect-remote/fetch: + post: + tags: + - Import + summary: Fetch the Health Connect folder now + description: Marks the folder due and sends one job to the scheduled fetch's queue; the download never runs in the + request. Follow the outcome on `GET /api/import/health-connect-remote` and the import on `GET + /api/import/health-connect-export/status`. Six an hour. + responses: + "202": + description: Queued. + content: + application/json: + schema: + $ref: "#/components/schemas/HealthConnectRemoteFetchEnvelope" + "401": *a1 + "403": *a9 + "404": + description: No folder is set up (`import.health_connect.remote.not_configured`). + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "422": *a4 + "429": *a5 /api/measurement-reminders: get: tags: @@ -17558,7 +18973,7 @@ paths: schema: $ref: "#/components/schemas/MeasurementReminderListEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 post: @@ -17583,7 +18998,7 @@ paths: schema: $ref: "#/components/schemas/MeasurementReminderCreatedEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "409": *a7 "422": *a4 "429": *a5 @@ -17607,8 +19022,8 @@ paths: schema: $ref: "#/components/schemas/MeasurementReminderEnvelope" "401": *a1 - "403": *a20 - "404": &a36 + "403": *a18 + "404": &a39 description: Measurement reminder not found / not owned. content: application/json: @@ -17645,8 +19060,8 @@ paths: schema: $ref: "#/components/schemas/MeasurementReminderPatchEnvelope" "401": *a1 - "403": *a20 - "404": *a36 + "403": *a18 + "404": *a39 "422": *a4 "429": *a5 delete: @@ -17668,8 +19083,8 @@ paths: schema: $ref: "#/components/schemas/MeasurementReminderDeleteEnvelope" "401": *a1 - "403": *a20 - "404": *a36 + "403": *a18 + "404": *a39 "422": *a4 "429": *a5 /api/measurement-reminders/{id}/satisfy: @@ -17693,8 +19108,8 @@ paths: schema: $ref: "#/components/schemas/MeasurementReminderSatisfyEnvelope" "401": *a1 - "403": *a20 - "404": *a36 + "403": *a18 + "404": *a39 "422": *a4 "429": *a5 /api/measurement-reminders/{id}/complete: @@ -17721,8 +19136,8 @@ paths: schema: $ref: "#/components/schemas/MeasurementReminderCompleteEnvelope" "401": *a1 - "403": *a20 - "404": *a36 + "403": *a18 + "404": *a39 "422": *a4 "429": *a5 /api/measurement-reminders/{id}/skip: @@ -17751,8 +19166,8 @@ paths: schema: $ref: "#/components/schemas/MeasurementReminderSkipEnvelope" "401": *a1 - "403": *a20 - "404": *a36 + "403": *a18 + "404": *a39 "422": *a4 "429": *a5 /api/measurement-reminders/{id}/snooze: @@ -17785,8 +19200,8 @@ paths: schema: $ref: "#/components/schemas/MeasurementReminderSnoozeEnvelope" "401": *a1 - "403": *a20 - "404": *a36 + "403": *a18 + "404": *a39 "422": *a4 "429": *a5 /api/measurement-reminders/{id}/history: @@ -17826,8 +19241,8 @@ paths: schema: $ref: "#/components/schemas/MeasurementReminderHistoryEnvelope" "401": *a1 - "403": *a20 - "404": *a36 + "403": *a18 + "404": *a39 "422": *a4 "429": *a5 /api/labs: @@ -17905,7 +19320,7 @@ paths: schema: $ref: "#/components/schemas/ListLabResultsEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 post: @@ -17932,7 +19347,7 @@ paths: schema: $ref: "#/components/schemas/CreateLabResultResponse" "401": *a1 - "403": *a20 + "403": *a18 "409": *a7 "422": description: "Nothing was written. `meta.errorCode` = `labs.create.invalid` when the body failed validation (every issue @@ -18012,7 +19427,7 @@ paths: schema: $ref: "#/components/schemas/LabOverviewEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/labs/{id}: @@ -18035,8 +19450,8 @@ paths: schema: $ref: "#/components/schemas/GetLabResultResponse" "401": *a1 - "403": *a20 - "404": &a37 + "403": *a18 + "404": &a40 description: Lab result not found (or owned by another user). content: application/json: @@ -18070,8 +19485,8 @@ paths: schema: $ref: "#/components/schemas/UpdateLabResultResponse" "401": *a1 - "403": *a20 - "404": *a37 + "403": *a18 + "404": *a40 "422": *a4 "429": *a5 delete: @@ -18093,8 +19508,8 @@ paths: schema: $ref: "#/components/schemas/DeleteLabResultResponse" "401": *a1 - "403": *a20 - "404": *a37 + "403": *a18 + "404": *a40 "422": *a4 "429": *a5 /api/labs/restore: @@ -18120,7 +19535,7 @@ paths: schema: $ref: "#/components/schemas/RestoreLabResultsResponse" "401": *a1 - "403": *a20 + "403": *a18 "409": *a7 "422": *a4 "429": *a5 @@ -18182,7 +19597,7 @@ paths: schema: $ref: "#/components/schemas/OcrTextExtractRequest" responses: - "202": &a47 + "202": &a50 description: Queued for the background worker. Every refusal the route can answer quickly (capability, provider, rate limit, budget, validation) has already been answered; anything that goes wrong from here is reported on the run. @@ -18282,7 +19697,7 @@ paths: schema: $ref: "#/components/schemas/AiRunEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: "`aiRuns.notFound`." content: @@ -18306,7 +19721,7 @@ paths: schema: $ref: "#/components/schemas/ListBiomarkersEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 post: @@ -18331,7 +19746,7 @@ paths: schema: $ref: "#/components/schemas/CreateBiomarkerResponse" "401": *a1 - "403": *a20 + "403": *a18 "409": description: A biomarker with this name already exists for the caller. content: @@ -18362,8 +19777,8 @@ paths: schema: $ref: "#/components/schemas/GetBiomarkerResponse" "401": *a1 - "403": *a20 - "404": &a38 + "403": *a18 + "404": &a41 description: "Biomarker not found (or owned by another user). `meta.errorCode` = `labs.biomarker.notFound`. Since v1.43 a marker that was merged into another answers with `meta.mergedInto` naming the marker it went into: drop the cached marker and open that one." @@ -18406,8 +19821,8 @@ paths: schema: $ref: "#/components/schemas/UpdateBiomarkerResponse" "401": *a1 - "403": *a20 - "404": *a38 + "403": *a18 + "404": *a41 "409": description: "`labs.biomarker.duplicate`: a rename collides with another of the caller's markers. `labs.biomarker.alias.taken` (v1.43): one of `aliases` is already the name or an alias of another marker; @@ -18440,8 +19855,8 @@ paths: schema: $ref: "#/components/schemas/DeleteBiomarkerResponse" "401": *a1 - "403": *a20 - "404": *a38 + "403": *a18 + "404": *a41 "422": *a4 "429": *a5 /api/biomarkers/{id}/series: @@ -18516,7 +19931,7 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "404": *a38 + "404": *a41 "422": description: "`labs.series.invalid`: an unknown `zoom`, a malformed date, a `range` without both ends or longer than 15 years, or `from` after `to`." @@ -18559,8 +19974,8 @@ paths: schema: $ref: "#/components/schemas/MergeBiomarkersResponse" "401": *a1 - "403": *a20 - "404": *a38 + "403": *a18 + "404": *a41 "409": *a7 "422": description: "`labs.biomarker.merge.invalid`: a malformed body, or the target among the sources (Zod issues in @@ -18634,7 +20049,7 @@ paths: schema: $ref: "#/components/schemas/ListEncountersEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 post: @@ -18660,7 +20075,7 @@ paths: schema: $ref: "#/components/schemas/CreateEncounterEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "409": *a7 "422": *a4 "429": *a12 @@ -18694,7 +20109,7 @@ paths: schema: $ref: "#/components/schemas/ListProceduresEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/body-sites: @@ -18731,7 +20146,7 @@ paths: schema: $ref: "#/components/schemas/ListBodySitesEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/encounters/suggest: @@ -18761,7 +20176,7 @@ paths: schema: $ref: "#/components/schemas/SuggestEncounterEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/encounters/{id}: @@ -18784,8 +20199,8 @@ paths: schema: $ref: "#/components/schemas/GetEncounterEnvelope" "401": *a1 - "403": *a20 - "404": &a39 + "403": *a18 + "404": &a42 description: Visit not found (or owned by another user). content: application/json: @@ -18818,8 +20233,8 @@ paths: schema: $ref: "#/components/schemas/UpdateEncounterEnvelope" "401": *a1 - "403": *a20 - "404": *a39 + "403": *a18 + "404": *a42 "422": *a4 "429": *a5 delete: @@ -18843,8 +20258,8 @@ paths: schema: $ref: "#/components/schemas/DeleteEncounterEnvelope" "401": *a1 - "403": *a20 - "404": *a39 + "403": *a18 + "404": *a42 "422": *a4 "429": *a5 /api/encounters/{id}/restore: @@ -18869,8 +20284,8 @@ paths: schema: $ref: "#/components/schemas/RestoreEncounterEnvelope" "401": *a1 - "403": *a20 - "404": *a39 + "403": *a18 + "404": *a42 "422": *a4 "429": *a5 /api/encounters/{id}/links: @@ -18902,7 +20317,7 @@ paths: $ref: "#/components/schemas/LinkEncounterEnvelope" "401": *a1 "403": *a9 - "404": *a39 + "404": *a42 "422": *a4 "429": *a5 delete: @@ -18932,7 +20347,7 @@ paths: $ref: "#/components/schemas/UnlinkEncounterEnvelope" "401": *a1 "403": *a9 - "404": *a39 + "404": *a42 "422": *a4 "429": *a5 /api/practitioners: @@ -18972,7 +20387,7 @@ paths: schema: $ref: "#/components/schemas/ListPractitionersEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 post: @@ -18996,7 +20411,7 @@ paths: schema: $ref: "#/components/schemas/CreatePractitionerEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "409": *a7 "422": *a4 "429": *a5 @@ -19020,8 +20435,8 @@ paths: schema: $ref: "#/components/schemas/GetPractitionerEnvelope" "401": *a1 - "403": *a20 - "404": &a40 + "403": *a18 + "404": &a43 description: Practitioner not found (or owned by another user). content: application/json: @@ -19054,8 +20469,8 @@ paths: schema: $ref: "#/components/schemas/UpdatePractitionerEnvelope" "401": *a1 - "403": *a20 - "404": *a40 + "403": *a18 + "404": *a43 "422": *a4 "429": *a5 delete: @@ -19079,8 +20494,8 @@ paths: schema: $ref: "#/components/schemas/DeletePractitionerEnvelope" "401": *a1 - "403": *a20 - "404": *a40 + "403": *a18 + "404": *a43 "422": *a4 "429": *a5 /api/practitioners/{id}/restore: @@ -19105,8 +20520,8 @@ paths: schema: $ref: "#/components/schemas/RestorePractitionerEnvelope" "401": *a1 - "403": *a20 - "404": *a40 + "403": *a18 + "404": *a43 "422": *a4 "429": *a5 /api/vaccinations/custom: @@ -19124,7 +20539,7 @@ paths: schema: $ref: "#/components/schemas/ListCustomVaccinesEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 post: @@ -19149,8 +20564,8 @@ paths: schema: $ref: "#/components/schemas/CreateCustomVaccineEnvelope" "401": *a1 - "403": *a20 - "409": &a41 + "403": *a18 + "409": &a44 description: A live definition on the record already carries this name, compared without case (`vaccination.custom.name-taken`). content: @@ -19186,14 +20601,14 @@ paths: schema: $ref: "#/components/schemas/UpdateCustomVaccineEnvelope" "401": *a1 - "403": *a20 - "404": &a42 + "403": *a18 + "404": &a45 description: No live definition with this id on the record (`vaccination.custom.not-found`). content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "409": *a41 + "409": *a44 "422": *a4 "429": *a5 delete: @@ -19217,8 +20632,8 @@ paths: schema: $ref: "#/components/schemas/DeleteCustomVaccineEnvelope" "401": *a1 - "403": *a20 - "404": *a42 + "403": *a18 + "404": *a45 "422": *a4 "429": *a5 /api/vaccinations: @@ -19271,7 +20686,7 @@ paths: schema: $ref: "#/components/schemas/ListVaccinationsEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 post: @@ -19298,7 +20713,7 @@ paths: schema: $ref: "#/components/schemas/CreateVaccinationEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: A practice, visit or own vaccine the body names is not the record's (`vaccination.practitioner-not-found`, `vaccination.encounter-not-found`, `vaccination.custom-vaccine-not-found`). @@ -19329,8 +20744,8 @@ paths: schema: $ref: "#/components/schemas/GetVaccinationEnvelope" "401": *a1 - "403": *a20 - "404": &a43 + "403": *a18 + "404": &a46 description: Vaccination not found (or owned by another user). content: application/json: @@ -19364,8 +20779,8 @@ paths: schema: $ref: "#/components/schemas/UpdateVaccinationEnvelope" "401": *a1 - "403": *a20 - "404": *a43 + "403": *a18 + "404": *a46 "422": *a4 "429": *a5 delete: @@ -19389,8 +20804,8 @@ paths: schema: $ref: "#/components/schemas/DeleteVaccinationEnvelope" "401": *a1 - "403": *a20 - "404": *a43 + "403": *a18 + "404": *a46 "422": *a4 "429": *a5 /api/vaccinations/{id}/restore: @@ -19414,8 +20829,8 @@ paths: schema: $ref: "#/components/schemas/RestoreVaccinationEnvelope" "401": *a1 - "403": *a20 - "404": *a43 + "403": *a18 + "404": *a46 "422": *a4 "429": *a5 /api/vaccinations/{id}/booster: @@ -19483,7 +20898,7 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "404": *a43 + "404": *a46 "422": *a4 "429": *a5 /api/vaccinations/suggest: @@ -19511,7 +20926,7 @@ paths: schema: $ref: "#/components/schemas/VaccinationSuggestEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/vaccinations/{id}/links: @@ -19544,7 +20959,7 @@ paths: $ref: "#/components/schemas/LinkVaccinationEnvelope" "401": *a1 "403": *a9 - "404": *a43 + "404": *a46 "422": *a4 "429": *a5 delete: @@ -19574,7 +20989,7 @@ paths: $ref: "#/components/schemas/UnlinkVaccinationEnvelope" "401": *a1 "403": *a9 - "404": *a43 + "404": *a46 "422": *a4 "429": *a5 /api/illness/episodes: @@ -19638,7 +21053,7 @@ paths: schema: $ref: "#/components/schemas/ListIllnessEpisodesEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 post: @@ -19664,7 +21079,7 @@ paths: schema: $ref: "#/components/schemas/CreateIllnessEpisodeEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "409": *a7 "422": *a4 "429": *a5 @@ -19688,8 +21103,8 @@ paths: schema: $ref: "#/components/schemas/GetIllnessEpisodeEnvelope" "401": *a1 - "403": *a20 - "404": &a44 + "403": *a18 + "404": &a47 description: Illness episode not found (or owned by another user). content: application/json: @@ -19723,8 +21138,8 @@ paths: schema: $ref: "#/components/schemas/UpdateIllnessEpisodeEnvelope" "401": *a1 - "403": *a20 - "404": *a44 + "403": *a18 + "404": *a47 "422": *a4 "429": *a5 delete: @@ -19747,8 +21162,8 @@ paths: schema: $ref: "#/components/schemas/DeleteIllnessEpisodeEnvelope" "401": *a1 - "403": *a20 - "404": *a44 + "403": *a18 + "404": *a47 "422": *a4 "429": *a5 /api/illness/episodes/{id}/restore: @@ -19775,8 +21190,8 @@ paths: schema: $ref: "#/components/schemas/RestoreIllnessEpisodeEnvelope" "401": *a1 - "403": *a20 - "404": *a44 + "403": *a18 + "404": *a47 "409": *a7 "422": *a4 "429": *a5 @@ -19808,8 +21223,8 @@ paths: schema: $ref: "#/components/schemas/ResolveIllnessEpisodeEnvelope" "401": *a1 - "403": *a20 - "404": *a44 + "403": *a18 + "404": *a47 "422": *a4 "429": *a5 /api/illness/episodes/{id}/day-logs: @@ -19859,8 +21274,8 @@ paths: schema: $ref: "#/components/schemas/GetIllnessDayLogEnvelope" "401": *a1 - "403": *a20 - "404": *a44 + "403": *a18 + "404": *a47 "422": *a4 "429": *a5 post: @@ -19896,8 +21311,8 @@ paths: schema: $ref: "#/components/schemas/UpsertIllnessDayLogCreatedEnvelope" "401": *a1 - "403": *a20 - "404": *a44 + "403": *a18 + "404": *a47 "422": *a4 "429": *a5 /api/illness/episodes/{id}/correlation: @@ -19925,7 +21340,7 @@ paths: $ref: "#/components/schemas/IllnessCorrelationEnvelope" "401": *a1 "403": *a9 - "404": *a44 + "404": *a47 "422": *a4 "429": *a5 /api/illness/insights: @@ -19999,7 +21414,7 @@ paths: schema: $ref: "#/components/schemas/ListMentalHealthAssessmentsEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 post: @@ -20032,7 +21447,7 @@ paths: schema: $ref: "#/components/schemas/CreateMentalHealthAssessmentEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "409": *a7 "422": *a4 "429": *a5 @@ -20059,7 +21474,7 @@ paths: schema: $ref: "#/components/schemas/GetMentalHealthAssessmentEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/allergies: @@ -20092,7 +21507,7 @@ paths: schema: $ref: "#/components/schemas/ListAllergiesEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 post: @@ -20117,7 +21532,7 @@ paths: schema: $ref: "#/components/schemas/CreateAllergyEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "409": *a7 "422": *a4 "429": *a12 @@ -20141,8 +21556,8 @@ paths: schema: $ref: "#/components/schemas/GetAllergyEnvelope" "401": *a1 - "403": *a20 - "404": &a45 + "403": *a18 + "404": &a48 description: Allergy not found (or owned by another user). content: application/json: @@ -20175,8 +21590,8 @@ paths: schema: $ref: "#/components/schemas/UpdateAllergyEnvelope" "401": *a1 - "403": *a20 - "404": *a45 + "403": *a18 + "404": *a48 "422": *a4 "429": *a5 delete: @@ -20199,8 +21614,8 @@ paths: schema: $ref: "#/components/schemas/DeleteAllergyEnvelope" "401": *a1 - "403": *a20 - "404": *a45 + "403": *a18 + "404": *a48 "422": *a4 "429": *a5 /api/family-history: @@ -20224,7 +21639,7 @@ paths: schema: $ref: "#/components/schemas/ListFamilyHistoryEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 post: @@ -20249,7 +21664,7 @@ paths: schema: $ref: "#/components/schemas/CreateFamilyHistoryEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "409": *a7 "422": *a4 "429": *a5 @@ -20273,8 +21688,8 @@ paths: schema: $ref: "#/components/schemas/GetFamilyHistoryEnvelope" "401": *a1 - "403": *a20 - "404": &a46 + "403": *a18 + "404": &a49 description: Family history entry not found (or owned by another user). content: application/json: @@ -20307,8 +21722,8 @@ paths: schema: $ref: "#/components/schemas/UpdateFamilyHistoryEnvelope" "401": *a1 - "403": *a20 - "404": *a46 + "403": *a18 + "404": *a49 "422": *a4 "429": *a5 delete: @@ -20331,8 +21746,8 @@ paths: schema: $ref: "#/components/schemas/DeleteFamilyHistoryEnvelope" "401": *a1 - "403": *a20 - "404": *a46 + "403": *a18 + "404": *a49 "422": *a4 "429": *a5 /api/documents/inbound: @@ -20447,7 +21862,7 @@ paths: schema: $ref: "#/components/schemas/InboundDocumentListEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 post: @@ -20622,7 +22037,7 @@ paths: schema: $ref: "#/components/schemas/DocumentUploadEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: An `episodeIds` or `encounterIds` id is not a live episode or visit of the caller (`documents.inbound.episodeNotFound` / `documents.inbound.encounterNotFound`). Nothing was stored. @@ -20725,7 +22140,7 @@ paths: schema: $ref: "#/components/schemas/DocumentAiCapabilityEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/documents/inbound/usage: @@ -20748,7 +22163,7 @@ paths: schema: $ref: "#/components/schemas/DocumentUsageEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/documents/inbound/layout: @@ -20766,7 +22181,7 @@ paths: schema: $ref: "#/components/schemas/DocumentsLayoutEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 put: @@ -20817,7 +22232,7 @@ paths: schema: $ref: "#/components/schemas/DocumentBulkEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/documents/inbound/{id}: @@ -20840,7 +22255,7 @@ paths: schema: $ref: "#/components/schemas/InboundDocumentDetailEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 patch: @@ -20872,7 +22287,7 @@ paths: schema: $ref: "#/components/schemas/InboundDocumentUpdateEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 delete: @@ -20898,7 +22313,7 @@ paths: schema: $ref: "#/components/schemas/InboundDiscardEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/documents/inbound/{id}/restore: @@ -20927,7 +22342,7 @@ paths: schema: $ref: "#/components/schemas/InboundRestoreEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "409": description: "Not restorable: purged past the grace window, or an identical live document exists." content: @@ -20957,7 +22372,7 @@ paths: schema: $ref: "#/components/schemas/DeletedDocumentListEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/documents/inbound/{id}/purge: @@ -21030,7 +22445,7 @@ paths: type: string format: binary "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/documents/inbound/{id}/thumbnail: @@ -21059,7 +22474,7 @@ paths: type: string format: binary "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/documents/inbound/{id}/extract: @@ -21103,7 +22518,7 @@ paths: required: true schema: type: string - - &a48 + - &a51 name: Prefer in: header required: false @@ -21128,9 +22543,9 @@ paths: application/json: schema: $ref: "#/components/schemas/InboundExtractEnvelope" - "202": *a47 + "202": *a50 "401": *a1 - "403": &a49 + "403": &a52 description: >- `meta.errorCode` = `auth.scope.insufficient` when a Bearer token's scope does not reach this route; the generic auth gate answers it before the route's own checks run. Otherwise: AI refusal: the `documentAi` @@ -21168,7 +22583,7 @@ paths: $ref: "#/components/schemas/ErrorEnvelope" "422": *a4 "429": *a5 - "503": &a50 + "503": &a53 description: "`ai.unavailable` — the inputs behind the AI capability could not be read, and the answer failed closed. Nothing was sent. Retry later." content: @@ -21198,7 +22613,7 @@ paths: required: true schema: type: string - - *a48 + - *a51 requestBody: required: false content: @@ -21234,12 +22649,12 @@ paths: application/json: schema: $ref: "#/components/schemas/DocumentSuggestEnvelope" - "202": *a47 + "202": *a50 "401": *a1 - "403": *a49 + "403": *a52 "422": *a4 "429": *a5 - "503": *a50 + "503": *a53 /api/documents/inbound/{id}/summary: post: tags: @@ -21289,7 +22704,7 @@ paths: type: boolean default: false description: With `persist=true`, explicitly replace an existing stored summary. - - *a48 + - *a51 requestBody: required: false content: @@ -21325,12 +22740,12 @@ paths: application/json: schema: $ref: "#/components/schemas/DocumentSummaryEnvelope" - "202": *a47 + "202": *a50 "401": *a1 - "403": *a49 + "403": *a52 "422": *a4 "429": *a5 - "503": *a50 + "503": *a53 /api/documents/inbound/{id}/index: post: tags: @@ -21358,7 +22773,7 @@ paths: required: true schema: type: string - - *a48 + - *a51 requestBody: required: false content: @@ -21394,12 +22809,12 @@ paths: application/json: schema: $ref: "#/components/schemas/DocumentIndexEnvelope" - "202": *a47 + "202": *a50 "401": *a1 - "403": *a49 + "403": *a52 "422": *a4 "429": *a5 - "503": *a50 + "503": *a53 /api/documents/inbound/{id}/chat: post: tags: @@ -21439,10 +22854,10 @@ paths: type: string description: "SSE frames: `data: \\n\\n`. See the operation description for the per-`type` frame shapes." "401": *a1 - "403": *a49 + "403": *a52 "422": *a4 "429": *a5 - "503": *a50 + "503": *a53 get: tags: - Documents @@ -21483,7 +22898,7 @@ paths: schema: $ref: "#/components/schemas/DocumentChatHistoryEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/documents/inbound/reindex: @@ -21506,10 +22921,10 @@ paths: schema: $ref: "#/components/schemas/DocumentReindexEnvelope" "401": *a1 - "403": *a49 + "403": *a52 "422": *a4 "429": *a5 - "503": *a50 + "503": *a53 /api/documents/inbound/{id}/facts/{factId}: patch: tags: @@ -21542,7 +22957,7 @@ paths: schema: $ref: "#/components/schemas/ExtractedFactEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/documents/inbound/{id}/confirm: @@ -21577,7 +22992,7 @@ paths: schema: $ref: "#/components/schemas/InboundConfirmEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "409": *a7 "422": *a4 "429": *a5 @@ -21596,7 +23011,7 @@ paths: schema: $ref: "#/components/schemas/ListCustomMetricsEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 post: @@ -21622,7 +23037,7 @@ paths: $ref: "#/components/schemas/CreateCustomMetricResponse" "401": *a1 "403": *a9 - "409": &a52 + "409": &a55 description: A custom metric with this name already exists for the caller. content: application/json: @@ -21650,8 +23065,8 @@ paths: schema: $ref: "#/components/schemas/GetCustomMetricResponse" "401": *a1 - "403": *a20 - "404": &a51 + "403": *a18 + "404": &a54 description: Custom metric not found (or owned by another user). content: application/json: @@ -21686,8 +23101,8 @@ paths: $ref: "#/components/schemas/UpdateCustomMetricResponse" "401": *a1 "403": *a9 - "404": *a51 - "409": *a52 + "404": *a54 + "409": *a55 "422": *a4 "429": *a5 delete: @@ -21711,7 +23126,7 @@ paths: $ref: "#/components/schemas/DeleteCustomMetricResponse" "401": *a1 "403": *a9 - "404": *a51 + "404": *a54 "422": *a4 "429": *a5 /api/custom-metrics/{id}/entries: @@ -21754,8 +23169,8 @@ paths: schema: $ref: "#/components/schemas/ListCustomMetricEntriesEnvelope" "401": *a1 - "403": *a20 - "404": *a51 + "403": *a18 + "404": *a54 "422": *a4 "429": *a5 post: @@ -21797,7 +23212,7 @@ paths: $ref: "#/components/schemas/CreateCustomMetricEntryResponse" "401": *a1 "403": *a9 - "404": *a51 + "404": *a54 "409": *a7 "422": *a4 "429": *a12 @@ -21834,7 +23249,7 @@ paths: $ref: "#/components/schemas/UpdateCustomMetricEntryResponse" "401": *a1 "403": *a9 - "404": &a53 + "404": &a56 description: Custom metric entry not found (or owned by another user). content: application/json: @@ -21868,7 +23283,7 @@ paths: $ref: "#/components/schemas/DeleteCustomMetricEntryResponse" "401": *a1 "403": *a9 - "404": *a53 + "404": *a56 "422": *a4 "429": *a5 /api/custom-metrics/{id}/entries/restore: @@ -21902,6 +23317,25 @@ paths: "403": *a9 "422": *a4 "429": *a5 + /api/onboarding/extras: + get: + tags: + - Onboarding + summary: Presence behind the checklist's optional rows + description: "Whether each optional getting-started row applies to the active record and whether it is set up: emergency + card, care calendar feed, sharing, imports, doctor report schedule, the iPhone app. The record's owner, or a + managed profile's guardian; a delegate on an adult's record is refused (403)." + responses: + "200": + description: One entry per row. + content: + application/json: + schema: + $ref: "#/components/schemas/OnboardingChecklistExtrasEnvelope" + "401": *a1 + "403": *a18 + "422": *a4 + "429": *a5 /api/onboarding/answers: patch: tags: @@ -21971,8 +23405,8 @@ paths: - Onboarding summary: Ask the setup questions again description: >- - "Set up again", from Settings. Puts the nine steps back to `pending`, clears the flow's own completion stamp, - and clears the derivation marker so the next `POST /api/onboarding/complete` may derive a module map again. + "Set up again", from Settings. Puts every step back to `pending`, clears the flow's own completion stamp, and + clears the derivation marker so the next `POST /api/onboarding/complete` may derive a module map again. It writes no module state at all: the ordering-versus-removal decision says a re-run never turns off a module @@ -22176,7 +23610,7 @@ paths: schema: $ref: "#/components/schemas/NutrientCatalogEnvelope" "401": *a1 - "403": &a54 + "403": &a57 description: >- `meta.errorCode` = `auth.scope.insufficient` when a Bearer token's scope does not reach this route; the generic auth gate answers it before the route's own checks run. Otherwise: The opt-in `nutrients` module is @@ -22323,7 +23757,7 @@ paths: schema: $ref: "#/components/schemas/NutrientBatchEnvelope" "401": *a1 - "403": &a55 + "403": &a58 description: "`meta.errorCode` = `auth.scope.insufficient` when a Bearer token's scope does not reach this route; the generic auth gate answers it before the route's own checks run. Otherwise: The opt-in `nutrients` module is off for this account (errorCode `module.disabled`). Stop syncing and do not retry; offer the @@ -22359,7 +23793,7 @@ paths: schema: $ref: "#/components/schemas/NutrientOverviewEnvelope" "401": *a1 - "403": *a54 + "403": *a57 "422": *a4 "429": *a5 /api/nutrients/daily: @@ -22399,7 +23833,38 @@ paths: schema: $ref: "#/components/schemas/NutrientDailySeriesEnvelope" "401": *a1 - "403": *a54 + "403": *a57 + "422": *a4 + "429": *a5 + /api/nutrients/energy-balance: + get: + tags: + - Nutrients + summary: The daily energy balance + description: "Intake against resting plus active energy over the last `days` local days (7 to 90, default 30), computed + live: intake is the folded `energy` nutrient total, resting and active energy are the day sums of + `BASAL_ENERGY_BURNED` and `ACTIVE_ENERGY_BURNED`. A day without a resting reading takes the Mifflin-St Jeor + estimate from the weight carried forward, the height, the age and the profile sex (`restingEstimated`); without + them, or without an active reading or an intake, the day has no balance rather than a guessed one. Today is + `partial` and stays out of the seven-day trend and the window means. Descriptive figures, not a target. Behind + the opt-in `nutrients` module." + parameters: + - in: query + name: days + schema: + default: 30 + type: integer + minimum: 7 + maximum: 90 + responses: + "200": + description: The balance per day, the trend and the window means. + content: + application/json: + schema: + $ref: "#/components/schemas/EnergyBalanceEnvelope" + "401": *a1 + "403": *a57 "422": *a4 "429": *a5 /api/nutrients/water: @@ -22428,7 +23893,7 @@ paths: schema: $ref: "#/components/schemas/NutrientWaterWriteEnvelope" "401": *a1 - "403": *a54 + "403": *a57 "409": *a7 "422": *a4 "429": *a5 @@ -22449,7 +23914,7 @@ paths: schema: $ref: "#/components/schemas/NutrientTargetsEnvelope" "401": *a1 - "403": *a55 + "403": *a58 "422": *a4 "429": *a5 patch: @@ -22473,7 +23938,7 @@ paths: schema: $ref: "#/components/schemas/NutrientTargetsPatchEnvelope" "401": *a1 - "403": *a55 + "403": *a58 "422": *a4 "429": *a12 /api/integrations/healthkit: @@ -23184,7 +24649,7 @@ paths: application/json: schema: $ref: "#/components/schemas/WithingsCredentialsUpdateEnvelope" - "400": &a56 + "400": &a59 description: Body is not parseable JSON. content: application/json: @@ -23192,19 +24657,19 @@ paths: $ref: "#/components/schemas/ErrorEnvelope" "401": *a1 "403": *a9 - "413": &a57 + "413": &a60 description: Body exceeds 64 KiB. content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "415": &a58 + "415": &a61 description: Content-Type is not `application/json`. content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "422": &a59 + "422": &a62 description: "`clientId` and `clientSecret` are both required and each must be 1–200 characters. The envelope carries a single fixed message, not per-field issues." content: @@ -23395,12 +24860,12 @@ paths: application/json: schema: $ref: "#/components/schemas/GoogleHealthCredentialsUpdateEnvelope" - "400": *a56 + "400": *a59 "401": *a1 "403": *a9 - "413": *a57 - "415": *a58 - "422": *a59 + "413": *a60 + "415": *a61 + "422": *a62 "429": *a5 delete: tags: @@ -23566,12 +25031,12 @@ paths: application/json: schema: $ref: "#/components/schemas/OuraCredentialsUpdateEnvelope" - "400": *a56 + "400": *a59 "401": *a1 "403": *a9 - "413": *a57 - "415": *a58 - "422": *a59 + "413": *a60 + "415": *a61 + "422": *a62 "429": *a5 delete: tags: @@ -23651,21 +25116,21 @@ paths: $ref: "#/components/schemas/OuraTestEnvelope" "401": *a1 "403": *a9 - "422": &a60 + "422": &a63 description: No usable connection for this provider — nothing stored, or the stored grant could no longer be resolved into an access token. `meta.errorCode` = `not_configured`. content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "429": &a61 + "429": &a64 description: More than 5 requests in 60 s from this user. `meta.errorCode` = `rate_limited_self` — this is the local limiter, distinct from a `rate_limited` 502 which is the provider's. content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "502": &a62 + "502": &a65 description: "The probe did not complete. `meta.errorCode` names the class: `credentials_rejected` (the provider answered 401/403 — the stored grant is gone), `rate_limited` (the PROVIDER answered 429, which is not this endpoint's own limiter), `upstream_error` (5xx), `timeout` (no answer within 5 s), `connection_failed` @@ -23711,12 +25176,12 @@ paths: application/json: schema: $ref: "#/components/schemas/PolarCredentialsUpdateEnvelope" - "400": *a56 + "400": *a59 "401": *a1 "403": *a9 - "413": *a57 - "415": *a58 - "422": *a59 + "413": *a60 + "415": *a61 + "422": *a62 "429": *a5 delete: tags: @@ -23796,9 +25261,9 @@ paths: $ref: "#/components/schemas/PolarTestEnvelope" "401": *a1 "403": *a9 - "422": *a60 - "429": *a61 - "502": *a62 + "422": *a63 + "429": *a64 + "502": *a65 /api/strava/credentials: get: tags: @@ -23835,12 +25300,12 @@ paths: application/json: schema: $ref: "#/components/schemas/StravaCredentialsUpdateEnvelope" - "400": *a56 + "400": *a59 "401": *a1 "403": *a9 - "413": *a57 - "415": *a58 - "422": *a59 + "413": *a60 + "415": *a61 + "422": *a62 "429": *a5 delete: tags: @@ -23922,20 +25387,20 @@ paths: $ref: "#/components/schemas/StravaTestEnvelope" "401": *a1 "403": *a9 - "422": *a60 - "429": *a61 - "502": *a62 + "422": *a63 + "429": *a64 + "502": *a65 /api/integrations/status: get: tags: - Integrations summary: Read every integration's status in one call - description: "The consolidated envelope behind the integrations settings surface: all nine providers, always, in a fixed - order, each with the ledger core, the server-resolved liveness verdict and its own extras. Prefer this over nine - per-provider round-trips. Pure read. Auth via cookie or Bearer." + description: "The consolidated envelope behind the integrations settings surface: all ten providers, always, in a fixed + order, each with the ledger core, the server-resolved liveness verdict and its own extras. Prefer this over a + round-trip per provider. Pure read. Auth via cookie or Bearer." responses: "200": - description: All nine provider entries plus the alert threshold. + description: All ten provider entries plus the alert threshold. content: application/json: schema: @@ -24002,7 +25467,7 @@ paths: "401": *a1 "403": *a9 "422": *a4 - "429": *a61 + "429": *a64 /api/integrations/google-health/test: post: tags: @@ -24036,9 +25501,9 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "422": *a60 - "429": *a61 - "502": *a62 + "422": *a63 + "429": *a64 + "502": *a65 /api/integrations/whoop/resume: post: tags: @@ -24056,7 +25521,7 @@ paths: "401": *a1 "403": *a9 "422": *a4 - "429": *a61 + "429": *a64 /api/integrations/whoop/test: post: tags: @@ -24074,9 +25539,9 @@ paths: $ref: "#/components/schemas/WhoopIntegrationTestEnvelope" "401": *a1 "403": *a9 - "422": *a60 - "429": *a61 - "502": *a62 + "422": *a63 + "429": *a64 + "502": *a65 /api/integrations/withings/resume: post: tags: @@ -24095,7 +25560,7 @@ paths: "401": *a1 "403": *a9 "422": *a4 - "429": *a61 + "429": *a64 /api/integrations/withings/test: post: tags: @@ -24114,8 +25579,8 @@ paths: $ref: "#/components/schemas/WithingsIntegrationTestEnvelope" "401": *a1 "403": *a9 - "422": *a60 - "429": *a61 + "422": *a63 + "429": *a64 "502": description: "The probe did not complete. The shared codes apply (`credentials_rejected`, `rate_limited`, `upstream_error`, `timeout`, `connection_failed`) and this path adds one of its own: @@ -24148,7 +25613,7 @@ paths: schema: $ref: "#/components/schemas/DailyDigestEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/daily/digest/dismiss: @@ -24241,7 +25706,7 @@ paths: schema: $ref: "#/components/schemas/DashboardSummaryEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/dashboard/widgets: @@ -24260,7 +25725,7 @@ paths: schema: $ref: "#/components/schemas/DashboardLayout" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 put: @@ -24269,9 +25734,9 @@ paths: summary: Replace the calling user's dashboard widget layout description: "Persists the layout with preserve-when-absent semantics and returns the normalised layout plus the advanced `updatedAt` token. Optimistic concurrency (v1.32.16): send `baseUpdatedAt` (the token from a prior - read) and the write 409s if the stored row changed since — so a committed Save can never be silently reverted by - a later request that started from an older snapshot; omit it for the legacy unconditional write. Invalid bodies - return the multi-issue 422 envelope." + read) and the write 409s if the stored layout changed since — so a committed Save can never be silently reverted + by a later request that started from an older snapshot; omit it for the legacy unconditional write. Invalid + bodies return the multi-issue 422 envelope." requestBody: required: true content: @@ -24295,7 +25760,7 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "422": *a22 + "422": *a26 "429": *a5 delete: tags: @@ -24533,7 +25998,7 @@ paths: schema: $ref: "#/components/schemas/RecordActivityEnvelope" "401": *a1 - "403": &a63 + "403": &a66 description: "`meta.errorCode` = `auth.scope.insufficient` when a Bearer token's scope does not reach this route; the generic auth gate answers it before the route's own checks run. Otherwise: Refused. `meta.errorCode` is `sharing.not_permitted` when the request was made while acting on another account (grant management is never @@ -24560,7 +26025,7 @@ paths: schema: $ref: "#/components/schemas/AccountGrantListEnvelope" "401": *a1 - "403": *a63 + "403": *a66 "422": *a4 "429": *a5 post: @@ -24664,7 +26129,7 @@ paths: schema: $ref: "#/components/schemas/AcceptedAccountGrantEnvelope" "401": *a1 - "403": *a63 + "403": *a66 "404": description: No such invitation for this account. content: @@ -24708,7 +26173,7 @@ paths: schema: $ref: "#/components/schemas/RevokedAccountGrantEnvelope" "401": *a1 - "403": *a63 + "403": *a66 "404": description: No such grant on this account's record. content: @@ -24749,7 +26214,7 @@ paths: schema: $ref: "#/components/schemas/RenouncedAccountGrantEnvelope" "401": *a1 - "403": *a63 + "403": *a66 "404": description: No such grant held by this account. content: @@ -24945,6 +26410,42 @@ paths: $ref: "#/components/schemas/ErrorEnvelope" "422": *a4 "429": *a5 + /api/managed-profiles/{id}/activity: + get: + tags: + - Account sharing + summary: Who did what in a managed profile + description: "The audit rows filed under one managed profile that a person performed, newest first: every Guardian's + acts, the caller's own included, because nobody signs in to a managed profile and every act on it is a + Guardian's. Reads coalesce to one row per Guardian per day with a count, as on `GET /api/account/activity`; the + entry shape and the window are the same, and `meta.truncated` says whether the row ceiling was hit. Only the + action, the actor and the instant are published, never a row's details. Cookie transport only, an ACTOR surface + like the roster beside it. Anyone who is not an active Guardian of THIS managed profile gets the same 404 as an + unknown id, an adult's record shared at manage level included." + parameters: + - in: path + name: id + schema: + type: string + required: true + responses: + "200": + description: The profile's activity, and how far back it can see. + content: + application/json: + schema: + $ref: "#/components/schemas/ManagedProfileActivityEnvelope" + "401": *a1 + "403": *a9 + "404": + description: "No such managed profile, or the caller is not one of its Guardians (`meta.errorCode: + managed_profile.not_found`). The two are byte-identical." + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "422": *a4 + "429": *a5 /api/managed-profiles/{id}/guardians: get: tags: @@ -25148,7 +26649,7 @@ paths: schema: $ref: "#/components/schemas/ErrorEnvelope" "401": *a1 - "403": *a63 + "403": *a66 "409": description: "The record this browser session is on is not the record the request asserted. `meta.errorCode` is `sharing.session.changed`. It is not a refusal of access — the caller may well be entitled to both records — @@ -25538,7 +27039,7 @@ paths: schema: $ref: "#/components/schemas/McpConnectionListEnvelope" "401": *a1 - "403": &a64 + "403": &a67 description: "`meta.errorCode` = `auth.scope.insufficient` when a Bearer token's scope does not reach this route; the generic auth gate answers it before the route's own checks run. Otherwise: The operator has disabled the API instance-wide. Every route in this module refuses while that setting is off, for a cookie session as well as @@ -25572,7 +27073,7 @@ paths: schema: $ref: "#/components/schemas/McpConnectionRevokeEnvelope" "401": *a1 - "403": *a64 + "403": *a67 "404": description: No live connection with this id for this caller — also the answer for an already-revoked one, so a repeat revoke is 404 rather than an idempotent 200. @@ -25599,7 +27100,7 @@ paths: schema: $ref: "#/components/schemas/McpConnectorTokenListEnvelope" "401": *a1 - "403": *a64 + "403": *a67 "422": *a4 "429": *a5 post: @@ -25636,7 +27137,7 @@ paths: schema: $ref: "#/components/schemas/ErrorEnvelope" "401": *a1 - "403": *a64 + "403": *a67 "413": description: Body exceeds 16 KiB. content: @@ -25679,7 +27180,7 @@ paths: schema: $ref: "#/components/schemas/McpConnectorTokenRevokeEnvelope" "401": *a1 - "403": *a64 + "403": *a67 "404": description: No `health:read` token with this id for this caller. An already-revoked token is still found, so a repeat revoke answers 200. @@ -25706,7 +27207,7 @@ paths: schema: $ref: "#/components/schemas/RecordSettingsEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/record-settings/integrations: @@ -25725,7 +27226,7 @@ paths: schema: $ref: "#/components/schemas/RecordSettingsIntegrationsEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/record-settings/integrations/{provider}/connect: @@ -25740,7 +27241,7 @@ paths: the record has no provider app of its own and the deployment has none, the Guardian's own app is copied onto the record (audited). Cookie session, while acting on a managed record the caller guards." parameters: - - &a65 + - &a68 name: provider in: path required: true @@ -25762,7 +27263,7 @@ paths: schema: $ref: "#/components/schemas/ManagedConnectStartEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: The path named a provider outside the closed set. Answered before the caller is authenticated. content: @@ -25787,7 +27288,7 @@ paths: Audited against the record with the Guardian as the actor. Cookie session or Bearer, while acting on a managed record the caller guards." parameters: - - *a65 + - *a68 responses: "200": description: The provider is disconnected. @@ -25796,7 +27297,7 @@ paths: schema: $ref: "#/components/schemas/ManagedDisconnectEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: The path named a provider outside the closed set, or the record has no connection to it. content: @@ -25813,7 +27314,7 @@ paths: description: Returns the named family's resolved settings for the record the session is acting on. Cookie session or Bearer, while acting on a managed record the caller guards. parameters: - - &a66 + - &a69 name: family in: path required: true @@ -25837,7 +27338,7 @@ paths: schema: $ref: "#/components/schemas/GetRecordSettingsFamilyEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: Either the path named a family outside the closed set, or the record row itself is gone. The two are not distinguished, and the first is answered before the caller is authenticated at all. @@ -25857,7 +27358,7 @@ paths: ride the audit row. Body capped at 64 KiB. Cookie session or Bearer, while acting on a managed record the caller guards. parameters: - - *a66 + - *a69 requestBody: required: true content: @@ -25878,7 +27379,7 @@ paths: schema: $ref: "#/components/schemas/ErrorEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: The path named a family outside the closed set. Answered before authentication. content: @@ -25992,7 +27493,7 @@ paths: schema: $ref: "#/components/schemas/ListPersonalRecordsEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": description: "`metricType` or `limit` carried an unacceptable value. `meta.errorCode` = `personal_records.invalid_query`, with the offending path under `details.issues`." @@ -26045,7 +27546,7 @@ paths: schema: $ref: "#/components/schemas/AchievementsEnvelope" "401": *a1 - "403": *a21 + "403": *a24 "422": *a4 "429": *a5 /api/environment/preferences: @@ -26071,7 +27572,7 @@ paths: schema: $ref: "#/components/schemas/EnvironmentPreferencesEnvelope" "401": *a1 - "403": *a16 + "403": *a20 "422": *a4 "429": *a5 /api/environment: @@ -26089,7 +27590,7 @@ paths: schema: $ref: "#/components/schemas/EnvironmentOverviewEnvelope" "401": *a1 - "403": *a16 + "403": *a20 "422": *a4 "429": *a5 /api/environment/home: @@ -26126,7 +27627,7 @@ paths: schema: $ref: "#/components/schemas/EnvironmentHomeEnvelope" "401": *a1 - "403": *a16 + "403": *a20 "413": description: Body exceeds 4 KiB. content: @@ -26186,7 +27687,7 @@ paths: schema: $ref: "#/components/schemas/EnvironmentBackfillEnvelope" "401": *a1 - "403": *a16 + "403": *a20 "409": description: No home location is set, so there is nothing to resolve the days against (`meta.errorCode` = `environment.no_home`), or a backfill for this account is already queued in the current twenty-minute slot @@ -26246,7 +27747,7 @@ paths: schema: $ref: "#/components/schemas/EnvironmentGeocodeEnvelope" "401": *a1 - "403": *a16 + "403": *a20 "422": description: "`q` was missing, empty after trimming, or longer than 120 characters. `meta.errorCode` = `environment.invalid`." @@ -26285,7 +27786,7 @@ paths: schema: $ref: "#/components/schemas/CreateEnvironmentTravelEnvelope" "401": *a1 - "403": *a16 + "403": *a20 "413": description: Body exceeds 4 KiB. content: @@ -26338,7 +27839,7 @@ paths: schema: $ref: "#/components/schemas/DeleteEnvironmentTravelEnvelope" "401": *a1 - "403": *a16 + "403": *a20 "404": description: No such override for this account. `meta.errorCode` = `environment.travel.not_found`. Also the answer for an id owned by somebody else — existence is not leaked. @@ -26360,9 +27861,9 @@ paths: **Auth is Bearer only.** A cookie session does not authenticate here: the route reads the `Authorization` header itself, hashes it and looks the token up, so a browser with a valid login and no token gets 401. The token must carry either the `*` wildcard or the `medication:ingest` scope — AND, once the named medication resolves, either - `*` or that medication's own `medication:{id}:ingest` scope. The second check runs after the lookup. A token - scoped to one medication gets the same 403 for a name that does not exist as for one outside its scope, so it - cannot be used to learn which medications exist; only a `*` token gets 404 for an unknown name. + `*` or that medication's own `medication:{id}:ingest` scope. The second check runs after the lookup. An unknown + name and a name outside the token's scope both answer the same 404 (`ingest.medication.notFound`), so a scoped + token cannot learn which medications exist. **The operator can switch this off.** With the global API kill switch disabled every request is refused with 403 @@ -26370,16 +27871,20 @@ paths: **Replay is by `idempotencyKey`, and the status says which happened.** A key already stored for this token's - owner and the same medication returns the existing row with **200**; a fresh dose returns **201**; a key already - used for another medication returns **409** without its row. Replay is answered only after both scope checks. - Nothing else distinguishes them — same body shape, same fields — so branch on the status code. + owner and the same medication, written within the last day, returns the existing row with **200**; a fresh dose + returns **201**; a key already used for another medication returns **409** without its row. Replay is answered + only after both scope checks. Nothing else distinguishes them — same body shape, same fields — so branch on the + status code. **A dose is attributed to its scheduled slot, not stamped ad-hoc.** When the take falls inside a schedule's window band it converges onto that slot's canonical row (closing the pending reminder rather than leaving it - open beside a duplicate ad-hoc take); otherwise it lands as a standalone row with `scheduledFor = takenAt`. Only - a genuine pending-to-taken transition consumes inventory, so a re-post that converges onto an already-taken slot - does not decrement stock twice. + open beside a duplicate ad-hoc take); outside every band it answers the nearest slot of the same local day + within six hours when that slot is still open (and never reaches past a nearer slot that is already answered); + otherwise it lands as a standalone row with `scheduledFor = takenAt`. A take of a slot that already holds a take + within two hours is the same dose reported twice and answers 200 with `alreadyTaken: true`. Only a genuine + pending-to-taken transition consumes inventory, so a re-post that converges onto an already-taken slot does not + decrement stock twice. Rate-limited to 60 requests per minute **per token**. A household running a chat bridge, a button and a @@ -26395,7 +27900,10 @@ paths: responses: "200": description: "Replay: a row with this `idempotencyKey` already exists for the token's owner and is returned unchanged. - Nothing was written and no inventory was consumed." + Or a repeat: the slot this take binds to already holds a take recorded within two hours of it, and the body + is that row with `alreadyTaken: true`. A take further from the recorded one is a dose of its own: it answers + the nearest open slot within six hours (201), or is recorded ad hoc. Either way nothing was written and no + inventory was consumed." content: application/json: schema: @@ -26416,22 +27924,24 @@ paths: $ref: "#/components/schemas/ErrorEnvelope" "403": description: Refused. Either the operator has the global API switch off (the message says so), or the token lacks - `medication:ingest` / `*`, or it lacks the resolved medication's own `medication:{id}:ingest` / `*` scope. A - token without `*` also gets this answer for a name that matches no active medication. + `medication:ingest` / `*`. content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" "404": - description: "Only for a `*` token: no ACTIVE medication of the token owner's matches `medicationName`. An inactive - medication of the right name is also a 404 — the name is only searched among active ones." + description: "No ACTIVE medication of the token owner's that this token may record matches `medicationName` (`errorCode: + ingest.medication.notFound`). The name is matched case-insensitively with surrounding and repeated + whitespace folded (`\"Ramipril \"` finds `Ramipril`); `Ramipril 5 mg` does not. An unknown name and one + outside the token's scope give the same answer." content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" "409": - description: The `idempotencyKey` is already stored for a dose of another medication. Nothing was written and that dose - is not returned. + description: "The `idempotencyKey` is already stored for a dose of another medication, or + (`ingest.idempotencyKey.reused`) for a take of this one recorded more than a day ago: a fixed key reused for + a new take. Nothing was written and that dose is not returned." content: application/json: schema: @@ -26570,7 +28080,7 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "403": *a28 + "403": *a25 "404": description: The account chosen with `into=existing` does not exist (`backup.target.not_found`). Nothing was stored. content: @@ -26639,13 +28149,13 @@ paths: application/json: schema: $ref: "#/components/schemas/AdminBackupDocument" - "403": &a67 + "403": &a70 description: Caller is not an admin. `requireAdmin()` is cookie-only, so a Bearer token lands here whatever its scope. content: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "404": &a68 + "404": &a71 description: No stored copy with this id. content: application/json: @@ -26719,8 +28229,8 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "403": *a67 - "404": *a68 + "403": *a70 + "404": *a71 "409": description: A restore of the same account is already queued or running (`meta.errorCode` = `backup.restore.active`, `meta.jobId` names it), the stored copy was replaced by a newer one while it was being checked @@ -26764,7 +28274,7 @@ paths: application/json: schema: $ref: "#/components/schemas/AdminBackupRestoreJobListResponse" - "403": *a67 + "403": *a70 /api/admin/backups/restores/{jobId}: get: tags: @@ -26787,7 +28297,7 @@ paths: application/json: schema: $ref: "#/components/schemas/AdminBackupRestoreJobResponse" - "403": *a67 + "403": *a70 "404": description: No restore job with this id. content: @@ -26806,7 +28316,7 @@ paths: request leaves the server. Needs neither the Documents module nor the list: with the list unset, `available` is false and any connection still stored is listed (with `originAllowed: false`) so it can be removed. Cookie session only; not delegable." - security: &a69 + security: &a72 - cookieAuth: [] responses: "200": @@ -26816,7 +28326,7 @@ paths: schema: $ref: "#/components/schemas/DocumentSourcesStatusEnvelope" "401": *a1 - "403": &a70 + "403": &a73 description: "`meta.errorCode` = `auth.scope.insufficient` when a Bearer token's scope does not reach this route; the generic auth gate answers it before the route's own checks run. Otherwise: Refused before any request to the source: `documents.sources.browserOnly` for a Bearer caller, `sharing.not_permitted` while acting on another @@ -26841,9 +28351,9 @@ paths: `documents.sources.tokenRequired`), so a stored token is never sent to an address it was not saved for. A Papra organization id is letters, digits, `_` and `-`. The token is stored encrypted (AES-256-GCM) and never returned. Ten saves and tests a minute per person. Cookie session only; not delegable." - security: *a69 + security: *a72 parameters: - - &a71 + - &a74 name: system in: path required: true @@ -26882,8 +28392,8 @@ paths: schema: $ref: "#/components/schemas/DocumentSourceConnectionEnvelope" "401": *a1 - "403": *a70 - "404": &a72 + "403": *a73 + "404": &a75 description: "`documents.sources.unavailable`: the operator has not listed any origin in `DOCUMENT_SOURCE_ORIGINS`, so the picker is off. `documents.sources.notConnected`: no connection is saved for this system. `documents.sources.notFound`: the source has no such document, or (Papra) no such organization, including @@ -26902,7 +28412,7 @@ paths: schema: $ref: "#/components/schemas/ErrorEnvelope" "429": *a5 - "502": &a73 + "502": &a76 description: "The source could not answer usefully, with the reason in `meta.errorCode` and, when the source answered at all, its HTTP status in `meta.upstreamStatus` (its body is never passed on): `documents.sources.unreachable` (no connection, timeout, or a destination refused at dial time), `documents.sources.redirected` (the source @@ -26921,9 +28431,9 @@ paths: description: Deletes the caller's connection for this system, and its token with it. Works even after the operator removed the origin from the list, and with the Documents module switched off. `disconnected` is false when there was nothing to delete. Cookie session only; not delegable. - security: *a69 + security: *a72 parameters: - - *a71 + - *a74 responses: "200": description: Removed, or there was nothing to remove. @@ -26932,7 +28442,7 @@ paths: schema: $ref: "#/components/schemas/DocumentSourceDisconnectEnvelope" "401": *a1 - "403": *a70 + "403": *a73 "422": *a4 "429": *a5 /api/documents/sources/{system}/test: @@ -26943,9 +28453,9 @@ paths: description: One request to the source with the stored token. Answers `ok` with the round-trip time and stamps `lastVerifiedAt`, or the reason in `meta.errorCode`. Shares the save's allowance of ten a minute. Cookie session only; not delegable. - security: *a69 + security: *a72 parameters: - - *a71 + - *a74 responses: "200": description: The source answered. @@ -26954,9 +28464,9 @@ paths: schema: $ref: "#/components/schemas/DocumentSourceTestEnvelope" "401": *a1 - "403": *a70 - "404": *a72 - "422": &a74 + "403": *a73 + "404": *a75 + "422": &a77 description: "`documents.sources.originNotAllowed`: the base address's origin is not on the operator's list (checked on every request, so a connection saved earlier is cut off once its origin is removed), or another validation failure." @@ -26965,7 +28475,7 @@ paths: schema: $ref: "#/components/schemas/ErrorEnvelope" "429": *a5 - "502": *a73 + "502": *a76 /api/documents/sources/{system}/tags: get: tags: @@ -26973,9 +28483,9 @@ paths: summary: Tags of a connected archive description: The source's tags for the picker's filter, the first 250 by name, in the source's own ids. Shares the search allowance of sixty a minute. Cookie session only; not delegable. - security: *a69 + security: *a72 parameters: - - *a71 + - *a74 responses: "200": description: The tags. @@ -26984,11 +28494,11 @@ paths: schema: $ref: "#/components/schemas/DocumentSourceTagsEnvelope" "401": *a1 - "403": *a70 - "404": *a72 - "422": *a74 + "403": *a73 + "404": *a75 + "422": *a77 "429": *a5 - "502": *a73 + "502": *a76 /api/documents/sources/{system}/search: get: tags: @@ -27002,9 +28512,9 @@ paths: under that source key: `new`, `imported` with the vault document's `documentId`, or `deleted` (deleted in HealthLog; importing it again stores nothing). Nothing is stored. Sixty searches a minute, shared with the tag read. Cookie session only; not delegable." - security: *a69 + security: *a72 parameters: - - *a71 + - *a74 - name: q in: query required: false @@ -27045,11 +28555,11 @@ paths: schema: $ref: "#/components/schemas/DocumentSourceSearchEnvelope" "401": *a1 - "403": *a70 - "404": *a72 - "422": *a74 + "403": *a73 + "404": *a75 + "422": *a77 "429": *a5 - "502": *a73 + "502": *a76 /api/documents/sources/{system}/import: post: tags: @@ -27071,9 +28581,9 @@ paths: fetched), including a duplicate. `kind` sets the document type (default OTHER). Automatic AI reading follows the person's own setting. Counts against the person's upload allowance (60 an hour) and storage quota. 201 for a new document, 200 otherwise. Cookie session only; not delegable." - security: *a69 + security: *a72 parameters: - - *a71 + - *a74 requestBody: required: true content: @@ -27134,7 +28644,7 @@ paths: schema: $ref: "#/components/schemas/DocumentSourceImportEnvelope" "401": *a1 - "403": *a70 + "403": *a73 "404": description: "`documents.sources.unavailable`: the operator has not listed any origin in `DOCUMENT_SOURCE_ORIGINS`, so the picker is off. `documents.sources.notConnected`: no connection is saved for this system. @@ -27165,7 +28675,7 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "422": *a74 + "422": *a77 "429": description: "`documents.inbound.rateLimited` (the person's hourly upload allowance, with the rate-limit headers) or `documents.inbound.uploadBusy` (too many uploads in progress; `Retry-After: 1`)." @@ -27173,7 +28683,7 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorEnvelope" - "502": *a73 + "502": *a76 /api/symptoms/definitions: get: tags: @@ -27197,7 +28707,7 @@ paths: schema: $ref: "#/components/schemas/ListSymptomDefinitionsEnvelope" "401": *a1 - "403": &a75 + "403": &a78 description: >- `meta.errorCode` = `auth.scope.insufficient` when a Bearer token's scope does not reach this route; the generic auth gate answers it before the route's own checks run. Otherwise: `illness.disabled`: the record @@ -27241,7 +28751,7 @@ paths: schema: $ref: "#/components/schemas/CreateSymptomDefinitionEnvelope" "401": *a1 - "403": *a75 + "403": *a78 "409": *a7 "422": *a4 "429": *a5 @@ -27271,8 +28781,8 @@ paths: schema: $ref: "#/components/schemas/UpdateSymptomDefinitionEnvelope" "401": *a1 - "403": *a75 - "404": &a76 + "403": *a78 + "404": &a79 description: "`symptoms.definition.notFound`: no definition with this id on the record." content: application/json: @@ -27286,7 +28796,8 @@ paths: summary: Hide or delete a symptom (v1.40) description: "Hides the definition and keeps its history. `?purge=true` deletes it and every occurrence of it. A built-in definition (`code` set) is not deleted: its occurrences are tombstoned and it stays hidden, so a later - Apple Health sync neither recreates it nor re-imports what was removed (a re-post answers `duplicate`)." + Apple Health sync neither recreates it nor re-imports what was removed (a re-post answers `skipped`, reason + `deleted_in_healthlog`)." parameters: - in: path name: id @@ -27308,8 +28819,8 @@ paths: schema: $ref: "#/components/schemas/DeleteSymptomDefinitionEnvelope" "401": *a1 - "403": *a75 - "404": *a76 + "403": *a78 + "404": *a79 "422": *a4 "429": *a5 /api/symptoms/events: @@ -27358,7 +28869,7 @@ paths: schema: $ref: "#/components/schemas/ListSymptomEventsEnvelope" "401": *a1 - "403": *a75 + "403": *a78 "422": *a4 "429": *a5 post: @@ -27384,8 +28895,8 @@ paths: schema: $ref: "#/components/schemas/CreateSymptomEventEnvelope" "401": *a1 - "403": *a75 - "404": *a76 + "403": *a78 + "404": *a79 "409": *a7 "422": *a4 "429": *a5 @@ -27443,6 +28954,35 @@ paths: $ref: "#/components/schemas/ErrorEnvelope" "429": *a12 /api/symptoms/events/{id}: + get: + tags: + - Symptoms + summary: Read one symptom occurrence + description: The occurrence as the list reads it, for a client that opens one entry by id (the web's save receipt opens + its edit sheet from it). + parameters: + - in: path + name: id + schema: + type: string + required: true + responses: + "200": + description: The occurrence. + content: + application/json: + schema: + $ref: "#/components/schemas/GetSymptomEventEnvelope" + "401": *a1 + "403": *a78 + "404": &a80 + description: "`symptoms.event.notFound`: no occurrence with this id on the record." + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" + "422": *a4 + "429": *a5 patch: tags: - Symptoms @@ -27470,21 +29010,16 @@ paths: schema: $ref: "#/components/schemas/UpdateSymptomEventEnvelope" "401": *a1 - "403": *a75 - "404": &a77 - description: "`symptoms.event.notFound`: no occurrence with this id on the record." - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorEnvelope" + "403": *a78 + "404": *a80 "422": *a4 "429": *a5 delete: tags: - Symptoms summary: Delete a symptom occurrence (v1.40) - description: Removes the occurrence. One imported from Apple Health is tombstoned instead, so a re-post of its sample - answers `duplicate`. Audits as `symptoms.event.delete`. + description: 'Removes the occurrence. One imported from Apple Health is tombstoned instead, so a re-post of its sample + answers `skipped` with `reason: "deleted_in_healthlog"`. Audits as `symptoms.event.delete`.' parameters: - in: path name: id @@ -27499,8 +29034,8 @@ paths: schema: $ref: "#/components/schemas/DeleteSymptomEventEnvelope" "401": *a1 - "403": *a75 - "404": *a77 + "403": *a78 + "404": *a80 "422": *a4 "429": *a5 /api/day/index: @@ -27533,7 +29068,7 @@ paths: schema: $ref: "#/components/schemas/DayIndexEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/day/notable: @@ -27568,7 +29103,7 @@ paths: schema: $ref: "#/components/schemas/DayNotableWindowEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/day/{date}: @@ -27598,7 +29133,7 @@ paths: schema: $ref: "#/components/schemas/DayEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/timeline: @@ -27665,7 +29200,7 @@ paths: schema: $ref: "#/components/schemas/TimelineEnvelope" "401": *a1 - "403": &a78 + "403": &a81 description: >- `meta.errorCode` = `auth.scope.insufficient` when a Bearer token's scope does not reach this route; the generic auth gate answers it before the route's own checks run. Otherwise: `module.disabled` with @@ -27704,7 +29239,7 @@ paths: schema: $ref: "#/components/schemas/TimelineReadinessEnvelope" "401": *a1 - "403": *a78 + "403": *a81 "422": *a4 "429": *a5 /api/life-events: @@ -27722,7 +29257,7 @@ paths: schema: $ref: "#/components/schemas/LifeEventListEnvelope" "401": *a1 - "403": &a79 + "403": &a82 description: >- `meta.errorCode` = `auth.scope.insufficient` when a Bearer token's scope does not reach this route; the generic auth gate answers it before the route's own checks run. Otherwise: Owner-only in v1.42: no share @@ -27764,7 +29299,7 @@ paths: schema: $ref: "#/components/schemas/CreateLifeEventEnvelope" "401": *a1 - "403": *a79 + "403": *a82 "409": *a7 "422": *a4 "429": *a12 @@ -27795,8 +29330,8 @@ paths: schema: $ref: "#/components/schemas/UpdateLifeEventEnvelope" "401": *a1 - "403": *a79 - "404": &a80 + "403": *a82 + "404": &a83 description: No such life event on this account. content: application/json: @@ -27823,8 +29358,8 @@ paths: schema: $ref: "#/components/schemas/DeleteLifeEventEnvelope" "401": *a1 - "403": *a79 - "404": *a80 + "403": *a82 + "404": *a83 "422": *a4 "429": *a5 /api/search: @@ -27870,7 +29405,7 @@ paths: schema: $ref: "#/components/schemas/SearchEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/auth/me/ai-usage: @@ -27903,6 +29438,27 @@ paths: schema: $ref: "#/components/schemas/ErrorEnvelope" "429": *a5 + /api/ai/job-failures: + get: + tags: + - Profile + summary: Why background AI work stopped (v1.49) + description: "Own account only: a cookie session or a full-scope token. One entry per kind of background AI work (and + per document for document work) whose latest run failed, newest first, at most 50. A document's entries are + listed only while the document is in the record. Refusals that are somebody's decision (an operator switch, a + module or the AI analysis turned off, the usage level) are never listed; a missing provider or consent only when + the person started the work or bound the capability to a named chain." + responses: + "200": + description: The recorded failures. + content: + application/json: + schema: + $ref: "#/components/schemas/GetAiJobFailuresResponse" + "401": *a1 + "403": *a9 + "422": *a4 + "429": *a5 /api/medications/{id}/ingredients: put: tags: @@ -27999,7 +29555,7 @@ paths: required: - file responses: - "202": *a47 + "202": *a50 "401": *a1 "403": description: "`meta.errorCode` = `auth.scope.insufficient` when a Bearer token's scope does not reach this route; the @@ -28035,7 +29591,45 @@ paths: schema: $ref: "#/components/schemas/ErrorEnvelope" "429": *a5 - "503": *a29 + "503": *a32 + /api/auth/me/medicine-registry: + patch: + tags: + - Auth + summary: Set the medicine registry for leaflet searches + description: >- + Which country's official medicine registry (or the EU's) the "Find leaflet" link on a medication opens, or + `NONE` to hide it. Independent of the interface language. The current value is `medicineRegistry` on + `/api/auth/me`. + + + Hard-set, idempotent, audit-logged. Rate-limited 60 / min per user. A value outside the list is 422. The + caller's own setting: under a switched session it is still the caller's. + + + The body is capped at 1 KB and must carry `Content-Type: application/json`. Anything larger is 413, a wrong + content type is 415, and a body that is not JSON at all is 400 — the same three the other scalars in this group + answer. + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/MedicineRegistryPatchRequest" + responses: + "200": + description: The stored registry. + content: + application/json: + schema: + $ref: "#/components/schemas/PatchMedicineRegistryEnvelope" + "400": *a28 + "401": *a1 + "403": *a9 + "413": *a29 + "415": *a30 + "422": *a4 + "429": *a5 /api/anamnesis/life-circumstances: get: tags: @@ -28050,7 +29644,7 @@ paths: schema: $ref: "#/components/schemas/LifeCircumstancesEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "422": *a4 "429": *a5 /api/anamnesis/life-circumstances/ai-sections: @@ -28114,9 +29708,10 @@ paths: summary: Record an AUDIT-C (v1.43) description: Scores the three items on the server. The entry is stored in the language of the wording the read route offers this account (`auditC.instrument.locale`), and the cut-off follows that wording; `locale`, when sent, - must name that same wording. A replay with the same `externalId` answers 200 with the stored result. 422 - `anamnesis.auditC.invalid` (also for another wording than the one offered, and for a `takenAt` more than five - minutes ahead of the server clock); 429 `anamnesis.auditC.rateLimited` after 30 in an hour. + must name that same wording. A replay with the same `externalId` answers 200 with the stored result, or 410 + (`anamnesis.auditC.deleted_in_healthlog`) when that entry was deleted since. 422 `anamnesis.auditC.invalid` + (also for another wording than the one offered, and for a `takenAt` more than five minutes ahead of the server + clock); 429 `anamnesis.auditC.rateLimited` after 30 in an hour. parameters: - *a6 requestBody: @@ -28139,8 +29734,18 @@ paths: schema: $ref: "#/components/schemas/AuditCCreatedEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "409": *a7 + "410": + description: "The `externalId` names an entry the person deleted in HealthLog. Nothing was written, and a re-post gets + the same answer: treat it as final and drop the entry from the outbox. `meta.errorCode` = + `anamnesis.auditC.deleted_in_healthlog`, `meta.reason` = `deleted_in_healthlog` (the word the bulk routes + use per entry), `meta.id` = the deleted row. An entry the app reported deleted in Apple Health (`DELETE + …/by-external-ids`) is written again instead." + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorEnvelope" "422": *a4 "429": *a5 /api/anamnesis/audit-c/{id}: @@ -28163,7 +29768,7 @@ paths: schema: $ref: "#/components/schemas/AuditCRemovedEnvelope" "401": *a1 - "403": *a20 + "403": *a18 "404": description: "`anamnesis.auditC.notFound`." content: @@ -28194,7 +29799,7 @@ paths: schema: $ref: "#/components/schemas/DawarichConnectEnvelope" "401": *a1 - "403": *a16 + "403": *a20 "422": *a4 "429": *a5 /api/dawarich/status: @@ -28210,7 +29815,7 @@ paths: schema: $ref: "#/components/schemas/DawarichStatusEnvelope" "401": *a1 - "403": *a16 + "403": *a20 "422": *a4 "429": *a5 /api/dawarich/places: @@ -28234,7 +29839,7 @@ paths: schema: $ref: "#/components/schemas/DawarichPlacesEnvelope" "401": *a1 - "403": *a16 + "403": *a20 "409": description: "`dawarich.not_connected`." content: @@ -28272,7 +29877,7 @@ paths: schema: $ref: "#/components/schemas/DawarichSettingsEnvelope" "401": *a1 - "403": *a16 + "403": *a20 "409": description: "`dawarich.not_connected`." content: @@ -28304,7 +29909,7 @@ paths: schema: $ref: "#/components/schemas/DawarichProbeEnvelope" "401": *a1 - "403": *a16 + "403": *a20 "422": *a4 "429": *a5 "502": @@ -28340,7 +29945,7 @@ paths: schema: $ref: "#/components/schemas/DawarichSyncEnvelope" "401": *a1 - "403": *a16 + "403": *a20 "409": description: "`dawarich.not_connected`." content: @@ -28375,7 +29980,7 @@ paths: schema: $ref: "#/components/schemas/DawarichDisconnectEnvelope" "401": *a1 - "403": *a16 + "403": *a20 "422": *a4 "429": *a5 /api/environment/travel/suggestions: @@ -28393,7 +29998,7 @@ paths: schema: $ref: "#/components/schemas/TravelSuggestionsEnvelope" "401": *a1 - "403": *a16 + "403": *a20 "422": *a4 "429": *a5 /api/environment/travel/suggestions/{id}/dismiss: @@ -28416,7 +30021,7 @@ paths: schema: $ref: "#/components/schemas/TravelSuggestionDismissEnvelope" "401": *a1 - "403": *a16 + "403": *a20 "404": description: "`environment.travel_suggestion.not_found`." content: @@ -28598,7 +30203,7 @@ paths: schema: $ref: "#/components/schemas/SeizureDiaryEnvelope" "401": *a1 - "403": &a81 + "403": &a84 description: >- `meta.errorCode` = `auth.scope.insufficient` when a Bearer token's scope does not reach this route; the generic auth gate answers it before the route's own checks run. Otherwise: `seizures.disabled`: the record @@ -28643,7 +30248,7 @@ paths: schema: $ref: "#/components/schemas/CreateSeizureEventEnvelope" "401": *a1 - "403": *a81 + "403": *a84 "404": description: "`seizures.type.notFound`: no seizure type with this id on the record." content: @@ -28679,7 +30284,7 @@ paths: schema: $ref: "#/components/schemas/UpdateSeizureEventEnvelope" "401": *a1 - "403": *a81 + "403": *a84 "404": description: "`seizures.event.notFound`: no seizure with this id on the record." content: @@ -28708,7 +30313,7 @@ paths: schema: $ref: "#/components/schemas/DeleteSeizureEventEnvelope" "401": *a1 - "403": *a81 + "403": *a84 "404": description: "`seizures.event.notFound`: no seizure with this id on the record." content: @@ -28745,7 +30350,7 @@ paths: schema: $ref: "#/components/schemas/CreateSeizureRescueDoseEnvelope" "401": *a1 - "403": *a81 + "403": *a84 "404": description: "`seizures.event.notFound`: no seizure with this id on the record." content: @@ -28785,7 +30390,7 @@ paths: schema: $ref: "#/components/schemas/UpdateSeizureRescueDoseEnvelope" "401": *a1 - "403": *a81 + "403": *a84 "404": description: "`seizures.rescue.notFound`: no rescue dose with this id on the record." content: @@ -28818,7 +30423,7 @@ paths: schema: $ref: "#/components/schemas/DeleteSeizureRescueDoseEnvelope" "401": *a1 - "403": *a81 + "403": *a84 "404": description: "`seizures.rescue.notFound`: no rescue dose with this id on the record." content: @@ -28840,7 +30445,7 @@ paths: schema: $ref: "#/components/schemas/ListSeizureTypesEnvelope" "401": *a1 - "403": *a81 + "403": *a84 "422": *a4 "429": *a5 post: @@ -28862,7 +30467,7 @@ paths: schema: $ref: "#/components/schemas/CreateSeizureTypeEnvelope" "401": *a1 - "403": *a81 + "403": *a84 "422": *a4 "429": *a5 /api/seizures/types/{id}: @@ -28890,7 +30495,7 @@ paths: schema: $ref: "#/components/schemas/UpdateSeizureTypeEnvelope" "401": *a1 - "403": *a81 + "403": *a84 "404": description: "`seizures.type.notFound`: no seizure type with this id on the record." content: @@ -28918,7 +30523,7 @@ paths: schema: $ref: "#/components/schemas/DeleteSeizureTypeEnvelope" "401": *a1 - "403": *a81 + "403": *a84 "404": description: "`seizures.type.notFound`: no seizure type with this id on the record." content: @@ -28946,7 +30551,7 @@ paths: schema: $ref: "#/components/schemas/SeizureSettingsEnvelope" "401": *a1 - "403": *a81 + "403": *a84 "422": *a4 "429": *a5 patch: @@ -28968,7 +30573,7 @@ paths: schema: $ref: "#/components/schemas/UpdateSeizureSettingsEnvelope" "401": *a1 - "403": *a81 + "403": *a84 "422": *a4 "429": *a5 /api/bugreport: @@ -29947,6 +31552,38 @@ components: minimum: 10 maximum: 16 - type: "null" + pregnancy: + type: object + properties: + state: + anyOf: + - type: string + enum: + - PREGNANT + - POSTPARTUM + - type: "null" + startDate: + anyOf: + - type: string + pattern: ^\d{4}-\d{2}-\d{2}$ + - type: "null" + dueDate: + anyOf: + - type: string + pattern: ^\d{4}-\d{2}-\d{2}$ + - type: "null" + deliveryDate: + anyOf: + - type: string + pattern: ^\d{4}-\d{2}-\d{2}$ + - type: "null" + postpartumWeeks: + type: integer + minimum: 1 + maximum: 78 + required: + - state + additionalProperties: false description: Partial cycle-preferences deep-merge. `enabled` flips the feature gate (`cycleTrackingEnabled`). Omitted fields are left untouched. CycleFeedOptionsPatch: @@ -29976,6 +31613,79 @@ components: additionalProperties: false description: "The writable options. At least one field. `includeFertile: true` is refused (422 `cycle.feed.fertile_goal`) unless the goal is TRYING_TO_CONCEIVE." + CareFeedOptionsPatch: + type: object + properties: + includeVisits: + type: boolean + includeCheckups: + type: boolean + includeVaccinations: + type: boolean + titleMode: + type: string + enum: + - DISCREET + - DESCRIPTIVE + additionalProperties: false + description: The writable options. At least one field. + EmergencyWalletRequest: + type: object + properties: + token: + type: string + maxLength: 80 + additionalProperties: false + EmergencyCardLinkCreate: + type: object + properties: + fields: + minItems: 1 + maxItems: 20 + type: array + items: + type: string + enum: + - BLOOD_TYPE + - ALLERGIES + - CONDITIONS + - MEDICATIONS + - PREGNANCY + - IMPLANTS + - CONTACTS + - ADVANCE_DIRECTIVE + - ORGAN_DONOR + - NOTE + - DATE_OF_BIRTH + expiresInDays: + anyOf: + - type: integer + minimum: 1 + maximum: 3660 + - type: "null" + required: + - fields + additionalProperties: false + ReportSchedulePut: + type: object + properties: + cadence: + type: string + enum: + - MONTHLY + - QUARTERLY + - YEARLY + window: + type: string + enum: + - PERIOD + - LAST_90_DAYS + - LAST_365_DAYS + required: + - cadence + - window + additionalProperties: false + description: The cadence and the window. HealthRecordExportRequest: type: object properties: @@ -30008,7 +31718,7 @@ components: type: number const: 2 leaves: - maxItems: 122 + maxItems: 133 type: array items: type: string @@ -30070,7 +31780,7 @@ components: type: number const: 2 leaves: - maxItems: 122 + maxItems: 133 type: array items: type: string @@ -30960,6 +32670,17 @@ components: - FEV1 - FVC - PEAK_EXPIRATORY_FLOW + - WORKOUT_EFFORT_SCORE + - ESTIMATED_WORKOUT_EFFORT_SCORE + - PHYSICAL_EFFORT + - CYCLING_DISTANCE + - ROWING_DISTANCE + - ROWING_SPEED + - RUNNING_SPEED + - RUNNING_POWER + - RUNNING_GROUND_CONTACT_TIME + - RUNNING_VERTICAL_OSCILLATION + - RUNNING_STRIDE_LENGTH value: type: number measuredAt: @@ -31202,6 +32923,15 @@ components: type: string minLength: 1 maxLength: 120 + computedAt: + description: "Since v1.49.0, on a `stats:` entry: when the client computed this day total. A write of the same row + carrying an earlier `computedAt` than the stored row's is refused, `skipped` with reason `stale`, so an + out-of-order replay never replaces a newer total; an equal or later one writes. Without it the entry + overwrites as before and the stored row forgets its time, so the next entry that states one writes. Ignored + on every other entry." + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ source: description: Source attribution for the row. Defaults to `APPLE_HEALTH` when omitted. Send `MANUAL` to tag rows the user entered by hand on-device (e.g. the standalone adopt-on-pair backfill). Part of the `(userId, type, source, @@ -31226,6 +32956,17 @@ components: - other - unknown - type: "null" + timeZone: + description: "IANA time zone the sample was taken in (`HKMetadataKeyTimeZone`, e.g. `America/New_York`). The local day + and wall clock of the reading are read in this zone: a night slept abroad files under that zone's wake day, + the day view and the daily charts count the reading on that zone's day. Omit it to keep the profile zone + (`timezone` on `/api/auth/me`), which is also what every row stored without one means. A name the server + cannot read (not a valid IANA name, or one its database does not know) is stored as null and the entry is + still written. Not part of any dedup key; a `stats:` re-post updates it. Rollup buckets are UTC days and do + not read it." + type: string + minLength: 1 + maxLength: 64 required: - hkIdentifier - value @@ -31545,18 +33286,34 @@ components: - production medicationDelivery: description: "v1.7.0 per-device medication-delivery override; omitted keeps the stored value. \"client\" keeps the - server's medication-reminder push off this device (the app reminds locally), \"server\" pushes it to this - device whatever the account says, and null / no override follows the account-wide switch + server's medication-reminder push off this device (the app reminds locally) while its local plan can run + (see `localRunwayUntil`; without one, for 3 days after its last authenticated request), \"server\" pushes it + to this device whatever the account says, and null / no override follows the account-wide switch (`notificationPrefs.medication.clientManaged` or `deliveryDefault: \"client\"`). Since v1.48.0 the server - honours it per device on the APNs send; before, it was stored and echoed only. Only the reminder that - announces a dose is affected: follow-ups for a dose still open, every other push, and the Telegram, ntfy, - webhook, email and Web Push channels are not." + honours it per device on the APNs send; before, it was stored and echoed only. Since v1.49.0 the relay + follows the same decision as this server's own APNs key. Only the reminder that announces a dose is + affected: follow-ups for a dose still open (except over the relay, which carries them only to a device the + server reminds), every other push, and the Telegram, ntfy, webhook, email and Web Push channels are not. + `GET /api/devices/me/push-diagnostics` shows the resolved value as `medicationReminder`." anyOf: - type: string enum: - server - client - type: "null" + localRunwayUntil: + description: "Until when this device has its medication reminders planned locally (ISO 8601). Only read while the device + delivers locally (`medicationDelivery: \"client\"`, or inheriting a client-managed account). Such a device + keeps the server's reminder push off only while `now <= localRunwayUntil`; past it the server pushes the + reminder that announces a dose to this device again. Without a runway the server allows 3 days after the + device's last authenticated request. Must lie between now (5 minutes of clock skew allowed) and 14 days + ahead, else 422. Null clears it (back to the 3-day rule); omitted keeps the stored value. Send it on every + registration, since a request that does not register does not move it." + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" liveActivityPushToken: description: v1.17.1 (#22) hex-encoded ActivityKit Live Activity push token (distinct from the device APNs token). The server addresses a Live Activity update / end push on a medication-intake mutation. Omitted = keep the prior @@ -31567,11 +33324,277 @@ components: maxLength: 256 pattern: ^[A-Fa-f0-9]+$ - type: "null" + liveActivityTokens: + description: "The device's running medication Live Activities, as a full replacement list: present replaces the stored + list (an empty array clears it), omitted leaves it unchanged. Each entry is ended with one `end` push once + its dose is answered, and removed after the push. When this field is present the legacy + `liveActivityPushToken` is ignored." + maxItems: 8 + type: array + items: + type: object + properties: + token: + type: string + minLength: 8 + maxLength: 256 + pattern: ^[A-Fa-f0-9]+$ + description: The Activity's ActivityKit push token (hex). + medicationId: + description: The medication the Activity shows. Required unless `relayStart` is true. + type: string + relayStart: + description: "The Activity was started by the server over the relay (attributes type `HealthLogDoseAttributes`), so the + app does not know its dose: the server fills in `medicationId` and `slotInstant` of the dose it + started. Send its update token with an `hl-activity-v1` statement as for any Activity. Only Activities + registered with it get relay updates; one the app started itself gets the direct path and the end push + only. The mark sticks to the token on later posts of the set; a rotated token is sent with it again." + type: boolean + slotInstant: + description: The slot the Activity counts down to (the today row's `slotInstant`). With it the server ends this Activity + once that slot is taken or skipped; without it, once no dose of the medication the Activity could show + is open. + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + statement: + description: The `hl-activity-v1` statement for this Activity, signed with the binding key. Stored here and handed to + the relay only inside the end push. + type: object + properties: + instanceId: + type: string + pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$ + tokenTag: + type: string + pattern: ^[0-9a-f]{32}$ + laTokenTag: + type: string + pattern: ^[0-9a-f]{32}$ + iat: + type: integer + minimum: 0 + maximum: 99999999999 + required: + - instanceId + - tokenTag + - laTokenTag + - iat + additionalProperties: false + signature: + description: Ed25519 signature of the statement, unpadded base64url. + type: string + required: + - token + pushKey: + description: The device's X25519 push key with the envelope suites it opens. Every later push to the device is sealed to + it. A low-order key is refused with 422 `devices.push.invalid_push_key`. `null` withdraws it and the relay + binding. + anyOf: + - type: object + properties: + v: + type: number + const: 1 + suites: + minItems: 1 + maxItems: 8 + type: array + items: + type: integer + minimum: 1 + maximum: 255 + publicKey: + type: string + pattern: ^[A-Za-z0-9_-]+$ + required: + - v + - suites + - publicKey + additionalProperties: false + - type: "null" + relayBinding: + description: "The signed `hl-bind-v1` statement, forwarded to the relay unchanged. Accepted only with + `relayConsent.granted: true` and a push key; refused with 422 `devices.push.` when the instance id, + the token tag or the signature does not hold." + type: object + properties: + bindingKey: + type: string + pattern: ^[A-Za-z0-9_-]+$ + statement: + type: object + properties: + instanceId: + type: string + pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$ + tokenTag: + type: string + pattern: ^[0-9a-f]{32}$ + kind: + type: string + const: device + seq: + type: integer + minimum: 0 + maximum: 9007199254740991 + iat: + type: integer + minimum: 0 + maximum: 99999999999 + required: + - instanceId + - tokenTag + - kind + - seq + - iat + additionalProperties: false + signature: + type: string + pattern: ^[A-Za-z0-9_-]+$ + required: + - bindingKey + - statement + - signature + additionalProperties: false + relayConsent: + description: "The person's choice on the opt-in card. `granted: false` withdraws the consent: the binding is removed at + the relay, and the Live Activity consent with it." + type: object + properties: + granted: + type: boolean + textVersion: + type: string + pattern: ^[A-Za-z0-9._-]{1,32}$ + required: + - granted + - textVersion + additionalProperties: false + liveActivityConsent: + description: "The second, separate switch: Live Activity start and update over the relay, off by default (\"The relay + and Apple can see when a dose is due.\"). The device's `hl-la-consent-v1` (`textVersion`, `iat` within 300 + s, signature by the binding key), checked here and passed on to the relay at once; + `push.device.liveActivityConsent` turns true once the relay took it. Needs a device bound with the relay + consent, else 422 `devices.push.relay_consent_required`; a bad statement 422 `devices.push.bad_signature` or + `devices.push.statement_stale`." + type: object + properties: + textVersion: + type: string + pattern: ^[A-Za-z0-9._-]{1,32}$ + iat: + type: integer + minimum: 0 + maximum: 99999999999 + signature: + type: string + pattern: ^[A-Za-z0-9_-]+$ + required: + - textVersion + - iat + - signature + additionalProperties: false + liveActivityWithdraw: + description: "The device's `hl-la-withdraw-v1` (`iat` within 300 s, signature by the binding key): drops the Live + Activity consent here and at the relay. Withdrawing the relay consent drops it too." + type: object + properties: + iat: + type: integer + minimum: 0 + maximum: 99999999999 + signature: + type: string + pattern: ^[A-Za-z0-9_-]+$ + required: + - iat + - signature + additionalProperties: false + liveActivityStart: + description: The ActivityKit push-to-start token with the device's `hl-la-start-v1` (`statement.laTokenTag` is the tag + of the push-to-start token, `iat` at most 30 days old; sign again when the token changes and at least every + 30 days). Handed to the relay only inside a start push. `null` drops it. + anyOf: + - type: object + properties: + token: + type: string + minLength: 64 + maxLength: 200 + pattern: ^[0-9A-Fa-f]+$ + statement: + type: object + properties: + instanceId: + type: string + pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$ + tokenTag: + type: string + pattern: ^[0-9a-f]{32}$ + laTokenTag: + type: string + pattern: ^[0-9a-f]{32}$ + iat: + type: integer + minimum: 0 + maximum: 99999999999 + required: + - instanceId + - tokenTag + - laTokenTag + - iat + additionalProperties: false + signature: + type: string + pattern: ^[A-Za-z0-9_-]+$ + required: + - token + - statement + - signature + additionalProperties: false + - type: "null" required: - token - bundleId - description: Native device registration. Re-registering an APNs token belonging to another user returns 409 - (cross-user-hijack guard). + description: Native device registration. A `token` or `apnsToken` another account holds is taken over once that account + is signed out of the device, and refused with 409 while it is still signed in there (see `POST /api/devices`). + AdminPushRelaySwitch: + type: object + properties: + enabled: + type: boolean + acceptTerms: + type: boolean + householdOnly: + type: boolean + invite: + description: The relay's one-time invite code, 24 base64url characters, for a relay that accepts new servers by + invitation only. Used for this registration attempt only and never stored; any other shape is 422. + type: string + pattern: ^[A-Za-z0-9_-]{24}$ + required: + - enabled + AdminServerSetupStepRequest: + type: object + properties: + step: + type: string + enum: + - accounts + - notifications + - ai + - privacy + - health + status: + type: string + enum: + - done + - skipped + required: + - step + - status + additionalProperties: false MedicationApiEndpointPutRequest: type: object properties: @@ -31820,7 +33843,11 @@ components: type: string minLength: 1 scheduledFor: - description: ISO instant; defaults to `takenAt` then now() when omitted. + description: "ISO instant; defaults to `takenAt` then now() when omitted. On a take the same rule as `POST + /api/medications/{id}/intake`: A take that names a real slot of the medication counts for it when the slot + lies behind the take (however late) or the take sits inside the slot's window, from its early grace on (a + 20:00 dose taken at 19:30 counts for 20:00). A slot further ahead does not bind: the take answers the slot + its own time falls into, or none. For a dose that is not open yet, send `forceSlotInstant`." type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ @@ -31958,8 +33985,9 @@ components: notificationsEnabled: type: boolean liveActivityEnabled: - description: iOS Live Activity opt-in for this medication's reminders. Default false. The iOS client owns the - ActivityKit lifecycle; the server only stores + echoes the flag. + description: iOS Live Activity opt-in for this medication's reminders. Default false. The iOS client plans its own + Activities by it; a server start over the push relay requires it, and a server-started Activity ends once it + is off. type: boolean criticalAlarmEnabled: description: iOS 26 AlarmKit critical-reminder opt-in. Default false. Critical alarms bypass the device mute switch / @@ -31991,6 +34019,15 @@ components: - type: string maxLength: 500 - type: "null" + leafletUrl: + description: "#1430 — the official leaflet the person found for this medication, saved as a link: an `https:` URL, any + host, at most 2048 characters after trimming. Any other scheme (`http:`, `javascript:`, `data:`) or text + that is not a URL is refused with 422. An empty string or NULL clears it; absent leaves it untouched. The + server never fetches it; clients show it only as an external link." + anyOf: + - type: string + maxLength: 2048 + - type: "null" externalSource: description: "Marks the medication as MIRRORED from an external medication list. Only `APPLE_HEALTH` (the iOS 26+ HealthKit Medications sync) is accepted. Must be supplied together with `externalId`. A mirrored medication @@ -32292,10 +34329,50 @@ components: type: string minLength: 1 maxLength: 64 + groupBy: + description: Grouping mode ("none" or "category"). Default "none". + type: string + enum: + - none + - category + groupsOpen: + description: Which groups open by default ("expanded", "flagged", "collapsed"). Default "expanded". + type: string + enum: + - expanded + - flagged + - collapsed + categoryOrder: + description: "The category order of the grouped list, first = top: built-in category values and `custom:` keys, at + most 64. A malformed key is a 422; a well-formed custom key the account does not have is dropped on write. + Categories not listed follow in the default order, OTHER last. Optional on PUT (preserve-when-absent); + always present on responses." + maxItems: 64 + type: array + items: + anyOf: + - type: string + enum: + - BLOOD_PRESSURE + - VITAMIN + - SUPPLEMENT + - PAIN_RELIEF + - ALLERGY + - DIGESTIVE + - THYROID + - HORMONE + - SKIN + - SLEEP_AID + - DIABETES + - ANTIBIOTIC + - MENTAL_HEALTH + - OTHER + - type: string + pattern: ^custom:[0-9a-f-]{36}$ baseUpdatedAt: description: "Optimistic-concurrency base token: the `updatedAt` the client last read for this resource. Omit it for the legacy unconditional write (older clients are unaffected). When present, the write is guarded on the stored - row still carrying this exact value — a stale token fails with 409 and changes nothing. A + resource still carrying this exact value — a stale token fails with 409 and changes nothing. A present-but-unparseable value fails with 422 and `meta.errorCode` = `invalid_base_updated_at` — note that this is NOT the unconditional write: sending `null` or a malformed string is rejected rather than treated as an omitted token. Treat as opaque: only ever echo a server-returned value, never parse or synthesise it." @@ -32395,8 +34472,8 @@ components: notificationsEnabled: type: boolean liveActivityEnabled: - description: iOS Live Activity opt-in for this medication's reminders. The iOS client owns the ActivityKit lifecycle; - the server only stores + echoes the flag. + description: iOS Live Activity opt-in for this medication's reminders. The iOS client plans its own Activities by it; a + server start over the push relay requires it, and a server-started Activity ends once it is off. type: boolean criticalAlarmEnabled: description: iOS 26 AlarmKit critical-reminder opt-in. Critical alarms bypass the device mute switch / Focus; the server @@ -32428,6 +34505,15 @@ components: - type: string maxLength: 500 - type: "null" + leafletUrl: + description: "#1430 — the official leaflet the person found for this medication, saved as a link: an `https:` URL, any + host, at most 2048 characters after trimming. Any other scheme (`http:`, `javascript:`, `data:`) or text + that is not a URL is refused with 422. An empty string or NULL clears it; absent leaves it untouched. The + server never fetches it; clients show it only as an external link." + anyOf: + - type: string + maxLength: 2048 + - type: "null" startsOn: description: Date the medication course begins (ISO `YYYY-MM-DD`). Anchors RRULE BYDAY / BYMONTHDAY patterns and the rolling-interval countdown's first window. NULL = active from creation (the legacy implicit behaviour). @@ -32502,8 +34588,12 @@ components: description: Server-narrowed from the URL path. The route layer overwrites whatever the body supplies before Zod parsing so a caller cannot log an intake against another medication. scheduledFor: - description: Slot the dose belongs to. Defaults to `takenAt` (or `now()` when both are absent) so the compliance pairing - logic can pin the dose to a schedule slot. + description: "Slot the dose belongs to. Defaults to `takenAt` (or `now()` when both are absent) so the compliance + pairing logic can pin the dose to a schedule slot. A take that names a real slot of the medication counts + for it when the slot lies behind the take (however late) or the take sits inside the slot's window, from its + early grace on (a 20:00 dose taken at 19:30 counts for 20:00). A slot further ahead does not bind: the take + answers the slot its own time falls into, or none. For a dose that is not open yet, send + `forceSlotInstant`." type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ @@ -32545,6 +34635,12 @@ components: type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + extraDose: + description: "Since v1.49.0: true records this take as an extra dose outside the plan. It answers no scheduled slot + (neither by its time nor by the nearest-slot rule) and is never bound to one later. Only on a taken write; + cannot be combined with `scheduledFor` or `forceSlotInstant` (422). Absent or false keeps the default + attribution." + type: boolean doseTaken: description: Dose actually consumed for THIS intake when it deviates from (or documents) the medication's configured dose, e.g. a half tablet or a titration step. Free text, max 50 characters. Omit to record the take under @@ -32804,6 +34900,17 @@ components: - FEV1 - FVC - PEAK_EXPIRATORY_FLOW + - WORKOUT_EFFORT_SCORE + - ESTIMATED_WORKOUT_EFFORT_SCORE + - PHYSICAL_EFFORT + - CYCLING_DISTANCE + - ROWING_DISTANCE + - ROWING_SPEED + - RUNNING_SPEED + - RUNNING_POWER + - RUNNING_GROUND_CONTACT_TIME + - RUNNING_VERTICAL_OSCILLATION + - RUNNING_STRIDE_LENGTH biomarkerId: type: string minLength: 1 @@ -32984,6 +35091,68 @@ components: - medium - high - type: "null" + localCoachBudget: + anyOf: + - type: object + properties: + snapshotChars: + anyOf: + - type: integer + minimum: 4000 + maximum: 120000 + - type: "null" + turnTokens: + anyOf: + - type: integer + minimum: 20000 + maximum: 600000 + - type: "null" + maxRounds: + anyOf: + - type: integer + minimum: 2 + maximum: 24 + - type: "null" + turnSeconds: + anyOf: + - type: integer + minimum: 30 + maximum: 600 + - type: "null" + - type: "null" + description: "Coach budget for this provider: snapshot size in characters, tokens, rounds and seconds per turn. A null + field restores its built-in value; null for the object clears the budget." + compatCoachBudget: + anyOf: + - type: object + properties: + snapshotChars: + anyOf: + - type: integer + minimum: 4000 + maximum: 120000 + - type: "null" + turnTokens: + anyOf: + - type: integer + minimum: 20000 + maximum: 600000 + - type: "null" + maxRounds: + anyOf: + - type: integer + minimum: 2 + maximum: 24 + - type: "null" + turnSeconds: + anyOf: + - type: integer + minimum: 30 + maximum: 600 + - type: "null" + - type: "null" + description: "Coach budget for this provider: snapshot size in characters, tokens, rounds and seconds per turn. A null + field restores its built-in value; null for the object clears the budget." description: "Partial update of the calling user's AI-provider configuration. An omitted key is left untouched; `null` (or an empty string, on the string fields) clears the column. At least one recognised key must be present, or the write is refused. Key material is write-only: it is encrypted on the way in and never returned. Unknown keys @@ -33093,7 +35262,7 @@ components: baseUpdatedAt: description: "Optimistic-concurrency base token: the `updatedAt` the client last read for this resource. Omit it for the legacy unconditional write (older clients are unaffected). When present, the write is guarded on the stored - row still carrying this exact value — a stale token fails with 409 and changes nothing. A + resource still carrying this exact value — a stale token fails with 409 and changes nothing. A present-but-unparseable value fails with 422 and `meta.errorCode` = `invalid_base_updated_at` — note that this is NOT the unconditional write: sending `null` or a malformed string is rejected rather than treated as an omitted token. Treat as opaque: only ever echo a server-returned value, never parse or synthesise it." @@ -33135,7 +35304,7 @@ components: baseUpdatedAt: description: "Optimistic-concurrency base token: the `updatedAt` the client last read for this resource. Omit it for the legacy unconditional write (older clients are unaffected). When present, the write is guarded on the stored - row still carrying this exact value — a stale token fails with 409 and changes nothing. A + resource still carrying this exact value — a stale token fails with 409 and changes nothing. A present-but-unparseable value fails with 422 and `meta.errorCode` = `invalid_base_updated_at` — note that this is NOT the unconditional write: sending `null` or a malformed string is rejected rather than treated as an omitted token. Treat as opaque: only ever echo a server-returned value, never parse or synthesise it." @@ -33202,7 +35371,7 @@ components: baseUpdatedAt: description: "Optimistic-concurrency base token: the `updatedAt` the client last read for this resource. Omit it for the legacy unconditional write (older clients are unaffected). When present, the write is guarded on the stored - row still carrying this exact value — a stale token fails with 409 and changes nothing. A + resource still carrying this exact value — a stale token fails with 409 and changes nothing. A present-but-unparseable value fails with 422 and `meta.errorCode` = `invalid_base_updated_at` — note that this is NOT the unconditional write: sending `null` or a malformed string is rejected rather than treated as an omitted token. Treat as opaque: only ever echo a server-returned value, never parse or synthesise it." @@ -33239,6 +35408,10 @@ components: type: integer minimum: 0 maximum: 60 + snoozeMinutes: + type: integer + minimum: 5 + maximum: 240 mood: type: object properties: @@ -33285,7 +35458,7 @@ components: baseUpdatedAt: description: "Optimistic-concurrency base token: the `updatedAt` the client last read for this resource. Omit it for the legacy unconditional write (older clients are unaffected). When present, the write is guarded on the stored - row still carrying this exact value — a stale token fails with 409 and changes nothing. A + resource still carrying this exact value — a stale token fails with 409 and changes nothing. A present-but-unparseable value fails with 422 and `meta.errorCode` = `invalid_base_updated_at` — note that this is NOT the unconditional write: sending `null` or a malformed string is rejected rather than treated as an omitted token. Treat as opaque: only ever echo a server-returned value, never parse or synthesise it." @@ -33305,7 +35478,7 @@ components: type: number const: 2 leaves: - maxItems: 122 + maxItems: 133 type: array items: type: string @@ -34038,7 +36211,7 @@ components: baseUpdatedAt: description: "Optimistic-concurrency base token: the `updatedAt` the client last read for this resource. Omit it for the legacy unconditional write (older clients are unaffected). When present, the write is guarded on the stored - row still carrying this exact value — a stale token fails with 409 and changes nothing. A + resource still carrying this exact value — a stale token fails with 409 and changes nothing. A present-but-unparseable value fails with 422 and `meta.errorCode` = `invalid_base_updated_at` — note that this is NOT the unconditional write: sending `null` or a malformed string is rejected rather than treated as an omitted token. Treat as opaque: only ever echo a server-returned value, never parse or synthesise it." @@ -34594,6 +36767,17 @@ components: - FEV1 - FVC - PEAK_EXPIRATORY_FLOW + - WORKOUT_EFFORT_SCORE + - ESTIMATED_WORKOUT_EFFORT_SCORE + - PHYSICAL_EFFORT + - CYCLING_DISTANCE + - ROWING_DISTANCE + - ROWING_SPEED + - RUNNING_SPEED + - RUNNING_POWER + - RUNNING_GROUND_CONTACT_TIME + - RUNNING_VERTICAL_OSCILLATION + - RUNNING_STRIDE_LENGTH description: DB-stored measurement category. v1.4.23 added 7 Apple Health values (HRV, resting HR, active energy, flights, walking/running distance, VO2 max, body temperature). InsightsSettingsPutRequest: @@ -35083,7 +37267,7 @@ components: baseUpdatedAt: description: "Optimistic-concurrency base token: the `updatedAt` the client last read for this resource. Omit it for the legacy unconditional write (older clients are unaffected). When present, the write is guarded on the stored - row still carrying this exact value — a stale token fails with 409 and changes nothing. A + resource still carrying this exact value — a stale token fails with 409 and changes nothing. A present-but-unparseable value fails with 422 and `meta.errorCode` = `invalid_base_updated_at` — note that this is NOT the unconditional write: sending `null` or a malformed string is rejected rather than treated as an omitted token. Treat as opaque: only ever echo a server-returned value, never parse or synthesise it." @@ -35935,6 +38119,12 @@ components: type: string minLength: 1 maxLength: 32 + timeZone: + description: The IANA zone the reading was taken in, as `POST /api/measurements/batch` stores it. A name the server + cannot read is stored as null (the profile zone), never a refusal. + type: string + minLength: 1 + maxLength: 64 notes: description: Encrypted at rest. type: string @@ -38506,6 +40696,25 @@ components: - metric - imperial - type: "null" + timezone: + type: string + maxLength: 64 + medicineRegistry: + type: string + enum: + - PL + - DE + - ES + - FR + - GB + - BE + - NL + - US + - CA + - AU + - BR + - EU + - NONE additionalProperties: false required: - step @@ -38522,6 +40731,28 @@ components: required: - step additionalProperties: false + - type: object + properties: + step: + type: string + const: reminders + status: + type: string + const: done + required: + - step + additionalProperties: false + - type: object + properties: + step: + type: string + const: ai + status: + type: string + const: done + required: + - step + additionalProperties: false - type: object properties: step: @@ -38625,6 +40856,30 @@ components: - step - status additionalProperties: false + - type: object + properties: + step: + type: string + const: reminders + status: + type: string + const: skipped + required: + - step + - status + additionalProperties: false + - type: object + properties: + step: + type: string + const: ai + status: + type: string + const: skipped + required: + - step + - status + additionalProperties: false - type: object properties: step: @@ -38637,10 +40892,11 @@ components: - step - status additionalProperties: false - description: "One step, answered or deliberately passed. The union has an arm per step id plus a skip arm for the six - steps that may be passed — `who` is the one required question, and `confirm` / `done` are acknowledgements - rather than questions, so none of the three has a skip arm. Every arm is strict: an unknown key is a 422, and a - skip may never carry an answer." + description: "One step, answered or deliberately passed. The union has an arm per step id plus a skip arm for the eight + steps that may be passed (the two 1.49 follow-ups `reminders` and `ai` carry no payload: their settings have + their own routes) — `who` is the one required question, and `confirm` / `done` are acknowledgements rather than + questions, so none of the three has a skip arm. Every arm is strict: an unknown key is a 422, and a skip may + never carry an answer." OnboardingRestartRequest: type: object properties: {} @@ -40224,7 +42480,7 @@ components: baseUpdatedAt: description: "Optimistic-concurrency base token: the `updatedAt` the client last read for this resource. Omit it for the legacy unconditional write (older clients are unaffected). When present, the write is guarded on the stored - row still carrying this exact value — a stale token fails with 409 and changes nothing. A + resource still carrying this exact value — a stale token fails with 409 and changes nothing. A present-but-unparseable value fails with 422 and `meta.errorCode` = `invalid_base_updated_at` — note that this is NOT the unconditional write: sending `null` or a malformed string is rejected rather than treated as an omitted token. Treat as opaque: only ever echo a server-returned value, never parse or synthesise it." @@ -40578,6 +42834,7 @@ components: - MEDICATION_LOW_STOCK - MEASUREMENT_REMINDER - MEDICATION_INTAKE_SYNC + - MEDICATION_INTAKE_RECORDED - SECURITY_ALERT - DAILY_BRIEFING - SHARED_RECORD_INTAKE @@ -40632,6 +42889,7 @@ components: - $ref: "#/components/schemas/RecordCoachSettingsPatch" - $ref: "#/components/schemas/RecordInsightsSettingsPatch" - $ref: "#/components/schemas/RecordDocumentsSettingsPatch" + - $ref: "#/components/schemas/RecordAiSourceSettingsPatch" description: The body for the family named in the path. Only that family's variant is accepted — sending the profile body to `/thresholds` is a 422, because every variant is strict. OpenAPI cannot tie the variant to the path parameter, so the union is the honest publication of six separate contracts sharing one URL shape. @@ -41218,6 +43476,28 @@ components: description: "Turn automatic AI reading of the record's uploads on or off. Turning it on is the guardian's consent to document reading on the profile's behalf: it mints the profile's `ai_extraction` receipt when none is active, and the audit row names the guardian." + RecordAiSourceSettingsPatch: + type: object + properties: + source: + type: string + enum: + - INSTANCE + - NONE + - GUARDIAN + chainId: + anyOf: + - type: string + pattern: ^[A-Za-z0-9_-]{1,32}$ + - type: "null" + required: + - source + additionalProperties: false + description: Choose the managed profile's AI provider source. `GUARDIAN` lends the calling guardian's own chain + (`chainId` one of their named chains, or null for their default chain); a chain id the caller does not have + answers 422 `record_settings.ai_source.chain_missing`. The profile's consent receipts and switches still gate + every call. The audit row names the guardian and records the source and whether a named or the default chain was + picked. EnvironmentPreferencesRequest: type: object properties: @@ -41317,8 +43597,10 @@ components: description: "An externally-observed dose. `medicationName` is matched case-insensitively against the token owner's ACTIVE medications — there is no id form on this surface. `takenAt` is optional and defaults to now, bounded by the same plausibility range the interactive create paths use. `idempotencyKey` is an identity, not a windowed - replay token: it is stored on the row forever and matched by equality, so a key that rotates per client launch - never matches its own earlier row and every re-sync logs the dose again." + replay token: it is stored on the row forever and matched by equality. Derive one key per take (for example from + the take's time) and reuse it only to retry that same request: a fixed key records the first dose and answers + every later one as a replay of it, and a key that rotates per client launch logs a re-sent dose again. There is + no `scheduledFor`; the slot is resolved from `takenAt`." AdminBackupRestoreRequest: type: object properties: @@ -41609,6 +43891,28 @@ components: description: "Replace the composition: 0..40 entries, one per nutrient code, `amount` > 0 in one of the code's `inputUnits` (`GET /api/nutrients/catalog`). `source` is `MANUAL` (default) or `LABEL_AI` after a label proposal was reviewed." + MedicineRegistryPatchRequest: + type: object + properties: + medicineRegistry: + type: string + enum: + - PL + - DE + - ES + - FR + - GB + - BE + - NL + - US + - CA + - AU + - BR + - EU + - NONE + required: + - medicineRegistry + description: Which official medicine registry the leaflet search opens, or `NONE`. LifeAiSectionsPatchRequest: type: object properties: @@ -42811,72 +45115,88 @@ components: `/test` operation instead, where the differences can be stated; and a 401 raised by a route checking a credential of its own carries the generic `http.unauthenticated`. account — account.deletion.already_pending, account.deletion.no_guardian, account.deletion.not_pending; activity — - activity.calendar.future_date, activity.calendar.too_old; admin — admin.users.delete.managed_profile, + activity.calendar.future_date, activity.calendar.too_old; devices — devices.push.apns_token_required, + devices.push.bad_signature, devices.push.consent_required, devices.push.instance_mismatch, + devices.push.invalid_push_key, devices.push.push_key_required, devices.push.relay_consent_required, + devices.push.relay_daily_limit, devices.push.relay_device_limit, devices.push.relay_not_offered, + devices.push.statement_stale, devices.push.token_mismatch, devices.push.unsupported_suite, + devices.register.signed_in_elsewhere; admin — admin.pushRelay.confirmationsRequired, + admin.pushRelay.decisionNotOpen, admin.pushRelay.noSenderKey, admin.pushRelay.notRegistered, + admin.pushRelay.rateLimited, admin.pushRelay.unavailable, admin.serverSetup.invalid, + admin.serverSetup.notOffered, admin.serverSetup.rateLimited, admin.users.delete.managed_profile, admin.users.delete.self; ai — ai.budget.exceeded, ai.provider.none, ai.record.notPermitted, ai.unavailable, ai.usage.aboveCeiling, ai.usage.defaultAboveCeiling, ai.usage.invalid, ai.usage.levelTooLow, ai.usage.rateLimited; ai_provider — ai_provider.invalid, ai_provider.no_fields, ai_provider.private_host; aiRuns — aiRuns.failed, aiRuns.notFound, aiRuns.readerBusy, aiRuns.timedOut, aiRuns.workerUnavailable; allergy — allergy.invalid; analytics — analytics.invalid_query; anamnesis — - anamnesis.auditC.invalid, anamnesis.auditC.notFound, anamnesis.auditC.rateLimited, - anamnesis.fact.conflict, anamnesis.fact.currentExists, anamnesis.fact.invalidValue, - anamnesis.lifeConfirm.invalid, anamnesis.lifeSections.invalid; auth — auth.account.deletion_pending, - auth.admin.required, auth.already_authenticated, auth.mfa.already_active, auth.mfa.code_invalid, - auth.missing, auth.passkey.last_method, auth.refresh.invalid, auth.refresh.reuse, auth.refresh.revoked, - auth.register.invite_invalid, auth.register.taken, auth.reproof.failed, auth.reproof.required, - auth.reproof.too_weak, auth.scope.insufficient, auth.session.insecure_transport, - auth.session.unavailable, auth.stepup.required, auth.token.expired, auth.token.invalid; backup — - backup.foreign_reference, backup.key.missing, backup.owner.exists, backup.owner.missing, - backup.payload.undecryptable, backup.restore.active, backup.restore.rows_exist_elsewhere, - backup.section.missing, backup.target.admin_account, backup.target.holds_records, - backup.target.managed_profile, backup.target.not_found, backup.target.pending_deletion, - backup.target.unconfirmed, backup.target.username_taken, backup.upload.too_large; biomarkers — - biomarkers.unit.locked; body-site — body-site.invalid; coach — coach.budget.exceeded, - coach.conversation.invalidTitle, coach.conversation.notFound, coach.fenced.attachmentConflict, - coach.fenced.attachmentLimit, coach.fenced.attachmentNotFound, coach.fenced.attachmentNotIndexed, - coach.fenced.attachmentRequired, coach.fenced.attachmentUnavailable, coach.fenced.invalid, - coach.request.invalid; coach-prefs — coach-prefs.body.invalid_json, coach-prefs.body.invalid_shape; - consent — consent.ai.confirmRequired, consent.ai.required; customMetric — customMetric.name_taken; cycle - — cycle.bulk.invalid, cycle.bulk.too_large, cycle.calendar.invalid, cycle.calendar.range, - cycle.cycles.invalid, cycle.day-log.conflict, cycle.day-log.invalid, cycle.disabled, + anamnesis.auditC.deleted_in_healthlog, anamnesis.auditC.invalid, anamnesis.auditC.notFound, + anamnesis.auditC.rateLimited, anamnesis.fact.conflict, anamnesis.fact.currentExists, + anamnesis.fact.invalidValue, anamnesis.lifeConfirm.invalid, anamnesis.lifeSections.invalid; auth — + auth.account.deletion_pending, auth.admin.required, auth.already_authenticated, auth.mfa.already_active, + auth.mfa.code_invalid, auth.missing, auth.passkey.last_method, auth.refresh.invalid, auth.refresh.reuse, + auth.refresh.revoked, auth.refresh.superseded, auth.register.invite_invalid, auth.register.taken, + auth.reproof.failed, auth.reproof.required, auth.reproof.too_weak, auth.scope.insufficient, + auth.session.insecure_transport, auth.session.unavailable, auth.stepup.required, auth.token.expired, + auth.token.invalid; backup — backup.foreign_reference, backup.key.missing, backup.owner.exists, + backup.owner.missing, backup.payload.undecryptable, backup.restore.active, + backup.restore.rows_exist_elsewhere, backup.section.missing, backup.target.admin_account, + backup.target.holds_records, backup.target.managed_profile, backup.target.not_found, + backup.target.pending_deletion, backup.target.unconfirmed, backup.target.username_taken, + backup.upload.too_large; biomarkers — biomarkers.unit.locked; body-site — body-site.invalid; care — + care.feed.api_disabled, care.feed.cookie_only, care.feed.exists, care.feed.none, care.feed.notFound, + care.feed.rateLimited; coach — coach.budget.exceeded, coach.conversation.invalidTitle, + coach.conversation.notFound, coach.fenced.attachmentConflict, coach.fenced.attachmentLimit, + coach.fenced.attachmentNotFound, coach.fenced.attachmentNotIndexed, coach.fenced.attachmentRequired, + coach.fenced.attachmentUnavailable, coach.fenced.invalid, coach.request.invalid; coach-prefs — + coach-prefs.body.invalid_json, coach-prefs.body.invalid_shape; consent — consent.ai.confirmRequired, + consent.ai.required; customMetric — customMetric.name_taken; cycle — cycle.bulk.invalid, + cycle.bulk.too_large, cycle.calendar.invalid, cycle.calendar.range, cycle.cycles.invalid, + cycle.day-log.conflict, cycle.day-log.deleted_in_healthlog, cycle.day-log.invalid, cycle.disabled, cycle.feed.api_disabled, cycle.feed.cookie_only, cycle.feed.exists, cycle.feed.fertile_goal, cycle.feed.none, cycle.feed.notFound, cycle.feed.rateLimited, cycle.period.invalid, cycle.symptom.custom.invalid, cycle.symptom.custom.limit; cycle-prefs — cycle-prefs.body.invalid_json, - cycle-prefs.invalid; disable-coach — disable-coach.body.invalid_json; data_wipe — data_wipe.copy_failed; - dawarich — dawarich.credentials_rejected, dawarich.home_place_unknown, dawarich.invalid, - dawarich.not_connected, dawarich.rate_limited, dawarich.unreachable; day — day.invalid; demo — - demo.readOnly; documents — documents.chat.conversationNotFound, documents.chat.invalid, - documents.inbound.alreadyConfirmed, documents.inbound.alreadyPartlyConfirmed, - documents.inbound.budgetExceeded, documents.inbound.decryptFailed, documents.inbound.encounterNotFound, - documents.inbound.episodeNotFound, documents.inbound.extractFailed, documents.inbound.factNotFound, - documents.inbound.factNotPending, documents.inbound.factTypeMismatch, documents.inbound.fileTooLarge, - documents.inbound.fileType, documents.inbound.invalidMetadata, documents.inbound.invalidQuery, - documents.inbound.invalidUpdate, documents.inbound.localOcrDisabled, documents.inbound.notDeleted, - documents.inbound.notFound, documents.inbound.notIndexed, documents.inbound.outputLimit, - documents.inbound.pdfRendererUnavailable, documents.inbound.providerUnsupported, - documents.inbound.quotaExceeded, documents.inbound.rateLimited, documents.inbound.restoreDuplicate, - documents.inbound.restoreGone, documents.inbound.sourceAliasLimit, documents.inbound.uploadBusy, - documents.inbound.uploadTimeout, documents.inbound.vaccinationNotFound, documents.sources.authRefused, - documents.sources.badResponse, documents.sources.browserOnly, documents.sources.invalidAddress, - documents.sources.linkTargetNotFound, documents.sources.notConnected, documents.sources.notFound, - documents.sources.organizationRequired, documents.sources.originNotAllowed, + cycle-prefs.invalid, cycle-prefs.pregnancy.delivery_in_future, cycle-prefs.pregnancy.delivery_required, + cycle-prefs.pregnancy.due_before_start, cycle-prefs.pregnancy.start_in_future; disable-coach — + disable-coach.body.invalid_json; data_wipe — data_wipe.copy_failed; dawarich — + dawarich.credentials_rejected, dawarich.home_place_unknown, dawarich.invalid, dawarich.not_connected, + dawarich.rate_limited, dawarich.unreachable; day — day.invalid; demo — demo.readOnly; documents — + documents.chat.conversationNotFound, documents.chat.invalid, documents.inbound.alreadyConfirmed, + documents.inbound.alreadyPartlyConfirmed, documents.inbound.budgetExceeded, + documents.inbound.decryptFailed, documents.inbound.encounterNotFound, documents.inbound.episodeNotFound, + documents.inbound.extractFailed, documents.inbound.factNotFound, documents.inbound.factNotPending, + documents.inbound.factTypeMismatch, documents.inbound.fileTooLarge, documents.inbound.fileType, + documents.inbound.invalidMetadata, documents.inbound.invalidQuery, documents.inbound.invalidUpdate, + documents.inbound.localOcrDisabled, documents.inbound.notDeleted, documents.inbound.notFound, + documents.inbound.notIndexed, documents.inbound.outputLimit, documents.inbound.pdfRendererUnavailable, + documents.inbound.providerUnsupported, documents.inbound.quotaExceeded, documents.inbound.rateLimited, + documents.inbound.restoreDuplicate, documents.inbound.restoreGone, documents.inbound.sourceAliasLimit, + documents.inbound.uploadBusy, documents.inbound.uploadTimeout, documents.inbound.vaccinationNotFound, + documents.sources.authRefused, documents.sources.badResponse, documents.sources.browserOnly, + documents.sources.invalidAddress, documents.sources.linkTargetNotFound, documents.sources.notConnected, + documents.sources.notFound, documents.sources.organizationRequired, documents.sources.originNotAllowed, documents.sources.permissionMissing, documents.sources.rateLimited, documents.sources.redirected, documents.sources.tokenRequired, documents.sources.unavailable, documents.sources.unreachable, documents.sources.versionTooOld; encounter — encounter.invalid, encounter.link.invalid, - encounter.practitioner-not-found, encounter.reminder-conflict, encounter.reminder-not-found; encryption - — encryption.key_mismatch; environment — environment.backfill_pending, - environment.backfill_rate_limited, environment.invalid, environment.no_home, - environment.range_too_large, environment.travel.not_found, environment.travel_suggestion.not_found; - export — export.selection.empty, export.selection.unknown_leaf; familyHistory — familyHistory.invalid; - feedback — feedback.body.invalid; garmin — garmin.key_refused, garmin.rate_limited, garmin.unreachable; - glp1 — glp1.doseChange.deleted; health_score_config — health_score_config.invalid, - health_score_config.too_narrow; http — http.bad_gateway, http.bad_request, http.client_error, - http.conflict, http.forbidden, http.gateway_timeout, http.gone, http.internal, http.invalid, - http.method_not_allowed, http.not_found, http.payload_too_large, http.rate_limited, http.server_error, - http.unauthenticated, http.unavailable, http.unsupported_media_type; illness — illness.day-log.invalid, - illness.disabled, illness.episode.chronic-no-resolve, illness.episode.invalid, + encounter.practitioner-not-found, encounter.reminder-conflict, encounter.reminder-not-found; + emergency-card — emergency-card.api_disabled, emergency-card.cookie_only, emergency-card.exists, + emergency-card.none, emergency-card.rateLimited, emergency-card.wallet.token; encryption — + encryption.key_mismatch; environment — environment.backfill_pending, environment.backfill_rate_limited, + environment.invalid, environment.no_home, environment.range_too_large, environment.travel.not_found, + environment.travel_suggestion.not_found; export — export.selection.empty, export.selection.unknown_leaf; + familyHistory — familyHistory.invalid; feedback — feedback.body.invalid; garmin — garmin.key_refused, + garmin.rate_limited, garmin.unreachable; glp1 — glp1.doseChange.deleted; health_score_config — + health_score_config.invalid, health_score_config.too_narrow; http — http.bad_gateway, http.bad_request, + http.client_error, http.conflict, http.forbidden, http.gateway_timeout, http.gone, http.internal, + http.invalid, http.method_not_allowed, http.not_found, http.payload_too_large, http.rate_limited, + http.server_error, http.unauthenticated, http.unavailable, http.unsupported_media_type; illness — + illness.day-log.invalid, illness.disabled, illness.episode.chronic-no-resolve, illness.episode.invalid, illness.episode.invalid-window, illness.episode.parent-not-found, illness.insights.invalid; import — import.apple_health.busy, import.csv.content_type, import.csv.empty, import.csv.too_large, - import.rate_limited, import.write_failed; ingest — ingest.rate_limited; insights — + import.file.too_large, import.health_connect.remote.https_required, + import.health_connect.remote.invalid_url, import.health_connect.remote.not_configured, + import.health_connect.remote.origin_config_invalid, import.health_connect.remote.password_required, + import.health_connect.remote.private_origin_not_approved, import.rate_limited, import.write_failed; + ingest — ingest.idempotencyKey.reused, ingest.medication.notFound, ingest.rate_limited; insights — insights.generate.budgetExceeded, insights.generate.outboundScreened, insights.generate.profileScopeChanged, insights.generate.scopeChanged; labs — labs.biomarker.alias.taken, labs.biomarker.create.invalid, labs.biomarker.duplicate, @@ -42895,38 +45215,41 @@ components: maintenance.pulseDayMean.busy, maintenance.pulseDayMean.dryRunRequired; measurement — measurement.batch.invalid, measurement.batch.source_not_permitted, measurement.batch.too_large, measurement.bulk-delete.invalid, measurement.create.invalid, measurement.create.source_not_permitted, - measurement.delete.too_large, measurement.duplicate_timestamp, measurement.restore.invalid, - measurement.update.glucose_context_not_glucose, measurement.update.server_owned_source; medication — - medication.intake.import.invalid_format, medication.intake.notTracked, medication.link.invalid; - medications — medications.category.invalid, medications.category.limitReached, - medications.category.unknown, medications.course.currentOpen, medications.course.invalid, - medications.course.invalidRange, medications.course.notFound, medications.course.notRunning, - medications.course.oneShot, medications.course.overlap, medications.course.windowRequired, - medications.ingredients.extract.budgetExceeded, medications.ingredients.extract.failed, - medications.ingredients.extract.fileTooLarge, medications.ingredients.extract.fileType, - medications.ingredients.extract.rateLimited, medications.ingredients.invalid, - medications.ingredients.unitMismatch, medications.intake.bulk.apple_health_not_mirrored, - medications.intake.bulk.invalid, medications.intake.bulk.too_large, - medications.intake.force_slot.invalid, medications.intake.force_slot.occupied, - medications.intake.injection_site.disallowed, medications.intake.taken_at.before_start, - medications.mirror.limit_exceeded, medications.notFound; mentalHealth — mentalHealth.rateLimited; module - — module.disabled; modules — modules.body.invalid_json, modules.invalid; mood — - mood.bulk-delete.invalid, mood.bulk.invalid, mood.bulk.too_large, mood.create.external_id_not_delegable, - mood.create.invalid, mood.duplicate_timestamp, mood.linkedContext.invalid, mood.list.invalid, - mood.not_found, mood.ratedFactor.out_of_range, mood.restore.invalid, mood.update.invalid; - notification-prefs — notification-prefs.body.invalid_json; notification — - notification.action.already_used, notification.action.expired, notification.action.invalid, - notification.action.module_disabled; nutrient — nutrient.batch.invalid, nutrient.batch.too_large, - nutrient.daily.invalid, nutrient.read.invalid, nutrient.water.invalid, nutrient.water.invalid_day; - onboarding — onboarding.answers.invalid, onboarding.answers.rateLimited, onboarding.complete.invalid, - onboarding.complete.recordNotFound, onboarding.complete.recordTargetMismatch, - onboarding.disclaimer.invalid, onboarding.restart.invalid, onboarding.restart.rateLimited, - onboarding.tour.invalid; passkey — passkey.challenge.expired, passkey.response.invalid, passkey.unknown, - passkey.verification.failed; personal_records — personal_records.invalid_query; practitioner — - practitioner.invalid; profile — profile.update.emailInUse, profile.update.emailRateLimited, - profile.update.emailSecondFactorRequired, profile.update.invalidBody, profile.update.nothingSaved; - profile_claim — profile_claim.invalid, profile_claim.oidc_only_unsupported, - profile_claim.sso_unavailable, profile_claim.taken; record_write — record_write.rate_limited; recovery — + measurement.delete.too_large, measurement.deleted_in_healthlog, measurement.duplicate_timestamp, + measurement.restore.invalid, measurement.update.glucose_context_not_glucose, + measurement.update.server_owned_source; medication — medication.intake.import.invalid_format, + medication.intake.notTracked, medication.link.invalid; medications — medications.category.invalid, + medications.category.limitReached, medications.category.unknown, medications.course.currentOpen, + medications.course.invalid, medications.course.invalidRange, medications.course.notFound, + medications.course.notRunning, medications.course.oneShot, medications.course.overlap, + medications.course.windowRequired, medications.ingredients.extract.budgetExceeded, + medications.ingredients.extract.failed, medications.ingredients.extract.fileTooLarge, + medications.ingredients.extract.fileType, medications.ingredients.extract.rateLimited, + medications.ingredients.invalid, medications.ingredients.unitMismatch, + medications.intake.bulk.apple_health_not_mirrored, medications.intake.bulk.invalid, + medications.intake.bulk.too_large, medications.intake.changedSinceSeen, + medications.intake.invalidPrecondition, medications.intake.force_slot.invalid, + medications.intake.force_slot.occupied, medications.intake.injection_site.disallowed, + medications.intake.taken_at.before_start, medications.mirror.limit_exceeded, medications.notFound; + mentalHealth — mentalHealth.rateLimited; module — module.disabled; modules — modules.body.invalid_json, + modules.invalid; mood — mood.bulk-delete.invalid, mood.bulk.invalid, mood.bulk.too_large, + mood.create.external_id_not_delegable, mood.create.invalid, mood.deleted_in_healthlog, + mood.duplicate_timestamp, mood.linkedContext.invalid, mood.list.invalid, mood.not_found, + mood.ratedFactor.out_of_range, mood.restore.invalid, mood.update.invalid; notification-prefs — + notification-prefs.body.invalid_json; notification — notification.action.already_used, + notification.action.expired, notification.action.invalid, notification.action.module_disabled; nutrient + — nutrient.batch.invalid, nutrient.batch.too_large, nutrient.daily.invalid, + nutrient.energyBalance.invalid, nutrient.read.invalid, nutrient.water.invalid, + nutrient.water.invalid_day; onboarding — onboarding.answers.invalid, onboarding.answers.rateLimited, + onboarding.complete.invalid, onboarding.complete.recordNotFound, + onboarding.complete.recordTargetMismatch, onboarding.disclaimer.invalid, onboarding.restart.invalid, + onboarding.restart.rateLimited, onboarding.tour.invalid; passkey — passkey.challenge.expired, + passkey.response.invalid, passkey.unknown, passkey.verification.failed; personal_records — + personal_records.invalid_query; practitioner — practitioner.invalid; profile — + profile.update.emailInUse, profile.update.emailRateLimited, profile.update.emailSecondFactorRequired, + profile.update.invalidBody, profile.update.nothingSaved; profile_claim — profile_claim.invalid, + profile_claim.oidc_only_unsupported, profile_claim.sso_unavailable, profile_claim.taken; record_settings + — record_settings.ai_source.chain_missing; record_write — record_write.rate_limited; recovery — recovery.kit.stale; report-selection — report-selection.body.invalid_json, report-selection.body.invalid_shape, report-selection.leaves.unknown; request — request.cross_site; route — route.retired; search — search.invalid; security_activity — security_activity.invalid; seizures @@ -43015,6 +45338,33 @@ components: type: array items: type: string + minimum: + description: "On `too_small`: the lower bound the schema declares (a number's value, a string's or a list's length; see + `origin`). Since v1.49.0 also on `too_big` when the field declares a lower bound too (with + `minimumInclusive`), on every body validated through the shared body parser. From the schema, never the + request." + type: number + maximum: + description: "On `too_big`: the upper bound the schema declares, for example a nutrient target's plausibility cap. Since + v1.49.0 also on `too_small` when the field declares an upper bound too (with `maximumInclusive`). From the + schema, never the request." + type: number + inclusive: + description: "With `minimum` / `maximum`: whether the bound that was broken is itself allowed (`false` for a value that + must be above 0)." + type: boolean + minimumInclusive: + description: "Since v1.49.0. Present only when the issue carries both `minimum` and `maximum`: whether `minimum` itself + is allowed." + type: boolean + maximumInclusive: + description: "Since v1.49.0. Present only when the issue carries both `minimum` and `maximum`: whether `maximum` itself + is allowed." + type: boolean + origin: + description: "With `minimum` / `maximum`: what the bound measures, e.g. `number`, `string`, `array`. Treat an unfamiliar + value as opaque." + type: string required: - path - code @@ -43455,12 +45805,16 @@ components: externalId: type: string reason: - description: "On a `skipped` entry. `unstable_external_id` is a verdict on the entry and terminal: resending it - unchanged is skipped again. `constraint` means the write met a database constraint (a key another - write claimed at the same moment, or a reference that no longer exists). `upsert_failed` is a - write failure on the server's side: nothing was stored, the entry should be sent again, and the - response carrying it is `Cache-Control: no-store`, so a retry under the same `Idempotency-Key` - writes again rather than replaying the failure." + description: "On a `skipped` entry. `deleted_in_healthlog` (since v1.49.0): an `APPLE_HEALTH` re-post of a + `cycle-hk:` externalId whose day the person deleted in HealthLog; nothing is written, the day + stays deleted, and resending gives the same answer. A day the phone reported deleted through + `DELETE /api/cycle/day-logs/by-external-ids` is written again from empty fields. + `unstable_external_id` is a verdict on the entry and terminal: resending it unchanged is skipped + again. `constraint` means the write met a database constraint (a key another write claimed at the + same moment, or a reference that no longer exists). `upsert_failed` is a write failure on the + server's side: nothing was stored, the entry should be sent again, and the response carrying it is + `Cache-Control: no-store`, so a retry under the same `Idempotency-Key` writes again rather than + replaying the failure." type: string required: - index @@ -43597,6 +45951,8 @@ components: - predictionEnabled - cyclesObserved additionalProperties: false + pregnancy: + $ref: "#/components/schemas/CyclePregnancyDTO" prediction: anyOf: - $ref: "#/components/schemas/CyclePredictionDTO" @@ -43750,6 +46106,7 @@ components: additionalProperties: false required: - profile + - pregnancy - prediction - verdict - stillLearning @@ -43779,6 +46136,90 @@ components: - PERIMENOPAUSE - OFF description: Drives cycle copy + fertile-window gating. + CyclePregnancyDTO: + type: object + properties: + storedState: + anyOf: + - type: string + enum: + - PREGNANT + - POSTPARTUM + - type: "null" + state: + anyOf: + - type: string + enum: + - PREGNANT + - POSTPARTUM + - type: "null" + startDate: + anyOf: + - type: string + pattern: ^\d{4}-\d{2}-\d{2}$ + - type: "null" + dueDate: + anyOf: + - type: string + pattern: ^\d{4}-\d{2}-\d{2}$ + - type: "null" + deliveryDate: + anyOf: + - type: string + pattern: ^\d{4}-\d{2}-\d{2}$ + - type: "null" + postpartumWeeks: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + gestationalWeeks: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + gestationalDays: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + postpartumWeek: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + postpartumEndsOn: + anyOf: + - type: string + pattern: ^\d{4}-\d{2}-\d{2}$ + - type: "null" + predictionsPaused: + type: boolean + lapsed: + type: boolean + required: + - storedState + - state + - startDate + - dueDate + - deliveryDate + - postpartumWeeks + - gestationalWeeks + - gestationalDays + - postpartumWeek + - postpartumEndsOn + - predictionsPaused + - lapsed + additionalProperties: false + description: "The pregnancy / postpartum state, resolved on the owner's calendar day. `storedState` is what the owner + set; `state` is what holds today (POSTPARTUM past `postpartumEndsOn` reads null). + `gestationalWeeks`+`gestationalDays` count completed weeks from `startDate`, or from `dueDate` less 280 days. + While `predictionsPaused` is true the period and fertility forecast is empty on every surface and no prediction + push is sent. The state is bounded by its dates: PREGNANT holds from `startDate` (or `dueDate` less 280 days) + and no longer than four weeks past the due date; past that `state` is null and `lapsed` is true, so a client can + ask whether the entry is still current. Render these values; do not recompute them." CyclePredictionDTO: type: object properties: @@ -44404,6 +46845,8 @@ components: type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + pregnancy: + $ref: "#/components/schemas/CyclePregnancyDTO" required: - goal - cycleTrackingEnabled @@ -44416,6 +46859,7 @@ components: - typicalPeriodLength - lutealPhaseLength - updatedAt + - pregnancy additionalProperties: false description: The full per-user cycle settings row. CyclePrefsGetEnvelope: @@ -44644,11 +47088,19 @@ components: - data - error additionalProperties: false - MeasurementCategoriesEnvelope: + CareFeedStatus: type: object properties: data: - $ref: "#/components/schemas/MeasurementCategoriesResponse" + type: object + properties: + feed: + anyOf: + - $ref: "#/components/schemas/CareFeedSummary" + - type: "null" + required: + - feed + additionalProperties: false error: type: "null" meta: @@ -44661,54 +47113,78 @@ components: - data - error additionalProperties: false - MeasurementCategoriesResponse: + CareFeedSummary: type: object properties: - version: - type: number - const: 1 - description: Additive schema marker; assignments never reshuffle. - categories: - type: array - items: - type: object - properties: - id: - type: string - description: Category id (e.g. `vitals`). - labelKey: - type: string - description: i18n key for the category label (`categories.`). - order: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - description: Stable display order. - required: - - id - - labelKey - - order - additionalProperties: false - description: The ordered category list for the picker. - assignments: - type: object - propertyNames: - type: string - additionalProperties: - type: string - description: MeasurementType → category id map. + tokenPrefix: + type: string + description: The first 8 characters of the link's token, to tell links apart. + createdAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + lastFetchedAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + fetchCount: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + lastFetcher: + anyOf: + - type: string + enum: + - GOOGLE + - APPLE + - MICROSOFT + - OTHER + - type: "null" + description: Which calendar app fetched last, as a family; never the raw User-Agent. + includeVisits: + type: boolean + includeCheckups: + type: boolean + includeVaccinations: + type: boolean + titleMode: + type: string + enum: + - DISCREET + - DESCRIPTIVE required: - - version - - categories - - assignments + - tokenPrefix + - createdAt + - lastFetchedAt + - fetchCount + - lastFetcher + - includeVisits + - includeCheckups + - includeVaccinations + - titleMode additionalProperties: false - description: "The measurement categorisation overlay: the ordered category list plus the MeasurementType → category - assignments. Derived server-side from the canonical map; cached `public, max-age=600`." - CapabilitiesEnvelope: + description: "The live care calendar subscription, without its secret: never the token hash and never the URL." + CareFeedMinted: type: object properties: data: - $ref: "#/components/schemas/CapabilitiesResponse" + type: object + properties: + url: + type: string + description: The feed URL. Returned exactly once; it cannot be read back later. + webcalUrl: + type: string + description: The same URL with the `webcal:` scheme, which opens a calendar app's subscribe dialog. + feed: + $ref: "#/components/schemas/CareFeedSummary" + required: + - url + - webcalUrl + - feed + additionalProperties: false error: type: "null" meta: @@ -44721,233 +47197,274 @@ components: - data - error additionalProperties: false - CapabilitiesResponse: + CareFeedStatusAfterPatch: type: object properties: - apiContractVersion: - type: string - description: Running build version — mirrors GET /api/version `version`. - derivedMetricIds: - type: array - items: - type: string - description: Closed derived-metric id set (GET /api/insights/derived). - vitalsBaselineTypes: - type: array - items: - type: string - description: MeasurementTypes the typical-range baseline engine supports. - layoutTileIds: - type: array - items: - type: string - description: Canonical insights layout tile-id set (English ids). - metricStatusIds: - type: array - items: - type: string - description: Closed metric-status / assessment id set. - ingest: + data: type: object properties: - quantityTypes: - type: array - items: - type: object - properties: - type: - type: string - description: HealthLog MeasurementType. - hk: - type: string - description: HealthKit identifier. - unit: - type: string - description: Canonical DB unit. - required: - - type - - hk - - unit - additionalProperties: false - description: Accepted HealthKit quantity-sample mappings. - eventTypes: - type: array - items: - type: string - description: MeasurementTypes for device-flagged EVENT-class HealthKit samples. - computedScores: - type: array - items: - type: string - description: Server-owned nightly composite score types. - writeAllowlist: - type: array - items: - type: string - description: MeasurementSources a client may attribute on a write (others are server-owned). + feed: + anyOf: + - $ref: "#/components/schemas/CareFeedSummary" + - type: "null" required: - - quantityTypes - - eventTypes - - computedScores - - writeAllowlist + - feed additionalProperties: false - description: Ingest vocabularies the batch / single-write paths accept. - fhir: + error: + type: "null" + meta: type: object properties: - atcSystem: - type: string - description: WHO ATC CodeSystem URI. - snomedRoute: - type: string - description: SNOMED CT CodeSystem URI. - germanAtcDefaultLocales: - type: array - items: - type: string - description: App locales that default the additive BfArM ATC coding on. - restBaseUrl: + requestId: type: string - description: Base path of the read-only FHIR R4 REST face. - scopeMintable: + additionalProperties: false + required: + - data + - error + additionalProperties: false + CareFeedRevoked: + type: object + properties: + data: + type: object + properties: + revoked: type: boolean - description: "Whether a narrow Bearer token for the FHIR face can be obtained. Always false: no mint path grants the - scope, so the face is reachable by the owner's cookie session or a wildcard device token only." - resourceTypes: - type: array - items: - type: string - description: FHIR resource types the REST face serves (read + search). - operations: - type: array - items: - type: string - description: Whole-record operations exposed (e.g. $everything). - searchParams: - type: array - items: - type: string - description: Search parameters honoured uniformly across the search routes. + const: true required: - - atcSystem - - snomedRoute - - germanAtcDefaultLocales - - restBaseUrl - - scopeMintable - - resourceTypes - - operations - - searchParams + - revoked additionalProperties: false - description: FHIR coding constants + the read-only REST face descriptor (v1.11). - share: + error: + type: "null" + meta: type: object properties: - supported: - type: boolean - description: Whether clinician share links are served. - maxDays: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - description: Maximum lifetime of a share link, in days. No never-expiring share. - reportDownload: - type: array - items: - type: string - description: Machine formats a share link serves as a download under its token, behind the same unlock as the page. - selectionVersion: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - description: Version of the leaf-selection grammar this build speaks. - groups: - type: array - items: - type: object - properties: - id: - type: string - description: Group id. - leaves: - type: array - items: - type: string - description: Member leaf ids, in the order the panel renders them. - sensitive: - description: "Present and true only on the fenced tier: no single control may switch on more than one of its leaves." - type: boolean - required: - - id - - leaves - additionalProperties: false - description: Selection groups, in presentation order, each carrying its member leaf ids. - leaves: - type: array - items: - type: string - description: Every leaf id a report selection may carry. Membership is inclusion; absence is exclusion. + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + EmergencyCardRead: + type: object + properties: + data: + type: object + properties: + card: + $ref: "#/components/schemas/EmergencyCardView" required: - - supported - - maxDays - - reportDownload - - selectionVersion - - groups - - leaves + - card additionalProperties: false - description: Clinician share-link surface descriptor. - retiredRoutes: + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + EmergencyCardView: + type: object + properties: + fields: type: array items: - type: object - properties: - path: - type: string - description: The path, as it was published. - removedIn: - type: string - description: Release the removal shipped in, without the `v`. - replacedBy: - description: Where the capability went, or null when it went nowhere. - type: - - string - - "null" - reason: + type: string + enum: + - BLOOD_TYPE + - ALLERGIES + - CONDITIONS + - MEDICATIONS + - PREGNANCY + - IMPLANTS + - CONTACTS + - ADVANCE_DIRECTIVE + - ORGAN_DONOR + - NOTE + - DATE_OF_BIRTH + description: The items the card was read for, in reading order. + bloodType: + anyOf: + - type: string + enum: + - A_POS + - A_NEG + - B_POS + - B_NEG + - AB_POS + - AB_NEG + - O_POS + - O_NEG + - UNKNOWN + - type: "null" + allergies: + anyOf: + - type: array + items: + type: object + properties: + substance: + type: string + severity: + anyOf: + - type: string + enum: + - MILD + - MODERATE + - SEVERE + - type: "null" + reaction: + type: + - string + - "null" + required: + - substance + - severity + - reaction + additionalProperties: false + - type: "null" + conditions: + anyOf: + - type: array + items: type: string - description: Why it was removed, in one sentence, in English. - methods: - type: array - items: + - type: "null" + medications: + anyOf: + - type: array + items: + type: object + properties: + name: + type: string + dose: + type: + - string + - "null" + required: + - name + - dose + additionalProperties: false + - type: "null" + pregnancy: + anyOf: + - type: object + properties: + state: type: string - description: The verbs the route exported before it was removed. Every verb answers 410 regardless — the path was - retired, not a selection of methods on it. - required: - - path - - removedIn - - replacedBy - - reason - - methods - additionalProperties: false - description: Paths this server used to serve and no longer does. Each answers 410 Gone with `meta.errorCode` = - `route.retired`. Read on launch so a client can drop the surface that depended on one before it makes the - call, rather than learning from the failure. + enum: + - PREGNANT + - POSTPARTUM + gestationalWeeks: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + gestationalDays: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + dueDate: + anyOf: + - type: string + pattern: ^\d{4}-\d{2}-\d{2}$ + - type: "null" + deliveryDate: + anyOf: + - type: string + pattern: ^\d{4}-\d{2}-\d{2}$ + - type: "null" + postpartumWeek: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + required: + - state + - gestationalWeeks + - gestationalDays + - dueDate + - deliveryDate + - postpartumWeek + additionalProperties: false + - type: "null" + implants: + type: + - string + - "null" + contacts: + type: + - string + - "null" + advanceDirective: + anyOf: + - type: string + enum: + - EXISTS + - NONE + - UNKNOWN + - type: "null" + organDonor: + anyOf: + - type: string + enum: + - YES + - NO + - UNKNOWN + - type: "null" + note: + type: + - string + - "null" + dateOfBirth: + anyOf: + - type: string + pattern: ^\d{4}-\d{2}-\d{2}$ + - type: "null" + asOf: + type: string + pattern: ^\d{4}-\d{2}-\d{2}$ + description: The owner's calendar day the card was read on. required: - - apiContractVersion - - derivedMetricIds - - vitalsBaselineTypes - - layoutTileIds - - metricStatusIds - - ingest - - fhir - - share - - retiredRoutes + - fields + - bloodType + - allergies + - conditions + - medications + - pregnancy + - implants + - contacts + - advanceDirective + - organDonor + - note + - dateOfBirth + - asOf additionalProperties: false - description: Live id vocabularies + contract version. Every list is derived server-side from the canonical registry it - documents, so it cannot drift from the values the routes actually accept/emit. - VersionEnvelope: + description: The emergency card. An item is null when the card was not read for it (see `fields`) or it holds nothing. + Render these values; do not recompute them. + EmergencyCardLinkStatus: type: object properties: data: - $ref: "#/components/schemas/VersionResponse" + type: object + properties: + link: + anyOf: + - $ref: "#/components/schemas/EmergencyCardLinkSummary" + - type: "null" + required: + - link + additionalProperties: false error: type: "null" meta: @@ -44960,62 +47477,74 @@ components: - data - error additionalProperties: false - VersionResponse: + EmergencyCardLinkSummary: type: object properties: - version: + tokenPrefix: type: string - description: The running build's version. From the image build arg when present, falling back to package.json for a - local dev run. - buildSha: - description: Short Git SHA baked at image build time. Null for a local dev run, which is how a client tells a released - image from one. - type: - - string - - "null" - builtAt: + description: The first 8 characters of the link's token. + fields: + type: array + items: + type: string + enum: + - BLOOD_TYPE + - ALLERGIES + - CONDITIONS + - MEDICATIONS + - PREGNANCY + - IMPLANTS + - CONTACTS + - ADVANCE_DIRECTIVE + - ORGAN_DONOR + - NOTE + - DATE_OF_BIRTH + expiresAt: anyOf: - type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - type: "null" - description: ISO-8601 build timestamp. Null for a local dev run. - license: - type: string - repository: - type: string - format: uri - changelog: - type: string - format: uri - docs: + createdAt: type: string - format: uri - offlineGeoEnabled: + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + lastAccessAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + accessCount: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + expired: type: boolean - description: A GeoLite2-City database is present and in use. When false, login-IP geolocation falls back to the online - provider named below — every login IP then leaves the host. - geoProviderHost: - type: string - description: Host of the online geolocation provider the fallback would use, so an operator surface names the real one - instead of assuming the default. required: - - version - - buildSha - - builtAt - - license - - repository - - changelog - - docs - - offlineGeoEnabled - - geoProviderHost + - tokenPrefix + - fields + - expiresAt + - createdAt + - lastAccessAt + - accessCount + - expired additionalProperties: false - description: The running build's identity plus the offline-geolocation state. Public — no authentication, no account data. - AssistantFlagsEnvelope: + description: "The live emergency card link without its secret: never the token hash and never the URL." + EmergencyCardLinkMinted: type: object properties: data: - $ref: "#/components/schemas/AssistantFlagsResponse" + type: object + properties: + url: + type: string + link: + $ref: "#/components/schemas/EmergencyCardLinkSummary" + required: + - url + - link + additionalProperties: false error: type: "null" meta: @@ -45028,47 +47557,35 @@ components: - data - error additionalProperties: false - AssistantFlagsResponse: + EmergencyCardLinkRevoked: type: object properties: - assistant: + data: type: object properties: - enabled: - type: boolean - description: Master switch for every AI feature. - coach: - type: boolean - description: The Coach. - briefing: - type: boolean - description: The daily briefing and model-written period narratives. - insightStatus: - type: boolean - description: "Status notes: per-metric notes, workout notes and reaction lines." - documentAi: + revoked: type: boolean - description: "Reading documents: the document vault's AI reads, lab report scans and medication extraction." + const: true required: - - enabled - - coach - - briefing - - insightStatus - - documentAi + - revoked + additionalProperties: false + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string additionalProperties: false - description: "The operator's switches, master applied: when `enabled` is false every sub-switch is false in this - payload. A switch read that fails answers every switch false." required: - - assistant + - data + - error additionalProperties: false - description: "The operator's assistant switches, and nothing else. Deprecated: whether a capability is available also - depends on the record's modules, the provider, consent and who is asking, and `ai` on GET /api/auth/me is that - resolved answer." - UpdateCheckEnvelope: + NavCountsResponse: type: object properties: data: - $ref: "#/components/schemas/UpdateCheckResponse" + $ref: "#/components/schemas/NavCounts" error: type: "null" meta: @@ -45081,122 +47598,37 @@ components: - data - error additionalProperties: false - UpdateCheckResponse: + NavCounts: type: object properties: - status: - type: string - enum: - - up_to_date - - newer_available - - unknown - description: "`unknown` is a normal outcome, not an error — it means the release feed could not be reached or read." - current: - type: string - description: The version this instance is running. - latest_tag: - description: The newest published release tag. Absent when `unknown`. - type: string - html_url: - description: Release page to deep-link to. Only on `newer_available`. - anyOf: - - type: string - format: uri - - type: "null" - published_at: - description: When that release was published. Only on `newer_available`. - anyOf: - - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - - type: "null" - checked_at: - description: When the check ran. Absent when `unknown`. - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - reason: - description: "Only on `unknown`: `network_error`, or `github_status_` when the feed answered but not with a - success." - type: string + dosesDue: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: Today's scheduled doses of active, tracked medications whose resolved state is `due` or `overdue` (the dose + resolver's own answer, as the today list gives it), not counting a slot the person snoozed. + checkupsDue: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: "Check-up reminders due now: enabled, not snoozed, no booked visit, due today on a long cycle or past their + time on a short one, as the daily digest's rail counts them." required: - - status - - current + - dosesDue + - checkupsDue additionalProperties: false - description: Whether a newer release exists. The three states are carried in `status`; which of the optional fields are - present follows from it. - ShareLinkCreated: + ReportScheduleStatus: type: object properties: data: type: object properties: - id: - type: string - label: - type: string - rangeStart: - type: string - rangeEnd: - type: - - string - - "null" - protected: - type: boolean - documentCount: - type: number - documentOnly: - type: boolean - needsReselection: - type: boolean - expiresAt: - type: string - createdAt: - type: string - revokedAt: - type: - - string - - "null" - lastAccessAt: - type: - - string - - "null" - accessCount: - type: number - active: - type: boolean - token: - type: string - description: Raw `hls_` token — returned ONCE and unrecoverable thereafter. - passphrase: - type: string - description: Raw passphrase second factor — returned ONCE; stored only as an HMAC hash, unrecoverable. - shareUrl: - type: string - description: Absolute `/c/` URL (no passphrase). - qrUrl: - type: string - description: Absolute share URL with the passphrase in the URL FRAGMENT (`#k=`). Encode this as the QR - payload; the fragment is never sent to the server. + schedule: + anyOf: + - $ref: "#/components/schemas/ReportSchedule" + - type: "null" required: - - id - - label - - rangeStart - - rangeEnd - - protected - - documentCount - - documentOnly - - needsReselection - - expiresAt - - createdAt - - revokedAt - - lastAccessAt - - accessCount - - active - - token - - passphrase - - shareUrl - - qrUrl + - schedule additionalProperties: false error: type: "null" @@ -45210,69 +47642,76 @@ components: - data - error additionalProperties: false - ShareLinkList: + ReportSchedule: + type: object + properties: + cadence: + type: string + enum: + - MONTHLY + - QUARTERLY + - YEARLY + window: + type: string + enum: + - PERIOD + - LAST_90_DAYS + - LAST_365_DAYS + lastPeriod: + description: "The last period a run settled: `2026-10`, `2026-Q3` or `2025`. Null before the first run." + type: + - string + - "null" + lastOutcome: + anyOf: + - type: string + enum: + - stored + - alreadyFiled + - deletedByOwner + - quotaExceeded + - tooLarge + - noSelection + - failed + - type: "null" + description: "How the last run ended. `stored`: filed. `alreadyFiled`: the vault already held this period's report. + `deletedByOwner`: the owner deleted it, so it is not filed again. `quotaExceeded` / `tooLarge`: it did not + fit the vault; the next period tries again. `noSelection`: no saved report selection to render, retried once + there is one. `failed`: retried on the next run." + lastRunAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + duePeriod: + description: The closed period the next run files, on the record's clock; null when it is already settled. + type: + - string + - "null" + required: + - cadence + - window + - lastPeriod + - lastOutcome + - lastRunAt + - duePeriod + additionalProperties: false + description: "The scheduled doctor report. Each closed period is rendered with the owner's saved report selection and + filed once into the document vault as a `DOCTOR_REPORT` document with `sourceSystem: REPORT_SCHEDULE` and + `sourceId: :`. No notification is sent." + ReportScheduleStatusAfterPut: type: object properties: data: type: object properties: - shareLinks: - type: array - items: - type: object - properties: - id: - type: string - label: - type: string - rangeStart: - type: string - rangeEnd: - type: - - string - - "null" - protected: - type: boolean - documentCount: - type: number - documentOnly: - type: boolean - needsReselection: - type: boolean - expiresAt: - type: string - createdAt: - type: string - revokedAt: - type: - - string - - "null" - lastAccessAt: - type: - - string - - "null" - accessCount: - type: number - active: - type: boolean - required: - - id - - label - - rangeStart - - rangeEnd - - protected - - documentCount - - documentOnly - - needsReselection - - expiresAt - - createdAt - - revokedAt - - lastAccessAt - - accessCount - - active - additionalProperties: false + schedule: + anyOf: + - $ref: "#/components/schemas/ReportSchedule" + - type: "null" required: - - shareLinks + - schedule additionalProperties: false error: type: "null" @@ -45286,19 +47725,18 @@ components: - data - error additionalProperties: false - ShareLinkRevoked: + ReportScheduleStatusAfterDelete: type: object properties: data: type: object properties: - id: - type: string - revoked: - type: boolean + schedule: + anyOf: + - $ref: "#/components/schemas/ReportSchedule" + - type: "null" required: - - id - - revoked + - schedule additionalProperties: false error: type: "null" @@ -45312,18 +47750,11 @@ components: - data - error additionalProperties: false - ShareLinkUnlock: + MeasurementCategoriesEnvelope: type: object properties: data: - type: object - properties: - unlocked: - type: boolean - const: true - required: - - unlocked - additionalProperties: false + $ref: "#/components/schemas/MeasurementCategoriesResponse" error: type: "null" meta: @@ -45336,10 +47767,783 @@ components: - data - error additionalProperties: false - ExportJsonBody: + MeasurementCategoriesResponse: type: object properties: - data: + version: + type: number + const: 1 + description: Additive schema marker; assignments never reshuffle. + categories: + type: array + items: + type: object + properties: + id: + type: string + description: Category id (e.g. `vitals`). + labelKey: + type: string + description: i18n key for the category label (`categories.`). + order: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: Stable display order. + required: + - id + - labelKey + - order + additionalProperties: false + description: The ordered category list for the picker. + assignments: + type: object + propertyNames: + type: string + additionalProperties: + type: string + description: MeasurementType → category id map. + required: + - version + - categories + - assignments + additionalProperties: false + description: "The measurement categorisation overlay: the ordered category list plus the MeasurementType → category + assignments. Derived server-side from the canonical map; cached `public, max-age=600`." + CapabilitiesEnvelope: + type: object + properties: + data: + $ref: "#/components/schemas/CapabilitiesResponse" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + CapabilitiesResponse: + type: object + properties: + apiContractVersion: + type: string + description: Running build version — mirrors GET /api/version `version`. + derivedMetricIds: + type: array + items: + type: string + description: Closed derived-metric id set (GET /api/insights/derived). + vitalsBaselineTypes: + type: array + items: + type: string + description: MeasurementTypes the typical-range baseline engine supports. + layoutTileIds: + type: array + items: + type: string + description: Canonical insights layout tile-id set (English ids). + metricStatusIds: + type: array + items: + type: string + description: Closed metric-status / assessment id set. + ingest: + type: object + properties: + quantityTypes: + type: array + items: + type: object + properties: + type: + type: string + description: HealthLog MeasurementType. + hk: + type: string + description: HealthKit identifier. + unit: + type: string + description: Canonical DB unit. + required: + - type + - hk + - unit + additionalProperties: false + description: Accepted HealthKit quantity-sample mappings. + eventTypes: + type: array + items: + type: string + description: MeasurementTypes for device-flagged EVENT-class HealthKit samples. + computedScores: + type: array + items: + type: string + description: Server-owned nightly composite score types. + writeAllowlist: + type: array + items: + type: string + description: MeasurementSources a client may attribute on a write (others are server-owned). + required: + - quantityTypes + - eventTypes + - computedScores + - writeAllowlist + additionalProperties: false + description: Ingest vocabularies the batch / single-write paths accept. + fhir: + type: object + properties: + atcSystem: + type: string + description: WHO ATC CodeSystem URI. + snomedRoute: + type: string + description: SNOMED CT CodeSystem URI. + germanAtcDefaultLocales: + type: array + items: + type: string + description: App locales that default the additive BfArM ATC coding on. + restBaseUrl: + type: string + description: Base path of the read-only FHIR R4 REST face. + scopeMintable: + type: boolean + description: "Whether a narrow Bearer token for the FHIR face can be obtained. Always false: no mint path grants the + scope, so the face is reachable by the owner's cookie session or a wildcard device token only." + resourceTypes: + type: array + items: + type: string + description: FHIR resource types the REST face serves (read + search). + operations: + type: array + items: + type: string + description: Whole-record operations exposed (e.g. $everything). + searchParams: + type: array + items: + type: string + description: Search parameters honoured uniformly across the search routes. + required: + - atcSystem + - snomedRoute + - germanAtcDefaultLocales + - restBaseUrl + - scopeMintable + - resourceTypes + - operations + - searchParams + additionalProperties: false + description: FHIR coding constants + the read-only REST face descriptor (v1.11). + share: + type: object + properties: + supported: + type: boolean + description: Whether clinician share links are served. + maxDays: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: Maximum lifetime of a share link, in days. No never-expiring share. + reportDownload: + type: array + items: + type: string + description: Machine formats a share link serves as a download under its token, behind the same unlock as the page. + selectionVersion: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: Version of the leaf-selection grammar this build speaks. + groups: + type: array + items: + type: object + properties: + id: + type: string + description: Group id. + leaves: + type: array + items: + type: string + description: Member leaf ids, in the order the panel renders them. + sensitive: + description: "Present and true only on the fenced tier: no single control may switch on more than one of its leaves." + type: boolean + required: + - id + - leaves + additionalProperties: false + description: Selection groups, in presentation order, each carrying its member leaf ids. + leaves: + type: array + items: + type: string + description: Every leaf id a report selection may carry. Membership is inclusion; absence is exclusion. + required: + - supported + - maxDays + - reportDownload + - selectionVersion + - groups + - leaves + additionalProperties: false + description: Clinician share-link surface descriptor. + retiredRoutes: + type: array + items: + type: object + properties: + path: + type: string + description: The path, as it was published. + removedIn: + type: string + description: Release the removal shipped in, without the `v`. + replacedBy: + description: Where the capability went, or null when it went nowhere. + type: + - string + - "null" + reason: + type: string + description: Why it was removed, in one sentence, in English. + methods: + type: array + items: + type: string + description: The verbs the route exported before it was removed. Every verb answers 410 regardless — the path was + retired, not a selection of methods on it. + required: + - path + - removedIn + - replacedBy + - reason + - methods + additionalProperties: false + description: Paths this server used to serve and no longer does. Each answers 410 Gone with `meta.errorCode` = + `route.retired`. Read on launch so a client can drop the surface that depended on one before it makes the + call, rather than learning from the failure. + required: + - apiContractVersion + - derivedMetricIds + - vitalsBaselineTypes + - layoutTileIds + - metricStatusIds + - ingest + - fhir + - share + - retiredRoutes + additionalProperties: false + description: Live id vocabularies + contract version. Every list is derived server-side from the canonical registry it + documents, so it cannot drift from the values the routes actually accept/emit. + VersionEnvelope: + type: object + properties: + data: + $ref: "#/components/schemas/VersionResponse" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + VersionResponse: + type: object + properties: + version: + type: string + description: The running build's version. From the image build arg when present, falling back to package.json for a + local dev run. + buildSha: + description: Short Git SHA baked at image build time. Null for a local dev run, which is how a client tells a released + image from one. + type: + - string + - "null" + builtAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: ISO-8601 build timestamp. Null for a local dev run. + license: + type: string + repository: + type: string + format: uri + changelog: + type: string + format: uri + docs: + type: string + format: uri + offlineGeoEnabled: + type: boolean + description: A GeoLite2-City database is present and in use. When false, login-IP geolocation falls back to the online + provider named below — every login IP then leaves the host. + geoProviderHost: + type: string + description: Host of the online geolocation provider the fallback would use, so an operator surface names the real one + instead of assuming the default. + features: + type: array + items: + type: string + enum: + - medication.intake-recorded-push + - medication.already-taken + - medication.bulk-already-taken + - medication.undo-precondition + - sync.medications-last-updated + - medication.live-activity-tokens + - push.relay + - medication.dose-state + - measurement.reading-timezone + - apple-health.types-2026-11 + - medication.snooze-setting + - apple-health.effort-scores + - medication.intake-sync-version + - medication.current-dose-open-slot + - cycle.pregnancy-state + - profile.emergency-card + - push.data-changed + - push.healthkit-catch-up + - push.security-alert-relay + - push.live-activity-relay + - push.live-activity-started + - day.dose-offset + - push.device-diagnostics + - medication.resolved-slots + - medication.intake-reopened + - push.relay-operator-decision + - measurement.stats-computed-at + description: "The server behaviours a client may rely on, by key; check for a key rather than compare versions. A key is + listed only once its behaviour has fully shipped, and is never renamed. `medication.intake-recorded-push`: A + take or skip recorded elsewhere sends MEDICATION_INTAKE_RECORDED to the owner's other iOS devices; since + v1.49.0 so does its undo (outcome reopened), and every one carries asOf. `medication.already-taken`: POST + /api/medications/{id}/intake and POST /api/ingest/medication carry data.alreadyTaken; a take of a taken slot + writes nothing. `medication.bulk-already-taken`: POST /api/medications/intake/bulk answers status + alreadyTaken per entry with intake, takenAt and takenVia. `medication.undo-precondition`: DELETE + /api/medications/{id}/intake/{eventId} honours expectedSyncVersion and expectedIdempotencyKey, 409 + medications.intake.changedSinceSeen. `sync.medications-last-updated`: GET /api/sync/state carries + medications.lastUpdatedAt. `medication.live-activity-tokens`: POST /api/devices takes liveActivityTokens; + each Activity is ended by its own push once its dose is answered. `push.relay`: The server seals push + envelopes and can use the push relay; /api/auth/me push.relay and push.device carry the state, POST + /api/devices takes pushKey, relayConsent and relayBinding. `medication.dose-state`: Today rows carry the + resolved state, takenLate, dueAt, overdueSince and slotInstant; complianceDisplay.currentDose carries the + same state, takenLate, dueAt and overdueSince, with its slot as targetAt. `measurement.reading-timezone`: + POST /api/measurements/batch accepts an optional IANA timeZone per entry; the reading's own zone sets its + day for sleep, the day view, list day groups and daily charts. `apple-health.types-2026-11`: The batch + ingest accepts the Apple Health cycling distance, rowing distance and speed, and running speed, power, + ground contact time, vertical oscillation and stride length types. `medication.snooze-setting`: GET/PATCH + /api/auth/me/notification-prefs carry medication.snoozeMinutes (5–240, default 30); a snooze without + snoozedUntil and Telegram's Remind me later button defer by it. `apple-health.effort-scores`: The batch + ingest accepts HealthKit workoutEffortScore, estimatedWorkoutEffortScore and physicalEffort as + WORKOUT_EFFORT_SCORE, ESTIMATED_WORKOUT_EFFORT_SCORE and PHYSICAL_EFFORT. `medication.intake-sync-version`: + Today rows, the single take answers and every landed bulk entry carry the row's syncVersion, the value + expectedSyncVersion compares. `medication.current-dose-open-slot`: complianceDisplay.currentDose names the + earliest slot still due or overdue, so a dose whose time has passed stays current until it is recorded or + missed. `cycle.pregnancy-state`: CycleProfileDTO and the cycle calendar carry pregnancy (CyclePregnancyDTO): + PREGNANT or POSTPARTUM with its dates, the resolved week and predictionsPaused; PATCH + /api/auth/me/cycle-prefs takes pregnancy. While paused the forecast is empty and the verdict is + INSUFFICIENT_DATA. `profile.emergency-card`: GET /api/emergency-card returns the emergency card; + /api/emergency-card/link mints, reads and revokes its read-only hlm_ link, served at /e/{token} with only + the fields the owner ticked. `push.data-changed`: A device with a push key gets a sealed silent DATA_CHANGED + (d.domains, d.changedAt) when a server-side sync stores readings, and since v1.49.0 when doses or schedules + change (domains intakes, medications); per device at most once per five minutes and three times an hour, + within one silent budget shared with MEDICATION_INTAKE_SYNC, never for a change the device started itself. + `push.healthkit-catch-up`: A device with a push key whose app registered in the last three days gets a + sealed silent HEALTHKIT_CATCH_UP (d.requestedAt) when the account's Apple Health upload is six hours behind; + at most three a day, four hours apart. `push.security-alert-relay`: SECURITY_ALERT (new sign-in, passkey + added or removed, token revoked, refresh-token reuse, a device taken over by another account) reaches sealed + and relay-bound devices with ui.level time-sensitive and d.securityKind. `push.live-activity-relay`: POST + /api/devices takes liveActivityConsent (hl-la-consent-v1), liveActivityWithdraw (hl-la-withdraw-v1), + liveActivityStart (push-to-start token with hl-la-start-v1) and liveActivityTokens[].relayStart; the server + starts medication Live Activities over the relay and updates only those registered with relayStart, with the + closed content state, while push.relay.liveActivity lists start and update (operator switch + PUSH_RELAY_LIVE_ACTIVITY, off by default). `push.live-activity-started`: push.device.liveActivityStarted on + /api/auth/me and in the POST /api/devices answer names the dose ({ medicationId, slotInstant }) of the Live + Activity the server started on the calling device; null once that slot is answered, its medication paused or + ended, or nothing was started. `day.dose-offset`: GET /api/day/{date} symptom events and every GET + /api/symptoms/events occurrence carry doseOffset (intakeId, title, minutes) from one rule: the nearest dose + taken at or before it on the same local day of the record's zone, else the nearest after it (negative + minutes); absent without a timed dose that day or when medications are not readable. + `push.device-diagnostics`: GET /api/devices/me/push-diagnostics returns the X-Device-Id device's push state: + transport, relay and binding state, the silent budget (windowMinutes, limit, wakeLimit, usedInWindow, + wakesUsedInWindow, owedSyncs, nextFreeAt), the last delivery per kind, the last receipt and the masked APNs + token; 404 for a device that is not the caller's. `medication.resolved-slots`: GET + /api/medications/resolved-slots?from=&to= returns every medication's resolved slots with their state for a + window of at most 14 days (default two days back to eight ahead), from the same resolver as dose-history and + the today list. `medication.intake-reopened`: MEDICATION_INTAKE_RECORDED carries outcome \"reopened\" with + takenAt and takenVia null when a dose is undone elsewhere, plus asOf (server time) in d and in plaintext; + the today list answers with a HealthLog-As-Of header on 200 and 304. `push.relay-operator-decision`: + /api/auth/me carries push.relay.operatorDecision (undecided | on | off) and push.relay.canDecide; an admin + answers the one-time relay question in the web admin (POST /api/admin/push-relay/decision is cookie-only). + `measurement.stats-computed-at`: POST /api/measurements/batch accepts an optional computedAt (ISO 8601) on + stats: rows; a write older than the stored one answers skipped with reason stale, and without computedAt the + last write wins." + required: + - version + - buildSha + - builtAt + - license + - repository + - changelog + - docs + - offlineGeoEnabled + - geoProviderHost + - features + additionalProperties: false + description: The running build's identity plus the offline-geolocation state. Public — no authentication, no account data. + AssistantFlagsEnvelope: + type: object + properties: + data: + $ref: "#/components/schemas/AssistantFlagsResponse" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + AssistantFlagsResponse: + type: object + properties: + assistant: + type: object + properties: + enabled: + type: boolean + description: Master switch for every AI feature. + coach: + type: boolean + description: The Coach. + briefing: + type: boolean + description: The daily briefing and model-written period narratives. + insightStatus: + type: boolean + description: "Status notes: per-metric notes, workout notes and reaction lines." + documentAi: + type: boolean + description: "Reading documents: the document vault's AI reads, lab report scans and medication extraction." + required: + - enabled + - coach + - briefing + - insightStatus + - documentAi + additionalProperties: false + description: "The operator's switches, master applied: when `enabled` is false every sub-switch is false in this + payload. A switch read that fails answers every switch false." + required: + - assistant + additionalProperties: false + description: "The operator's assistant switches, and nothing else. Deprecated: whether a capability is available also + depends on the record's modules, the provider, consent and who is asking, and `ai` on GET /api/auth/me is that + resolved answer." + UpdateCheckEnvelope: + type: object + properties: + data: + $ref: "#/components/schemas/UpdateCheckResponse" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + UpdateCheckResponse: + type: object + properties: + status: + type: string + enum: + - up_to_date + - newer_available + - unknown + description: "`unknown` is a normal outcome, not an error — it means the release feed could not be reached or read." + current: + type: string + description: The version this instance is running. + latest_tag: + description: The newest published release tag. Absent when `unknown`. + type: string + html_url: + description: Release page to deep-link to. Only on `newer_available`. + anyOf: + - type: string + format: uri + - type: "null" + published_at: + description: When that release was published. Only on `newer_available`. + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + checked_at: + description: When the check ran. Absent when `unknown`. + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + reason: + description: "Only on `unknown`: `network_error`, or `github_status_` when the feed answered but not with a + success." + type: string + required: + - status + - current + additionalProperties: false + description: Whether a newer release exists. The three states are carried in `status`; which of the optional fields are + present follows from it. + ShareLinkCreated: + type: object + properties: + data: + type: object + properties: + id: + type: string + label: + type: string + rangeStart: + type: string + rangeEnd: + type: + - string + - "null" + protected: + type: boolean + documentCount: + type: number + documentOnly: + type: boolean + needsReselection: + type: boolean + expiresAt: + type: string + createdAt: + type: string + revokedAt: + type: + - string + - "null" + lastAccessAt: + type: + - string + - "null" + accessCount: + type: number + active: + type: boolean + token: + type: string + description: Raw `hls_` token — returned ONCE and unrecoverable thereafter. + passphrase: + type: string + description: Raw passphrase second factor — returned ONCE; stored only as an HMAC hash, unrecoverable. + shareUrl: + type: string + description: Absolute `/c/` URL (no passphrase). + qrUrl: + type: string + description: Absolute share URL with the passphrase in the URL FRAGMENT (`#k=`). Encode this as the QR + payload; the fragment is never sent to the server. + required: + - id + - label + - rangeStart + - rangeEnd + - protected + - documentCount + - documentOnly + - needsReselection + - expiresAt + - createdAt + - revokedAt + - lastAccessAt + - accessCount + - active + - token + - passphrase + - shareUrl + - qrUrl + additionalProperties: false + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + ShareLinkList: + type: object + properties: + data: + type: object + properties: + shareLinks: + type: array + items: + type: object + properties: + id: + type: string + label: + type: string + rangeStart: + type: string + rangeEnd: + type: + - string + - "null" + protected: + type: boolean + documentCount: + type: number + documentOnly: + type: boolean + needsReselection: + type: boolean + expiresAt: + type: string + createdAt: + type: string + revokedAt: + type: + - string + - "null" + lastAccessAt: + type: + - string + - "null" + accessCount: + type: number + active: + type: boolean + required: + - id + - label + - rangeStart + - rangeEnd + - protected + - documentCount + - documentOnly + - needsReselection + - expiresAt + - createdAt + - revokedAt + - lastAccessAt + - accessCount + - active + additionalProperties: false + required: + - shareLinks + additionalProperties: false + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + ShareLinkRevoked: + type: object + properties: + data: + type: object + properties: + id: + type: string + revoked: + type: boolean + required: + - id + - revoked + additionalProperties: false + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + ShareLinkUnlock: + type: object + properties: + data: + type: object + properties: + unlocked: + type: boolean + const: true + required: + - unlocked + additionalProperties: false + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + ExportJsonBody: + type: object + properties: + data: type: object properties: measurements: @@ -45519,6 +48723,24 @@ components: - low - medium - high + aiUsageMaxLevel: + type: string + enum: + - FRUGAL + - STANDARD + - FULL + aiUsageDefaultLevel: + type: string + enum: + - FRUGAL + - STANDARD + - FULL + aiSyncRegenGapHours: + anyOf: + - type: integer + minimum: 1 + maximum: 48 + - type: "null" moduleAvailabilityJson: anyOf: - {} @@ -45530,6 +48752,22 @@ components: documentQuotaBytes: type: string pattern: ^\d+$ + serverSetupCompletedAt: + anyOf: + - type: string + minLength: 1 + - type: "null" + serverSetupStepsJson: + anyOf: + - {} + - type: "null" + pushRelayDecision: + anyOf: + - type: string + enum: + - on + - off + - type: "null" required: - id - registrationEnabled @@ -45674,6 +48912,10 @@ components: type: - string - "null" + medicineRegistry: + type: + - string + - "null" timeFormat: type: string dateFormat: @@ -45692,6 +48934,7 @@ components: activityGoalsJson: {} nutrientTargetsJson: {} reportSelectionJson: {} + reportScheduleJson: {} globalExcludedInjectionSites: type: array items: @@ -45726,6 +48969,7 @@ components: - "null" aiProviderChain: {} aiNamedChains: {} + aiCoachBudgets: {} aiResponseTimeoutSeconds: anyOf: - type: integer @@ -45887,6 +49131,17 @@ components: - FEV1 - FVC - PEAK_EXPIRATORY_FLOW + - WORKOUT_EFFORT_SCORE + - ESTIMATED_WORKOUT_EFFORT_SCORE + - PHYSICAL_EFFORT + - CYCLING_DISTANCE + - ROWING_DISTANCE + - ROWING_SPEED + - RUNNING_SPEED + - RUNNING_POWER + - RUNNING_GROUND_CONTACT_TIME + - RUNNING_VERTICAL_OSCILLATION + - RUNNING_STRIDE_LENGTH value: type: number valueMin: @@ -45984,6 +49239,11 @@ components: type: - string - "null" + timeZone: + anyOf: + - type: string + maxLength: 64 + - type: "null" ingestTokenId: anyOf: - type: string @@ -45998,6 +49258,16 @@ components: - type: string minLength: 1 - type: "null" + appleHealthDeletedAt: + anyOf: + - type: string + minLength: 1 + - type: "null" + statsComputedAt: + anyOf: + - type: string + minLength: 1 + - type: "null" createdAt: type: string minLength: 1 @@ -46129,6 +49399,10 @@ components: - type: string minLength: 1 - type: "null" + leafletUrl: + type: + - string + - "null" lowStockNotifiedAt: anyOf: - type: string @@ -46682,6 +49956,17 @@ components: - FEV1 - FVC - PEAK_EXPIRATORY_FLOW + - WORKOUT_EFFORT_SCORE + - ESTIMATED_WORKOUT_EFFORT_SCORE + - PHYSICAL_EFFORT + - CYCLING_DISTANCE + - ROWING_DISTANCE + - ROWING_SPEED + - RUNNING_SPEED + - RUNNING_POWER + - RUNNING_GROUND_CONTACT_TIME + - RUNNING_VERTICAL_OSCILLATION + - RUNNING_STRIDE_LENGTH - type: "null" biomarkerName: anyOf: @@ -46832,6 +50117,12 @@ components: medicationId: type: string minLength: 1 + ref: + type: string + minLength: 1 + medicationRef: + type: string + minLength: 1 medication: type: string minLength: 1 @@ -46862,6 +50153,18 @@ components: - REMINDER - IMPORT - APPLE_HEALTH + takenVia: + anyOf: + - type: string + enum: + - WEB + - APP + - INTEGRATION + - TELEGRAM + - APPLE_HEALTH + - IMPORT + - AUTO + - type: "null" idempotencyKey: type: - string @@ -46906,6 +50209,11 @@ components: - type: string minLength: 1 - type: "null" + appleHealthDeletedAt: + anyOf: + - type: string + minLength: 1 + - type: "null" required: - medication - scheduledFor @@ -46998,6 +50306,11 @@ components: - type: string minLength: 1 - type: "null" + appleHealthDeletedAt: + anyOf: + - type: string + minLength: 1 + - type: "null" createdAt: type: string minLength: 1 @@ -47213,6 +50526,39 @@ components: type: boolean sensitiveCategoryEncryption: type: boolean + reproductiveState: + anyOf: + - type: string + enum: + - PREGNANT + - POSTPARTUM + - type: "null" + pregnancyStartDate: + anyOf: + - type: string + pattern: ^\d{4}-\d{2}-\d{2}$ + - type: "null" + pregnancyDueDate: + anyOf: + - type: string + pattern: ^\d{4}-\d{2}-\d{2}$ + - type: "null" + deliveryDate: + anyOf: + - type: string + pattern: ^\d{4}-\d{2}-\d{2}$ + - type: "null" + postpartumWeeks: + type: integer + minimum: 1 + maximum: 78 + pregnancyOwnerDecided: + type: boolean + pregnancyEncrypted: + anyOf: + - type: string + minLength: 1 + - type: "null" createdAt: type: string minLength: 1 @@ -47485,6 +50831,11 @@ components: - type: string minLength: 1 - type: "null" + appleHealthDeletedAt: + anyOf: + - type: string + minLength: 1 + - type: "null" createdAt: type: string minLength: 1 @@ -47529,6 +50880,20 @@ components: - key - createdAt additionalProperties: false + symptomSources: + type: array + items: + type: object + properties: + key: + type: string + minLength: 1 + source: + type: string + required: + - key + - source + additionalProperties: {} required: - date - symptomKeys @@ -47933,6 +51298,31 @@ components: - source - externalId additionalProperties: {} + fhirImportedResources: + default: [] + type: array + items: + type: object + properties: + resourceType: + type: string + minLength: 1 + maxLength: 64 + resourceKey: + type: string + pattern: ^[0-9a-f]{40}$ + recordId: + type: string + minLength: 1 + maxLength: 64 + createdAt: + type: string + minLength: 1 + required: + - resourceType + - resourceKey + - recordId + additionalProperties: {} illnessEpisodes: default: [] type: array @@ -48181,6 +51571,11 @@ components: - type: string minLength: 1 - type: "null" + appleHealthDeletedAt: + anyOf: + - type: string + minLength: 1 + - type: "null" createdAt: type: string minLength: 1 @@ -49024,29 +52419,6 @@ components: - durationSec - source additionalProperties: {} - appleHealthTombstones: - default: [] - type: array - items: - type: object - properties: - domain: - type: string - enum: - - workout - - ecg - externalId: - type: string - minLength: 1 - maxLength: 120 - createdAt: - type: string - minLength: 1 - required: - - domain - - externalId - - createdAt - additionalProperties: {} documents: default: [] type: array @@ -49154,6 +52526,7 @@ components: - PAPERLESS - PAPRA - OTHER + - REPORT_SCHEDULE - type: "null" sourceId: anyOf: @@ -49280,6 +52653,7 @@ components: - PAPERLESS - PAPRA - OTHER + - REPORT_SCHEDULE sourceId: type: string minLength: 1 @@ -49878,6 +53252,17 @@ components: - FEV1 - FVC - PEAK_EXPIRATORY_FLOW + - WORKOUT_EFFORT_SCORE + - ESTIMATED_WORKOUT_EFFORT_SCORE + - PHYSICAL_EFFORT + - CYCLING_DISTANCE + - ROWING_DISTANCE + - ROWING_SPEED + - RUNNING_SPEED + - RUNNING_POWER + - RUNNING_GROUND_CONTACT_TIME + - RUNNING_VERTICAL_OSCILLATION + - RUNNING_STRIDE_LENGTH dateKey: type: string pattern: ^\d{4}-\d{2}-\d{2}$ @@ -51088,6 +54473,17 @@ components: - FEV1 - FVC - PEAK_EXPIRATORY_FLOW + - WORKOUT_EFFORT_SCORE + - ESTIMATED_WORKOUT_EFFORT_SCORE + - PHYSICAL_EFFORT + - CYCLING_DISTANCE + - ROWING_DISTANCE + - ROWING_SPEED + - RUNNING_SPEED + - RUNNING_POWER + - RUNNING_GROUND_CONTACT_TIME + - RUNNING_VERTICAL_OSCILLATION + - RUNNING_STRIDE_LENGTH - type: "null" intervalDays: anyOf: @@ -51324,6 +54720,17 @@ components: - FEV1 - FVC - PEAK_EXPIRATORY_FLOW + - WORKOUT_EFFORT_SCORE + - ESTIMATED_WORKOUT_EFFORT_SCORE + - PHYSICAL_EFFORT + - CYCLING_DISTANCE + - ROWING_DISTANCE + - ROWING_SPEED + - RUNNING_SPEED + - RUNNING_POWER + - RUNNING_GROUND_CONTACT_TIME + - RUNNING_VERTICAL_OSCILLATION + - RUNNING_STRIDE_LENGTH metricSlot: type: - string @@ -51857,6 +55264,7 @@ components: - biomarkers - biomarkerMerges - labResultImportKeys + - fhirImportedResources - illnessEpisodes - symptomDefinitions - lifeEvents @@ -51866,7 +55274,6 @@ components: - allergies - familyHistory - workouts - - appleHealthTombstones - documents - documentConditionLinks - extractedFacts @@ -51929,11 +55336,214 @@ components: data: type: object properties: - redirectTo: + redirectTo: + type: string + required: + - redirectTo + additionalProperties: false + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + ProfileClaimPreviewEnvelope: + type: object + properties: + data: + $ref: "#/components/schemas/ProfileClaimPreview" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + ProfileClaimPreview: + type: object + properties: + displayName: + description: The profile's name, as its guardians set it. + type: + - string + - "null" + expiresAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + guardians: + type: array + items: + type: object + properties: + displayName: + description: "The guardian's display name; null when they set none. Never a login name or an id: the holder of the link + has proved nothing yet." + type: + - string + - "null" + proposal: + $ref: "#/components/schemas/ProfileClaimGuardianAccess" + required: + - displayName + - proposal + additionalProperties: false + description: Each guardian and the access they keep after the claim, as proposed. The new owner confirms or changes it + after signing in. + methods: + description: "v1.43 — how this link can be redeemed: `password` and/or `sso`. Absent on older servers." + type: array + items: + type: string + enum: + - password + - sso + ssoProviderName: + description: v1.43 — the identity provider's display name for the "Continue with …" button; null without one. + type: + - string + - "null" + required: + - displayName + - expiresAt + - guardians + additionalProperties: false + ProfileClaimGuardianAccess: + type: string + enum: + - end + - read + - manage + ProfileClaimEnvelope: + type: object + properties: + data: + type: object + properties: + userId: + type: string + username: + type: string + required: + - userId + - username + additionalProperties: false + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + LoginResponse: + type: object + properties: + data: + $ref: "#/components/schemas/AccessRefreshBundle" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + AccessRefreshBundle: + type: object + properties: + user: + type: object + properties: + id: + type: string + username: type: string required: - - redirectTo + - id + - username + additionalProperties: false + token: + description: Access token (`hlk_<64hex>`); only present for native-policy callers. A browser caller gets the session + cookie instead. + type: string + tokenExpiresAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + refreshToken: + description: Refresh token (`hlr_<64hex>`); only present for native-policy callers. + type: string + refreshTokenExpiresAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + required: + - user + additionalProperties: false + description: Native-client token bundle returned by login + refresh. Web cookie-only callers see only `user`. + MfaRequiredResponse: + type: object + properties: + data: + type: "null" + error: + type: "null" + meta: + type: object + properties: + mfaRequired: + type: boolean + const: true + mfaTicket: + type: string + description: Opaque, single-use, ~5-minute ticket to present to /api/auth/mfa/verify. + methods: + type: array + items: + type: string + enum: + - totp + - recovery + - webauthn + description: Second factors the account can complete the challenge with. `webauthn` is completed via + /api/auth/mfa/webauthn/verify; the rest via /api/auth/mfa/verify. + required: + - mfaRequired + - mfaTicket + - methods additionalProperties: false + required: + - data + - error + - meta + additionalProperties: false + description: Password accepted but a second factor is required. Not an error and not a session — no token is issued + until /api/auth/mfa/verify succeeds. + MfaVerifyResponse: + type: object + properties: + data: + $ref: "#/components/schemas/AccessRefreshBundle" error: type: "null" meta: @@ -51946,11 +55556,11 @@ components: - data - error additionalProperties: false - ProfileClaimPreviewEnvelope: + OidcNativeTokenResponse: type: object properties: data: - $ref: "#/components/schemas/ProfileClaimPreview" + $ref: "#/components/schemas/AccessRefreshBundle" error: type: "null" meta: @@ -51963,75 +55573,394 @@ components: - data - error additionalProperties: false - ProfileClaimPreview: + NativeHandoffTokenResponse: type: object properties: - displayName: - description: The profile's name, as its guardians set it. - type: - - string - - "null" + data: + $ref: "#/components/schemas/AccessRefreshBundle" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + StepUpOptionsEnvelope: + type: object + properties: + data: + $ref: "#/components/schemas/StepUpOptionsResponse" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + StepUpOptionsResponse: + type: object + properties: + options: + type: object + propertyNames: + type: string + additionalProperties: {} + description: SimpleWebAuthn assertion options for the caller's passkeys. + challengeId: + type: string + required: + - options + - challengeId + additionalProperties: false + StepUpMintEnvelope: + type: object + properties: + data: + $ref: "#/components/schemas/StepUpMintResponse" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + StepUpMintResponse: + type: object + properties: + elevation: + type: string + description: Opaque single-use elevation (`hle_<64hex>`). Present it in the `X-Step-Up` header on ONE + second-factor-management call. Returned exactly once; store it in memory only. expiresAt: type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - guardians: + expiresInSeconds: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + method: + type: string + enum: + - password + - totp + - webauthn + - passkey + description: The factor that was re-proved. + satisfiesFreshFactor: + type: boolean + description: Whether this elevation reaches the fresh-factor routes (MFA disable, recovery-code regeneration, + security-key removal). False for a password proof — mirroring the web, where a password login never marks a + session second-factor-verified. + required: + - elevation + - expiresAt + - expiresInSeconds + - method + - satisfiesFreshFactor + additionalProperties: false + ReproofEnvelope: + type: object + properties: + data: + $ref: "#/components/schemas/ReproofResponse" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + ReproofResponse: + type: object + properties: + method: + type: string + enum: + - password + - totp + - webauthn + - passkey + verifiedAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$ + required: + - method + - verifiedAt + additionalProperties: false + ReproofStatusEnvelope: + type: object + properties: + data: + $ref: "#/components/schemas/ReproofStatus" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + ReproofStatus: + type: object + properties: + recent: + type: boolean + const: true + required: + - recent + additionalProperties: false + TotpSetupEnvelope: + type: object + properties: + data: + $ref: "#/components/schemas/TotpSetupResponse" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + TotpSetupResponse: + type: object + properties: + otpauthUri: + type: string + description: otpauth:// URI to render as a QR code (carries the secret). + totpSecret: + type: string + description: Base32 secret for manual entry. Pending until confirmed. + required: + - otpauthUri + - totpSecret + additionalProperties: false + TotpConfirmEnvelope: + type: object + properties: + data: + $ref: "#/components/schemas/MfaRecoveryCodesResponse" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + MfaRecoveryCodesResponse: + type: object + properties: + enabled: + type: boolean + recoveryCodes: type: array items: - type: object - properties: - displayName: - description: "The guardian's display name; null when they set none. Never a login name or an id: the holder of the link - has proved nothing yet." - type: - - string - - "null" - proposal: - $ref: "#/components/schemas/ProfileClaimGuardianAccess" - required: - - displayName - - proposal - additionalProperties: false - description: Each guardian and the access they keep after the claim, as proposed. The new owner confirms or changes it - after signing in. - methods: - description: "v1.43 — how this link can be redeemed: `password` and/or `sso`. Absent on older servers." + type: string + description: Single-use recovery codes, shown once. Save them now. + recoveryCodesRemaining: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + required: + - recoveryCodes + - recoveryCodesRemaining + additionalProperties: false + MfaDisableEnvelope: + type: object + properties: + data: + $ref: "#/components/schemas/MfaToggleResponse" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + MfaToggleResponse: + type: object + properties: + enabled: + type: boolean + required: + - enabled + additionalProperties: false + MfaRecoveryRegenEnvelope: + type: object + properties: + data: + $ref: "#/components/schemas/MfaRecoveryCodesResponse" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + MfaStatusEnvelope: + type: object + properties: + data: + $ref: "#/components/schemas/MfaStatusResponse" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + MfaStatusResponse: + type: object + properties: + totp: + type: object + properties: + enabled: + type: boolean + required: + - enabled + additionalProperties: false + recoveryCodesRemaining: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + webauthn: + type: array + items: + $ref: "#/components/schemas/WebauthnMfaCredentialInfo" + passkeyNudgeDismissed: + type: boolean + proofMethods: type: array items: type: string enum: - password - - sso - ssoProviderName: - description: v1.43 — the identity provider's display name for the "Continue with …" button; null without one. - type: - - string - - "null" + - oidc + - totp + - webauthn + - passkey + description: The ways this account can confirm it is you, the same list a recent-proof refusal names in `meta.methods`. + `password` and `oidc` only on an account without a second factor; `oidc` is a browser round trip to the + identity provider (`GET /api/auth/oidc/reproof`) and is never offered to a token. required: - - displayName - - expiresAt - - guardians + - totp + - recoveryCodesRemaining + - webauthn + - passkeyNudgeDismissed + - proofMethods + additionalProperties: false + WebauthnMfaCredentialInfo: + type: object + properties: + id: + type: string + name: + type: string + createdAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + lastUsedAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + required: + - id + - name + - createdAt + - lastUsedAt + additionalProperties: false + MfaWebauthnRegisterOptionsEnvelope: + type: object + properties: + data: + $ref: "#/components/schemas/WebauthnOptionsResponse" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + WebauthnOptionsResponse: + type: object + properties: + options: + type: object + propertyNames: + type: string + additionalProperties: {} + description: SimpleWebAuthn options to pass to the browser ceremony. + challengeId: + type: string + description: Server-issued challenge id. + required: + - options + - challengeId additionalProperties: false - ProfileClaimGuardianAccess: - type: string - enum: - - end - - read - - manage - ProfileClaimEnvelope: + MfaWebauthnRegisterVerifyEnvelope: type: object properties: data: - type: object - properties: - userId: - type: string - username: - type: string - required: - - userId - - username - additionalProperties: false + $ref: "#/components/schemas/WebauthnMfaCredentialInfo" error: type: "null" meta: @@ -52044,11 +55973,11 @@ components: - data - error additionalProperties: false - LoginResponse: + MfaWebauthnRenameEnvelope: type: object properties: data: - $ref: "#/components/schemas/AccessRefreshBundle" + $ref: "#/components/schemas/WebauthnMfaCredentialInfo" error: type: "null" meta: @@ -52061,78 +55990,49 @@ components: - data - error additionalProperties: false - AccessRefreshBundle: + MfaWebauthnRemoveEnvelope: type: object properties: - user: + data: + $ref: "#/components/schemas/AuthSuccessFlagResponse" + error: + type: "null" + meta: type: object properties: - id: - type: string - username: + requestId: type: string - required: - - id - - username additionalProperties: false - token: - description: Access token (`hlk_<64hex>`); only present for native-policy callers. A browser caller gets the session - cookie instead. - type: string - tokenExpiresAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - refreshToken: - description: Refresh token (`hlr_<64hex>`); only present for native-policy callers. - type: string - refreshTokenExpiresAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ required: - - user + - data + - error additionalProperties: false - description: Native-client token bundle returned by login + refresh. Web cookie-only callers see only `user`. - MfaRequiredResponse: + AuthSuccessFlagResponse: + type: object + properties: + success: + type: boolean + required: + - success + additionalProperties: false + MfaWebauthnLoginOptionsEnvelope: type: object properties: data: - type: "null" + $ref: "#/components/schemas/WebauthnOptionsResponse" error: type: "null" meta: type: object properties: - mfaRequired: - type: boolean - const: true - mfaTicket: + requestId: type: string - description: Opaque, single-use, ~5-minute ticket to present to /api/auth/mfa/verify. - methods: - type: array - items: - type: string - enum: - - totp - - recovery - - webauthn - description: Second factors the account can complete the challenge with. `webauthn` is completed via - /api/auth/mfa/webauthn/verify; the rest via /api/auth/mfa/verify. - required: - - mfaRequired - - mfaTicket - - methods additionalProperties: false required: - data - error - - meta additionalProperties: false - description: Password accepted but a second factor is required. Not an error and not a session — no token is issued - until /api/auth/mfa/verify succeeds. - MfaVerifyResponse: + MfaWebauthnVerifyResponse: type: object properties: data: @@ -52149,7 +56049,7 @@ components: - data - error additionalProperties: false - OidcNativeTokenResponse: + PasskeyLoginVerifyResponse: type: object properties: data: @@ -52166,7 +56066,7 @@ components: - data - error additionalProperties: false - NativeHandoffTokenResponse: + RefreshResponse: type: object properties: data: @@ -52183,11 +56083,17 @@ components: - data - error additionalProperties: false - StepUpOptionsEnvelope: + RefreshRevokeResponse: type: object properties: data: - $ref: "#/components/schemas/StepUpOptionsResponse" + type: object + properties: + revoked: + type: boolean + required: + - revoked + additionalProperties: false error: type: "null" meta: @@ -52200,26 +56106,11 @@ components: - data - error additionalProperties: false - StepUpOptionsResponse: - type: object - properties: - options: - type: object - propertyNames: - type: string - additionalProperties: {} - description: SimpleWebAuthn assertion options for the caller's passkeys. - challengeId: - type: string - required: - - options - - challengeId - additionalProperties: false - StepUpMintEnvelope: + PasskeyListEnvelope: type: object properties: data: - $ref: "#/components/schemas/StepUpMintResponse" + $ref: "#/components/schemas/PasskeyListResponse" error: type: "null" meta: @@ -52232,46 +56123,53 @@ components: - data - error additionalProperties: false - StepUpMintResponse: + PasskeyListResponse: + type: array + items: + $ref: "#/components/schemas/PasskeyInfo" + PasskeyInfo: type: object properties: - elevation: + id: type: string - description: Opaque single-use elevation (`hle_<64hex>`). Present it in the `X-Step-Up` header on ONE - second-factor-management call. Returned exactly once; store it in memory only. - expiresAt: + description: Row id; the handle for DELETE. + name: type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - expiresInSeconds: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - method: + description: User-supplied label, defaulting to “Passkey”. + credentialDeviceType: type: string - enum: - - password - - totp - - webauthn - - passkey - description: The factor that was re-proved. - satisfiesFreshFactor: + description: "Authenticator device type as reported at registration: `singleDevice` for a credential bound to one + authenticator, `multiDevice` for a syncable one." + credentialBackedUp: type: boolean - description: Whether this elevation reaches the fresh-factor routes (MFA disable, recovery-code regeneration, - security-key removal). False for a password proof — mirroring the web, where a password login never marks a - session second-factor-verified. + description: Whether the authenticator reported the credential as backed up (synced to the platform keychain) at + registration time. Not re-read afterwards. + createdAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + description: Registered at. + lastUsedAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: When this passkey last completed a verified assertion; null when it has never been used to sign in. Stamped + on every successful login, so a client can render a real 'last used' rather than assuming never. required: - - elevation - - expiresAt - - expiresInSeconds - - method - - satisfiesFreshFactor + - id + - name + - credentialDeviceType + - credentialBackedUp + - createdAt + - lastUsedAt additionalProperties: false - ReproofEnvelope: + SessionListEnvelope: type: object properties: data: - $ref: "#/components/schemas/ReproofResponse" + $ref: "#/components/schemas/SessionListResponse" error: type: "null" meta: @@ -52284,29 +56182,59 @@ components: - data - error additionalProperties: false - ReproofResponse: + SessionListResponse: type: object properties: - method: - type: string - enum: - - password - - totp - - webauthn - - passkey - verifiedAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$ + sessions: + type: array + items: + type: object + properties: + id: + type: string + device: + type: string + description: Coarse device label derived from the User-Agent. + ipMasked: + description: IP with the host portion masked — never the full address. + type: + - string + - "null" + location: + description: Resolved coarse location, when available. + type: + - string + - "null" + lastActiveAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + createdAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + isCurrent: + type: boolean + description: True for the session making this request. + required: + - id + - device + - ipMasked + - location + - lastActiveAt + - createdAt + - isCurrent + additionalProperties: false required: - - method - - verifiedAt + - sessions additionalProperties: false - ReproofStatusEnvelope: + SignOutEverywhereEnvelope: type: object properties: data: - $ref: "#/components/schemas/ReproofStatus" + $ref: "#/components/schemas/SignOutEverywhereResponse" error: type: "null" meta: @@ -52319,20 +56247,93 @@ components: - data - error additionalProperties: false - ReproofStatus: + SignOutEverywhereResponse: type: object properties: - recent: - type: boolean - const: true + sessionsRevoked: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: Number of OTHER sessions removed (the current one is kept). + accessTokensRevoked: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: "Tokens revoked: the access tokens of other device logins plus every programmatic token (connector, + measurement, document), never the caller's own." + connectorsRevoked: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: Connected AI-assistant (MCP OAuth) connections revoked. + shareLinksRevoked: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: Clinician share links revoked; 0 when `keepShareLinks=1` was sent. + pendingInvitesRevoked: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: "Record-sharing invitations this account offered that nobody had accepted yet, now withdrawn (`revokedBy: + GRANTOR`)." + grantsKept: + type: array + items: + type: object + properties: + id: + type: string + description: The grant id, for DELETE /api/account/grants/{id}. + account: + type: object + properties: + id: + type: string + username: + type: string + displayName: + type: + - string + - "null" + required: + - id + - username + - displayName + additionalProperties: false + access: + type: string + enum: + - READ + - WRITE + - MANAGE + required: + - id + - account + - access + additionalProperties: false + description: Accepted grants this account gave that are still live. Signing out does not end them, because each is a + person the owner chose and ending one silently could cut off a carer; they are listed so a client can show + who can still read the record and offer to end each with DELETE /api/account/grants/{id}. required: - - recent + - sessionsRevoked + - accessTokensRevoked + - connectorsRevoked + - shareLinksRevoked + - pendingInvitesRevoked + - grantsKept additionalProperties: false - TotpSetupEnvelope: + SessionRevokeEnvelope: type: object properties: data: - $ref: "#/components/schemas/TotpSetupResponse" + type: object + properties: + revoked: + type: boolean + required: + - revoked + additionalProperties: false error: type: "null" meta: @@ -52345,24 +56346,77 @@ components: - data - error additionalProperties: false - TotpSetupResponse: + TrustedDeviceListEnvelope: type: object properties: - otpauthUri: - type: string - description: otpauth:// URI to render as a QR code (carries the secret). - totpSecret: - type: string - description: Base32 secret for manual entry. Pending until confirmed. + data: + $ref: "#/components/schemas/TrustedDeviceListResponse" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false required: - - otpauthUri - - totpSecret + - data + - error additionalProperties: false - TotpConfirmEnvelope: + TrustedDeviceListResponse: + type: object + properties: + devices: + type: array + items: + type: object + properties: + id: + type: string + label: + description: Coarse, IP-free device label (e.g. 'Firefox on macOS'). + type: + - string + - "null" + createdAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + lastUsedAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + expiresAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + isCurrent: + type: boolean + description: True for the device making this request. + required: + - id + - label + - createdAt + - lastUsedAt + - expiresAt + - isCurrent + additionalProperties: false + required: + - devices + additionalProperties: false + TrustedDeviceRevokeAllEnvelope: type: object properties: data: - $ref: "#/components/schemas/MfaRecoveryCodesResponse" + type: object + properties: + revoked: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + required: + - revoked + additionalProperties: false error: type: "null" meta: @@ -52375,29 +56429,86 @@ components: - data - error additionalProperties: false - MfaRecoveryCodesResponse: + TrustedDeviceRevokeEnvelope: type: object properties: - enabled: - type: boolean - recoveryCodes: + data: + type: object + properties: + revoked: + type: boolean + required: + - revoked + additionalProperties: false + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + SecurityActivityEnvelope: + type: object + properties: + data: + $ref: "#/components/schemas/SecurityActivityResponse" + error: + type: "null" + meta: + $ref: "#/components/schemas/ListCapMeta" + required: + - data + - error + - meta + additionalProperties: false + SecurityActivityResponse: + type: object + properties: + events: type: array items: - type: string - description: Single-use recovery codes, shown once. Save them now. - recoveryCodesRemaining: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 + type: object + properties: + action: + type: string + description: Audit action name, e.g. auth.login.password. + createdAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + location: + type: + - string + - "null" + ipMasked: + description: Host-masked IP. + type: + - string + - "null" + carrier: + type: + - string + - "null" + required: + - action + - createdAt + - location + - ipMasked + - carrier + additionalProperties: false required: - - recoveryCodes - - recoveryCodesRemaining + - events additionalProperties: false - MfaDisableEnvelope: + LogoutEnvelope: type: object properties: data: - $ref: "#/components/schemas/MfaToggleResponse" + $ref: "#/components/schemas/LogoutResponse" error: type: "null" meta: @@ -52410,19 +56521,22 @@ components: - data - error additionalProperties: false - MfaToggleResponse: + LogoutResponse: type: object properties: - enabled: + loggedOut: type: boolean + const: true + description: "Always true. The endpoint has no failure the caller acts on: it answers the same whether a cookie was + cleared, a token was revoked, or neither was there." required: - - enabled + - loggedOut additionalProperties: false - MfaRecoveryRegenEnvelope: + OidcStatusEnvelope: type: object properties: data: - $ref: "#/components/schemas/MfaRecoveryCodesResponse" + $ref: "#/components/schemas/OidcStatusResponse" error: type: "null" meta: @@ -52435,11 +56549,42 @@ components: - data - error additionalProperties: false - MfaStatusEnvelope: + OidcStatusResponse: + type: object + properties: + enabled: + type: boolean + description: An OIDC provider is configured on this instance. + buttonLabel: + description: Operator-set label for the SSO button (`OIDC_BUTTON_LABEL`, defaulting to “Single Sign-On”). Null when no + provider is configured. + type: + - string + - "null" + only: + type: boolean + description: "`OIDC_ONLY=true` — password and passkey login are refused with 403 `oidc_only`. A client that offers those + controls anyway strands the user." + nativeReturnPath: + description: "The path of the native sign-in's opt-in https return, `/auth/native-return`, a fixed constant. Present + (non-null) only when SSO is configured and the instance is served over https (`NEXT_PUBLIC_APP_URL`). An app + build that carries an associated domain for this host may then start the native leg with `return=https` on + GET /api/auth/oidc/login and receive the callback on `https://` with the same + parameters the custom scheme carries. Null or absent: use the scheme. Servers before v1.48.0 omit the + field." + type: + - string + - "null" + required: + - enabled + - buttonLabel + - only + additionalProperties: false + RegistrationStatusEnvelope: type: object properties: data: - $ref: "#/components/schemas/MfaStatusResponse" + $ref: "#/components/schemas/RegistrationStatusResponse" error: type: "null" meta: @@ -52452,71 +56597,23 @@ components: - data - error additionalProperties: false - MfaStatusResponse: + RegistrationStatusResponse: type: object properties: - totp: - type: object - properties: - enabled: - type: boolean - required: - - enabled - additionalProperties: false - recoveryCodesRemaining: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - webauthn: - type: array - items: - $ref: "#/components/schemas/WebauthnMfaCredentialInfo" - passkeyNudgeDismissed: + registrationEnabled: type: boolean - proofMethods: - type: array - items: - type: string - enum: - - password - - oidc - - totp - - webauthn - - passkey - description: The ways this account can confirm it is you, the same list a recent-proof refusal names in `meta.methods`. - `password` and `oidc` only on an account without a second factor; `oidc` is a browser round trip to the - identity provider (`GET /api/auth/oidc/reproof`) and is never offered to a token. - required: - - totp - - recoveryCodesRemaining - - webauthn - - passkeyNudgeDismissed - - proofMethods - additionalProperties: false - WebauthnMfaCredentialInfo: - type: object - properties: - id: - type: string - name: - type: string - createdAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - lastUsedAt: - anyOf: - - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - - type: "null" + description: Whether open self-registration is on. An operator who turned it off can still admit a signup through an + invite token. + sessionCookieSecure: + type: boolean + description: Whether this server issues its session cookies with the `Secure` flag (`SESSION_COOKIE_SECURE`, else on in + production). A browser on a plain `http://` page cannot keep such a cookie; the web login page compares this + with its own scheme before any credential is sent. required: - - id - - name - - createdAt - - lastUsedAt + - registrationEnabled + - sessionCookieSecure additionalProperties: false - MfaWebauthnRegisterOptionsEnvelope: + PasskeyLoginOptionsEnvelope: type: object properties: data: @@ -52533,27 +56630,11 @@ components: - data - error additionalProperties: false - WebauthnOptionsResponse: - type: object - properties: - options: - type: object - propertyNames: - type: string - additionalProperties: {} - description: SimpleWebAuthn options to pass to the browser ceremony. - challengeId: - type: string - description: Server-issued challenge id. - required: - - options - - challengeId - additionalProperties: false - MfaWebauthnRegisterVerifyEnvelope: + PasskeyRenameEnvelope: type: object properties: data: - $ref: "#/components/schemas/WebauthnMfaCredentialInfo" + $ref: "#/components/schemas/PasskeyInfo" error: type: "null" meta: @@ -52566,11 +56647,11 @@ components: - data - error additionalProperties: false - MfaWebauthnRenameEnvelope: + PasskeyRemoveEnvelope: type: object properties: data: - $ref: "#/components/schemas/WebauthnMfaCredentialInfo" + $ref: "#/components/schemas/AuthSuccessFlagResponse" error: type: "null" meta: @@ -52583,11 +56664,11 @@ components: - data - error additionalProperties: false - MfaWebauthnRemoveEnvelope: + ApiTokenListEnvelope: type: object properties: data: - $ref: "#/components/schemas/AuthSuccessFlagResponse" + $ref: "#/components/schemas/ApiTokenListResponse" error: type: "null" meta: @@ -52600,19 +56681,65 @@ components: - data - error additionalProperties: false - AuthSuccessFlagResponse: + ApiTokenListResponse: + type: array + items: + $ref: "#/components/schemas/ApiTokenInfo" + ApiTokenInfo: type: object properties: - success: + id: + type: string + description: Row id; the handle for DELETE. + name: + type: string + permissions: + type: array + items: + type: string + description: The token's scope list. `["*"]` is cookie-equivalent (what a native login mints); anything else is narrow + and reaches only the routes that name it. Admin endpoints are cookie-only and are reachable by no token at + any scope. + lastUsedAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: Stamped fire-and-forget on use; null for an unused token. + expiresAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + createdAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + revoked: + type: boolean + description: Revoked tokens stay in the list rather than disappearing, so a client must filter on this rather than treat + presence as validity. + mirrorToAppleHealth: type: boolean + description: "A measurement token's Apple Health setting: whether the HealthLog app writes the readings this token sent + into Apple Health. Changed with `PATCH /api/tokens/{id}`; false on every other token." required: - - success + - id + - name + - permissions + - lastUsedAt + - expiresAt + - createdAt + - revoked + - mirrorToAppleHealth additionalProperties: false - MfaWebauthnLoginOptionsEnvelope: + MeasurementTokenSummaryEnvelope: type: object properties: data: - $ref: "#/components/schemas/WebauthnOptionsResponse" + $ref: "#/components/schemas/MeasurementTokenSummaryResponse" error: type: "null" meta: @@ -52625,11 +56752,23 @@ components: - data - error additionalProperties: false - MfaWebauthnVerifyResponse: + MeasurementTokenSummaryResponse: + type: object + properties: + unattributedReadings: + type: integer + minimum: 0 + maximum: 9007199254740991 + description: "Live EXTERNAL readings that belong to no token: sent before readings were linked to their token, by an + account that held more than one. No token's Apple Health setting reaches them." + required: + - unattributedReadings + additionalProperties: false + CreateMeasurementTokenEnvelope: type: object properties: data: - $ref: "#/components/schemas/AccessRefreshBundle" + $ref: "#/components/schemas/CreateMeasurementTokenResponse" error: type: "null" meta: @@ -52642,11 +56781,31 @@ components: - data - error additionalProperties: false - PasskeyLoginVerifyResponse: + CreateMeasurementTokenResponse: + type: object + properties: + token: + type: string + description: The raw `hlk_` Bearer, RETURNED EXACTLY ONCE. It is stored only as an HMAC-SHA256 hash, so there is no way + to retrieve it later; a client that does not capture it here has to mint a replacement. Treat it as a secret + in logs, crash reports and analytics. + name: + type: string + expiresAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + required: + - token + - name + - expiresAt + additionalProperties: false + description: The one response that carries a usable measurement-ingest Bearer value. + CreateWorkoutTokenEnvelope: type: object properties: data: - $ref: "#/components/schemas/AccessRefreshBundle" + $ref: "#/components/schemas/CreateWorkoutTokenResponse" error: type: "null" meta: @@ -52659,11 +56818,30 @@ components: - data - error additionalProperties: false - RefreshResponse: + CreateWorkoutTokenResponse: + type: object + properties: + token: + type: string + description: The raw `hlk_` Bearer, RETURNED EXACTLY ONCE. It is stored only as an HMAC-SHA256 hash and cannot be + retrieved later. Treat it as a secret. + name: + type: string + expiresAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + required: + - token + - name + - expiresAt + additionalProperties: false + description: The one response that carries a usable workout-ingest Bearer value. + CreateDocumentTokenEnvelope: type: object properties: data: - $ref: "#/components/schemas/AccessRefreshBundle" + $ref: "#/components/schemas/CreateDocumentTokenResponse" error: type: "null" meta: @@ -52676,7 +56854,26 @@ components: - data - error additionalProperties: false - RefreshRevokeResponse: + CreateDocumentTokenResponse: + type: object + properties: + token: + type: string + description: The raw `hlk_` Bearer, RETURNED EXACTLY ONCE. It is stored only as an HMAC-SHA256 hash and cannot be + retrieved later. Treat it as a secret. + name: + type: string + expiresAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + required: + - token + - name + - expiresAt + additionalProperties: false + description: The one response that carries a usable document-upload Bearer value. + ApiTokenRevokeEnvelope: type: object properties: data: @@ -52699,11 +56896,11 @@ components: - data - error additionalProperties: false - PasskeyListEnvelope: + UpdateMeasurementTokenEnvelope: type: object properties: data: - $ref: "#/components/schemas/PasskeyListResponse" + $ref: "#/components/schemas/UpdateMeasurementTokenResponse" error: type: "null" meta: @@ -52716,53 +56913,22 @@ components: - data - error additionalProperties: false - PasskeyListResponse: - type: array - items: - $ref: "#/components/schemas/PasskeyInfo" - PasskeyInfo: + UpdateMeasurementTokenResponse: type: object properties: id: type: string - description: Row id; the handle for DELETE. - name: - type: string - description: User-supplied label, defaulting to “Passkey”. - credentialDeviceType: - type: string - description: "Authenticator device type as reported at registration: `singleDevice` for a credential bound to one - authenticator, `multiDevice` for a syncable one." - credentialBackedUp: + mirrorToAppleHealth: type: boolean - description: Whether the authenticator reported the credential as backed up (synced to the platform keychain) at - registration time. Not re-read afterwards. - createdAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - description: Registered at. - lastUsedAt: - anyOf: - - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - - type: "null" - description: When this passkey last completed a verified assertion; null when it has never been used to sign in. Stamped - on every successful login, so a client can render a real 'last used' rather than assuming never. required: - id - - name - - credentialDeviceType - - credentialBackedUp - - createdAt - - lastUsedAt + - mirrorToAppleHealth additionalProperties: false - SessionListEnvelope: + RegisterEnvelope: type: object properties: data: - $ref: "#/components/schemas/SessionListResponse" + $ref: "#/components/schemas/RegisteredUserResponse" error: type: "null" meta: @@ -52775,59 +56941,35 @@ components: - data - error additionalProperties: false - SessionListResponse: + RegisteredUserResponse: type: object properties: - sessions: - type: array - items: - type: object - properties: - id: - type: string - device: - type: string - description: Coarse device label derived from the User-Agent. - ipMasked: - description: IP with the host portion masked — never the full address. - type: - - string - - "null" - location: - description: Resolved coarse location, when available. - type: - - string - - "null" - lastActiveAt: - anyOf: - - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - - type: "null" - createdAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - isCurrent: - type: boolean - description: True for the session making this request. - required: - - id - - device - - ipMasked - - location - - lastActiveAt - - createdAt - - isCurrent - additionalProperties: false + user: + type: object + properties: + id: + type: string + username: + type: string + email: + type: + - string + - "null" + required: + - id + - username + - email + additionalProperties: false required: - - sessions + - user additionalProperties: false - SignOutEverywhereEnvelope: + description: The account that was created. No credential rides this response — the session arrives as a cookie, and a + native client signs in afterwards through /api/auth/login. + PasswordChangeEnvelope: type: object properties: data: - $ref: "#/components/schemas/SignOutEverywhereResponse" + $ref: "#/components/schemas/PasswordChangedResponse" error: type: "null" meta: @@ -52840,93 +56982,20 @@ components: - data - error additionalProperties: false - SignOutEverywhereResponse: + PasswordChangedResponse: type: object properties: - sessionsRevoked: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - description: Number of OTHER sessions removed (the current one is kept). - accessTokensRevoked: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - description: "Tokens revoked: the access tokens of other device logins plus every programmatic token (connector, - measurement, document), never the caller's own." - connectorsRevoked: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - description: Connected AI-assistant (MCP OAuth) connections revoked. - shareLinksRevoked: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - description: Clinician share links revoked; 0 when `keepShareLinks=1` was sent. - pendingInvitesRevoked: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - description: "Record-sharing invitations this account offered that nobody had accepted yet, now withdrawn (`revokedBy: - GRANTOR`)." - grantsKept: - type: array - items: - type: object - properties: - id: - type: string - description: The grant id, for DELETE /api/account/grants/{id}. - account: - type: object - properties: - id: - type: string - username: - type: string - displayName: - type: - - string - - "null" - required: - - id - - username - - displayName - additionalProperties: false - access: - type: string - enum: - - READ - - WRITE - - MANAGE - required: - - id - - account - - access - additionalProperties: false - description: Accepted grants this account gave that are still live. Signing out does not end them, because each is a - person the owner chose and ending one silently could cut off a carer; they are listed so a client can show - who can still read the record and offer to end each with DELETE /api/account/grants/{id}. + changed: + type: boolean + const: true required: - - sessionsRevoked - - accessTokensRevoked - - connectorsRevoked - - shareLinksRevoked - - pendingInvitesRevoked - - grantsKept + - changed additionalProperties: false - SessionRevokeEnvelope: + AuthProfileUpdateEnvelope: type: object properties: data: - type: object - properties: - revoked: - type: boolean - required: - - revoked - additionalProperties: false + $ref: "#/components/schemas/AuthProfileUpdateResponse" error: type: "null" meta: @@ -52936,14 +57005,87 @@ components: type: string additionalProperties: false required: - - data - - error + - data + - error + additionalProperties: false + AuthProfileUpdateResponse: + type: object + properties: + id: + type: string + username: + type: string + email: + type: + - string + - "null" + role: + type: string + heightCm: + type: + - number + - "null" + dateOfBirth: + type: + - string + - "null" + gender: + type: + - string + - "null" + timezone: + type: + - string + - "null" + fullName: + type: + - string + - "null" + insurerName: + type: + - string + - "null" + insurerIkNumber: + type: + - string + - "null" + hasInsuranceNumber: + type: boolean + description: Whether an insurance number is stored. The number itself is encrypted at rest and is never returned — only + its presence. + rejectedFields: + description: "Present only on a PARTIAL success: the fields that were skipped while the rest of the patch was written. A + 200 carrying this key means the save was incomplete — surface it, do not treat the response as a clean save. + `code` is the validator code for a field that failed validation, or `rate_limited` for an email-address + change that has spent the account's hourly budget; that one is not a bad value and the same address will be + accepted once the window rolls over." + type: array + items: + $ref: "#/components/schemas/ValidationIssue" + required: + - id + - username + - email + - role + - heightCm + - dateOfBirth + - gender + - timezone + - fullName + - insurerName + - insurerIkNumber + - hasInsuranceNumber additionalProperties: false - TrustedDeviceListEnvelope: + description: "The profile after the patch, as THIS path projects it. Deliberately named apart from + `ProfileUpdateResponse`: PATCH /api/user/profile runs the same handler and answers a different field set — this + one carries `id` and `role`, that one carries `displayName`, `locale`, `timeFormat`, `dateFormat` and + `moodReminderEnabled`. Neither is a superset of the other. Field-by-field either way: a bad field is dropped and + reported in `rejectedFields` rather than failing the whole request, unless EVERY supplied field was rejected." + PasskeyReauthOptionsEnvelope: type: object properties: data: - $ref: "#/components/schemas/TrustedDeviceListResponse" + $ref: "#/components/schemas/PasskeyReauthOptionsResponse" error: type: "null" meta: @@ -52956,60 +57098,31 @@ components: - data - error additionalProperties: false - TrustedDeviceListResponse: + PasskeyReauthOptionsResponse: type: object properties: - devices: - type: array - items: - type: object - properties: - id: - type: string - label: - description: Coarse, IP-free device label (e.g. 'Firefox on macOS'). - type: - - string - - "null" - createdAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - lastUsedAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - expiresAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - isCurrent: - type: boolean - description: True for the device making this request. - required: - - id - - label - - createdAt - - lastUsedAt - - expiresAt - - isCurrent - additionalProperties: false + options: + type: object + propertyNames: + type: string + additionalProperties: {} + description: SimpleWebAuthn assertion options for the re-proof ceremony. + challengeId: + type: string + reauth: + type: boolean + const: true + description: Marks this as the re-proof arm rather than the enrollment arm. Present only here. required: - - devices + - options + - challengeId + - reauth additionalProperties: false - TrustedDeviceRevokeAllEnvelope: + PasskeyRegisterOptionsEnvelope: type: object properties: data: - type: object - properties: - revoked: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - required: - - revoked - additionalProperties: false + $ref: "#/components/schemas/WebauthnOptionsResponse" error: type: "null" meta: @@ -53022,16 +57135,17 @@ components: - data - error additionalProperties: false - TrustedDeviceRevokeEnvelope: + PasskeyRegisterVerifyEnvelope: type: object properties: data: type: object properties: - revoked: + verified: type: boolean + const: true required: - - revoked + - verified additionalProperties: false error: type: "null" @@ -53045,63 +57159,11 @@ components: - data - error additionalProperties: false - SecurityActivityEnvelope: - type: object - properties: - data: - $ref: "#/components/schemas/SecurityActivityResponse" - error: - type: "null" - meta: - $ref: "#/components/schemas/ListCapMeta" - required: - - data - - error - - meta - additionalProperties: false - SecurityActivityResponse: - type: object - properties: - events: - type: array - items: - type: object - properties: - action: - type: string - description: Audit action name, e.g. auth.login.password. - createdAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - location: - type: - - string - - "null" - ipMasked: - description: Host-masked IP. - type: - - string - - "null" - carrier: - type: - - string - - "null" - required: - - action - - createdAt - - location - - ipMasked - - carrier - additionalProperties: false - required: - - events - additionalProperties: false - LogoutEnvelope: + CodexDeviceStartEnvelope: type: object properties: data: - $ref: "#/components/schemas/LogoutResponse" + $ref: "#/components/schemas/CodexDeviceStartResponse" error: type: "null" meta: @@ -53114,22 +57176,35 @@ components: - data - error additionalProperties: false - LogoutResponse: + CodexDeviceStartResponse: type: object properties: - loggedOut: - type: boolean - const: true - description: "Always true. The endpoint has no failure the caller acts on: it answers the same whether a cookie was - cleared, a token was revoked, or neither was there." + userCode: + type: string + description: Short code the person types on the verification page. + verificationUrl: + type: string + format: uri + description: Where to type it — an OpenAI-hosted page, not a HealthLog one. + intervalSeconds: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: "How often to call the poll endpoint. Honour it: the poll surface is limited to 60 calls per minute per + user." required: - - loggedOut + - userCode + - verificationUrl + - intervalSeconds additionalProperties: false - OidcStatusEnvelope: + description: The user-facing half of a device-code grant. The device-auth id that pairs with it is NOT here — it is + sealed into an encrypted, httpOnly, 15-minute cookie, so the poll can only be completed by the browser that + started the flow. + CodexDevicePollEnvelope: type: object properties: data: - $ref: "#/components/schemas/OidcStatusResponse" + $ref: "#/components/schemas/CodexDevicePollResponse" error: type: "null" meta: @@ -53142,42 +57217,30 @@ components: - data - error additionalProperties: false - OidcStatusResponse: + CodexDevicePollResponse: type: object properties: - enabled: - type: boolean - description: An OIDC provider is configured on this instance. - buttonLabel: - description: Operator-set label for the SSO button (`OIDC_BUTTON_LABEL`, defaulting to “Single Sign-On”). Null when no - provider is configured. - type: - - string - - "null" - only: - type: boolean - description: "`OIDC_ONLY=true` — password and passkey login are refused with 403 `oidc_only`. A client that offers those - controls anyway strands the user." - nativeReturnPath: - description: "The path of the native sign-in's opt-in https return, `/auth/native-return`, a fixed constant. Present - (non-null) only when SSO is configured and the instance is served over https (`NEXT_PUBLIC_APP_URL`). An app - build that carries an associated domain for this host may then start the native leg with `return=https` on - GET /api/auth/oidc/login and receive the callback on `https://` with the same - parameters the custom scheme carries. Null or absent: use the scheme. Servers before v1.48.0 omit the - field." - type: - - string - - "null" + status: + type: string + enum: + - pending + - connected + description: "`pending` while the person has not approved yet — keep polling. `connected` once the credentials are + stored; stop polling, the cookie is gone." required: - - enabled - - buttonLabel - - only + - status additionalProperties: false - RegistrationStatusEnvelope: + CodexDisconnectEnvelope: type: object properties: data: - $ref: "#/components/schemas/RegistrationStatusResponse" + type: object + properties: + disconnected: + type: boolean + required: + - disconnected + additionalProperties: false error: type: "null" meta: @@ -53190,27 +57253,11 @@ components: - data - error additionalProperties: false - RegistrationStatusResponse: - type: object - properties: - registrationEnabled: - type: boolean - description: Whether open self-registration is on. An operator who turned it off can still admit a signup through an - invite token. - sessionCookieSecure: - type: boolean - description: Whether this server issues its session cookies with the `Secure` flag (`SESSION_COOKIE_SECURE`, else on in - production). A browser on a plain `http://` page cannot keep such a cookie; the web login page compares this - with its own scheme before any credential is sent. - required: - - registrationEnabled - - sessionCookieSecure - additionalProperties: false - PasskeyLoginOptionsEnvelope: + SyncStateEnvelope: type: object properties: data: - $ref: "#/components/schemas/WebauthnOptionsResponse" + $ref: "#/components/schemas/SyncStateResponse" error: type: "null" meta: @@ -53223,28 +57270,155 @@ components: - data - error additionalProperties: false - PasskeyRenameEnvelope: + SyncStateResponse: type: object properties: - data: - $ref: "#/components/schemas/PasskeyInfo" - error: - type: "null" - meta: + userId: + type: string + timezone: + type: string + lastSyncedAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + serverNow: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + measurements: type: object properties: - requestId: - type: string + lastUpdatedAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + liveCount: + type: integer + minimum: 0 + maximum: 9007199254740991 + tombstonedCount: + type: integer + minimum: 0 + maximum: 9007199254740991 + required: + - lastUpdatedAt + - liveCount + - tombstonedCount + additionalProperties: false + mood: + type: object + properties: + lastUpdatedAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + liveCount: + type: integer + minimum: 0 + maximum: 9007199254740991 + tombstonedCount: + type: integer + minimum: 0 + maximum: 9007199254740991 + required: + - lastUpdatedAt + - liveCount + - tombstonedCount + additionalProperties: false + intakes: + type: object + properties: + lastUpdatedAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + liveCount: + type: integer + minimum: 0 + maximum: 9007199254740991 + tombstonedCount: + type: integer + minimum: 0 + maximum: 9007199254740991 + required: + - lastUpdatedAt + - liveCount + - tombstonedCount + additionalProperties: false + medications: + type: object + properties: + lastUpdatedAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: Newest write to any of the account's medication rows. A snooze, a pause and a schedule change move what is + due without touching an intake row; compare this together with `intakes` (on inequality) to know whether + the dose list is stale. + required: + - lastUpdatedAt + additionalProperties: false + description: Freshness of the medication rows the dose state derives from. + sync: + type: object + properties: + incrementalWindowDays: + type: integer + exclusiveMinimum: 0 + maximum: 9007199254740991 + description: Days an incremental delta stays valid; tracks the native refresh-token lifetime. Beyond it a device + re-pairs with a full backfill. iOS derives its window from this rather than hardcoding 60. + tombstoneRetentionDays: + type: integer + exclusiveMinimum: 0 + maximum: 9007199254740991 + description: Horizon past which tombstones may be pruned. A cursor older than this gets `cursorExpired` on + `/api/sync/changes`. + required: + - incrementalWindowDays + - tombstoneRetentionDays + additionalProperties: false + description: Sync-window metadata the client reads instead of hardcoding. + push: + type: object + properties: + receiptsRecorded: + type: boolean + description: Whether the envelope receipts of this request (`openedAlert`, `openedSilent`) were recorded. + required: + - receiptsRecorded additionalProperties: false + description: v1.49 — envelope receipts. required: - - data - - error + - userId + - timezone + - lastSyncedAt + - serverNow + - measurements + - mood + - intakes + - medications + - sync + - push additionalProperties: false - PasskeyRemoveEnvelope: + description: iOS SyncMode handshake. Reports the server-side `lastSyncedAt` checkpoint, which the batch ingest endpoints + set when a client push lands; the handshake does not move it, and writes only the envelope receipts it carries. + The cheap 'should I sync?' summary; the durable delta cursor lives on `/api/sync/changes`. + SyncChangesEnvelope: type: object properties: data: - $ref: "#/components/schemas/AuthSuccessFlagResponse" + $ref: "#/components/schemas/SyncChangesResponse" error: type: "null" meta: @@ -53257,50 +57431,238 @@ components: - data - error additionalProperties: false - ApiTokenListEnvelope: + SyncChangesResponse: type: object properties: - data: - $ref: "#/components/schemas/ApiTokenListResponse" - error: - type: "null" - meta: + serverNow: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + cursor: + description: Opaque cursor to echo into the next request. + type: + - string + - "null" + hasMore: + type: boolean + description: False once the client is caught up as of `serverNow`. Every row domain that ran dry on a page takes a + watermark two minutes before `serverNow` (on the last page of a walk, all of them), so the next pull reads + rows changed in that stretch again (a write still in flight may commit a row stamped there) and a domain + that stays quiet never ages its cursor past the tombstone horizon; upserts are idempotent. + cursorExpired: + type: boolean + description: True when the supplied cursor predates tombstone retention, or was issued before the account's data was + last restored from a backup or deleted — drop the cursor and do a clean initial sync. + changes: type: object properties: - requestId: - type: string + measurements: + type: object + properties: + upserts: + type: array + items: + $ref: "#/components/schemas/SyncMeasurementUpsert" + tombstones: + type: array + items: + $ref: "#/components/schemas/SyncMeasurementTombstone" + required: + - upserts + - tombstones + additionalProperties: false + mood: + type: object + properties: + upserts: + type: array + items: + $ref: "#/components/schemas/SyncMoodUpsert" + tombstones: + type: array + items: + $ref: "#/components/schemas/SyncMoodTombstone" + required: + - upserts + - tombstones + additionalProperties: false + intakes: + type: object + properties: + upserts: + type: array + items: + $ref: "#/components/schemas/SyncIntakeUpsert" + tombstones: + type: array + items: + $ref: "#/components/schemas/SyncIntakeTombstone" + required: + - upserts + - tombstones + additionalProperties: false + cycleDays: + type: object + properties: + upserts: + type: array + items: + $ref: "#/components/schemas/CycleDayLogDTO" + tombstones: + type: array + items: + $ref: "#/components/schemas/SyncCycleDayTombstone" + required: + - upserts + - tombstones + additionalProperties: false + description: Cycle day logs. Present on every page, empty arrays when the account has the cycle module off. + cycles: + type: object + properties: + upserts: + type: array + items: + $ref: "#/components/schemas/MenstrualCycleDTO" + tombstones: + type: array + items: + $ref: "#/components/schemas/SyncCycleTombstone" + required: + - upserts + - tombstones + additionalProperties: false + description: Menstrual cycles, observed and forward-predicted. Present on every page, empty arrays when the account has + the cycle module off. + measurementMirror: + type: object + properties: + upserts: + type: array + items: + $ref: "#/components/schemas/SyncMeasurementMirrorUpsert" + tombstones: + maxItems: 0 + type: array + items: + type: object + properties: + id: + type: string + required: + - id + additionalProperties: false + description: "Always empty: a deleted reading is a measurement tombstone." + required: + - upserts + - tombstones + additionalProperties: false + description: Apple Health write-back changes for readings that are otherwise unchanged. Apply after `measurements`. + required: + - measurements + - mood + - intakes + - cycleDays + - cycles + - measurementMirror additionalProperties: false required: - - data - - error + - serverNow + - cursor + - hasMore + - cursorExpired + - changes additionalProperties: false - ApiTokenListResponse: - type: array - items: - $ref: "#/components/schemas/ApiTokenInfo" - ApiTokenInfo: + description: "Multi-domain delta page: measurements, mood, intakes, cycle day logs, cycles, and the Apple Health + write-back changes of otherwise unchanged readings. One opaque multi-domain keyset cursor; tombstones apply + before upserts within each domain. Tombstone identity: measurements key on externalId, every other domain on + server id. All six keys are present on every response, including the `cursorExpired` short-circuit — a domain + with nothing to report sends empty arrays rather than being omitted." + SyncMeasurementUpsert: type: object properties: id: type: string - description: Row id; the handle for DELETE. - name: + description: Stored row id, or a synthetic key (`day::`, `sleep-seg::`) on the collapsed list + modes. + type: + $ref: "#/components/schemas/MeasurementType" + value: + type: number + unit: type: string - permissions: - type: array - items: - type: string - description: The token's scope list. `["*"]` is cookie-equivalent (what a native login mints); anything else is narrow - and reaches only the routes that name it. Admin endpoints are cookie-only and are reachable by no token at - any scope. - lastUsedAt: - anyOf: - - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - - type: "null" - description: Stamped fire-and-forget on use; null for an unused token. - expiresAt: + measuredAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + source: + $ref: "#/components/schemas/MeasurementSource" + notes: + type: + - string + - "null" + userId: + type: string + valueMin: + description: Bucket MINIMUM — set only on an hourly heart-rate `stats:` row. + type: + - number + - "null" + valueMax: + description: Bucket MAXIMUM — set only on an hourly heart-rate `stats:` row. + type: + - number + - "null" + externalId: + description: Cross-device dedup key (UUID string or `stats::`). + type: + - string + - "null" + externalSourceVersion: + type: + - string + - "null" + aggregationProvenance: + description: "Authority of an aggregate stored under a `stats:` identity: `HEALTHKIT_STATISTICS`, + `EXPORT_XML_SOURCE_MAX` or `LEGACY_UNKNOWN`. Null on an ordinary sample row. Decode unknown values + leniently." + type: + - string + - "null" + glucoseContext: + description: Set only on BLOOD_GLUCOSE rows, and null there too when the writer recorded no classification (a sensor + export, a device sync). Never invent one. + type: + - string + - "null" + sleepStage: + description: Set only on SLEEP_DURATION rows. + type: + - string + - "null" + rhythmClassification: + description: Device classification verdict; set only on EVENT rows. + type: + - string + - "null" + deviceType: + description: "`watch | band | ring | phone | scale | other | unknown`." + type: + - string + - "null" + timeZone: + description: IANA zone the reading was taken in, when its writer sent one; null means the profile zone. The reading's + local day is read in it. + type: + - string + - "null" + syncVersion: + type: integer + exclusiveMinimum: 0 + maximum: 9007199254740991 + description: LWW reconciliation counter; echo to keep the mirror monotonic. + deletedAt: + description: Soft-delete tombstone; null on a live row. anyOf: - type: string format: date-time @@ -53310,285 +57672,412 @@ components: type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - revoked: - type: boolean - description: Revoked tokens stay in the list rather than disappearing, so a client must filter on this rather than treat - presence as validity. - mirrorToAppleHealth: + updatedAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + appleHealthMirror: type: boolean - description: "A measurement token's Apple Health setting: whether the HealthLog app writes the readings this token sent - into Apple Health. Changed with `PATCH /api/tokens/{id}`; false on every other token." - required: - - id - - name - - permissions - - lastUsedAt - - expiresAt - - createdAt - - revoked - - mirrorToAppleHealth - additionalProperties: false - MeasurementTokenSummaryEnvelope: - type: object - properties: - data: - $ref: "#/components/schemas/MeasurementTokenSummaryResponse" - error: - type: "null" - meta: - type: object - properties: - requestId: - type: string - additionalProperties: false - required: - - data - - error - additionalProperties: false - MeasurementTokenSummaryResponse: - type: object - properties: - unattributedReadings: + description: Whether the HealthLog app writes this reading into Apple Health. Server-resolved; mirror exactly the rows + that say true. + dayKey: + type: string + sampleCount: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + mainAsleepMinutes: + description: The main night's own time asleep in minutes; null on a day of naps alone. On a sleep row `value` is the + day's total, the main night plus its naps. + anyOf: + - type: integer + minimum: 0 + maximum: 9007199254740991 + - type: "null" + napCount: + description: Naps on the same wake day. type: integer minimum: 0 maximum: 9007199254740991 - description: "Live EXTERNAL readings that belong to no token: sent before readings were linked to their token, by an - account that held more than one. No token's Apple Health setting reaches them." - required: - - unattributedReadings - additionalProperties: false - CreateMeasurementTokenEnvelope: - type: object - properties: - data: - $ref: "#/components/schemas/CreateMeasurementTokenResponse" - error: - type: "null" - meta: + napAsleepMinutes: + description: Time asleep across those naps, in minutes. + type: number + minimum: 0 + sleepStages: + description: The main night's minutes per stage (`IN_BED`, `ASLEEP`, `AWAKE`, `CORE`, `DEEP`, `REM`), each the union of + that stage's spans; empty on a day of naps alone. type: object - properties: - requestId: - type: string - additionalProperties: false + propertyNames: + type: string + additionalProperties: + type: number + minimum: 0 + inBedMinutes: + description: The main night's time in bed in minutes, or null when no in-bed span was recorded. + anyOf: + - type: number + minimum: 0 + - type: "null" + awakeMinutes: + description: The main night's time awake in bed in minutes, or null when no awake span was recorded. + anyOf: + - type: number + minimum: 0 + - type: "null" + awakenings: + description: Awake spans between the main night's first and last time asleep. + type: integer + minimum: 0 + maximum: 9007199254740991 required: - - data - - error + - id + - type + - value + - unit + - measuredAt + - source + - externalId + - syncVersion + - updatedAt + - appleHealthMirror additionalProperties: false - CreateMeasurementTokenResponse: + MeasurementSource: + type: string + enum: + - MANUAL + - WITHINGS + - IMPORT + - APPLE_HEALTH + - COMPUTED + - WHOOP + - FITBIT + - NIGHTSCOUT + - POLAR + - OURA + - TELEGRAM + - MCP + - GOOGLE_HEALTH + - STRAVA + - EXTERNAL + - HEALTH_CONNECT + - GARMIN + description: Origin of the measurement. v1.4.23 added APPLE_HEALTH for the iOS HealthKit batch ingest path. v1.38.x + added EXTERNAL for rows pushed in under a narrow `measurements:write` Bearer — a scale, a watch bridge, a + home-automation rule — and workouts pushed in under a narrow `workouts:write` Bearer carry it too. No client may + name that value on a write; the server resolves it from the credential. + SyncMeasurementTombstone: type: object properties: - token: + id: type: string - description: The raw `hlk_` Bearer, RETURNED EXACTLY ONCE. It is stored only as an HMAC-SHA256 hash, so there is no way - to retrieve it later; a client that does not capture it here has to mint a replacement. Treat it as a secret - in logs, crash reports and analytics. - name: + externalId: + description: The identity key the client dedups on for measurements. + type: + - string + - "null" + syncVersion: + type: integer + exclusiveMinimum: 0 + maximum: 9007199254740991 + deletedAt: type: string - expiresAt: + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + updatedAt: type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ required: - - token - - name - - expiresAt - additionalProperties: false - description: The one response that carries a usable measurement-ingest Bearer value. - CreateWorkoutTokenEnvelope: - type: object - properties: - data: - $ref: "#/components/schemas/CreateWorkoutTokenResponse" - error: - type: "null" - meta: - type: object - properties: - requestId: - type: string - additionalProperties: false - required: - - data - - error + - id + - externalId + - syncVersion + - deletedAt + - updatedAt additionalProperties: false - CreateWorkoutTokenResponse: + description: A soft-deleted measurement. Apply tombstones BEFORE upserts within a page to avoid resurrecting a row. + Since v1.42 only deletions a person makes appear here; the nightly fold that condenses raw samples into `stats:` + rows deletes them outright and lists nothing. + SyncMoodUpsert: type: object properties: - token: + id: type: string - description: The raw `hlk_` Bearer, RETURNED EXACTLY ONCE. It is stored only as an HMAC-SHA256 hash and cannot be - retrieved later. Treat it as a secret. - name: + date: type: string - expiresAt: + description: YYYY-MM-DD anchored to the row's `tz`. + mood: + type: string + score: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: The legacy 1-5 axis. Unchanged. + a1: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + description: Pleasantness, 0-10. Server-derived from `mood` on every write, so this is populated even for rows a client + posted without it. Consume the value; do not re-derive it. + a2: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + description: "Stress, 0-10, INVERSE-oriented: a higher value is more stress. NULL when nobody answered it." + a3: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + description: Energy, 0-10, or null. + a4: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + description: Connectedness, 0-10, or null. + a5: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + description: Stability, 0-10, or null. + context: + anyOf: + - $ref: "#/components/schemas/MoodContextOutput" + - type: "null" + description: The day's context, or null when the entry carries none. Null and an object of nulls are different answers. + tags: + description: JSON array of tag keys, or null. + type: + - string + - "null" + note: + type: + - string + - "null" + moodLoggedAt: type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - required: - - token - - name - - expiresAt - additionalProperties: false - description: The one response that carries a usable workout-ingest Bearer value. - CreateDocumentTokenEnvelope: - type: object - properties: - data: - $ref: "#/components/schemas/CreateDocumentTokenResponse" - error: - type: "null" - meta: - type: object - properties: - requestId: - type: string - additionalProperties: false - required: - - data - - error - additionalProperties: false - CreateDocumentTokenResponse: - type: object - properties: - token: - type: string - description: The raw `hlk_` Bearer, RETURNED EXACTLY ONCE. It is stored only as an HMAC-SHA256 hash and cannot be - retrieved later. Treat it as a secret. - name: + source: type: string - expiresAt: + syncVersion: + type: integer + minimum: 0 + maximum: 9007199254740991 + description: LWW reconciliation counter; mood is last-writer-wins by it. + updatedAt: type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ required: - - token - - name - - expiresAt - additionalProperties: false - description: The one response that carries a usable document-upload Bearer value. - ApiTokenRevokeEnvelope: - type: object - properties: - data: - type: object - properties: - revoked: - type: boolean - required: - - revoked - additionalProperties: false - error: - type: "null" - meta: - type: object - properties: - requestId: - type: string - additionalProperties: false - required: - - data - - error + - id + - date + - mood + - score + - a1 + - a2 + - a3 + - a4 + - a5 + - context + - tags + - note + - moodLoggedAt + - source + - syncVersion + - updatedAt additionalProperties: false - UpdateMeasurementTokenEnvelope: + SyncMoodTombstone: type: object properties: - data: - $ref: "#/components/schemas/UpdateMeasurementTokenResponse" - error: - type: "null" - meta: - type: object - properties: - requestId: - type: string - additionalProperties: false + id: + type: string + description: Server id — the identity key the client dedups on for mood. + syncVersion: + type: integer + minimum: 0 + maximum: 9007199254740991 + deletedAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + updatedAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ required: - - data - - error + - id + - syncVersion + - deletedAt + - updatedAt additionalProperties: false - UpdateMeasurementTokenResponse: + description: A soft-deleted mood entry, keyed on server `id`. Apply before upserts within the domain page. + SyncIntakeUpsert: type: object properties: id: type: string - mirrorToAppleHealth: + medicationId: + type: string + scheduledFor: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + takenAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + skipped: + type: boolean + source: + type: string + autoRecorded: type: boolean + description: v1.42.2 — the server recorded this dose because the medication has `autoMarkTaken` on. Counts as taken. + syncVersion: + type: integer + minimum: 0 + maximum: 9007199254740991 + description: Reconciliation counter. An intake is immutable; a correction is a tombstone + re-insert. + updatedAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ required: - id - - mirrorToAppleHealth + - medicationId + - scheduledFor + - takenAt + - skipped + - source + - autoRecorded + - syncVersion + - updatedAt additionalProperties: false - RegisterEnvelope: + SyncIntakeTombstone: type: object properties: - data: - $ref: "#/components/schemas/RegisteredUserResponse" - error: - type: "null" - meta: - type: object - properties: - requestId: - type: string - additionalProperties: false + id: + type: string + description: Server id — the identity key the client dedups on for intakes. + syncVersion: + type: integer + minimum: 0 + maximum: 9007199254740991 + deletedAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + updatedAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + externalId: + description: "Since v1.49.0: the HealthKit dose-event UUID the dose recorded, null for a dose not from Apple Health. + Lets a client match a deleted dose to its Apple Health record without holding the server id. Informational: + `POST /api/medications/intake/bulk` already refuses the re-post of a dose the person deleted in HealthLog + (`skipped`, `deleted_in_healthlog`), and takes one the phone reported deleted in Apple Health." + type: + - string + - "null" + source: + type: string + description: "Since v1.49.0: the row's `source`, as on the upsert. A dose from Apple Health that landed on a pending + slot row keeps that row's source (`REMINDER`), so `externalId`, not `source`, says whether it came from + Apple Health." required: - - data - - error + - id + - syncVersion + - deletedAt + - updatedAt + - externalId + - source additionalProperties: false - RegisteredUserResponse: + description: A soft-deleted medication intake, keyed on server `id`. Apply before upserts within the domain page. + SyncCycleDayTombstone: type: object properties: - user: - type: object - properties: - id: - type: string - username: - type: string - email: - type: - - string - - "null" - required: - - id - - username - - email - additionalProperties: false + id: + type: string + externalId: + description: The client's own key for the day log, when it set one. + type: + - string + - "null" + syncVersion: + type: integer + minimum: 0 + maximum: 9007199254740991 + deletedAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + updatedAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ required: - - user + - id + - externalId + - syncVersion + - deletedAt + - updatedAt additionalProperties: false - description: The account that was created. No credential rides this response — the session arrives as a cookie, and a - native client signs in afterwards through /api/auth/login. - PasswordChangeEnvelope: + description: A soft-deleted cycle day log, keyed on server `id`. Apply before upserts within the domain page. + SyncCycleTombstone: type: object properties: - data: - $ref: "#/components/schemas/PasswordChangedResponse" - error: - type: "null" - meta: - type: object - properties: - requestId: - type: string - additionalProperties: false + id: + type: string + syncVersion: + type: integer + minimum: 0 + maximum: 9007199254740991 + deletedAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + updatedAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ required: - - data - - error + - id + - syncVersion + - deletedAt + - updatedAt additionalProperties: false - PasswordChangedResponse: + description: A soft-deleted menstrual cycle, keyed on server `id`. Apply before upserts within the domain page. + SyncMeasurementMirrorUpsert: type: object properties: - changed: + id: + type: string + description: The measurement's server id. + appleHealthMirror: type: boolean - const: true + description: The reading's write-back as it now stands. False means stop writing it; samples already in Apple Health stay. required: - - changed + - id + - appleHealthMirror additionalProperties: false - AuthProfileUpdateEnvelope: + description: A reading whose `appleHealthMirror` changed because the account switched the Apple Health setting of the + token that sent it. The reading itself did not change and is not re-sent in `measurements`. + GetBloodPressureTimeOfDayResponse: type: object properties: data: - $ref: "#/components/schemas/AuthProfileUpdateResponse" + $ref: "#/components/schemas/BloodPressureTimeOfDay" error: type: "null" meta: @@ -53601,145 +58090,138 @@ components: - data - error additionalProperties: false - AuthProfileUpdateResponse: + BloodPressureTimeOfDay: type: object properties: - id: + days: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: The window asked for, in local days. + from: type: string - username: + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + description: Window start (ISO-8601). + to: type: string - email: - type: - - string - - "null" - role: + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + description: "Window end: the last instant of today in the record's time zone." + timeZone: type: string - heightCm: - type: - - number - - "null" - dateOfBirth: - type: - - string - - "null" - gender: - type: - - string - - "null" - timezone: - type: - - string - - "null" - fullName: - type: - - string - - "null" - insurerName: - type: - - string - - "null" - insurerIkNumber: - type: - - string - - "null" - hasInsuranceNumber: - type: boolean - description: Whether an insurance number is stored. The number itself is encrypted at rest and is never returned — only - its presence. - rejectedFields: - description: "Present only on a PARTIAL success: the fields that were skipped while the rest of the patch was written. A - 200 carrying this key means the save was incomplete — surface it, do not treat the response as a clean save. - `code` is the validator code for a field that failed validation, or `rate_limited` for an email-address - change that has spent the account's hourly budget; that one is not a bad value and the same address will be - accepted once the window rolls over." + description: IANA zone the hours were read in (the record's own). + minReadings: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: Readings a part needs before its mean is given. + readingCount: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: Paired readings in the window, across the three parts. + parts: type: array items: - $ref: "#/components/schemas/ValidationIssue" - required: - - id - - username - - email - - role - - heightCm - - dateOfBirth - - gender - - timezone - - fullName - - insurerName - - insurerIkNumber - - hasInsuranceNumber - additionalProperties: false - description: "The profile after the patch, as THIS path projects it. Deliberately named apart from - `ProfileUpdateResponse`: PATCH /api/user/profile runs the same handler and answers a different field set — this - one carries `id` and `role`, that one carries `displayName`, `locale`, `timeFormat`, `dateFormat` and - `moodReminderEnabled`. Neither is a superset of the other. Field-by-field either way: a bad field is dropped and - reported in `rejectedFields` rather than failing the whole request, unless EVERY supplied field was rejected." - PasskeyReauthOptionsEnvelope: - type: object - properties: - data: - $ref: "#/components/schemas/PasskeyReauthOptionsResponse" - error: - type: "null" - meta: - type: object - properties: - requestId: - type: string - additionalProperties: false + $ref: "#/components/schemas/BloodPressurePartOfDay" + description: "Always three entries: morning, midday, evening, in order." + morningEveningDifference: + anyOf: + - type: object + properties: + systolic: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + diastolic: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + required: + - systolic + - diastolic + additionalProperties: false + - type: "null" + description: Morning mean minus evening mean, from the two whole-mmHg means given above (so it equals their difference + exactly). Null unless both parts reach `minReadings`. required: - - data - - error + - days + - from + - to + - timeZone + - minReadings + - readingCount + - parts + - morningEveningDifference additionalProperties: false - PasskeyReauthOptionsResponse: + BloodPressurePartOfDay: type: object properties: - options: - type: object - propertyNames: - type: string - additionalProperties: {} - description: SimpleWebAuthn assertion options for the re-proof ceremony. - challengeId: + part: type: string - reauth: - type: boolean - const: true - description: Marks this as the re-proof arm rather than the enrollment arm. Present only here. - required: - - options - - challengeId - - reauth - additionalProperties: false - PasskeyRegisterOptionsEnvelope: - type: object - properties: - data: - $ref: "#/components/schemas/WebauthnOptionsResponse" - error: - type: "null" - meta: - type: object - properties: - requestId: - type: string - additionalProperties: false + enum: + - morning + - midday + - evening + description: The part of the day. + startHour: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: First local hour of the part (inclusive). + endHour: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: "Local hour the part ends at (exclusive). Smaller than `startHour` when the part runs past midnight + (evening: 18 to 4)." + readingCount: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: Paired systolic/diastolic readings in this part. + systolic: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + description: Mean systolic in whole mmHg; null while `readingCount` is below `minReadings`. + diastolic: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + description: Mean diastolic in whole mmHg; null on the same floor. + pulseReadingCount: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: Readings in this part that carried a pulse (same source, within five minutes). + pulse: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + description: Mean pulse in whole bpm; null while `pulseReadingCount` is below `minReadings`. required: - - data - - error + - part + - startHour + - endHour + - readingCount + - systolic + - diastolic + - pulseReadingCount + - pulse additionalProperties: false - PasskeyRegisterVerifyEnvelope: + GetMeasurementsSeriesBatchResponse: type: object properties: data: - type: object - properties: - verified: - type: boolean - const: true - required: - - verified - additionalProperties: false + $ref: "#/components/schemas/MeasurementsSeriesBatchResponse" error: type: "null" meta: @@ -53752,52 +58234,62 @@ components: - data - error additionalProperties: false - CodexDeviceStartEnvelope: + MeasurementsSeriesBatchResponse: type: object properties: - data: - $ref: "#/components/schemas/CodexDeviceStartResponse" - error: - type: "null" - meta: + series: type: object - properties: - requestId: - type: string - additionalProperties: false - required: - - data - - error - additionalProperties: false - CodexDeviceStartResponse: - type: object - properties: - userCode: - type: string - description: Short code the person types on the verification page. - verificationUrl: - type: string - format: uri - description: Where to type it — an OpenAI-hosted page, not a HealthLog one. - intervalSeconds: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - description: "How often to call the poll endpoint. Honour it: the poll surface is limited to 60 calls per minute per - user." - required: - - userCode - - verificationUrl - - intervalSeconds - additionalProperties: false - description: The user-facing half of a device-code grant. The device-auth id that pairs with it is NOT here — it is - sealed into an encrypted, httpOnly, 15-minute cookie, so the poll can only be completed by the browser that - started the flow. - CodexDevicePollEnvelope: + propertyNames: + $ref: "#/components/schemas/MeasurementType" + additionalProperties: + type: array + items: + type: object + properties: + type: + $ref: "#/components/schemas/MeasurementType" + value: + type: number + description: "The day's mean (spot metrics) or total (cumulative). A row of a coarser tier (a window longer than the + daily cap) carries the average day of its bucket, the same quantity: a spot metric's mean of its + daily means, a cumulative metric's total over the days of the bucket that hold a reading." + measuredAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + description: "Day-bucket start (ISO-8601): the user's local midnight. A window longer than the daily cap is served from + a coarser tier (a UTC day, week or month); its rows are stamped at noon UTC of the bucket's first + day, which falls inside the bucket's own week or month in every zone." + count: + description: Underlying raw-row count for the bucket. + type: integer + minimum: 0 + maximum: 9007199254740991 + minValue: + description: Per-day minimum (spot metrics only; absent for cumulative). + type: + - number + - "null" + maxValue: + description: Per-day maximum (spot metrics only; absent for cumulative). + type: + - number + - "null" + required: + - type + - value + - measuredAt + additionalProperties: false + description: Per-type daily series, keyed by MeasurementType. Only the requested types are present. + required: + - series + additionalProperties: false + description: Batched daily series — one rollup-backed series per requested type. + GetMeasurementsSeriesResponse: type: object properties: data: - $ref: "#/components/schemas/CodexDevicePollResponse" + $ref: "#/components/schemas/MeasurementsSeriesResponse" error: type: "null" meta: @@ -53810,340 +58302,295 @@ components: - data - error additionalProperties: false - CodexDevicePollResponse: + MeasurementsSeriesResponse: type: object properties: - status: + kind: type: string enum: - - pending - - connected - description: "`pending` while the person has not approved yet — keep polling. `connected` once the credentials are - stored; stop polling, the cookie is gone." - required: - - status - additionalProperties: false - CodexDisconnectEnvelope: - type: object - properties: - data: + - weight + - bloodPressure + - pulse + - bodyFat + - glucose + - sleep + - steps + - totalBodyWater + - boneMass + - oxygenSaturation + - restingHeartRate + - heartRateVariability + - vo2Max + - ketones + - glucoseKetoneIndex + unit: + type: string + description: Resolved unit token for `value`. `glucose` follows the user's mg/dL|mmol/L preference; `sleep` is `h` + (per-night time-asleep in hours); `ketones` is `mmol/L`; `glucoseKetoneIndex` is `ratio`. + points: + type: array + items: + type: object + properties: + id: + type: string + description: Measurement row id; `sleep:` for a sleep night; `day:` for a day bucket (`pulse`, + `glucose`, `heartRateVariability`, `oxygenSaturation` beyond 90 days); `hour:` for an hour + bucket (the same kinds within 90 days when the window holds more than 10 000 readings). + at: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + description: Point timestamp (ISO-8601). + value: + type: number + description: Primary value in the top-level `unit`. + secondary: + description: Diastolic value for `kind=bloodPressure` (paired within ±5 min); null for every other kind. + type: + - number + - "null" + sleepStages: + description: Per-stage hours for a `kind=sleep` night (CORE/DEEP/REM/…); null/absent for non-sleep kinds. + anyOf: + - type: object + propertyNames: + type: string + additionalProperties: + type: number + - type: "null" + valueMin: + description: "v1.19.2 (iOS #34 extension) — per-point MINIMUM for `kind=pulse`. On an aggregated hourly heart-rate + bucket `value` is the hour's average and this is the hour's low; null on a per-sample PULSE row and + absent for every other kind." + type: + - number + - "null" + valueMax: + description: "v1.19.2 (iOS #34 extension) — per-point MAXIMUM for `kind=pulse`. On an aggregated hourly heart-rate + bucket `value` is the hour's average and this is the hour's high; null on a per-sample PULSE row and + absent for every other kind." + type: + - number + - "null" + gki: + description: "#1367 — for `kind=glucoseKetoneIndex` only: the readings the index was computed from. `id` and `at` are + the ketone reading's. Absent for every other kind." + type: object + properties: + glucoseId: + type: string + description: The paired glucose reading's id. + glucoseAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + description: The paired glucose reading's timestamp. + glucoseMmol: + type: number + description: The paired glucose in mmol/L, one decimal. + ketonesMmol: + type: number + description: The ketone reading (beta-hydroxybutyrate), mmol/L. + required: + - glucoseId + - glucoseAt + - glucoseMmol + - ketonesMmol + additionalProperties: false + required: + - id + - at + - value + - secondary + additionalProperties: false + stats: type: object properties: - disconnected: - type: boolean + mean: + type: number + min: + type: number + max: + type: number + stdDev: + type: number + count: + type: integer + minimum: 0 + maximum: 9007199254740991 required: - - disconnected - additionalProperties: false - error: - type: "null" - meta: - type: object - properties: - requestId: - type: string - additionalProperties: false - required: - - data - - error - additionalProperties: false - SyncStateEnvelope: - type: object - properties: - data: - $ref: "#/components/schemas/SyncStateResponse" - error: - type: "null" - meta: - type: object - properties: - requestId: - type: string + - mean + - min + - max + - stdDev + - count additionalProperties: false + description: Summary over the returned points; all-zero when empty. + direction: + description: v1.43 — which way a change of this metric counts. + anyOf: + - $ref: "#/components/schemas/TrendVerdict" + - type: "null" + change: + description: v1.43 — first and last day value; null under two days. + anyOf: + - $ref: "#/components/schemas/SeriesChange" + - type: "null" + referenceLines: + description: v1.43 — lines to draw; empty when there is nothing to draw. + type: array + items: + $ref: "#/components/schemas/SeriesReferenceLine" required: - - data - - error + - kind + - unit + - points + - stats additionalProperties: false - SyncStateResponse: + description: "iOS-friendly per-kind time series: one point per reading (or per reconstructed night for `sleep`), an + explicit `unit` token, and a summary `stats` block. Sample-dense kinds (`pulse`, `glucose`, + `heartRateVariability`, `oxygenSaturation`) are bucketed server-side: beyond 90 days per local day, and within + 90 days per local hour when the window holds more than 10 000 readings (a continuous glucose sensor, a watch or + ring recording every minute; a cuff, a fingerstick meter or a few readings a night stay raw). A bucket carries + the mean as `value` and otherwise has the shape of a reading of its kind; a `pulse` bucket also carries its + range as `valueMin` / `valueMax`, and a `glucose` bucket is converted to the user's unit like a raw reading. + `stats` is always computed over the underlying readings, never over the buckets. `glucoseKetoneIndex` (#1367) is + derived at read time, never stored: one point per ketone reading above zero that has a glucose reading at the + same instant or, failing that, the nearest one within 15 minutes either side; value = glucose (mmol/L, from + mg/dL by 18.0182) / ketones (mmol/L), one decimal. Draw it as given; do not recompute it." + TrendVerdict: type: object properties: - userId: - type: string - timezone: + direction: type: string - lastSyncedAt: + enum: + - up-good + - up-bad + - neutral + - hold + description: "How a change counts: `up-good` a rise is progress, `up-bad` a fall is progress, `hold` staying is progress + and a move either way is no setback, `neutral` no judgement. `hold` covers a value inside its band, a blood + pressure, resting pulse or body fat below a profile-default band (a default's lower edge is no goal; below + the person's own target a rise stays `up-good`), and steps or oxygen saturation above their band (more is + never worse)." + targetPosition: anyOf: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + enum: + - below + - inside + - above - type: "null" - serverNow: + description: Where the value sits against the band; null without one. + basis: type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - measurements: - type: object - properties: - lastUpdatedAt: - anyOf: - - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - - type: "null" - liveCount: - type: integer - minimum: 0 - maximum: 9007199254740991 - tombstonedCount: - type: integer - minimum: 0 - maximum: 9007199254740991 - required: - - lastUpdatedAt - - liveCount - - tombstonedCount - additionalProperties: false - mood: - type: object - properties: - lastUpdatedAt: - anyOf: - - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - - type: "null" - liveCount: - type: integer - minimum: 0 - maximum: 9007199254740991 - tombstonedCount: - type: integer - minimum: 0 - maximum: 9007199254740991 - required: - - lastUpdatedAt - - liveCount - - tombstonedCount - additionalProperties: false - intakes: - type: object - properties: - lastUpdatedAt: - anyOf: - - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - - type: "null" - liveCount: - type: integer - minimum: 0 - maximum: 9007199254740991 - tombstonedCount: - type: integer - minimum: 0 - maximum: 9007199254740991 - required: - - lastUpdatedAt - - liveCount - - tombstonedCount - additionalProperties: false - sync: - type: object - properties: - incrementalWindowDays: - type: integer - exclusiveMinimum: 0 - maximum: 9007199254740991 - description: Days an incremental delta stays valid; tracks the native refresh-token lifetime. Beyond it a device - re-pairs with a full backfill. iOS derives its window from this rather than hardcoding 60. - tombstoneRetentionDays: - type: integer - exclusiveMinimum: 0 - maximum: 9007199254740991 - description: Horizon past which tombstones may be pruned. A cursor older than this gets `cursorExpired` on - `/api/sync/changes`. - required: - - incrementalWindowDays - - tombstoneRetentionDays - additionalProperties: false - description: Sync-window metadata the client reads instead of hardcoding. + enum: + - personal_target + - profile_default + - metric_default + description: "What the verdict was judged against: the person's own target, a profile-derived default (e.g. the + age-based blood pressure target), or the metric's default direction." required: - - userId - - timezone - - lastSyncedAt - - serverNow - - measurements - - mood - - intakes - - sync + - direction + - targetPosition + - basis additionalProperties: false - description: iOS SyncMode handshake. Reports the server-side `lastSyncedAt` checkpoint, which the batch ingest endpoints - set when a client push lands; the handshake itself writes nothing. The cheap 'should I sync?' summary; the - durable delta cursor lives on `/api/sync/changes`. - SyncChangesEnvelope: + description: Which way a change of a metric counts as progress for this person. The generalisation of `tiles.weightTrend`. + SeriesChange: type: object properties: - data: - $ref: "#/components/schemas/SyncChangesResponse" - error: - type: "null" - meta: - type: object - properties: - requestId: - type: string - additionalProperties: false + from: + type: number + to: + type: number + delta: + type: number + sentiment: + $ref: "#/components/schemas/TrendSentiment" required: - - data - - error + - from + - to + - delta + - sentiment additionalProperties: false - SyncChangesResponse: + description: First and last day value in the window (by the metric's day statistic) and how the change counts. Null + under two days. + TrendSentiment: + type: string + enum: + - positive + - negative + - neutral + description: The verdict applied to one delivered change, with the noise floor applied. Colour the change from this. + SeriesReferenceLine: type: object properties: - serverNow: + value: + type: number + description: In the unit of the response. + kind: type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - cursor: - description: Opaque cursor to echo into the next request. - type: - - string - - "null" - hasMore: - type: boolean - description: False once the client is caught up as of `serverNow`. Every row domain that ran dry on a page takes a - watermark two minutes before `serverNow` (on the last page of a walk, all of them), so the next pull reads - rows changed in that stretch again (a write still in flight may commit a row stamped there) and a domain - that stays quiet never ages its cursor past the tombstone horizon; upserts are idempotent. - cursorExpired: - type: boolean - description: True when the supplied cursor predates tombstone retention, or was issued before the account's data was - last restored from a backup or deleted — drop the cursor and do a clean initial sync. - changes: - type: object - properties: - measurements: - type: object - properties: - upserts: - type: array - items: - $ref: "#/components/schemas/SyncMeasurementUpsert" - tombstones: - type: array - items: - $ref: "#/components/schemas/SyncMeasurementTombstone" - required: - - upserts - - tombstones - additionalProperties: false - mood: - type: object - properties: - upserts: - type: array - items: - $ref: "#/components/schemas/SyncMoodUpsert" - tombstones: - type: array - items: - $ref: "#/components/schemas/SyncMoodTombstone" - required: - - upserts - - tombstones - additionalProperties: false - intakes: - type: object - properties: - upserts: - type: array - items: - $ref: "#/components/schemas/SyncIntakeUpsert" - tombstones: - type: array - items: - $ref: "#/components/schemas/SyncIntakeTombstone" - required: - - upserts - - tombstones - additionalProperties: false - cycleDays: - type: object - properties: - upserts: - type: array - items: - $ref: "#/components/schemas/CycleDayLogDTO" - tombstones: - type: array - items: - $ref: "#/components/schemas/SyncCycleDayTombstone" - required: - - upserts - - tombstones - additionalProperties: false - description: Cycle day logs. Present on every page, empty arrays when the account has the cycle module off. - cycles: - type: object - properties: - upserts: - type: array - items: - $ref: "#/components/schemas/MenstrualCycleDTO" - tombstones: - type: array - items: - $ref: "#/components/schemas/SyncCycleTombstone" - required: - - upserts - - tombstones - additionalProperties: false - description: Menstrual cycles, observed and forward-predicted. Present on every page, empty arrays when the account has - the cycle module off. - measurementMirror: - type: object - properties: - upserts: - type: array - items: - $ref: "#/components/schemas/SyncMeasurementMirrorUpsert" - tombstones: - maxItems: 0 - type: array - items: - type: object - properties: - id: - type: string - required: - - id - additionalProperties: false - description: "Always empty: a deleted reading is a measurement tombstone." - required: - - upserts - - tombstones - additionalProperties: false - description: Apple Health write-back changes for readings that are otherwise unchanged. Apply after `measurements`. + enum: + - lower + - upper + source: + type: string + enum: + - personal + - clinical + appliesTo: + type: string + enum: + - value + - secondary + description: "`secondary` is the diastolic value of a blood pressure." + labelKey: + type: string + label: + type: string + description: In the account language. + required: + - value + - kind + - source + - appliesTo + - labelKey + - label + additionalProperties: false + description: A horizontal line to draw on the chart. A personal line replaces the clinical one for the same edge. Empty + list when there is nothing to draw. + ListMeasurementsResponse: + type: object + properties: + data: + type: object + properties: + measurements: + type: array + items: + anyOf: + - $ref: "#/components/schemas/MeasurementResource" + - $ref: "#/components/schemas/AggregatedMeasurementBucket" + meta: + $ref: "#/components/schemas/ListMeasurementsMeta" required: - measurements - - mood - - intakes - - cycleDays - - cycles - - measurementMirror + - meta + additionalProperties: false + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string additionalProperties: false required: - - serverNow - - cursor - - hasMore - - cursorExpired - - changes + - data + - error additionalProperties: false - description: "Multi-domain delta page: measurements, mood, intakes, cycle day logs, cycles, and the Apple Health - write-back changes of otherwise unchanged readings. One opaque multi-domain keyset cursor; tombstones apply - before upserts within each domain. Tombstone identity: measurements key on externalId, every other domain on - server id. All six keys are present on every response, including the `cursorExpired` short-circuit — a domain - with nothing to report sends empty arrays rather than being omitted." - SyncMeasurementUpsert: + MeasurementResource: type: object properties: id: @@ -54179,7 +58626,7 @@ components: - number - "null" externalId: - description: Cross-device dedup key (UUID string or `stats::`). + description: External-system dedup key; null for manual entries. type: - string - "null" @@ -54215,11 +58662,17 @@ components: type: - string - "null" + timeZone: + description: IANA zone the reading was taken in, when its writer sent one; null means the profile zone. The reading's + local day is read in it. + type: + - string + - "null" syncVersion: + description: Bumped on every server-side mutation; the last-writer-wins input for cross-device reconciliation. type: integer - exclusiveMinimum: 0 + minimum: -9007199254740991 maximum: 9007199254740991 - description: LWW reconciliation counter; echo to keep the mirror monotonic. deletedAt: description: Soft-delete tombstone; null on a live row. anyOf: @@ -54236,9 +58689,10 @@ components: format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ appleHealthMirror: + description: "Whether the HealthLog app writes this reading into Apple Health. Resolved by the server on every stored + row: true for WITHINGS, IMPORT and MANUAL, for an EXTERNAL row whatever its account chose for the token that + sent it, false otherwise. Absent on the synthesised list rows." type: boolean - description: Whether the HealthLog app writes this reading into Apple Health. Server-resolved; mirror exactly the rows - that say true. dayKey: type: string sampleCount: @@ -54295,50 +58749,197 @@ components: - unit - measuredAt - source - - externalId - - syncVersion - - updatedAt - - appleHealthMirror additionalProperties: false - MeasurementSource: - type: string - enum: - - MANUAL - - WITHINGS - - IMPORT - - APPLE_HEALTH - - COMPUTED - - WHOOP - - FITBIT - - NIGHTSCOUT - - POLAR - - OURA - - TELEGRAM - - MCP - - GOOGLE_HEALTH - - STRAVA - - EXTERNAL - - HEALTH_CONNECT - - GARMIN - description: Origin of the measurement. v1.4.23 added APPLE_HEALTH for the iOS HealthKit batch ingest path. v1.38.x - added EXTERNAL for rows pushed in under a narrow `measurements:write` Bearer — a scale, a watch bridge, a - home-automation rule — and workouts pushed in under a narrow `workouts:write` Bearer carry it too. No client may - name that value on a write; the server resolves it from the credential. - SyncMeasurementTombstone: + description: Server-shaped measurement row. GET endpoints return the whole stored row with the decrypted note on `notes` + and the `notesEncrypted` ciphertext stripped; the collapsed list modes synthesise rows carrying the display + fields plus `dayKey` / `sampleCount`. + AggregatedMeasurementBucket: + type: object + properties: + type: + $ref: "#/components/schemas/MeasurementType" + value: + type: number + description: The bucket's aggregated value. + measuredAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + description: Bucket start. + count: + type: integer + minimum: 0 + maximum: 9007199254740991 + minValue: + description: The lowest reading in the bucket; absent on a summed (cumulative) type. + type: + - number + - "null" + maxValue: + description: The highest reading in the bucket; absent on a summed (cumulative) type. + type: + - number + - "null" + unit: + type: string + required: + - type + - value + - measuredAt + additionalProperties: false + description: Pre-folded bucket returned by the `aggregate=` list modes instead of a stored row. + ListMeasurementsMeta: + type: object + properties: + total: + type: integer + minimum: 0 + maximum: 9007199254740991 + limit: + type: integer + minimum: 0 + maximum: 9007199254740991 + offset: + type: integer + minimum: 0 + maximum: 9007199254740991 + dayKey: + description: Echoed on the per-sample drill-down modes. + type: string + groupBy: + description: Set on the collapsed day-sum / per-night modes. + type: string + enum: + - day + - night + aggregate: + description: Set on the aggregate modes — the requested grain. + type: string + partOfDay: + description: Echoed when the series was narrowed with `partOfDay`. + type: string + enum: + - morning + - midday + - evening + droppedDuplicates: + description: Rows discarded by the cross-source canonical picker on the day-collapse mode. + type: integer + minimum: 0 + maximum: 9007199254740991 + required: + - total + - limit + - offset + additionalProperties: false + NamedSleepStageDuplicateResponse: + type: object + properties: + data: + $ref: "#/components/schemas/NamedSleepStageMeasurement" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + NamedSleepStageMeasurement: type: object properties: id: type: string + description: Stored row id, or a synthetic key (`day::`, `sleep-seg::`) on the collapsed list + modes. + type: + $ref: "#/components/schemas/MeasurementType" + value: + type: number + unit: + type: string + measuredAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + source: + $ref: "#/components/schemas/MeasurementSource" + notes: + type: + - string + - "null" + userId: + type: string + valueMin: + description: Bucket MINIMUM — set only on an hourly heart-rate `stats:` row. + type: + - number + - "null" + valueMax: + description: Bucket MAXIMUM — set only on an hourly heart-rate `stats:` row. + type: + - number + - "null" externalId: - description: The identity key the client dedups on for measurements. + description: External-system dedup key; null for manual entries. + type: + - string + - "null" + externalSourceVersion: + type: + - string + - "null" + aggregationProvenance: + description: "Authority of an aggregate stored under a `stats:` identity: `HEALTHKIT_STATISTICS`, + `EXPORT_XML_SOURCE_MAX` or `LEGACY_UNKNOWN`. Null on an ordinary sample row. Decode unknown values + leniently." + type: + - string + - "null" + glucoseContext: + description: Set only on BLOOD_GLUCOSE rows, and null there too when the writer recorded no classification (a sensor + export, a device sync). Never invent one. + type: + - string + - "null" + sleepStage: + description: Set only on SLEEP_DURATION rows. + type: + - string + - "null" + rhythmClassification: + description: Device classification verdict; set only on EVENT rows. + type: + - string + - "null" + deviceType: + description: "`watch | band | ring | phone | scale | other | unknown`." + type: + - string + - "null" + timeZone: + description: IANA zone the reading was taken in, when its writer sent one; null means the profile zone. The reading's + local day is read in it. type: - string - "null" syncVersion: + description: Bumped on every server-side mutation; the last-writer-wins input for cross-device reconciliation. type: integer - exclusiveMinimum: 0 + minimum: -9007199254740991 maximum: 9007199254740991 deletedAt: + description: Soft-delete tombstone; null on a live row. + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + createdAt: type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ @@ -54346,282 +58947,713 @@ components: type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - required: - - id - - externalId - - syncVersion - - deletedAt - - updatedAt - additionalProperties: false - description: A soft-deleted measurement. Apply tombstones BEFORE upserts within a page to avoid resurrecting a row. - Since v1.42 only deletions a person makes appear here; the nightly fold that condenses raw samples into `stats:` - rows deletes them outright and lists nothing. - SyncMoodUpsert: - type: object - properties: - id: - type: string - date: - type: string - description: YYYY-MM-DD anchored to the row's `tz`. - mood: + appleHealthMirror: + description: "Whether the HealthLog app writes this reading into Apple Health. Resolved by the server on every stored + row: true for WITHINGS, IMPORT and MANUAL, for an EXTERNAL row whatever its account chose for the token that + sent it, false otherwise. Absent on the synthesised list rows." + type: boolean + dayKey: type: string - score: + sampleCount: type: integer minimum: -9007199254740991 maximum: 9007199254740991 - description: The legacy 1-5 axis. Unchanged. - a1: - anyOf: - - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - - type: "null" - description: Pleasantness, 0-10. Server-derived from `mood` on every write, so this is populated even for rows a client - posted without it. Consume the value; do not re-derive it. - a2: - anyOf: - - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - - type: "null" - description: "Stress, 0-10, INVERSE-oriented: a higher value is more stress. NULL when nobody answered it." - a3: - anyOf: - - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - - type: "null" - description: Energy, 0-10, or null. - a4: + mainAsleepMinutes: + description: The main night's own time asleep in minutes; null on a day of naps alone. On a sleep row `value` is the + day's total, the main night plus its naps. anyOf: - type: integer - minimum: -9007199254740991 + minimum: 0 maximum: 9007199254740991 - type: "null" - description: Connectedness, 0-10, or null. - a5: + napCount: + description: Naps on the same wake day. + type: integer + minimum: 0 + maximum: 9007199254740991 + napAsleepMinutes: + description: Time asleep across those naps, in minutes. + type: number + minimum: 0 + sleepStages: + description: The main night's minutes per stage (`IN_BED`, `ASLEEP`, `AWAKE`, `CORE`, `DEEP`, `REM`), each the union of + that stage's spans; empty on a day of naps alone. + type: object + propertyNames: + type: string + additionalProperties: + type: number + minimum: 0 + inBedMinutes: + description: The main night's time in bed in minutes, or null when no in-bed span was recorded. anyOf: - - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 + - type: number + minimum: 0 - type: "null" - description: Stability, 0-10, or null. - context: + awakeMinutes: + description: The main night's time awake in bed in minutes, or null when no awake span was recorded. anyOf: - - $ref: "#/components/schemas/MoodContextOutput" + - type: number + minimum: 0 - type: "null" - description: The day's context, or null when the entry carries none. Null and an object of nulls are different answers. - tags: - description: JSON array of tag keys, or null. - type: - - string - - "null" - note: - type: - - string - - "null" - moodLoggedAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - source: + awakenings: + description: Awake spans between the main night's first and last time asleep. + type: integer + minimum: 0 + maximum: 9007199254740991 + status: type: string - syncVersion: + enum: + - inserted + - updated + - duplicate + description: "`inserted` — a new row (HTTP 201). `duplicate` — the segment was already stored, by this route or the + batch route, and nothing changed (HTTP 200). `updated` — a stored segment with the same stage, source and + end was corrected in place, for example a later start (HTTP 200)." + required: + - id + - type + - value + - unit + - measuredAt + - source + - status + additionalProperties: false + description: The stored SLEEP_DURATION row for a named sleep-stage segment, with what the call did to it. + CreateMeasurementResponse: + type: object + properties: + data: + anyOf: + - $ref: "#/components/schemas/NamedSleepStageMeasurement" + - $ref: "#/components/schemas/MeasurementResource" + - type: array + items: + $ref: "#/components/schemas/MeasurementResource" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + GetMeasurementResponse: + type: object + properties: + data: + $ref: "#/components/schemas/MeasurementResource" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + UpdateMeasurementResponse: + type: object + properties: + data: + $ref: "#/components/schemas/MeasurementResource" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + DeleteMeasurementResponse: + type: object + properties: + data: + type: object + properties: + deleted: + type: boolean + const: true + required: + - deleted + additionalProperties: false + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + BatchMeasurementsResponse: + type: object + properties: + data: + $ref: "#/components/schemas/AppleHealthBatchResponse" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + AppleHealthBatchResponse: + type: object + properties: + processed: + type: integer + minimum: 0 + maximum: 9007199254740991 + inserted: + type: integer + minimum: 0 + maximum: 9007199254740991 + updated: type: integer minimum: 0 maximum: 9007199254740991 - description: LWW reconciliation counter; mood is last-writer-wins by it. - updatedAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + duplicates: + type: integer + minimum: 0 + maximum: 9007199254740991 + failed: + type: integer + minimum: 0 + maximum: 9007199254740991 + skipped: + type: array + items: + type: object + properties: + index: + type: integer + minimum: 0 + maximum: 9007199254740991 + reason: + type: string + required: + - index + - reason + additionalProperties: false + entries: + type: array + items: + $ref: "#/components/schemas/AppleHealthBatchEntryResult" required: - - id - - date - - mood - - score - - a1 - - a2 - - a3 - - a4 - - a5 - - context - - tags - - note - - moodLoggedAt - - source - - syncVersion - - updatedAt + - processed + - inserted + - updated + - duplicates + - failed + - skipped + - entries additionalProperties: false - SyncMoodTombstone: + AppleHealthBatchEntryResult: type: object properties: - id: - type: string - description: Server id — the identity key the client dedups on for mood. - syncVersion: + index: type: integer minimum: 0 maximum: 9007199254740991 - deletedAt: + status: type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - updatedAt: + enum: + - inserted + - updated + - duplicate + - skipped + - failed + description: "`inserted`/`duplicate` — the row landed (advance the cursor). `updated` — a `stats:` aggregate overwrote + an existing row. `skipped` — validation no-op; see `reason`. `failed` — retryable database failure that must + not advance the entry cursor; the response is marked `Cache-Control: no-store`." + reason: + description: "Why a row was `skipped` or a `duplicate`. On a `skipped`: `deleted_in_healthlog` (since v1.49.0), an + immutable sample whose `(type, source, externalId)` names a row the person deleted in HealthLog (web, app or + MCP); it stays deleted and nothing is written. Final: drop the entry. A sample the phone reported deleted + through `DELETE /api/measurements/by-external-ids` is the other case: posted again, it is back in Apple + Health, and the deleted row is written again in place (`updated`). A `stats:` aggregate is a day's total, + not a sample, and a re-post writes it again either way. `stale` (since v1.49.0, on a `skipped`): a `stats:` + entry whose `computedAt` is earlier than the one the stored row was written with; the newer total stays. + Final: drop the entry. `superseded_in_batch`: a later entry of the same batch carries the same `stats:` id. + `folded_window` (since v1.42): a raw sample of a dense or mean type whose local day lies before the fold + boundary and whose hour or day a live `stats:` row of the same source already covers. Nothing to retry; + treat it like any duplicate. `hour_bucket_misaligned`, `hour_bucket_unsupported_type`, `hour_bucket_too_old` + (since v1.43): an hourly `stats::T` row the server refused, see `externalId`; permanent + for the row as sent." type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + convertedValue: + description: "Only on a `value_out_of_range` skip (since v1.39.1): the entry's value after conversion into the stored + unit, which is the number the band was checked against. A HealthKit fraction that should have been a percent + shows up here a hundred times off." + type: number + range: + description: "Only on a `value_out_of_range` skip (since v1.39.1): the plausibility band that refused the entry, in the + stored unit. Both edges are inclusive. A skip is permanent for the value as sent; resending it unchanged + skips it again." + type: object + properties: + min: + type: number + max: + type: number + unit: + type: string + required: + - min + - max + - unit + additionalProperties: false required: - - id - - syncVersion - - deletedAt - - updatedAt + - index + - status additionalProperties: false - description: A soft-deleted mood entry, keyed on server `id`. Apply before upserts within the domain page. - SyncIntakeUpsert: + MeasurementsDeleteByExternalIdsResponse: type: object properties: - id: - type: string - medicationId: - type: string - scheduledFor: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - takenAt: - anyOf: - - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - - type: "null" - skipped: - type: boolean - source: - type: string - autoRecorded: - type: boolean - description: v1.42.2 — the server recorded this dose because the medication has `autoMarkTaken` on. Counts as taken. - syncVersion: - type: integer - minimum: 0 - maximum: 9007199254740991 - description: Reconciliation counter. An intake is immutable; a correction is a tombstone + re-insert. - updatedAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + data: + $ref: "#/components/schemas/MeasurementsDeleteByExternalIdsResult" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false required: - - id - - medicationId - - scheduledFor - - takenAt - - skipped - - source - - autoRecorded - - syncVersion - - updatedAt + - data + - error additionalProperties: false - SyncIntakeTombstone: + MeasurementsDeleteByExternalIdsResult: type: object properties: - id: - type: string - description: Server id — the identity key the client dedups on for intakes. - syncVersion: + deletedCount: type: integer minimum: 0 maximum: 9007199254740991 - deletedAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - updatedAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ required: - - id - - syncVersion - - deletedAt - - updatedAt + - deletedCount additionalProperties: false - description: A soft-deleted medication intake, keyed on server `id`. Apply before upserts within the domain page. - SyncCycleDayTombstone: + MeasurementsBulkDeleteResponse: type: object properties: - id: - type: string - externalId: - description: The client's own key for the day log, when it set one. - type: - - string - - "null" - syncVersion: + data: + $ref: "#/components/schemas/MeasurementsBulkDeleteResult" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + MeasurementsBulkDeleteResult: + type: object + properties: + deleted: type: integer minimum: 0 maximum: 9007199254740991 - deletedAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - updatedAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ required: - - id - - externalId - - syncVersion - - deletedAt - - updatedAt + - deleted additionalProperties: false - description: A soft-deleted cycle day log, keyed on server `id`. Apply before upserts within the domain page. - SyncCycleTombstone: + MeasurementsRestoreResponse: type: object properties: - id: - type: string - syncVersion: + data: + $ref: "#/components/schemas/MeasurementsRestoreResult" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + MeasurementsRestoreResult: + type: object + properties: + restored: type: integer minimum: 0 maximum: 9007199254740991 - deletedAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - updatedAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ required: - - id - - syncVersion - - deletedAt - - updatedAt + - restored additionalProperties: false - description: A soft-deleted menstrual cycle, keyed on server `id`. Apply before upserts within the domain page. - SyncMeasurementMirrorUpsert: + SleepNightResponse: type: object properties: - id: - type: string - description: The measurement's server id. - appleHealthMirror: - type: boolean - description: The reading's write-back as it now stands. False means stop writing it; samples already in Apple Health stay. + data: + $ref: "#/components/schemas/SleepNightResource" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + SleepNightResource: + type: object + properties: + night: + type: + - string + - "null" + main: + anyOf: + - type: object + properties: + night: + type: string + description: Wake-day key (YYYY-MM-DD), in `timeZone` when set, else in the profile zone. + timeZone: + description: The zone the night is read in when its last stage row carries one other than the profile zone (a night + slept abroad); null otherwise. Render the night's clock times in it. + type: + - string + - "null" + source: + anyOf: + - $ref: "#/components/schemas/MeasurementSource" + - type: "null" + start: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + end: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + asleepMinutes: + type: integer + minimum: 0 + maximum: 9007199254740991 + inBedMinutes: + anyOf: + - type: integer + minimum: 0 + maximum: 9007199254740991 + - type: "null" + awakeMinutes: + anyOf: + - type: integer + minimum: 0 + maximum: 9007199254740991 + - type: "null" + awakenings: + type: integer + minimum: 0 + maximum: 9007199254740991 + reconstructed: + type: boolean + description: True when the source has no per-stage onset timestamps and the server synthesised a contiguous timeline in + a fixed physiological order (WHOOP). The client renders the hypnogram but labels it an approximate + layout and never recomputes. False for real-series sources (Apple Health / Withings / Fitbit). + stages: + type: object + propertyNames: + type: string + enum: + - IN_BED + - AWAKE + - ASLEEP + - REM + - CORE + - DEEP + additionalProperties: + type: integer + minimum: 0 + maximum: 9007199254740991 + description: Minutes per stage. Only the stages the night recorded are present; an absent stage is not zero minutes, it + was not measured. + segments: + type: array + items: + type: object + properties: + stage: + anyOf: + - type: string + enum: + - IN_BED + - AWAKE + - ASLEEP + - REM + - CORE + - DEEP + - type: "null" + start: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + end: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + minutes: + type: integer + minimum: 0 + maximum: 9007199254740991 + required: + - stage + - start + - end + - minutes + additionalProperties: false + sourceDiscrepancy: + anyOf: + - type: object + properties: + deltaMinutes: + type: integer + minimum: 0 + maximum: 9007199254740991 + description: Spread (max − min) of the disagreeing per-writer asleep totals, in minutes. + sources: + type: array + items: + type: object + properties: + source: + type: string + description: MeasurementSource value of the writer bucket. + deviceType: + type: + - string + - "null" + asleepMinutes: + type: integer + minimum: 0 + maximum: 9007199254740991 + required: + - source + - deviceType + - asleepMinutes + additionalProperties: false + required: + - deltaMinutes + - sources + additionalProperties: false + - type: "null" + description: Non-null when two writer buckets reported clearly different asleep totals for this session (> 45 min apart + and > 20% of the larger total). Observational only — the served totals stay the winning writer's; + clients may show a discreet 'sources disagree' hint listing each bucket's total. + required: + - night + - source + - start + - end + - asleepMinutes + - inBedMinutes + - awakeMinutes + - awakenings + - reconstructed + - stages + - segments + - sourceDiscrepancy + additionalProperties: false + - type: "null" + naps: + type: array + items: + type: object + properties: + night: + type: string + description: Wake-day key (YYYY-MM-DD), in `timeZone` when set, else in the profile zone. + timeZone: + description: The zone the night is read in when its last stage row carries one other than the profile zone (a night + slept abroad); null otherwise. Render the night's clock times in it. + type: + - string + - "null" + source: + anyOf: + - $ref: "#/components/schemas/MeasurementSource" + - type: "null" + start: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + end: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + asleepMinutes: + type: integer + minimum: 0 + maximum: 9007199254740991 + inBedMinutes: + anyOf: + - type: integer + minimum: 0 + maximum: 9007199254740991 + - type: "null" + awakeMinutes: + anyOf: + - type: integer + minimum: 0 + maximum: 9007199254740991 + - type: "null" + awakenings: + type: integer + minimum: 0 + maximum: 9007199254740991 + reconstructed: + type: boolean + description: True when the source has no per-stage onset timestamps and the server synthesised a contiguous timeline in + a fixed physiological order (WHOOP). The client renders the hypnogram but labels it an approximate + layout and never recomputes. False for real-series sources (Apple Health / Withings / Fitbit). + stages: + type: object + propertyNames: + type: string + enum: + - IN_BED + - AWAKE + - ASLEEP + - REM + - CORE + - DEEP + additionalProperties: + type: integer + minimum: 0 + maximum: 9007199254740991 + description: Minutes per stage. Only the stages the night recorded are present; an absent stage is not zero minutes, it + was not measured. + segments: + type: array + items: + type: object + properties: + stage: + anyOf: + - type: string + enum: + - IN_BED + - AWAKE + - ASLEEP + - REM + - CORE + - DEEP + - type: "null" + start: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + end: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + minutes: + type: integer + minimum: 0 + maximum: 9007199254740991 + required: + - stage + - start + - end + - minutes + additionalProperties: false + sourceDiscrepancy: + anyOf: + - type: object + properties: + deltaMinutes: + type: integer + minimum: 0 + maximum: 9007199254740991 + description: Spread (max − min) of the disagreeing per-writer asleep totals, in minutes. + sources: + type: array + items: + type: object + properties: + source: + type: string + description: MeasurementSource value of the writer bucket. + deviceType: + type: + - string + - "null" + asleepMinutes: + type: integer + minimum: 0 + maximum: 9007199254740991 + required: + - source + - deviceType + - asleepMinutes + additionalProperties: false + required: + - deltaMinutes + - sources + additionalProperties: false + - type: "null" + description: Non-null when two writer buckets reported clearly different asleep totals for this session (> 45 min apart + and > 20% of the larger total). Observational only — the served totals stay the winning writer's; + clients may show a discreet 'sources disagree' hint listing each bucket's total. + required: + - night + - source + - start + - end + - asleepMinutes + - inBedMinutes + - awakeMinutes + - awakenings + - reconstructed + - stages + - segments + - sourceDiscrepancy + additionalProperties: false required: - - id - - appleHealthMirror + - night + - main + - naps additionalProperties: false - description: A reading whose `appleHealthMirror` changed because the account switched the Apple Health setting of the - token that sent it. The reading itself did not change and is not re-sent in `measurements`. - GetBloodPressureTimeOfDayResponse: + description: "One reconstructed sleep night: the main session's hypnogram segments + breakdown, plus same-wake-day naps + surfaced separately. A session is a nap when it holds under three hours asleep centred between 10:00 and 20:00 + local time; the main session is the longest session that is not a nap. A day whose only sleep is naps has `main: + null` and its naps." + SleepRhythmResponse: type: object properties: data: - $ref: "#/components/schemas/BloodPressureTimeOfDay" + $ref: "#/components/schemas/SleepRhythmResource" error: type: "null" meta: @@ -54634,494 +59666,158 @@ components: - data - error additionalProperties: false - BloodPressureTimeOfDay: - type: object - properties: - days: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - description: The window asked for, in local days. - from: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - description: Window start (ISO-8601). - to: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - description: "Window end: the last instant of today in the record's time zone." - timeZone: - type: string - description: IANA zone the hours were read in (the record's own). - minReadings: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - description: Readings a part needs before its mean is given. - readingCount: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - description: Paired readings in the window, across the three parts. - parts: - type: array - items: - $ref: "#/components/schemas/BloodPressurePartOfDay" - description: "Always three entries: morning, midday, evening, in order." - morningEveningDifference: - anyOf: - - type: object - properties: - systolic: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - diastolic: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - required: - - systolic - - diastolic - additionalProperties: false - - type: "null" - description: Morning mean minus evening mean, from the two whole-mmHg means given above (so it equals their difference - exactly). Null unless both parts reach `minReadings`. - required: - - days - - from - - to - - timeZone - - minReadings - - readingCount - - parts - - morningEveningDifference - additionalProperties: false - BloodPressurePartOfDay: - type: object - properties: - part: - type: string - enum: - - morning - - midday - - evening - description: The part of the day. - startHour: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - description: First local hour of the part (inclusive). - endHour: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - description: "Local hour the part ends at (exclusive). Smaller than `startHour` when the part runs past midnight - (evening: 18 to 4)." - readingCount: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - description: Paired systolic/diastolic readings in this part. - systolic: - anyOf: - - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - - type: "null" - description: Mean systolic in whole mmHg; null while `readingCount` is below `minReadings`. - diastolic: - anyOf: - - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - - type: "null" - description: Mean diastolic in whole mmHg; null on the same floor. - pulseReadingCount: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - description: Readings in this part that carried a pulse (same source, within five minutes). - pulse: - anyOf: - - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - - type: "null" - description: Mean pulse in whole bpm; null while `pulseReadingCount` is below `minReadings`. - required: - - part - - startHour - - endHour - - readingCount - - systolic - - diastolic - - pulseReadingCount - - pulse - additionalProperties: false - GetMeasurementsSeriesBatchResponse: + SleepRhythmResource: type: object properties: - data: - $ref: "#/components/schemas/MeasurementsSeriesBatchResponse" - error: - type: "null" - meta: + sleepDebt: type: object properties: - requestId: + state: type: string + enum: + - partial + - ready + description: "`partial` until enough tracked nights exist (calm 'still learning'); `ready` once the rolling window can + assert a balance." + debtMinutes: + type: integer + minimum: 0 + maximum: 9007199254740991 + description: Outstanding sleep-debt balance over the window, in minutes, after caps. A night below need adds its + shortfall; a night above need pays the balance down (floored at 0). + needMinutes: + type: integer + minimum: 0 + maximum: 9007199254740991 + description: Age-based sleep need (minutes) used for the per-night deficit. + nightsCounted: + type: integer + minimum: 0 + maximum: 9007199254740991 + windowNights: + type: integer + exclusiveMinimum: 0 + maximum: 9007199254740991 + description: Rolling window length in nights. + nightsUntilReady: + type: integer + minimum: 0 + maximum: 9007199254740991 + description: Nights still needed before the debt is asserted (0 when ready). + source: + description: v1.25.0 — the active source the debt is resolved FROM, picked off the user's `sleepDebt` source ladder. + `COMPUTED` is HealthLog's own rolling-balance estimate (the only producer today); a provider value would + be a device-native debt. Clients explain the figure when it is `COMPUTED`. + $ref: "#/components/schemas/MeasurementSource" + required: + - state + - debtMinutes + - needMinutes + - nightsCounted + - windowNights + - nightsUntilReady + - source additionalProperties: false - required: - - data - - error - additionalProperties: false - MeasurementsSeriesBatchResponse: - type: object - properties: - series: - type: object - propertyNames: - $ref: "#/components/schemas/MeasurementType" - additionalProperties: - type: array - items: - type: object - properties: - type: - $ref: "#/components/schemas/MeasurementType" - value: - type: number - description: "The day's mean (spot metrics) or total (cumulative). A row of a coarser tier (a window longer than the - daily cap) carries the average day of its bucket, the same quantity: a spot metric's mean of its - daily means, a cumulative metric's total over the days of the bucket that hold a reading." - measuredAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - description: "Day-bucket start (ISO-8601): the user's local midnight. A window longer than the daily cap is served from - a coarser tier (a UTC day, week or month); its rows are stamped at noon UTC of the bucket's first - day, which falls inside the bucket's own week or month in every zone." - count: - description: Underlying raw-row count for the bucket. - type: integer - minimum: 0 - maximum: 9007199254740991 - minValue: - description: Per-day minimum (spot metrics only; absent for cumulative). - type: - - number - - "null" - maxValue: - description: Per-day maximum (spot metrics only; absent for cumulative). - type: - - number - - "null" - required: - - type - - value - - measuredAt - additionalProperties: false - description: Per-type daily series, keyed by MeasurementType. Only the requested types are present. - required: - - series - additionalProperties: false - description: Batched daily series — one rollup-backed series per requested type. - GetMeasurementsSeriesResponse: - type: object - properties: - data: - $ref: "#/components/schemas/MeasurementsSeriesResponse" - error: - type: "null" - meta: + chronotype: type: object properties: - requestId: + state: type: string + enum: + - learning + - ready + description: "`learning` until enough free-day nights exist (no band asserted); `ready` once the free-day sample is + large enough." + msfMinutes: + description: Mid-sleep on free days (minutes-of-day), null while learning. + type: + - number + - "null" + msfScMinutes: + description: Sleep-debt-corrected mid-sleep on free days (MSFsc, minutes-of-day), null while learning. + type: + - number + - "null" + band: + anyOf: + - type: string + enum: + - extreme_early + - early + - intermediate + - late + - extreme_late + - type: "null" + description: MCTQ chronotype band off MSFsc, null while learning. + socialJetlagMinutes: + description: Social jetlag = circular |MSF_work − MSF_free| in minutes, null when one side is missing. + type: + - number + - "null" + freeNightsCounted: + type: integer + minimum: 0 + maximum: 9007199254740991 + workNightsCounted: + type: integer + minimum: 0 + maximum: 9007199254740991 + freeNightsUntilReady: + type: integer + minimum: 0 + maximum: 9007199254740991 + description: Free-day nights still needed before a band is asserted. + required: + - state + - msfMinutes + - msfScMinutes + - band + - socialJetlagMinutes + - freeNightsCounted + - workNightsCounted + - freeNightsUntilReady additionalProperties: false - required: - - data - - error - additionalProperties: false - MeasurementsSeriesResponse: - type: object - properties: - kind: - type: string - enum: - - weight - - bloodPressure - - pulse - - bodyFat - - glucose - - sleep - - steps - - totalBodyWater - - boneMass - - oxygenSaturation - - restingHeartRate - - heartRateVariability - - vo2Max - - ketones - - glucoseKetoneIndex - unit: - type: string - description: Resolved unit token for `value`. `glucose` follows the user's mg/dL|mmol/L preference; `sleep` is `h` - (per-night time-asleep in hours); `ketones` is `mmol/L`; `glucoseKetoneIndex` is `ratio`. - points: - type: array - items: - type: object - properties: - id: - type: string - description: Measurement row id; `sleep:` for a sleep night; `day:` for a day bucket (`pulse`, - `glucose`, `heartRateVariability`, `oxygenSaturation` beyond 90 days); `hour:` for an hour - bucket (the same kinds within 90 days when the window holds more than 10 000 readings). - at: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - description: Point timestamp (ISO-8601). - value: - type: number - description: Primary value in the top-level `unit`. - secondary: - description: Diastolic value for `kind=bloodPressure` (paired within ±5 min); null for every other kind. - type: - - number - - "null" - sleepStages: - description: Per-stage hours for a `kind=sleep` night (CORE/DEEP/REM/…); null/absent for non-sleep kinds. - anyOf: - - type: object - propertyNames: - type: string - additionalProperties: - type: number - - type: "null" - valueMin: - description: "v1.19.2 (iOS #34 extension) — per-point MINIMUM for `kind=pulse`. On an aggregated hourly heart-rate - bucket `value` is the hour's average and this is the hour's low; null on a per-sample PULSE row and - absent for every other kind." - type: - - number - - "null" - valueMax: - description: "v1.19.2 (iOS #34 extension) — per-point MAXIMUM for `kind=pulse`. On an aggregated hourly heart-rate - bucket `value` is the hour's average and this is the hour's high; null on a per-sample PULSE row and - absent for every other kind." - type: - - number - - "null" - gki: - description: "#1367 — for `kind=glucoseKetoneIndex` only: the readings the index was computed from. `id` and `at` are - the ketone reading's. Absent for every other kind." - type: object - properties: - glucoseId: - type: string - description: The paired glucose reading's id. - glucoseAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - description: The paired glucose reading's timestamp. - glucoseMmol: - type: number - description: The paired glucose in mmol/L, one decimal. - ketonesMmol: - type: number - description: The ketone reading (beta-hydroxybutyrate), mmol/L. - required: - - glucoseId - - glucoseAt - - glucoseMmol - - ketonesMmol - additionalProperties: false - required: - - id - - at - - value - - secondary - additionalProperties: false - stats: + averagePerNight: type: object properties: - mean: - type: number - min: - type: number - max: - type: number - stdDev: - type: number - count: + state: + type: string + enum: + - partial + - ready + averageMinutes: + type: integer + minimum: 0 + maximum: 9007199254740991 + description: Mean asleep minutes per scorable night (0 while partial). + nightsCounted: + type: integer + minimum: 0 + maximum: 9007199254740991 + nightsUntilReady: type: integer minimum: 0 maximum: 9007199254740991 + description: Scorable nights still needed before the average is asserted. required: - - mean - - min - - max - - stdDev - - count + - state + - averageMinutes + - nightsCounted + - nightsUntilReady additionalProperties: false - description: Summary over the returned points; all-zero when empty. - direction: - description: v1.43 — which way a change of this metric counts. - anyOf: - - $ref: "#/components/schemas/TrendVerdict" - - type: "null" - change: - description: v1.43 — first and last day value; null under two days. - anyOf: - - $ref: "#/components/schemas/SeriesChange" - - type: "null" - referenceLines: - description: v1.43 — lines to draw; empty when there is nothing to draw. - type: array - items: - $ref: "#/components/schemas/SeriesReferenceLine" - required: - - kind - - unit - - points - - stats - additionalProperties: false - description: "iOS-friendly per-kind time series: one point per reading (or per reconstructed night for `sleep`), an - explicit `unit` token, and a summary `stats` block. Sample-dense kinds (`pulse`, `glucose`, - `heartRateVariability`, `oxygenSaturation`) are bucketed server-side: beyond 90 days per local day, and within - 90 days per local hour when the window holds more than 10 000 readings (a continuous glucose sensor, a watch or - ring recording every minute; a cuff, a fingerstick meter or a few readings a night stay raw). A bucket carries - the mean as `value` and otherwise has the shape of a reading of its kind; a `pulse` bucket also carries its - range as `valueMin` / `valueMax`, and a `glucose` bucket is converted to the user's unit like a raw reading. - `stats` is always computed over the underlying readings, never over the buckets. `glucoseKetoneIndex` (#1367) is - derived at read time, never stored: one point per ketone reading above zero that has a glucose reading at the - same instant or, failing that, the nearest one within 15 minutes either side; value = glucose (mmol/L, from - mg/dL by 18.0182) / ketones (mmol/L), one decimal. Draw it as given; do not recompute it." - TrendVerdict: - type: object - properties: - direction: - type: string - enum: - - up-good - - up-bad - - neutral - - hold - description: "How a change counts: `up-good` a rise is progress, `up-bad` a fall is progress, `hold` staying is progress - and a move either way is no setback, `neutral` no judgement. `hold` covers a value inside its band, a blood - pressure, resting pulse or body fat below a profile-default band (a default's lower edge is no goal; below - the person's own target a rise stays `up-good`), and steps or oxygen saturation above their band (more is - never worse)." - targetPosition: - anyOf: - - type: string - enum: - - below - - inside - - above - - type: "null" - description: Where the value sits against the band; null without one. - basis: - type: string - enum: - - personal_target - - profile_default - - metric_default - description: "What the verdict was judged against: the person's own target, a profile-derived default (e.g. the - age-based blood pressure target), or the metric's default direction." - required: - - direction - - targetPosition - - basis - additionalProperties: false - description: Which way a change of a metric counts as progress for this person. The generalisation of `tiles.weightTrend`. - SeriesChange: - type: object - properties: - from: - type: number - to: - type: number - delta: - type: number - sentiment: - $ref: "#/components/schemas/TrendSentiment" - required: - - from - - to - - delta - - sentiment - additionalProperties: false - description: First and last day value in the window (by the metric's day statistic) and how the change counts. Null - under two days. - TrendSentiment: - type: string - enum: - - positive - - negative - - neutral - description: The verdict applied to one delivered change, with the noise floor applied. Colour the change from this. - SeriesReferenceLine: - type: object - properties: - value: - type: number - description: In the unit of the response. - kind: - type: string - enum: - - lower - - upper - source: - type: string - enum: - - personal - - clinical - appliesTo: - type: string - enum: - - value - - secondary - description: "`secondary` is the diastolic value of a blood pressure." - labelKey: - type: string - label: - type: string - description: In the account language. required: - - value - - kind - - source - - appliesTo - - labelKey - - label + - sleepDebt + - chronotype + - averagePerNight additionalProperties: false - description: A horizontal line to draw on the chart. A personal line replaces the clinical one for the same edge. Empty - list when there is nothing to draw. - ListMeasurementsResponse: + description: "Server-authoritative sleep-rhythm read: the outstanding sleep-debt balance over the rolling window + MCTQ + chronotype (MSF/MSFsc band, social jetlag). Free vs work nights default to weekend = free in the user's timezone + (no work calendar). A view over existing per-stage SLEEP_DURATION rows — no schema, no new type." + ListWorkoutsResponse: type: object properties: data: - type: object - properties: - measurements: - type: array - items: - anyOf: - - $ref: "#/components/schemas/MeasurementResource" - - $ref: "#/components/schemas/AggregatedMeasurementBucket" - meta: - $ref: "#/components/schemas/ListMeasurementsMeta" - required: - - measurements - - meta - additionalProperties: false + $ref: "#/components/schemas/WorkoutListResponse" error: type: "null" meta: @@ -55134,247 +59830,231 @@ components: - data - error additionalProperties: false - MeasurementResource: + WorkoutListResponse: + type: object + properties: + workouts: + type: array + items: + $ref: "#/components/schemas/WorkoutListEntry" + meta: + type: object + properties: + total: + type: integer + minimum: 0 + maximum: 9007199254740991 + limit: + type: integer + exclusiveMinimum: 0 + maximum: 9007199254740991 + offset: + type: integer + minimum: 0 + maximum: 9007199254740991 + droppedDuplicates: + type: integer + minimum: 0 + maximum: 9007199254740991 + required: + - total + - limit + - offset + - droppedDuplicates + additionalProperties: false + trainingLoad: + description: v1.44 — on the first page (`offset=0`) only, account-wide whatever the filter. Absent on later pages and + older servers. + $ref: "#/components/schemas/WorkoutTrainingLoad" + required: + - workouts + - meta + additionalProperties: false + WorkoutListEntry: type: object properties: id: type: string - description: Stored row id, or a synthetic key (`day::`, `sleep-seg::`) on the collapsed list - modes. - type: - $ref: "#/components/schemas/MeasurementType" - value: - type: number - unit: - type: string - measuredAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - source: - $ref: "#/components/schemas/MeasurementSource" - notes: - type: - - string - - "null" - userId: - type: string - valueMin: - description: Bucket MINIMUM — set only on an hourly heart-rate `stats:` row. - type: - - number - - "null" - valueMax: - description: Bucket MAXIMUM — set only on an hourly heart-rate `stats:` row. - type: - - number - - "null" - externalId: - description: External-system dedup key; null for manual entries. - type: - - string - - "null" - externalSourceVersion: - type: - - string - - "null" - aggregationProvenance: - description: "Authority of an aggregate stored under a `stats:` identity: `HEALTHKIT_STATISTICS`, - `EXPORT_XML_SOURCE_MAX` or `LEGACY_UNKNOWN`. Null on an ordinary sample row. Decode unknown values - leniently." - type: - - string - - "null" - glucoseContext: - description: Set only on BLOOD_GLUCOSE rows, and null there too when the writer recorded no classification (a sensor - export, a device sync). Never invent one. - type: - - string - - "null" - sleepStage: - description: Set only on SLEEP_DURATION rows. - type: - - string - - "null" - rhythmClassification: - description: Device classification verdict; set only on EVENT rows. - type: - - string - - "null" - deviceType: - description: "`watch | band | ring | phone | scale | other | unknown`." + sportType: type: - string - "null" - syncVersion: - description: Bumped on every server-side mutation; the last-writer-wins input for cross-device reconciliation. - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - deletedAt: - description: Soft-delete tombstone; null on a live row. + startedAt: anyOf: - type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - type: "null" - createdAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - updatedAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - appleHealthMirror: - description: "Whether the HealthLog app writes this reading into Apple Health. Resolved by the server on every stored - row: true for WITHINGS, IMPORT and MANUAL, for an EXTERNAL row whatever its account chose for the token that - sent it, false otherwise. Absent on the synthesised list rows." - type: boolean - dayKey: - type: string - sampleCount: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - mainAsleepMinutes: - description: The main night's own time asleep in minutes; null on a day of naps alone. On a sleep row `value` is the - day's total, the main night plus its naps. - anyOf: - - type: integer - minimum: 0 - maximum: 9007199254740991 - - type: "null" - napCount: - description: Naps on the same wake day. - type: integer - minimum: 0 - maximum: 9007199254740991 - napAsleepMinutes: - description: Time asleep across those naps, in minutes. - type: number - minimum: 0 - sleepStages: - description: The main night's minutes per stage (`IN_BED`, `ASLEEP`, `AWAKE`, `CORE`, `DEEP`, `REM`), each the union of - that stage's spans; empty on a day of naps alone. - type: object - propertyNames: - type: string - additionalProperties: - type: number - minimum: 0 - inBedMinutes: - description: The main night's time in bed in minutes, or null when no in-bed span was recorded. + endedAt: anyOf: - - type: number - minimum: 0 + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - type: "null" - awakeMinutes: - description: The main night's time awake in bed in minutes, or null when no awake span was recorded. + durationSec: anyOf: - - type: number + - type: integer minimum: 0 + maximum: 9007199254740991 - type: "null" - awakenings: - description: Awake spans between the main night's first and last time asleep. - type: integer - minimum: 0 - maximum: 9007199254740991 - required: - - id - - type - - value - - unit - - measuredAt - - source - additionalProperties: false - description: Server-shaped measurement row. GET endpoints return the whole stored row with the decrypted note on `notes` - and the `notesEncrypted` ciphertext stripped; the collapsed list modes synthesise rows carrying the display - fields plus `dayKey` / `sampleCount`. - AggregatedMeasurementBucket: - type: object - properties: - type: - $ref: "#/components/schemas/MeasurementType" - value: - type: number - description: The bucket's aggregated value. - measuredAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - description: Bucket start. - count: - type: integer - minimum: 0 - maximum: 9007199254740991 - minValue: - description: The lowest reading in the bucket; absent on a summed (cumulative) type. + distanceM: type: - number - "null" - maxValue: - description: The highest reading in the bucket; absent on a summed (cumulative) type. + activeEnergyKcal: type: - number - "null" - unit: - type: string - required: - - type - - value - - measuredAt - additionalProperties: false - description: Pre-folded bucket returned by the `aggregate=` list modes instead of a stored row. - ListMeasurementsMeta: - type: object - properties: - total: - type: integer - minimum: 0 - maximum: 9007199254740991 - limit: - type: integer - minimum: 0 - maximum: 9007199254740991 - offset: - type: integer - minimum: 0 - maximum: 9007199254740991 - dayKey: - description: Echoed on the per-sample drill-down modes. - type: string - groupBy: - description: Set on the collapsed day-sum / per-night modes. - type: string - enum: - - day - - night - aggregate: - description: Set on the aggregate modes — the requested grain. - type: string - partOfDay: - description: Echoed when the series was narrowed with `partOfDay`. - type: string - enum: - - morning - - midday - - evening - droppedDuplicates: - description: Rows discarded by the cross-source canonical picker on the day-collapse mode. - type: integer - minimum: 0 - maximum: 9007199254740991 + avgHr: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + maxHr: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + source: + $ref: "#/components/schemas/MeasurementSource" + externalId: + type: + - string + - "null" + hasRoute: + type: boolean + hasHrSeries: + type: boolean required: - - total - - limit - - offset + - id + - sportType + - startedAt + - endedAt + - durationSec + - distanceM + - activeEnergyKcal + - avgHr + - maxHr + - source + - externalId + - hasRoute + - hasHrSeries additionalProperties: false - NamedSleepStageDuplicateResponse: + WorkoutTrainingLoad: + anyOf: + - type: object + properties: + status: + type: string + const: ok + asOf: + type: string + description: The last rated UTC day, at most yesterday; the figures are those of this day. The series runs on to + yesterday, so a later stretch without data shows as unrated days. + ctl: + type: number + description: "Fitness: 42-day exponentially weighted TRIMP." + atl: + type: number + description: "Fatigue: 7-day exponentially weighted TRIMP." + tsb: + type: number + description: "Form: fitness minus fatigue at `asOf`." + daysCovered: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + trainingDays: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + recentRatedDays: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: "Rated days of the trailing `recentDays` (42 up to yesterday, or fewer when covered less): a stored + impulse, or activity data without a workout." + recentDays: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + warmingUp: + type: boolean + description: "True below 42 covered days: both averages start at zero." + series: + type: array + items: + type: object + properties: + day: + type: string + ctl: + type: number + atl: + type: number + tsb: + type: number + rated: + type: boolean + description: "False for a day that could not be rated: no stored impulse and no activity data (steps, heart rate, active + energy), or a workout that was never scored. The averages held through it rather than counting it + as rest. A day with activity data and no workout is rest (impulse 0)." + required: + - day + - ctl + - atl + - tsb + - rated + additionalProperties: false + description: The trailing 90 days, oldest first; `tsb` is form going into the day. + required: + - status + - asOf + - ctl + - atl + - tsb + - daysCovered + - trainingDays + - recentRatedDays + - recentDays + - warmingUp + - series + additionalProperties: false + - type: object + properties: + status: + type: string + const: insufficient + reason: + type: string + enum: + - no_impulse_history + - too_little_history + daysCovered: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + trainingDays: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + required: + - status + - reason + - daysCovered + - trainingDays + additionalProperties: false + description: "v1.44 — the fitness-fatigue model over the stored daily heart-rate training impulse (Banister TRIMP; a day + with activity data but no training is 0, a day with no data or an unscored workout is not rated and the averages + hold through it). Needs 28 days and three training days. TRIMP units: comparable with the person's own past + only." + GetWorkoutResponse: type: object properties: data: - $ref: "#/components/schemas/NamedSleepStageMeasurement" + $ref: "#/components/schemas/WorkoutDetailResponse" error: type: "null" meta: @@ -55387,228 +60067,474 @@ components: - data - error additionalProperties: false - NamedSleepStageMeasurement: + WorkoutDetailResponse: type: object properties: id: type: string - description: Stored row id, or a synthetic key (`day::`, `sleep-seg::`) on the collapsed list - modes. - type: - $ref: "#/components/schemas/MeasurementType" - value: - type: number - unit: + sportType: type: string - measuredAt: + startedAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + endedAt: type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + dayKey: + type: string + durationSec: + type: integer + minimum: 0 + maximum: 9007199254740991 + distanceM: + type: + - number + - "null" + activeEnergyKcal: + type: + - number + - "null" + avgHr: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + maxHr: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + minHr: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + storedAvgHr: + description: The row's own average heart rate (v1.42). `avgHr` may be filled in from a same-session twin by the + canonical picker; this is the stored value, which an edit of a hand-entered workout sends back so the twin's + value is not written onto it. + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + storedMaxHr: + description: The row's own maximum heart rate (v1.42), as `storedAvgHr` is to `avgHr`. + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + stepCount: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + elevationM: + type: + - number + - "null" + pauseDurationSec: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" source: $ref: "#/components/schemas/MeasurementSource" - notes: + externalId: type: - string - "null" - userId: + metadata: + anyOf: + - {} + - type: "null" + performance: + anyOf: + - $ref: "#/components/schemas/WorkoutPerformance" + - type: "null" + route: + anyOf: + - $ref: "#/components/schemas/WorkoutRouteGeometry" + - type: "null" + samples: + anyOf: + - $ref: "#/components/schemas/WorkoutHrSeries" + - type: "null" + hrSeries: + anyOf: + - $ref: "#/components/schemas/WorkoutHrCurve" + - type: "null" + zones: + anyOf: + - $ref: "#/components/schemas/WorkoutZones" + - type: "null" + splits: + anyOf: + - type: array + items: + $ref: "#/components/schemas/WorkoutSplit" + - type: "null" + sportContext: + anyOf: + - $ref: "#/components/schemas/WorkoutSportContext" + - type: "null" + aiInsight: + anyOf: + - $ref: "#/components/schemas/WorkoutActivityInsight" + - type: "null" + ai: + description: The `workoutInsights` AI capability. While it is unavailable `aiInsight` is null and the stored paragraph + is not even read. + $ref: "#/components/schemas/AiCapabilityState" + canonicalId: type: string - valueMin: - description: Bucket MINIMUM — set only on an hourly heart-rate `stats:` row. + previousWorkoutId: + type: + - string + - "null" + required: + - id + - sportType + - startedAt + - endedAt + - dayKey + - durationSec + - distanceM + - activeEnergyKcal + - avgHr + - maxHr + - minHr + - stepCount + - elevationM + - pauseDurationSec + - source + - externalId + - metadata + - route + - samples + - hrSeries + - zones + - splits + - sportContext + - aiInsight + - ai + - canonicalId + - previousWorkoutId + additionalProperties: false + WorkoutPerformance: + type: object + properties: + aerobicTrainingEffect: + description: 0–5 score. type: - number - "null" - valueMax: - description: Bucket MAXIMUM — set only on an hourly heart-rate `stats:` row. + anaerobicTrainingEffect: + description: 0–5 score. type: - number - "null" - externalId: - description: External-system dedup key; null for manual entries. + trainingLoad: type: - - string + - number - "null" - externalSourceVersion: + recoveryTimeMin: + description: Minutes until the watch considers the person recovered. type: - - string + - number - "null" - aggregationProvenance: - description: "Authority of an aggregate stored under a `stats:` identity: `HEALTHKIT_STATISTICS`, - `EXPORT_XML_SOURCE_MAX` or `LEGACY_UNKNOWN`. Null on an ordinary sample row. Decode unknown values - leniently." + sweatLossMl: + description: Estimated, millilitres. type: - - string + - number - "null" - glucoseContext: - description: Set only on BLOOD_GLUCOSE rows, and null there too when the writer recorded no classification (a sensor - export, a device sync). Never invent one. + avgPowerW: type: - - string + - number - "null" - sleepStage: - description: Set only on SLEEP_DURATION rows. + avgVerticalOscillationMm: type: - - string + - number - "null" - rhythmClassification: - description: Device classification verdict; set only on EVENT rows. + avgGroundContactTimeMs: type: - - string + - number - "null" - deviceType: - description: "`watch | band | ring | phone | scale | other | unknown`." + avgGroundContactBalancePct: + description: The left foot's share of ground contact, percent. type: - - string + - number - "null" - syncVersion: - description: Bumped on every server-side mutation; the last-writer-wins input for cross-device reconciliation. - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - deletedAt: - description: Soft-delete tombstone; null on a live row. + required: + - aerobicTrainingEffect + - anaerobicTrainingEffect + - trainingLoad + - recoveryTimeMin + - sweatLossMl + - avgPowerW + - avgVerticalOscillationMm + - avgGroundContactTimeMs + - avgGroundContactBalancePct + additionalProperties: false + WorkoutRouteGeometry: + type: object + properties: + geometry: {} + sampleTimestamps: anyOf: - - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: array + items: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: object + properties: + t: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + speedMs: + type: number + hr: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + required: + - t + additionalProperties: false - type: "null" - createdAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - updatedAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - appleHealthMirror: - description: "Whether the HealthLog app writes this reading into Apple Health. Resolved by the server on every stored - row: true for WITHINGS, IMPORT and MANUAL, for an EXTERNAL row whatever its account chose for the token that - sent it, false otherwise. Absent on the synthesised list rows." - type: boolean - dayKey: - type: string + description: "One entry per geometry point, as the track was stored: a bare instant, or (from the workout batch and the + Apple Health export) an object with its instant and, where recorded, speed (m/s) and heart rate (bpm)." + required: + - geometry + - sampleTimestamps + additionalProperties: false + WorkoutHrSeries: + type: object + properties: sampleCount: type: integer - minimum: -9007199254740991 + minimum: 0 maximum: 9007199254740991 - mainAsleepMinutes: - description: The main night's own time asleep in minutes; null on a day of naps alone. On a sleep row `value` is the - day's total, the main night plus its naps. + samples: {} + required: + - sampleCount + - samples + additionalProperties: false + WorkoutHrCurve: + type: object + properties: + source: + type: string + enum: + - workout_series + - pulse_window + bucketSec: + type: integer + exclusiveMinimum: 0 + maximum: 9007199254740991 + points: + type: array + items: + type: object + properties: + tSec: + type: integer + minimum: 0 + maximum: 9007199254740991 + mean: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + min: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + max: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + required: + - tSec + - mean + - min + - max + additionalProperties: false + envelope: + type: boolean + required: + - source + - bucketSec + - points + - envelope + additionalProperties: false + WorkoutZones: + type: object + properties: + model: + type: string + enum: + - whoop + - tanaka + hrMax: anyOf: - type: integer - minimum: 0 + minimum: -9007199254740991 maximum: 9007199254740991 - type: "null" - napCount: - description: Naps on the same wake day. + zones: + type: array + items: + type: object + properties: + zone: + type: integer + minimum: 1 + maximum: 5 + lowBpm: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + highBpm: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + seconds: + type: integer + minimum: 0 + maximum: 9007199254740991 + required: + - zone + - lowBpm + - highBpm + - seconds + additionalProperties: false + required: + - model + - hrMax + - zones + additionalProperties: false + WorkoutSplit: + type: object + properties: + km: type: integer - minimum: 0 + exclusiveMinimum: 0 maximum: 9007199254740991 - napAsleepMinutes: - description: Time asleep across those naps, in minutes. - type: number + durationSec: + type: integer minimum: 0 - sleepStages: - description: The main night's minutes per stage (`IN_BED`, `ASLEEP`, `AWAKE`, `CORE`, `DEEP`, `REM`), each the union of - that stage's spans; empty on a day of naps alone. - type: object - propertyNames: - type: string - additionalProperties: - type: number - minimum: 0 - inBedMinutes: - description: The main night's time in bed in minutes, or null when no in-bed span was recorded. - anyOf: - - type: number - minimum: 0 - - type: "null" - awakeMinutes: - description: The main night's time awake in bed in minutes, or null when no awake span was recorded. - anyOf: - - type: number - minimum: 0 - - type: "null" - awakenings: - description: Awake spans between the main night's first and last time asleep. + maximum: 9007199254740991 + paceSecPerKm: type: integer minimum: 0 maximum: 9007199254740991 - status: - type: string - enum: - - inserted - - updated - - duplicate - description: "`inserted` — a new row (HTTP 201). `duplicate` — the segment was already stored, by this route or the - batch route, and nothing changed (HTTP 200). `updated` — a stored segment with the same stage, source and - end was corrected in place, for example a later start (HTTP 200)." required: - - id - - type - - value - - unit - - measuredAt - - source - - status + - km + - durationSec + - paceSecPerKm additionalProperties: false - description: The stored SLEEP_DURATION row for a named sleep-stage segment, with what the call did to it. - CreateMeasurementResponse: + WorkoutSportContext: type: object properties: - data: + count: + type: integer + minimum: 0 + maximum: 9007199254740991 + avgDurationSec: + type: integer + minimum: 0 + maximum: 9007199254740991 + avgDistanceM: + type: + - number + - "null" + avgAvgHr: anyOf: - - $ref: "#/components/schemas/NamedSleepStageMeasurement" - - $ref: "#/components/schemas/MeasurementResource" - - type: array - items: - $ref: "#/components/schemas/MeasurementResource" - error: - type: "null" - meta: - type: object - properties: - requestId: - type: string - additionalProperties: false + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" required: - - data - - error + - count + - avgDurationSec + - avgDistanceM + - avgAvgHr additionalProperties: false - GetMeasurementResponse: + WorkoutActivityInsight: type: object properties: - data: - $ref: "#/components/schemas/MeasurementResource" - error: - type: "null" - meta: - type: object - properties: - requestId: - type: string - additionalProperties: false + paragraph: + type: string + generatedAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ required: - - data - - error + - paragraph + - generatedAt additionalProperties: false - UpdateMeasurementResponse: + AiUnavailableReason: + type: string + enum: + - check_failed + - operator_disabled + - not_permitted_for_record + - module_disabled + - user_disabled + - usage_level + - no_provider + - consent_required + description: "Why an AI capability is unavailable, listed in precedence order; only the outermost reason that applies is + reported, because it names the layer that would have to change first. `check_failed` — an input could not be + read and the answer failed closed. `operator_disabled` — the operator's master switch, the capability's own + switch, or the operator's instance-wide availability of its module. `not_permitted_for_record` — AI work is not + admitted for this record (a delegate inside somebody else's record). `module_disabled` — an owning module is off + for this record, by its own switch or by the edge of the active grant. `user_disabled` — the record's own AI + opt-out: the Coach preference for the Coach, the `insights` module (AI analysis) for everything else. + `usage_level` — the record's AI usage level (`ai.usage.level`, v1.43) is below what the capability needs; today + only `supplementLabel` on `frugal`. `no_provider` — no configured provider can serve this capability's input. + `consent_required` — the provider chain needs an AI consent receipt and none is active. The list is closed; a + client that meets a value it does not know treats the capability as unavailable." + AiCapabilityState: type: object properties: - data: - $ref: "#/components/schemas/MeasurementResource" - error: - type: "null" - meta: - type: object - properties: - requestId: - type: string - additionalProperties: false + available: + type: boolean + reason: + anyOf: + - $ref: "#/components/schemas/AiUnavailableReason" + - type: "null" + description: "`null` exactly when `available` is true." + onDeviceAllowed: + type: boolean + description: "Whether an on-device model may do this work. False for `operator_disabled`, `not_permitted_for_record`, + `module_disabled`, `user_disabled`, `usage_level` and `check_failed`: the operator's and the person's + decisions hold on the device too. True otherwise, since a missing server provider or a missing consent for + server egress do not concern a model that runs on the device. Resolved here so the client never decides + which reasons apply off the server." required: - - data - - error + - available + - reason + - onDeviceAllowed additionalProperties: false - DeleteMeasurementResponse: + description: "One AI capability, resolved for one record from every layer that can say no. Render from it; never + recompute it. Data never depends on it: measurements, scores, statistics and device records load whatever it + says." + DeleteWorkoutResponse: type: object properties: data: @@ -55632,11 +60558,11 @@ components: - data - error additionalProperties: false - BatchMeasurementsResponse: + BatchWorkoutsResponse: type: object properties: data: - $ref: "#/components/schemas/AppleHealthBatchResponse" + $ref: "#/components/schemas/WorkoutBatchResponse" error: type: "null" meta: @@ -55649,29 +60575,26 @@ components: - data - error additionalProperties: false - AppleHealthBatchResponse: + WorkoutBatchResponse: type: object properties: processed: type: integer minimum: 0 maximum: 9007199254740991 + description: Entries in the request. Equals `inserted + duplicates + skipped.length`. inserted: type: integer minimum: 0 maximum: 9007199254740991 - updated: - type: integer - minimum: 0 - maximum: 9007199254740991 + description: Workout rows this request wrote. duplicates: type: integer minimum: 0 maximum: 9007199254740991 - failed: - type: integer - minimum: 0 - maximum: 9007199254740991 + description: Entries that wrote no workout row because the workout was already stored. The top-level counters count + workout rows, so an entry reported as `enriched` counts here as well even though its heart-rate series or + GPS track was attached. skipped: type: array items: @@ -55690,17 +60613,15 @@ components: entries: type: array items: - $ref: "#/components/schemas/AppleHealthBatchEntryResult" + $ref: "#/components/schemas/WorkoutBatchEntryResult" required: - processed - inserted - - updated - duplicates - - failed - skipped - entries additionalProperties: false - AppleHealthBatchEntryResult: + WorkoutBatchEntryResult: type: object properties: index: @@ -55711,51 +60632,35 @@ components: type: string enum: - inserted - - updated - duplicate + - enriched + - updated - skipped - - failed - description: "`inserted`/`duplicate` — the row landed (advance the cursor). `updated` — a `stats:` aggregate overwrote - an existing row. `skipped` — validation no-op; see `reason`. `failed` — retryable database failure that must - not advance the entry cursor; the response is marked `Cache-Control: no-store`." + description: "`inserted`: a new workout row. `duplicate`: the workout was already stored and nothing was written. From + v1.48.2 to v1.48.x also an `APPLE_HEALTH` workout whose externalId was deleted through `DELETE + /api/workouts/by-external-ids`; since v1.49.0 such a re-post is written again (`inserted`): only the phone + can delete an Apple Health workout, so one it posts again is back in Apple Health. `enriched`: the workout + was already stored and the heart-rate series or GPS track this entry carried (or both) was attached because + the stored workout had none; no workout row was inserted, and the entry also counts towards the top-level + `duplicates`. A track is attached only while the account keeps tracks (`storeWorkoutRoutes`), and when the + stored workout had no elevation, the climb derived from the attached track fills `elevationM`; no other + column of the workout row is written. `updated` (since v1.40.0): a workout entered by hand (`source: + MANUAL`, `externalId` starting `manual:`) was sent again with different values and the stored row now + carries them; no row was inserted, so it also counts towards `duplicates`. `skipped`: the server refused the + entry, see `reason`." reason: - description: "Why a row was `skipped` or a `duplicate`. `folded_window` (since v1.42): a raw sample of a dense or mean - type whose local day lies before the fold boundary and whose hour or day a live `stats:` row of the same - source already covers. Nothing to retry; treat it like any duplicate. `hour_bucket_misaligned`, - `hour_bucket_unsupported_type`, `hour_bucket_too_old` (since v1.43): an hourly - `stats::T` row the server refused, see `externalId`; permanent for the row as sent." + description: "Why a `skipped` entry was refused: `unstable_external_id` for an id that does not survive a client + restart, `invalid_samples` for a heart-rate series that failed validation." type: string - convertedValue: - description: "Only on a `value_out_of_range` skip (since v1.39.1): the entry's value after conversion into the stored - unit, which is the number the band was checked against. A HealthKit fraction that should have been a percent - shows up here a hundred times off." - type: number - range: - description: "Only on a `value_out_of_range` skip (since v1.39.1): the plausibility band that refused the entry, in the - stored unit. Both edges are inclusive. A skip is permanent for the value as sent; resending it unchanged - skips it again." - type: object - properties: - min: - type: number - max: - type: number - unit: - type: string - required: - - min - - max - - unit - additionalProperties: false required: - index - status additionalProperties: false - MeasurementsDeleteByExternalIdsResponse: + WorkoutsDeleteByExternalIdsResponse: type: object properties: data: - $ref: "#/components/schemas/MeasurementsDeleteByExternalIdsResult" + $ref: "#/components/schemas/ExternalIdDeleteResult" error: type: "null" meta: @@ -55768,21 +60673,23 @@ components: - data - error additionalProperties: false - MeasurementsDeleteByExternalIdsResult: + ExternalIdDeleteResult: type: object properties: deletedCount: type: integer minimum: 0 maximum: 9007199254740991 + description: Rows this call deleted. An id that matched nothing, matched a row of another source or account, or was + already deleted is not counted. required: - deletedCount additionalProperties: false - MeasurementsBulkDeleteResponse: + EcgDeleteByExternalIdsResponse: type: object properties: data: - $ref: "#/components/schemas/MeasurementsBulkDeleteResult" + $ref: "#/components/schemas/ExternalIdDeleteResult" error: type: "null" meta: @@ -55795,21 +60702,11 @@ components: - data - error additionalProperties: false - MeasurementsBulkDeleteResult: - type: object - properties: - deleted: - type: integer - minimum: 0 - maximum: 9007199254740991 - required: - - deleted - additionalProperties: false - MeasurementsRestoreResponse: + CycleDayLogsDeleteByExternalIdsResponse: type: object properties: data: - $ref: "#/components/schemas/MeasurementsRestoreResult" + $ref: "#/components/schemas/ExternalIdDeleteResult" error: type: "null" meta: @@ -55822,21 +60719,11 @@ components: - data - error additionalProperties: false - MeasurementsRestoreResult: - type: object - properties: - restored: - type: integer - minimum: 0 - maximum: 9007199254740991 - required: - - restored - additionalProperties: false - SleepNightResponse: + MoodEntriesDeleteByExternalIdsResponse: type: object properties: data: - $ref: "#/components/schemas/SleepNightResource" + $ref: "#/components/schemas/ExternalIdDeleteResult" error: type: "null" meta: @@ -55847,325 +60734,13 @@ components: additionalProperties: false required: - data - - error - additionalProperties: false - SleepNightResource: - type: object - properties: - night: - type: - - string - - "null" - main: - anyOf: - - type: object - properties: - night: - type: string - description: Wake-day key (YYYY-MM-DD). - source: - anyOf: - - $ref: "#/components/schemas/MeasurementSource" - - type: "null" - start: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - end: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - asleepMinutes: - type: integer - minimum: 0 - maximum: 9007199254740991 - inBedMinutes: - anyOf: - - type: integer - minimum: 0 - maximum: 9007199254740991 - - type: "null" - awakeMinutes: - anyOf: - - type: integer - minimum: 0 - maximum: 9007199254740991 - - type: "null" - awakenings: - type: integer - minimum: 0 - maximum: 9007199254740991 - reconstructed: - type: boolean - description: True when the source has no per-stage onset timestamps and the server synthesised a contiguous timeline in - a fixed physiological order (WHOOP). The client renders the hypnogram but labels it an approximate - layout and never recomputes. False for real-series sources (Apple Health / Withings / Fitbit). - stages: - type: object - propertyNames: - type: string - enum: - - IN_BED - - AWAKE - - ASLEEP - - REM - - CORE - - DEEP - additionalProperties: - type: integer - minimum: 0 - maximum: 9007199254740991 - description: Minutes per stage. Only the stages the night recorded are present; an absent stage is not zero minutes, it - was not measured. - segments: - type: array - items: - type: object - properties: - stage: - anyOf: - - type: string - enum: - - IN_BED - - AWAKE - - ASLEEP - - REM - - CORE - - DEEP - - type: "null" - start: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - end: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - minutes: - type: integer - minimum: 0 - maximum: 9007199254740991 - required: - - stage - - start - - end - - minutes - additionalProperties: false - sourceDiscrepancy: - anyOf: - - type: object - properties: - deltaMinutes: - type: integer - minimum: 0 - maximum: 9007199254740991 - description: Spread (max − min) of the disagreeing per-writer asleep totals, in minutes. - sources: - type: array - items: - type: object - properties: - source: - type: string - description: MeasurementSource value of the writer bucket. - deviceType: - type: - - string - - "null" - asleepMinutes: - type: integer - minimum: 0 - maximum: 9007199254740991 - required: - - source - - deviceType - - asleepMinutes - additionalProperties: false - required: - - deltaMinutes - - sources - additionalProperties: false - - type: "null" - description: Non-null when two writer buckets reported clearly different asleep totals for this session (> 45 min apart - and > 20% of the larger total). Observational only — the served totals stay the winning writer's; - clients may show a discreet 'sources disagree' hint listing each bucket's total. - required: - - night - - source - - start - - end - - asleepMinutes - - inBedMinutes - - awakeMinutes - - awakenings - - reconstructed - - stages - - segments - - sourceDiscrepancy - additionalProperties: false - - type: "null" - naps: - type: array - items: - type: object - properties: - night: - type: string - description: Wake-day key (YYYY-MM-DD). - source: - anyOf: - - $ref: "#/components/schemas/MeasurementSource" - - type: "null" - start: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - end: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - asleepMinutes: - type: integer - minimum: 0 - maximum: 9007199254740991 - inBedMinutes: - anyOf: - - type: integer - minimum: 0 - maximum: 9007199254740991 - - type: "null" - awakeMinutes: - anyOf: - - type: integer - minimum: 0 - maximum: 9007199254740991 - - type: "null" - awakenings: - type: integer - minimum: 0 - maximum: 9007199254740991 - reconstructed: - type: boolean - description: True when the source has no per-stage onset timestamps and the server synthesised a contiguous timeline in - a fixed physiological order (WHOOP). The client renders the hypnogram but labels it an approximate - layout and never recomputes. False for real-series sources (Apple Health / Withings / Fitbit). - stages: - type: object - propertyNames: - type: string - enum: - - IN_BED - - AWAKE - - ASLEEP - - REM - - CORE - - DEEP - additionalProperties: - type: integer - minimum: 0 - maximum: 9007199254740991 - description: Minutes per stage. Only the stages the night recorded are present; an absent stage is not zero minutes, it - was not measured. - segments: - type: array - items: - type: object - properties: - stage: - anyOf: - - type: string - enum: - - IN_BED - - AWAKE - - ASLEEP - - REM - - CORE - - DEEP - - type: "null" - start: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - end: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - minutes: - type: integer - minimum: 0 - maximum: 9007199254740991 - required: - - stage - - start - - end - - minutes - additionalProperties: false - sourceDiscrepancy: - anyOf: - - type: object - properties: - deltaMinutes: - type: integer - minimum: 0 - maximum: 9007199254740991 - description: Spread (max − min) of the disagreeing per-writer asleep totals, in minutes. - sources: - type: array - items: - type: object - properties: - source: - type: string - description: MeasurementSource value of the writer bucket. - deviceType: - type: - - string - - "null" - asleepMinutes: - type: integer - minimum: 0 - maximum: 9007199254740991 - required: - - source - - deviceType - - asleepMinutes - additionalProperties: false - required: - - deltaMinutes - - sources - additionalProperties: false - - type: "null" - description: Non-null when two writer buckets reported clearly different asleep totals for this session (> 45 min apart - and > 20% of the larger total). Observational only — the served totals stay the winning writer's; - clients may show a discreet 'sources disagree' hint listing each bucket's total. - required: - - night - - source - - start - - end - - asleepMinutes - - inBedMinutes - - awakeMinutes - - awakenings - - reconstructed - - stages - - segments - - sourceDiscrepancy - additionalProperties: false - required: - - night - - main - - naps - additionalProperties: false - description: "One reconstructed sleep night: the main session's hypnogram segments + breakdown, plus same-wake-day naps - surfaced separately. A session is a nap when it holds under three hours asleep centred between 10:00 and 20:00 - local time; the main session is the longest session that is not a nap. A day whose only sleep is naps has `main: - null` and its naps." - SleepRhythmResponse: + - error + additionalProperties: false + SymptomEventsDeleteByExternalIdsResponse: type: object properties: data: - $ref: "#/components/schemas/SleepRhythmResource" + $ref: "#/components/schemas/ExternalIdDeleteResult" error: type: "null" meta: @@ -56178,158 +60753,28 @@ components: - data - error additionalProperties: false - SleepRhythmResource: + MedicationIntakesDeleteByExternalIdsResponse: type: object properties: - sleepDebt: - type: object - properties: - state: - type: string - enum: - - partial - - ready - description: "`partial` until enough tracked nights exist (calm 'still learning'); `ready` once the rolling window can - assert a balance." - debtMinutes: - type: integer - minimum: 0 - maximum: 9007199254740991 - description: Outstanding sleep-debt balance over the window, in minutes, after caps. A night below need adds its - shortfall; a night above need pays the balance down (floored at 0). - needMinutes: - type: integer - minimum: 0 - maximum: 9007199254740991 - description: Age-based sleep need (minutes) used for the per-night deficit. - nightsCounted: - type: integer - minimum: 0 - maximum: 9007199254740991 - windowNights: - type: integer - exclusiveMinimum: 0 - maximum: 9007199254740991 - description: Rolling window length in nights. - nightsUntilReady: - type: integer - minimum: 0 - maximum: 9007199254740991 - description: Nights still needed before the debt is asserted (0 when ready). - source: - description: v1.25.0 — the active source the debt is resolved FROM, picked off the user's `sleepDebt` source ladder. - `COMPUTED` is HealthLog's own rolling-balance estimate (the only producer today); a provider value would - be a device-native debt. Clients explain the figure when it is `COMPUTED`. - $ref: "#/components/schemas/MeasurementSource" - required: - - state - - debtMinutes - - needMinutes - - nightsCounted - - windowNights - - nightsUntilReady - - source - additionalProperties: false - chronotype: - type: object - properties: - state: - type: string - enum: - - learning - - ready - description: "`learning` until enough free-day nights exist (no band asserted); `ready` once the free-day sample is - large enough." - msfMinutes: - description: Mid-sleep on free days (minutes-of-day), null while learning. - type: - - number - - "null" - msfScMinutes: - description: Sleep-debt-corrected mid-sleep on free days (MSFsc, minutes-of-day), null while learning. - type: - - number - - "null" - band: - anyOf: - - type: string - enum: - - extreme_early - - early - - intermediate - - late - - extreme_late - - type: "null" - description: MCTQ chronotype band off MSFsc, null while learning. - socialJetlagMinutes: - description: Social jetlag = circular |MSF_work − MSF_free| in minutes, null when one side is missing. - type: - - number - - "null" - freeNightsCounted: - type: integer - minimum: 0 - maximum: 9007199254740991 - workNightsCounted: - type: integer - minimum: 0 - maximum: 9007199254740991 - freeNightsUntilReady: - type: integer - minimum: 0 - maximum: 9007199254740991 - description: Free-day nights still needed before a band is asserted. - required: - - state - - msfMinutes - - msfScMinutes - - band - - socialJetlagMinutes - - freeNightsCounted - - workNightsCounted - - freeNightsUntilReady - additionalProperties: false - averagePerNight: + data: + $ref: "#/components/schemas/ExternalIdDeleteResult" + error: + type: "null" + meta: type: object properties: - state: + requestId: type: string - enum: - - partial - - ready - averageMinutes: - type: integer - minimum: 0 - maximum: 9007199254740991 - description: Mean asleep minutes per scorable night (0 while partial). - nightsCounted: - type: integer - minimum: 0 - maximum: 9007199254740991 - nightsUntilReady: - type: integer - minimum: 0 - maximum: 9007199254740991 - description: Scorable nights still needed before the average is asserted. - required: - - state - - averageMinutes - - nightsCounted - - nightsUntilReady additionalProperties: false required: - - sleepDebt - - chronotype - - averagePerNight + - data + - error additionalProperties: false - description: "Server-authoritative sleep-rhythm read: the outstanding sleep-debt balance over the rolling window + MCTQ - chronotype (MSF/MSFsc band, social jetlag). Free vs work nights default to weekend = free in the user's timezone - (no work calendar). A view over existing per-stage SLEEP_DURATION rows — no schema, no new type." - ListWorkoutsResponse: + ActivityCalendarEnvelope: type: object properties: data: - $ref: "#/components/schemas/WorkoutListResponse" + $ref: "#/components/schemas/ActivityCalendar" error: type: "null" meta: @@ -56342,680 +60787,1134 @@ components: - data - error additionalProperties: false - WorkoutListResponse: + ActivityCalendar: type: object properties: - workouts: + period: + type: string + enum: + - week + - month + start: + type: string + format: date + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ + end: + type: string + format: date + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ + gridStart: + type: string + format: date + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ + description: First day drawn (the Monday on or before `start`). + gridEnd: + type: string + format: date + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ + description: Last day drawn (the Sunday on or after `end`). + today: + type: string + format: date + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ + timezone: + type: string + description: The IANA zone the days are cut in. + loadType: + anyOf: + - type: string + enum: + - DAY_STRAIN + - CARDIO_LOAD + - STRAIN_SCORE + - type: "null" + description: Which training-load score `load` carries; null when the account has none. + days: type: array items: - $ref: "#/components/schemas/WorkoutListEntry" - meta: + type: object + properties: + date: + type: string + format: date + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ + inPeriod: + type: boolean + future: + type: boolean + steps: + type: + - number + - "null" + activeMinutes: + description: The larger of the day's exercise minutes and workout minutes (never their sum). + type: + - number + - "null" + workoutCount: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + workoutsBySport: + type: object + propertyNames: + type: string + additionalProperties: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + load: + type: + - number + - "null" + level: + type: object + properties: + steps: + type: string + enum: + - none + - unrated + - in_progress + - low + - below + - usual + - above + - high + description: "Where the day sits in the person's own spread over the 84 days before the period: `low` below their 10th + percentile, `below` below the 25th, `above` above the 75th, `high` above the 90th, `usual` + between. `none` = no value that day; `unrated` = fewer than 14 days of history to compare with; + `in_progress` = today, which has not ended and is never rated." + activeMinutes: + type: string + enum: + - none + - unrated + - in_progress + - low + - below + - usual + - above + - high + description: "Where the day sits in the person's own spread over the 84 days before the period: `low` below their 10th + percentile, `below` below the 25th, `above` above the 75th, `high` above the 90th, `usual` + between. `none` = no value that day; `unrated` = fewer than 14 days of history to compare with; + `in_progress` = today, which has not ended and is never rated." + load: + type: string + enum: + - none + - unrated + - in_progress + - low + - below + - usual + - above + - high + description: "Where the day sits in the person's own spread over the 84 days before the period: `low` below their 10th + percentile, `below` below the 25th, `above` above the 75th, `high` above the 90th, `usual` + between. `none` = no value that day; `unrated` = fewer than 14 days of history to compare with; + `in_progress` = today, which has not ended and is never rated." + required: + - steps + - activeMinutes + - load + additionalProperties: false + required: + - date + - inPeriod + - future + - steps + - activeMinutes + - workoutCount + - workoutsBySport + - load + - level + additionalProperties: false + weeks: + type: array + items: + type: object + properties: + start: + type: string + format: date + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ + end: + type: string + format: date + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ + steps: + type: + - number + - "null" + activeMinutes: + type: + - number + - "null" + workouts: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + goals: + type: array + items: + $ref: "#/components/schemas/ActivityGoalProgress" + description: The weekly goals for a week that has begun. + required: + - start + - end + - steps + - activeMinutes + - workouts + - goals + additionalProperties: false + baseline: type: object properties: - total: - type: integer - minimum: 0 - maximum: 9007199254740991 - limit: - type: integer - exclusiveMinimum: 0 - maximum: 9007199254740991 - offset: - type: integer - minimum: 0 - maximum: 9007199254740991 - droppedDuplicates: - type: integer - minimum: 0 - maximum: 9007199254740991 + steps: + $ref: "#/components/schemas/ActivityBaselineStats" + activeMinutes: + $ref: "#/components/schemas/ActivityBaselineStats" + load: + $ref: "#/components/schemas/ActivityBaselineStats" required: - - total - - limit - - offset - - droppedDuplicates + - steps + - activeMinutes + - load additionalProperties: false - trainingLoad: - description: v1.44 — on the first page (`offset=0`) only, account-wide whatever the filter. Absent on later pages and - older servers. - $ref: "#/components/schemas/WorkoutTrainingLoad" - required: - - workouts - - meta - additionalProperties: false - WorkoutListEntry: - type: object - properties: - id: + summary: + type: object + properties: + steps: + $ref: "#/components/schemas/ActivityPeriodComparison" + activeMinutes: + $ref: "#/components/schemas/ActivityPeriodComparison" + workouts: + $ref: "#/components/schemas/ActivityPeriodComparison" + load: + $ref: "#/components/schemas/ActivityPeriodComparison" + required: + - steps + - activeMinutes + - workouts + - load + additionalProperties: false + sports: + type: array + items: + type: object + properties: + sportType: + type: string + count: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + required: + - sportType + - count + additionalProperties: false + goals: + $ref: "#/components/schemas/ActivityGoals" + goalProgress: + type: array + items: + $ref: "#/components/schemas/ActivityGoalProgress" + available: + type: object + properties: + steps: + type: boolean + activeMinutes: + type: boolean + workouts: + type: boolean + load: + type: boolean + required: + - steps + - activeMinutes + - workouts + - load + additionalProperties: false + previous: type: string - sportType: - type: - - string - - "null" - startedAt: - anyOf: - - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - - type: "null" - endedAt: + format: date + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ + description: A day in the previous period. + next: anyOf: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - - type: "null" - durationSec: - anyOf: - - type: integer - minimum: 0 - maximum: 9007199254740991 - - type: "null" - distanceM: - type: - - number - - "null" - activeEnergyKcal: - type: - - number - - "null" - avgHr: - anyOf: - - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - - type: "null" - maxHr: - anyOf: - - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 + format: date + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ - type: "null" - source: - $ref: "#/components/schemas/MeasurementSource" - externalId: - type: - - string - - "null" - hasRoute: - type: boolean - hasHrSeries: + description: A day in the next period, or null when that lies after today. + required: + - period + - start + - end + - gridStart + - gridEnd + - today + - timezone + - loadType + - days + - weeks + - baseline + - summary + - sports + - goals + - goalProgress + - available + - previous + - next + additionalProperties: false + ActivityGoalProgress: + type: object + properties: + key: + type: string + enum: + - workoutsPerWeek + - activeMinutesPerWeek + - stepsPerWeek + - stepsPerMonth + target: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + value: + type: number + met: type: boolean required: - - id - - sportType - - startedAt - - endedAt - - durationSec - - distanceM - - activeEnergyKcal - - avgHr - - maxHr - - source - - externalId - - hasRoute - - hasHrSeries + - key + - target + - value + - met additionalProperties: false - WorkoutTrainingLoad: + ActivityBaselineStats: anyOf: - type: object properties: - status: - type: string - const: ok - asOf: - type: string - description: The last rated UTC day, at most yesterday; the figures are those of this day. The series runs on to - yesterday, so a later stretch without data shows as unrated days. - ctl: + median: type: number - description: "Fitness: 42-day exponentially weighted TRIMP." - atl: + p10: type: number - description: "Fatigue: 7-day exponentially weighted TRIMP." - tsb: + p25: type: number - description: "Form: fitness minus fatigue at `asOf`." - daysCovered: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - trainingDays: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - recentRatedDays: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - description: "Rated days of the trailing `recentDays` (42 up to yesterday, or fewer when covered less): a stored - impulse, or activity data without a workout." - recentDays: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - warmingUp: - type: boolean - description: "True below 42 covered days: both averages start at zero." - series: - type: array - items: - type: object - properties: - day: - type: string - ctl: - type: number - atl: - type: number - tsb: - type: number - rated: - type: boolean - description: "False for a day that could not be rated: no stored impulse and no activity data (steps, heart rate, active - energy), or a workout that was never scored. The averages held through it rather than counting it - as rest. A day with activity data and no workout is rest (impulse 0)." - required: - - day - - ctl - - atl - - tsb - - rated - additionalProperties: false - description: The trailing 90 days, oldest first; `tsb` is form going into the day. - required: - - status - - asOf - - ctl - - atl - - tsb - - daysCovered - - trainingDays - - recentRatedDays - - recentDays - - warmingUp - - series - additionalProperties: false - - type: object - properties: - status: - type: string - const: insufficient - reason: - type: string - enum: - - no_impulse_history - - too_little_history - daysCovered: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - trainingDays: + p75: + type: number + p90: + type: number + days: type: integer minimum: -9007199254740991 maximum: 9007199254740991 + description: Days with a value the spread was computed from. required: - - status - - reason - - daysCovered - - trainingDays - additionalProperties: false - description: "v1.44 — the fitness-fatigue model over the stored daily heart-rate training impulse (Banister TRIMP; a day - with activity data but no training is 0, a day with no data or an unscored workout is not rated and the averages - hold through it). Needs 28 days and three training days. TRIMP units: comparable with the person's own past - only." - GetWorkoutResponse: - type: object - properties: - data: - $ref: "#/components/schemas/WorkoutDetailResponse" - error: - type: "null" - meta: - type: object - properties: - requestId: - type: string + - median + - p10 + - p25 + - p75 + - p90 + - days additionalProperties: false - required: - - data - - error - additionalProperties: false - WorkoutDetailResponse: + - type: "null" + ActivityPeriodComparison: type: object properties: - id: - type: string - sportType: - type: string - startedAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - endedAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - dayKey: - type: string - durationSec: + value: + description: "The period so far: a total (steps, active minutes, workouts) or a mean (load)." + type: + - number + - "null" + daysWithData: type: integer - minimum: 0 + minimum: -9007199254740991 maximum: 9007199254740991 - distanceM: + completedDays: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: Days of the period that have ended (today excluded). + completedValue: + description: "`value` over the completed days only. This, not `value`, is what `usualToDate` is compared with, so a + running period is never judged on today's partial day." type: - number - "null" - activeEnergyKcal: + usual: + description: "The person's usual full period: the median of the twelve weeks (or, per day, of the six months) before it. + Null with fewer than three earlier periods of data." type: - number - "null" - avgHr: - anyOf: - - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - - type: "null" - maxHr: - anyOf: - - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - - type: "null" - minHr: - anyOf: - - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - - type: "null" - storedAvgHr: - description: The row's own average heart rate (v1.42). `avgHr` may be filled in from a same-session twin by the - canonical picker; this is the stored value, which an edit of a hand-entered workout sends back so the twin's - value is not written onto it. + usualToDate: + description: The usual figure for the completed days (today excluded); equals `usual` once the period is over, null + before the period's first day has ended. + type: + - number + - "null" + referencePeriods: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + required: + - value + - daysWithData + - completedDays + - completedValue + - usual + - usualToDate + - referencePeriods + additionalProperties: false + ActivityGoals: + type: object + properties: + workoutsPerWeek: anyOf: - type: integer minimum: -9007199254740991 maximum: 9007199254740991 - type: "null" - storedMaxHr: - description: The row's own maximum heart rate (v1.42), as `storedAvgHr` is to `avgHr`. + activeMinutesPerWeek: anyOf: - type: integer minimum: -9007199254740991 maximum: 9007199254740991 - type: "null" - stepCount: + stepsPerWeek: anyOf: - type: integer minimum: -9007199254740991 maximum: 9007199254740991 - type: "null" - elevationM: - type: - - number - - "null" - pauseDurationSec: + stepsPerMonth: anyOf: - type: integer minimum: -9007199254740991 maximum: 9007199254740991 - type: "null" - source: - $ref: "#/components/schemas/MeasurementSource" - externalId: - type: - - string - - "null" - metadata: - anyOf: - - {} - - type: "null" - route: - anyOf: - - $ref: "#/components/schemas/WorkoutRouteGeometry" - - type: "null" - samples: - anyOf: - - $ref: "#/components/schemas/WorkoutHrSeries" - - type: "null" - hrSeries: - anyOf: - - $ref: "#/components/schemas/WorkoutHrCurve" - - type: "null" - zones: - anyOf: - - $ref: "#/components/schemas/WorkoutZones" - - type: "null" - splits: - anyOf: - - type: array - items: - $ref: "#/components/schemas/WorkoutSplit" - - type: "null" - sportContext: - anyOf: - - $ref: "#/components/schemas/WorkoutSportContext" - - type: "null" - aiInsight: - anyOf: - - $ref: "#/components/schemas/WorkoutActivityInsight" - - type: "null" - ai: - description: The `workoutInsights` AI capability. While it is unavailable `aiInsight` is null and the stored paragraph - is not even read. - $ref: "#/components/schemas/AiCapabilityState" - canonicalId: - type: string - previousWorkoutId: - type: - - string - - "null" required: - - id - - sportType - - startedAt - - endedAt - - dayKey - - durationSec - - distanceM - - activeEnergyKcal - - avgHr - - maxHr - - minHr - - stepCount - - elevationM - - pauseDurationSec - - source - - externalId - - metadata - - route - - samples - - hrSeries - - zones - - splits - - sportContext - - aiInsight - - ai - - canonicalId - - previousWorkoutId + - workoutsPerWeek + - activeMinutesPerWeek + - stepsPerWeek + - stepsPerMonth additionalProperties: false - WorkoutRouteGeometry: + description: The person's own goals; `null` = not set. There is no default goal. + ActivityGoalsEnvelope: type: object properties: - geometry: {} - sampleTimestamps: - anyOf: - - type: array - items: - anyOf: - - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - - type: object - properties: - t: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - speedMs: - type: number - hr: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - required: - - t - additionalProperties: false - - type: "null" - description: "One entry per geometry point, as the track was stored: a bare instant, or (from the workout batch and the - Apple Health export) an object with its instant and, where recorded, speed (m/s) and heart rate (bpm)." + data: + $ref: "#/components/schemas/ActivityGoals" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false required: - - geometry - - sampleTimestamps + - data + - error additionalProperties: false - WorkoutHrSeries: + ActivityGoalsPatchEnvelope: type: object properties: - sampleCount: - type: integer - minimum: 0 - maximum: 9007199254740991 - samples: {} + data: + $ref: "#/components/schemas/ActivityGoals" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false required: - - sampleCount - - samples + - data + - error additionalProperties: false - WorkoutHrCurve: + DayProvenanceEnvelope: type: object properties: - source: + data: + $ref: "#/components/schemas/DayProvenance" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + DayProvenance: + type: object + properties: + type: + type: string + enum: + - WEIGHT + - BLOOD_PRESSURE_SYS + - BLOOD_PRESSURE_DIA + - PULSE + - BODY_FAT + - SLEEP_DURATION + - ACTIVITY_STEPS + - BLOOD_GLUCOSE + - TOTAL_BODY_WATER + - BONE_MASS + - OXYGEN_SATURATION + - HEART_RATE_VARIABILITY + - RESTING_HEART_RATE + - ACTIVE_ENERGY_BURNED + - FLIGHTS_CLIMBED + - WALKING_RUNNING_DISTANCE + - VO2_MAX + - BODY_TEMPERATURE + - FAT_FREE_MASS + - FAT_MASS + - MUSCLE_MASS + - SKIN_TEMPERATURE + - PULSE_WAVE_VELOCITY + - VASCULAR_AGE + - VISCERAL_FAT + - AUDIO_EXPOSURE_ENV + - AUDIO_EXPOSURE_HEADPHONE + - TIME_IN_DAYLIGHT + - WALKING_STEADINESS + - AUDIO_EXPOSURE_EVENT + - RESPIRATORY_RATE + - BODY_MASS_INDEX + - LEAN_BODY_MASS + - WALKING_HEART_RATE_AVERAGE + - WALKING_ASYMMETRY + - WALKING_DOUBLE_SUPPORT + - WALKING_STEP_LENGTH + - WALKING_SPEED + - CARDIO_RECOVERY + - WRIST_TEMPERATURE + - FALL_COUNT + - SIX_MINUTE_WALK_DISTANCE + - STAIR_ASCENT_SPEED + - STAIR_DESCENT_SPEED + - BREATHING_DISTURBANCES + - IRREGULAR_RHYTHM_NOTIFICATION + - HIGH_HEART_RATE_EVENT + - LOW_HEART_RATE_EVENT + - WALKING_STEADINESS_EVENT + - BREATHING_DISTURBANCE_EVENT + - HYPERTENSION_EVENT + - RECOVERY_SCORE + - STRESS_SCORE + - STRAIN_SCORE + - HRV_RMSSD + - DAY_STRAIN + - WORKOUT_STRAIN + - SLEEP_PERFORMANCE + - SLEEP_EFFICIENCY + - SLEEP_CONSISTENCY + - SLEEP_NEED + - ENERGY_EXPENDITURE_KJ + - AVERAGE_HEART_RATE + - MAX_HEART_RATE + - SLEEP_DISTURBANCE_COUNT + - ANS_CHARGE + - CARDIO_LOAD + - SLEEP_SCORE + - BODY_TEMPERATURE_DEVIATION + - RESILIENCE + - PHQ9_SCORE + - GAD7_SCORE + - GRIP_STRENGTH + - PAIN_NRS + - WAIST_CIRCUMFERENCE + - WAIST_TO_HEIGHT + - WHO5_SCORE + - SCI_SCORE + - EXERCISE_MINUTES + - STAND_MINUTES + - STAND_HOURS + - MINDFUL_MINUTES + - STATE_OF_MIND_VALENCE + - AFIB_BURDEN + - INDOOR_CO2 + - INDOOR_TEMPERATURE + - INDOOR_HUMIDITY + - BODY_BATTERY + - STRESS_LEVEL + - TRAINING_READINESS + - ACUTE_TRAINING_LOAD + - BASAL_ENERGY_BURNED + - BLOOD_KETONES + - LOW_CARDIO_FITNESS_EVENT + - MENOPAUSAL_STATE + - BLEEDING_AFTER_MENOPAUSE + - INSULIN_DELIVERY + - INHALER_USAGE + - FEV1 + - FVC + - PEAK_EXPIRATORY_FLOW + - WORKOUT_EFFORT_SCORE + - ESTIMATED_WORKOUT_EFFORT_SCORE + - PHYSICAL_EFFORT + - CYCLING_DISTANCE + - ROWING_DISTANCE + - ROWING_SPEED + - RUNNING_SPEED + - RUNNING_POWER + - RUNNING_GROUND_CONTACT_TIME + - RUNNING_VERTICAL_OSCILLATION + - RUNNING_STRIDE_LENGTH + date: + type: string + format: date + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ + aggregation: type: string enum: - - workout_series - - pulse_window - bucketSec: - type: integer - exclusiveMinimum: 0 - maximum: 9007199254740991 - points: + - sum + - mean + ranked: + type: boolean + metricKey: + type: + - string + - "null" + ladder: + type: array + items: + type: string + enum: + - MANUAL + - WITHINGS + - IMPORT + - APPLE_HEALTH + - COMPUTED + - WHOOP + - FITBIT + - NIGHTSCOUT + - POLAR + - OURA + - TELEGRAM + - MCP + - GOOGLE_HEALTH + - STRAVA + - EXTERNAL + - HEALTH_CONNECT + - GARMIN + picked: + anyOf: + - type: string + enum: + - MANUAL + - WITHINGS + - IMPORT + - APPLE_HEALTH + - COMPUTED + - WHOOP + - FITBIT + - NIGHTSCOUT + - POLAR + - OURA + - TELEGRAM + - MCP + - GOOGLE_HEALTH + - STRAVA + - EXTERNAL + - HEALTH_CONNECT + - GARMIN + - type: "null" + pickReason: + anyOf: + - type: string + enum: + - only_source + - highest_on_ladder + - name_tiebreak + - not_ranked + description: "`only_source`: one source that day. `highest_on_ladder`: it stands highest on the ladder among the day's + sources. `name_tiebreak`: none of them is on the ladder, the source name decided. `not_ranked`: this + metric has no ladder, every source counts." + - type: "null" + sources: type: array items: type: object properties: - tSec: - type: integer - minimum: 0 - maximum: 9007199254740991 - mean: + source: + type: string + enum: + - MANUAL + - WITHINGS + - IMPORT + - APPLE_HEALTH + - COMPUTED + - WHOOP + - FITBIT + - NIGHTSCOUT + - POLAR + - OURA + - TELEGRAM + - MCP + - GOOGLE_HEALTH + - STRAVA + - EXTERNAL + - HEALTH_CONNECT + - GARMIN + rank: type: integer minimum: -9007199254740991 maximum: 9007199254740991 - min: + description: Position on the ladder, 0 = highest; 90 = not on the ladder. + readings: type: integer minimum: -9007199254740991 maximum: 9007199254740991 + value: + description: "The day's value from this source: the day total for a cumulative metric (sleep counts asleep stages only), + the mean of the readings otherwise." + type: + - number + - "null" + min: + type: + - number + - "null" max: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 + type: + - number + - "null" + firstAt: + type: string + description: ISO instant of the first reading that day. + lastAt: + type: string + unit: + type: + - string + - "null" + devices: + type: array + items: + type: string + description: Device kinds the readings carry; `unknown` when untagged. + pass: + anyOf: + - type: string + enum: + - lower_on_ladder + - not_on_ladder + - name_tiebreak + - type: "null" + description: Why this source was not the one picked; null for the picked one. required: - - tSec - - mean + - source + - rank + - readings + - value - min - max + - firstAt + - lastAt + - unit + - devices + - pass additionalProperties: false - envelope: - type: boolean required: - - source - - bucketSec - - points - - envelope + - type + - date + - aggregation + - ranked + - metricKey + - ladder + - picked + - pickReason + - sources additionalProperties: false - WorkoutZones: + SourceComparisonEnvelope: type: object properties: - model: + data: + $ref: "#/components/schemas/SourceComparison" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + SourceComparison: + type: object + properties: + type: type: string enum: - - whoop - - tanaka - hrMax: - anyOf: - - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - - type: "null" - zones: + - WEIGHT + - BLOOD_PRESSURE_SYS + - BLOOD_PRESSURE_DIA + - PULSE + - BODY_FAT + - SLEEP_DURATION + - ACTIVITY_STEPS + - BLOOD_GLUCOSE + - TOTAL_BODY_WATER + - BONE_MASS + - OXYGEN_SATURATION + - HEART_RATE_VARIABILITY + - RESTING_HEART_RATE + - ACTIVE_ENERGY_BURNED + - FLIGHTS_CLIMBED + - WALKING_RUNNING_DISTANCE + - VO2_MAX + - BODY_TEMPERATURE + - FAT_FREE_MASS + - FAT_MASS + - MUSCLE_MASS + - SKIN_TEMPERATURE + - PULSE_WAVE_VELOCITY + - VASCULAR_AGE + - VISCERAL_FAT + - AUDIO_EXPOSURE_ENV + - AUDIO_EXPOSURE_HEADPHONE + - TIME_IN_DAYLIGHT + - WALKING_STEADINESS + - AUDIO_EXPOSURE_EVENT + - RESPIRATORY_RATE + - BODY_MASS_INDEX + - LEAN_BODY_MASS + - WALKING_HEART_RATE_AVERAGE + - WALKING_ASYMMETRY + - WALKING_DOUBLE_SUPPORT + - WALKING_STEP_LENGTH + - WALKING_SPEED + - CARDIO_RECOVERY + - WRIST_TEMPERATURE + - FALL_COUNT + - SIX_MINUTE_WALK_DISTANCE + - STAIR_ASCENT_SPEED + - STAIR_DESCENT_SPEED + - BREATHING_DISTURBANCES + - IRREGULAR_RHYTHM_NOTIFICATION + - HIGH_HEART_RATE_EVENT + - LOW_HEART_RATE_EVENT + - WALKING_STEADINESS_EVENT + - BREATHING_DISTURBANCE_EVENT + - HYPERTENSION_EVENT + - RECOVERY_SCORE + - STRESS_SCORE + - STRAIN_SCORE + - HRV_RMSSD + - DAY_STRAIN + - WORKOUT_STRAIN + - SLEEP_PERFORMANCE + - SLEEP_EFFICIENCY + - SLEEP_CONSISTENCY + - SLEEP_NEED + - ENERGY_EXPENDITURE_KJ + - AVERAGE_HEART_RATE + - MAX_HEART_RATE + - SLEEP_DISTURBANCE_COUNT + - ANS_CHARGE + - CARDIO_LOAD + - SLEEP_SCORE + - BODY_TEMPERATURE_DEVIATION + - RESILIENCE + - PHQ9_SCORE + - GAD7_SCORE + - GRIP_STRENGTH + - PAIN_NRS + - WAIST_CIRCUMFERENCE + - WAIST_TO_HEIGHT + - WHO5_SCORE + - SCI_SCORE + - EXERCISE_MINUTES + - STAND_MINUTES + - STAND_HOURS + - MINDFUL_MINUTES + - STATE_OF_MIND_VALENCE + - AFIB_BURDEN + - INDOOR_CO2 + - INDOOR_TEMPERATURE + - INDOOR_HUMIDITY + - BODY_BATTERY + - STRESS_LEVEL + - TRAINING_READINESS + - ACUTE_TRAINING_LOAD + - BASAL_ENERGY_BURNED + - BLOOD_KETONES + - LOW_CARDIO_FITNESS_EVENT + - MENOPAUSAL_STATE + - BLEEDING_AFTER_MENOPAUSE + - INSULIN_DELIVERY + - INHALER_USAGE + - FEV1 + - FVC + - PEAK_EXPIRATORY_FLOW + - WORKOUT_EFFORT_SCORE + - ESTIMATED_WORKOUT_EFFORT_SCORE + - PHYSICAL_EFFORT + - CYCLING_DISTANCE + - ROWING_DISTANCE + - ROWING_SPEED + - RUNNING_SPEED + - RUNNING_POWER + - RUNNING_GROUND_CONTACT_TIME + - RUNNING_VERTICAL_OSCILLATION + - RUNNING_STRIDE_LENGTH + from: + type: string + format: date + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ + to: + type: string + format: date + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ + aggregation: + type: string + enum: + - sum + - mean + ranked: + type: boolean + ladder: + type: array + items: + type: string + enum: + - MANUAL + - WITHINGS + - IMPORT + - APPLE_HEALTH + - COMPUTED + - WHOOP + - FITBIT + - NIGHTSCOUT + - POLAR + - OURA + - TELEGRAM + - MCP + - GOOGLE_HEALTH + - STRAVA + - EXTERNAL + - HEALTH_CONNECT + - GARMIN + unit: + type: + - string + - "null" + sources: type: array items: type: object properties: - zone: - type: integer - minimum: 1 - maximum: 5 - lowBpm: - anyOf: - - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - - type: "null" - highBpm: - anyOf: - - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - - type: "null" - seconds: + source: + type: string + enum: + - MANUAL + - WITHINGS + - IMPORT + - APPLE_HEALTH + - COMPUTED + - WHOOP + - FITBIT + - NIGHTSCOUT + - POLAR + - OURA + - TELEGRAM + - MCP + - GOOGLE_HEALTH + - STRAVA + - EXTERNAL + - HEALTH_CONNECT + - GARMIN + days: type: integer - minimum: 0 + minimum: -9007199254740991 maximum: 9007199254740991 required: - - zone - - lowBpm - - highBpm - - seconds + - source + - days additionalProperties: false - required: - - model - - hrMax - - zones - additionalProperties: false - WorkoutSplit: - type: object - properties: - km: - type: integer - exclusiveMinimum: 0 - maximum: 9007199254740991 - durationSec: - type: integer - minimum: 0 - maximum: 9007199254740991 - paceSecPerKm: - type: integer - minimum: 0 - maximum: 9007199254740991 - required: - - km - - durationSec - - paceSecPerKm - additionalProperties: false - WorkoutSportContext: - type: object - properties: - count: - type: integer - minimum: 0 - maximum: 9007199254740991 - avgDurationSec: - type: integer - minimum: 0 - maximum: 9007199254740991 - avgDistanceM: - type: - - number - - "null" - avgAvgHr: + a: anyOf: - - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - - type: "null" - required: - - count - - avgDurationSec - - avgDistanceM - - avgAvgHr - additionalProperties: false - WorkoutActivityInsight: - type: object - properties: - paragraph: - type: string - generatedAt: - type: string - format: date-time - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - required: - - paragraph - - generatedAt - additionalProperties: false - AiUnavailableReason: - type: string - enum: - - check_failed - - operator_disabled - - not_permitted_for_record - - module_disabled - - user_disabled - - usage_level - - no_provider - - consent_required - description: "Why an AI capability is unavailable, listed in precedence order; only the outermost reason that applies is - reported, because it names the layer that would have to change first. `check_failed` — an input could not be - read and the answer failed closed. `operator_disabled` — the operator's master switch, the capability's own - switch, or the operator's instance-wide availability of its module. `not_permitted_for_record` — AI work is not - admitted for this record (a delegate inside somebody else's record). `module_disabled` — an owning module is off - for this record, by its own switch or by the edge of the active grant. `user_disabled` — the record's own AI - opt-out: the Coach preference for the Coach, the `insights` module (AI analysis) for everything else. - `usage_level` — the record's AI usage level (`ai.usage.level`, v1.43) is below what the capability needs; today - only `supplementLabel` on `frugal`. `no_provider` — no configured provider can serve this capability's input. - `consent_required` — the provider chain needs an AI consent receipt and none is active. The list is closed; a - client that meets a value it does not know treats the capability as unavailable." - AiCapabilityState: - type: object - properties: - available: - type: boolean - reason: + - type: string + enum: + - MANUAL + - WITHINGS + - IMPORT + - APPLE_HEALTH + - COMPUTED + - WHOOP + - FITBIT + - NIGHTSCOUT + - POLAR + - OURA + - TELEGRAM + - MCP + - GOOGLE_HEALTH + - STRAVA + - EXTERNAL + - HEALTH_CONNECT + - GARMIN + - type: "null" + b: anyOf: - - $ref: "#/components/schemas/AiUnavailableReason" + - type: string + enum: + - MANUAL + - WITHINGS + - IMPORT + - APPLE_HEALTH + - COMPUTED + - WHOOP + - FITBIT + - NIGHTSCOUT + - POLAR + - OURA + - TELEGRAM + - MCP + - GOOGLE_HEALTH + - STRAVA + - EXTERNAL + - HEALTH_CONNECT + - GARMIN - type: "null" - description: "`null` exactly when `available` is true." - onDeviceAllowed: - type: boolean - description: "Whether an on-device model may do this work. False for `operator_disabled`, `not_permitted_for_record`, - `module_disabled`, `user_disabled`, `usage_level` and `check_failed`: the operator's and the person's - decisions hold on the device too. True otherwise, since a missing server provider or a missing consent for - server egress do not concern a model that runs on the device. Resolved here so the client never decides - which reasons apply off the server." - required: - - available - - reason - - onDeviceAllowed - additionalProperties: false - description: "One AI capability, resolved for one record from every layer that can say no. Render from it; never - recompute it. Data never depends on it: measurements, scores, statistics and device records load whatever it - says." - DeleteWorkoutResponse: - type: object - properties: - data: + days: + type: array + items: + type: object + properties: + date: + type: string + format: date + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ + a: + type: + - number + - "null" + b: + type: + - number + - "null" + picked: + anyOf: + - type: string + enum: + - MANUAL + - WITHINGS + - IMPORT + - APPLE_HEALTH + - COMPUTED + - WHOOP + - FITBIT + - NIGHTSCOUT + - POLAR + - OURA + - TELEGRAM + - MCP + - GOOGLE_HEALTH + - STRAVA + - EXTERNAL + - HEALTH_CONNECT + - GARMIN + - type: "null" + required: + - date + - a + - b + - picked + additionalProperties: false + summary: type: object properties: - deleted: - type: boolean - const: true + daysA: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + daysB: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + daysBoth: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + meanA: + type: + - number + - "null" + meanB: + type: + - number + - "null" + meanDifference: + type: + - number + - "null" + meanAbsoluteDifference: + type: + - number + - "null" + pickedA: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + pickedB: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 required: - - deleted - additionalProperties: false - error: - type: "null" - meta: - type: object - properties: - requestId: - type: string + - daysA + - daysB + - daysBoth + - meanA + - meanB + - meanDifference + - meanAbsoluteDifference + - pickedA + - pickedB additionalProperties: false required: - - data - - error + - type + - from + - to + - aggregation + - ranked + - ladder + - unit + - sources + - a + - b + - days + - summary additionalProperties: false - BatchWorkoutsResponse: + DeviceRegisterResponse: type: object properties: data: - $ref: "#/components/schemas/WorkoutBatchResponse" + type: object + properties: + id: + type: string + push: + $ref: "#/components/schemas/DevicePushState" + required: + - id + - push + additionalProperties: false error: type: "null" meta: @@ -57028,90 +61927,114 @@ components: - data - error additionalProperties: false - WorkoutBatchResponse: + DevicePushState: type: object properties: - processed: - type: integer - minimum: 0 - maximum: 9007199254740991 - description: Entries in the request. Equals `inserted + duplicates + skipped.length`. - inserted: - type: integer - minimum: 0 - maximum: 9007199254740991 - description: Workout rows this request wrote. - duplicates: - type: integer - minimum: 0 - maximum: 9007199254740991 - description: Entries that wrote no workout row because the workout was already stored. The top-level counters count - workout rows, so an entry reported as `enriched` counts here as well even though its heart-rate series or - GPS track was attached. - skipped: - type: array - items: - type: object - properties: - index: - type: integer - minimum: 0 - maximum: 9007199254740991 - reason: - type: string - required: - - index - - reason - additionalProperties: false - entries: + transport: + type: string + enum: + - relay + - direct + - none + description: "How pushes reach this device: this server's own APNs key, the relay, or not at all." + envelope: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + description: The envelope version sealed to this device, or null when it gets none. + consent: + type: boolean + description: The person turned the relay on for this device. + relayState: + type: string + enum: + - none + - bound + - rebind_needed + - conflict + description: "`rebind_needed`: send a fresh `relayBinding`. `conflict`: answer the relay's challenge push directly. A + `conflict` not settled by a fresh binding within 30 minutes (the challenge's lifetime) reads `rebind_needed` + (v1.49.0)." + intakeSync: + type: string + enum: + - ok + - degraded + description: "`degraded` when the relay is not healthy, the last dose confirmation to this device was dropped and no + alert opened since, or the newest alert the relay accepted was never opened although the device reported + receipts well after it. Only the last 24 hours count; silent and Live Activity pushes never do, since iOS + delivers them at its discretion (v1.49.0). The reason is in the device's push diagnostics." + senderKeys: type: array items: - $ref: "#/components/schemas/WorkoutBatchEntryResult" + $ref: "#/components/schemas/PushSenderKey" + description: The same keys as `push.relay.senderKeys`. + relayInstanceId: + type: + - string + - "null" + liveActivityConsent: + type: boolean + description: "The relay holds the device's Live Activity consent: start and update over the relay. Withdrawn with the + relay consent." + liveActivityStarted: + anyOf: + - type: object + properties: + medicationId: + type: string + slotInstant: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + required: + - medicationId + - slotInstant + additionalProperties: false + - type: "null" + description: "The dose the Live Activity the server started on this device (over the relay) shows. The start push never + carries it, so the app reads it here, and in the `POST /api/devices` answer right after it registers the + started Activity's token (`relayStart: true`). Null until the relay accepted the start (a start still in + flight or one the relay refused shows null; a refused one is tried again later), when no server start is + running, or once that slot is taken, skipped or missed, its medication paused, ended or deleted, or the + Activity ended." required: - - processed - - inserted - - duplicates - - skipped - - entries + - transport + - envelope + - consent + - relayState + - intakeSync + - senderKeys + - relayInstanceId + - liveActivityConsent + - liveActivityStarted additionalProperties: false - WorkoutBatchEntryResult: + PushSenderKey: type: object properties: - index: - type: integer - minimum: 0 - maximum: 9007199254740991 + publicKey: + type: string + description: X25519 sender public key, 32 bytes, unpadded base64url. status: type: string enum: - - inserted - - duplicate - - enriched - - updated - - skipped - description: "`inserted`: a new workout row. `duplicate`: the workout was already stored and nothing was written; since - v1.48.2 also an `APPLE_HEALTH` workout whose externalId was deleted through `DELETE - /api/workouts/by-external-ids`, which stays deleted. `enriched`: the workout was already stored and the - heart-rate series or GPS track this entry carried (or both) was attached because the stored workout had - none; no workout row was inserted, and the entry also counts towards the top-level `duplicates`. A track is - attached only while the account keeps tracks (`storeWorkoutRoutes`), and when the stored workout had no - elevation, the climb derived from the attached track fills `elevationM`; no other column of the workout row - is written. `updated` (since v1.40.0): a workout entered by hand (`source: MANUAL`, `externalId` starting - `manual:`) was sent again with different values and the stored row now carries them; no row was inserted, so - it also counts towards `duplicates`. `skipped`: the server refused the entry, see `reason`." - reason: - description: "Why a `skipped` entry was refused: `unstable_external_id` for an id that does not survive a client - restart, `invalid_samples` for a heart-rate series that failed validation." - type: string + - next + - current + - previous + description: "`current` seals every envelope now. `next` is the incoming key: published at least 7 days before it seals + anything, then it becomes `current` and the old `current` becomes `previous`. `previous` sealed until its + retirement and stays published for 30 days after it. Pin every listed key and try each when opening." required: - - index + - publicKey - status additionalProperties: false - WorkoutsDeleteByExternalIdsResponse: + DevicePushDiagnosticsEnvelope: type: object properties: data: - $ref: "#/components/schemas/ExternalIdDeleteResult" + $ref: "#/components/schemas/DevicePushDiagnostics" error: type: "null" meta: @@ -57124,74 +62047,440 @@ components: - data - error additionalProperties: false - ExternalIdDeleteResult: - type: object - properties: - deletedCount: - type: integer - minimum: 0 - maximum: 9007199254740991 - description: Rows this call deleted. An id that matched nothing, matched a row of another source or account, or was - already deleted is not counted. - required: - - deletedCount - additionalProperties: false - EcgDeleteByExternalIdsResponse: + DevicePushDiagnostics: type: object properties: - data: - $ref: "#/components/schemas/ExternalIdDeleteResult" - error: - type: "null" - meta: + deviceId: + type: string + transport: + type: string + enum: + - relay + - direct + - none + description: "The route the send takes, by the same rule as `push.device.transport`: this server's own APNs key + (`direct`), the relay, or none." + sealed: + type: boolean + description: Pushes to this device are sealed envelopes. False for a device without a push key, which gets plaintext + pushes over this server's own key, or none. + apnsToken: + anyOf: + - type: object + properties: + prefix: + type: + - string + - "null" + suffix: + type: + - string + - "null" + required: + - prefix + - suffix + additionalProperties: false + - type: "null" + description: "The APNs token masked: its first and last 8 hex characters only, the same mask as the admin diagnostic. + Null when the device registered no APNs token." + apnsEnvironment: + anyOf: + - type: string + enum: + - sandbox + - production + - type: "null" + relay: type: object properties: - requestId: + state: type: string + enum: + - ok + - degraded + - down + - off + since: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + reason: + description: As `push.relay.reason`, e.g. `bad_signature` once the relay refused this server's signature three times in + a row, or `relay_maintenance` from the relay's own status. + type: + - string + - "null" + required: + - state + - since + - reason additionalProperties: false - required: - - data - - error - additionalProperties: false - CycleDayLogsDeleteByExternalIdsResponse: - type: object - properties: - data: - $ref: "#/components/schemas/ExternalIdDeleteResult" - error: - type: "null" - meta: + description: The instance's relay registration, as `push.relay.state` reads it. + binding: type: object properties: - requestId: + state: type: string + enum: + - none + - bound + - rebind_needed + - conflict + description: "As `push.device.relayState`: a `conflict` older than 30 minutes reads `rebind_needed`." + consent: + type: boolean + description: The person turned the relay on for this device. + boundAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: When the relay last confirmed the binding. + required: + - state + - consent + - boundAt additionalProperties: false - required: - - data - - error - additionalProperties: false - MoodEntriesDeleteByExternalIdsResponse: - type: object - properties: - data: - $ref: "#/components/schemas/ExternalIdDeleteResult" - error: - type: "null" - meta: + description: This device's relay binding. + budget: type: object properties: - requestId: + windowMinutes: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: "The rolling window every limit counts: 60." + limit: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + description: "Silent pushes of every kind per window over the relay: 6. Null over this server's own APNs key, where no + overall cap applies." + wakeLimit: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: "`DATA_CHANGED` and `HEALTHKIT_CATCH_UP` together per window: 4. Over the relay the last 2 of `limit` stay + free for the intake sync." + usedInWindow: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: Silent pushes sent to this device in the window. + wakesUsedInWindow: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: Of those, wakes. + owedSyncs: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: "Intake syncs held back by the budget and waiting, coalesced: 0 or 1, however many changes arrived. Held + back by this server's count, or refused by the relay for its own (`device_quota`); sent once the budget + frees up, never dropped." + owedSince: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: Since when the sync is owed. + nextFreeAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: "When the next intake sync fits the budget again (an owed one goes then): by this server's count, or later + when the relay named a later time with a refusal; null when one fits now." + required: + - windowMinutes + - limit + - wakeLimit + - usedInWindow + - wakesUsedInWindow + - owedSyncs + - owedSince + - nextFreeAt + additionalProperties: false + description: The device's silent budget, from the rule the send asks (`src/lib/push-relay/wakes.ts`). + medicationReminder: + type: object + properties: + delivery: + type: string + enum: + - server + - client + description: "Who reminds this device of a dose now, by the same decision the send reads: `server` when the server's + medication reminder goes to this device (over `transport`, the relay included), `client` while the app + reminds locally. The device's `medicationDelivery`, else the account switch; a device that reminds + locally counts as `server` once its local plan has run out (`localRunwayUntil`, else 3 days after its + last request)." + localUntil: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: "While `delivery` is `client`: when the server takes over unless the device reports a new runway or shows + up again. Null while `delivery` is `server`." + required: + - delivery + - localUntil + additionalProperties: false + description: The medication-reminder delivery resolved for this device. A follow-up for a dose still open goes to every + device over this server's own key, and over the relay only while `delivery` is `server`. + lastDelivery: + type: object + properties: + alert: + anyOf: + - type: object + properties: + at: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + description: When the push was handed on. + eventType: + type: string + description: The push type, e.g. `MEDICATION_REMINDER`, `DATA_CHANGED`. + outcome: + type: string + enum: + - pending + - accepted + - opened + - dropped + - failed + - sent + - skipped + description: "Over the relay: `pending` (waiting or retrying), `accepted` (the relay took it), `opened` (accepted and + covered by a receipt from this device), `dropped` or `failed`. Over this server's own APNs key: + `sent` for a silent push, `accepted`, `failed` or `skipped` for an alert." + reason: + description: The relay's or Apple's reason on a failure; for a `pending` push over the relay, the code it waits on + (`bad_signature`, `relay_unavailable`, `relay_paused`, a quota code); else null. + type: + - string + - "null" + required: + - at + - eventType + - outcome + - reason + additionalProperties: false + - type: "null" + silentSync: + anyOf: + - type: object + properties: + at: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + description: When the push was handed on. + eventType: + type: string + description: The push type, e.g. `MEDICATION_REMINDER`, `DATA_CHANGED`. + outcome: + type: string + enum: + - pending + - accepted + - opened + - dropped + - failed + - sent + - skipped + description: "Over the relay: `pending` (waiting or retrying), `accepted` (the relay took it), `opened` (accepted and + covered by a receipt from this device), `dropped` or `failed`. Over this server's own APNs key: + `sent` for a silent push, `accepted`, `failed` or `skipped` for an alert." + reason: + description: The relay's or Apple's reason on a failure; for a `pending` push over the relay, the code it waits on + (`bad_signature`, `relay_unavailable`, `relay_paused`, a quota code); else null. + type: + - string + - "null" + required: + - at + - eventType + - outcome + - reason + additionalProperties: false + - type: "null" + description: "`MEDICATION_INTAKE_SYNC`." + wake: + anyOf: + - type: object + properties: + at: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + description: When the push was handed on. + eventType: + type: string + description: The push type, e.g. `MEDICATION_REMINDER`, `DATA_CHANGED`. + outcome: + type: string + enum: + - pending + - accepted + - opened + - dropped + - failed + - sent + - skipped + description: "Over the relay: `pending` (waiting or retrying), `accepted` (the relay took it), `opened` (accepted and + covered by a receipt from this device), `dropped` or `failed`. Over this server's own APNs key: + `sent` for a silent push, `accepted`, `failed` or `skipped` for an alert." + reason: + description: The relay's or Apple's reason on a failure; for a `pending` push over the relay, the code it waits on + (`bad_signature`, `relay_unavailable`, `relay_paused`, a quota code); else null. + type: + - string + - "null" + required: + - at + - eventType + - outcome + - reason + additionalProperties: false + - type: "null" + description: "`DATA_CHANGED` or `HEALTHKIT_CATCH_UP`." + liveActivity: + anyOf: + - type: object + properties: + at: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + description: When the push was handed on. + eventType: + type: string + description: The push type, e.g. `MEDICATION_REMINDER`, `DATA_CHANGED`. + outcome: + type: string + enum: + - pending + - accepted + - opened + - dropped + - failed + - sent + - skipped + description: "Over the relay: `pending` (waiting or retrying), `accepted` (the relay took it), `opened` (accepted and + covered by a receipt from this device), `dropped` or `failed`. Over this server's own APNs key: + `sent` for a silent push, `accepted`, `failed` or `skipped` for an alert." + reason: + description: The relay's or Apple's reason on a failure; for a `pending` push over the relay, the code it waits on + (`bad_signature`, `relay_unavailable`, `relay_paused`, a quota code); else null. + type: + - string + - "null" + required: + - at + - eventType + - outcome + - reason + additionalProperties: false + - type: "null" + required: + - alert + - silentSync + - wake + - liveActivity + additionalProperties: false + description: The newest push of each kind to this device, from the ledger that knows the device. Over the relay, the + relay outbox. Over this server's own APNs key, the silent ledger for the sync and the wakes; the alert comes + from the account's delivery attempts only while this is the account's one APNs device, because that ledger + names no device, and is null otherwise. A Live Activity push over this server's own key leaves no per-device + record and stays null. + intakeSync: + type: object + properties: + state: type: string + enum: + - ok + - degraded + description: The same value as `push.device.intakeSync`. + reason: + anyOf: + - type: string + enum: + - relay + - intake_recorded_dropped + - alert_unconfirmed + - type: "null" + description: "Why it reads `degraded`, null while `ok`: the relay is not healthy (`relay`); the last dose confirmation + to this device was dropped and no alert opened since (`intake_recorded_dropped`); the newest alert the + relay accepted in the last 24 hours was never opened although the device reported receipts well after it + (`alert_unconfirmed`). Silent and Live Activity pushes never count (v1.49.0)." + required: + - state + - reason additionalProperties: false + description: Whether a dose recorded on another device reaches this one, from the last 24 hours of evidence only. + receipt: + anyOf: + - type: object + properties: + reportedAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + openedAlert: + type: + - string + - "null" + openedSilent: + type: + - string + - "null" + required: + - reportedAt + - openedAlert + - openedSilent + additionalProperties: false + - type: "null" + description: "The last envelope receipt this device posted (`GET /api/sync/state` `openedAlert` / `openedSilent`): the + newest envelope ids it opened per class, kept forward only. Null before the first report." + serverTime: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ required: - - data - - error + - deviceId + - transport + - sealed + - apnsToken + - apnsEnvironment + - relay + - binding + - budget + - medicationReminder + - lastDelivery + - intakeSync + - receipt + - serverTime additionalProperties: false - SymptomEventsDeleteByExternalIdsResponse: + description: "One device's push state for its diagnostics screen. Only this device: nothing about the account's other + devices, no token in clear, no notification content." + DeviceRevokeEnvelope: type: object properties: data: - $ref: "#/components/schemas/ExternalIdDeleteResult" + $ref: "#/components/schemas/DeviceRevokeResponse" error: type: "null" meta: @@ -57204,28 +62493,37 @@ components: - data - error additionalProperties: false - MedicationIntakesDeleteByExternalIdsResponse: + DeviceRevokeResponse: type: object properties: - data: - $ref: "#/components/schemas/ExternalIdDeleteResult" - error: - type: "null" - meta: - type: object - properties: - requestId: - type: string - additionalProperties: false + id: + type: string + revoked: + type: boolean + const: true + refreshTokensRevoked: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: Refresh tokens the cascade revoked. + accessTokensRevoked: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: Access tokens the cascade revoked. required: - - data - - error + - id + - revoked + - refreshTokensRevoked + - accessTokensRevoked additionalProperties: false - ActivityCalendarEnvelope: + description: What the revocation cascade actually removed. The counts let a client say how many credentials were killed + rather than only that something happened. + AdminPushRelayStatusEnvelope: type: object properties: data: - $ref: "#/components/schemas/ActivityCalendar" + $ref: "#/components/schemas/AdminPushRelayStatus" error: type: "null" meta: @@ -57238,445 +62536,306 @@ components: - data - error additionalProperties: false - ActivityCalendar: + AdminPushRelayStatus: type: object properties: - period: - type: string - enum: - - week - - month - start: - type: string - format: date - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ - end: - type: string - format: date - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ - gridStart: - type: string - format: date - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ - description: First day drawn (the Monday on or before `start`). - gridEnd: - type: string - format: date - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ - description: Last day drawn (the Sunday on or after `end`). - today: - type: string - format: date - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ - timezone: - type: string - description: The IANA zone the days are cut in. - loadType: + allowed: + type: boolean + available: + type: boolean + unavailableReason: anyOf: - type: string enum: - - DAY_STRAIN - - CARDIO_LOAD - - STRAIN_SCORE + - mode_off + - invalid_url + - keys_unpinned - type: "null" - description: Which training-load score `load` carries; null when the account has none. - days: - type: array - items: - type: object - properties: - date: - type: string - format: date - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ - inPeriod: - type: boolean - future: - type: boolean - steps: - type: - - number - - "null" - activeMinutes: - description: The larger of the day's exercise minutes and workout minutes (never their sum). - type: - - number - - "null" - workoutCount: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - workoutsBySport: - type: object - propertyNames: + relayHost: + type: + - string + - "null" + offered: + type: boolean + state: + type: string + enum: + - ok + - degraded + - down + - off + since: + type: + - string + - "null" + reason: + description: Why the state is not `ok`, e.g. `bad_signature` (the relay refused this server's signature three times in a + row), `relay_degraded`, `relay_maintenance` or `relay_misconfigured` (what the relay's status reports about + itself), `circuit_open`, or a registration refusal. + type: + - string + - "null" + instanceId: + type: + - string + - "null" + tier: + type: + - string + - "null" + notice: + anyOf: + - type: object + properties: + id: type: string - additionalProperties: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - load: - type: - - number - - "null" - level: - type: object - properties: - steps: - type: string - enum: - - none - - unrated - - in_progress - - low - - below - - usual - - above - - high - description: "Where the day sits in the person's own spread over the 84 days before the period: `low` below their 10th - percentile, `below` below the 25th, `above` above the 75th, `high` above the 90th, `usual` - between. `none` = no value that day; `unrated` = fewer than 14 days of history to compare with; - `in_progress` = today, which has not ended and is never rated." - activeMinutes: - type: string - enum: - - none - - unrated - - in_progress - - low - - below - - usual - - above - - high - description: "Where the day sits in the person's own spread over the 84 days before the period: `low` below their 10th - percentile, `below` below the 25th, `above` above the 75th, `high` above the 90th, `usual` - between. `none` = no value that day; `unrated` = fewer than 14 days of history to compare with; - `in_progress` = today, which has not ended and is never rated." - load: - type: string - enum: - - none - - unrated - - in_progress - - low - - below - - usual - - above - - high - description: "Where the day sits in the person's own spread over the 84 days before the period: `low` below their 10th - percentile, `below` below the 25th, `above` above the 75th, `high` above the 90th, `usual` - between. `none` = no value that day; `unrated` = fewer than 14 days of history to compare with; - `in_progress` = today, which has not ended and is never rated." - required: - - steps - - activeMinutes - - load - additionalProperties: false - required: - - date - - inPeriod - - future - - steps - - activeMinutes - - workoutCount - - workoutsBySport - - load - - level - additionalProperties: false - weeks: - type: array - items: - type: object - properties: - start: - type: string - format: date - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ - end: - type: string - format: date - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ - steps: - type: - - number - - "null" - activeMinutes: - type: - - number - - "null" - workouts: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - goals: - type: array - items: - $ref: "#/components/schemas/ActivityGoalProgress" - description: The weekly goals for a week that has begun. - required: - - start - - end - - steps - - activeMinutes - - workouts - - goals - additionalProperties: false - baseline: - type: object - properties: - steps: - $ref: "#/components/schemas/ActivityBaselineStats" - activeMinutes: - $ref: "#/components/schemas/ActivityBaselineStats" - load: - $ref: "#/components/schemas/ActivityBaselineStats" - required: - - steps - - activeMinutes - - load - additionalProperties: false - summary: + level: + type: + - string + - "null" + required: + - id + - level + additionalProperties: false + - type: "null" + lastSuccessAt: + type: + - string + - "null" + devices: type: object properties: - steps: - $ref: "#/components/schemas/ActivityPeriodComparison" - activeMinutes: - $ref: "#/components/schemas/ActivityPeriodComparison" - workouts: - $ref: "#/components/schemas/ActivityPeriodComparison" - load: - $ref: "#/components/schemas/ActivityPeriodComparison" + bound: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + consented: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 required: - - steps - - activeMinutes - - workouts - - load + - bound + - consented additionalProperties: false - sports: - type: array - items: - type: object - properties: - sportType: - type: string - count: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - required: - - sportType - - count - additionalProperties: false - goals: - $ref: "#/components/schemas/ActivityGoals" - goalProgress: - type: array - items: - $ref: "#/components/schemas/ActivityGoalProgress" - available: + usage: type: object properties: - steps: - type: boolean - activeMinutes: - type: boolean - workouts: - type: boolean - load: - type: boolean - required: - - steps - - activeMinutes - - workouts - - load - additionalProperties: false - previous: - type: string - format: date - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ - description: A day in the previous period. - next: - anyOf: - - type: string - format: date - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ - - type: "null" - description: A day in the next period, or null when that lies after today. - required: - - period - - start - - end - - gridStart - - gridEnd - - today - - timezone - - loadType - - days - - weeks - - baseline - - summary - - sports - - goals - - goalProgress - - available - - previous - - next - additionalProperties: false - ActivityGoalProgress: - type: object - properties: - key: - type: string - enum: - - workoutsPerWeek - - activeMinutesPerWeek - - stepsPerWeek - - stepsPerMonth - target: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - value: - type: number - met: - type: boolean - required: - - key - - target - - value - - met - additionalProperties: false - ActivityBaselineStats: - anyOf: - - type: object - properties: - median: - type: number - p10: - type: number - p25: - type: number - p75: - type: number - p90: - type: number - days: + windowDays: type: integer minimum: -9007199254740991 maximum: 9007199254740991 - description: Days with a value the spread was computed from. + accepted: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + pending: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + dropped: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + failed: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + lastFailure: + anyOf: + - type: object + properties: + reason: + type: + - string + - "null" + at: + type: string + required: + - reason + - at + additionalProperties: false + - type: "null" required: - - median - - p10 - - p25 - - p75 - - p90 - - days + - windowDays + - accepted + - pending + - dropped + - failed + - lastFailure additionalProperties: false - - type: "null" - ActivityPeriodComparison: - type: object - properties: - value: - description: "The period so far: a total (steps, active minutes, workouts) or a mean (load)." - type: - - number - - "null" - daysWithData: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - completedDays: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - description: Days of the period that have ended (today excluded). - completedValue: - description: "`value` over the completed days only. This, not `value`, is what `usualToDate` is compared with, so a - running period is never judged on today's partial day." - type: - - number - - "null" - usual: - description: "The person's usual full period: the median of the twelve weeks (or, per day, of the six months) before it. - Null with fewer than three earlier periods of data." - type: - - number - - "null" - usualToDate: - description: The usual figure for the completed days (today excluded); equals `usual` once the period is over, null - before the period's first day has ended. - type: - - number - - "null" - referencePeriods: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - required: - - value - - daysWithData - - completedDays - - completedValue - - usual - - usualToDate - - referencePeriods - additionalProperties: false - ActivityGoals: - type: object - properties: - workoutsPerWeek: - anyOf: - - type: integer + description: "What this instance handed the relay in the last `windowDays` days, from its own delivery ledger: counts + per outcome and the last failure. Aggregate only." + handoff: + type: object + properties: + windowHours: + type: integer minimum: -9007199254740991 maximum: 9007199254740991 - - type: "null" - activeMinutesPerWeek: - anyOf: - - type: integer + count: + type: integer minimum: -9007199254740991 maximum: 9007199254740991 - - type: "null" - stepsPerWeek: - anyOf: - - type: integer + description: "Pushes the relay answered `accepted` in the window: what the percentiles are computed over." + p50Ms: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + description: The median hand-off time in whole milliseconds; null when `count` is 0. + p95Ms: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + description: The 95th percentile of the hand-off time in whole milliseconds; null when `count` is 0. + retried: + type: integer minimum: -9007199254740991 maximum: 9007199254740991 - - type: "null" - stepsPerMonth: + description: How many of the `count` pushes waited for at least one retry on this server, so their time includes its + backoff. + required: + - windowHours + - count + - p50Ms + - p95Ms + - retried + additionalProperties: false + description: "v1.49.0. The hand-off time as this server sees it, over the pushes the relay accepted in the last + `windowHours` hours: from queueing a push on this server until the relay answered `accepted`. The relay + answers `accepted` only once Apple accepted the push, so the time covers this server's hand-off, the network + and the relay's request to Apple. From this instance's own delivery ledger. Aggregate only: nothing per + person, device or kind of push." + relayCheck: anyOf: - - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 + - type: object + properties: + checkedAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: When this server last asked `GET /v1/status`. + answeredAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: When the relay last answered it. + state: + anyOf: + - type: string + enum: + - ok + - degraded + - maintenance + - misconfigured + - type: "null" + description: The relay's own state in that answer. + devices: + anyOf: + - type: object + properties: + active: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + provisional: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + limit: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + required: + - active + - provisional + - limit + additionalProperties: false + - type: "null" + description: "This instance's bindings at the relay: active (soft-invalid included), provisional, and its device limit." + required: + - checkedAt + - answeredAt + - state + - devices + additionalProperties: false - type: "null" + description: "v1.49.0. The hourly signed `GET /v1/status`: what the relay last reported about itself and this instance. + Null before the first check." + termsVersion: + type: string + termsConfirmationNeeded: + type: boolean + description: The relay is on, and the terms text the operator accepted is older than `termsVersion`. The relay keeps + running; turning it on again with both confirmations records the current text. + unbindsPending: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: Device unbinds owed to the relay that it has not confirmed yet. + unreachableRegistrations: + type: array + items: + type: string + description: Relay hosts this server is still registered with but cannot reach under its current settings + (`PUSH_RELAY_MODE=off`, a changed `PUSH_RELAY_URL`); they keep its device bindings until it leaves them. + termsUrl: + type: + - string + - "null" + privacyUrl: + type: + - string + - "null" + docsUrl: + type: string + operatorDecision: + description: "As `push.relay.operatorDecision` of `/api/auth/me`: the relay question is open while it is `undecided`." + $ref: "#/components/schemas/PushRelayOperatorDecision" required: - - workoutsPerWeek - - activeMinutesPerWeek - - stepsPerWeek - - stepsPerMonth - additionalProperties: false - description: The person's own goals; `null` = not set. There is no default goal. - ActivityGoalsEnvelope: - type: object - properties: - data: - $ref: "#/components/schemas/ActivityGoals" - error: - type: "null" - meta: - type: object - properties: - requestId: - type: string - additionalProperties: false - required: - - data - - error - additionalProperties: false - ActivityGoalsPatchEnvelope: + - allowed + - available + - unavailableReason + - relayHost + - offered + - state + - since + - reason + - instanceId + - tier + - notice + - lastSuccessAt + - devices + - usage + - handoff + - relayCheck + - termsVersion + - termsConfirmationNeeded + - unbindsPending + - unreachableRegistrations + - termsUrl + - privacyUrl + - docsUrl + - operatorDecision + additionalProperties: false + PushRelayOperatorDecision: + type: string + enum: + - undecided + - on + - off + AdminPushRelaySwitchEnvelope: type: object properties: data: - $ref: "#/components/schemas/ActivityGoals" + $ref: "#/components/schemas/AdminPushRelayStatus" error: type: "null" meta: @@ -57689,11 +62848,11 @@ components: - data - error additionalProperties: false - DayProvenanceEnvelope: + AdminPushRelayDecisionEnvelope: type: object properties: data: - $ref: "#/components/schemas/DayProvenance" + $ref: "#/components/schemas/AdminPushRelayStatus" error: type: "null" meta: @@ -57706,284 +62865,11 @@ components: - data - error additionalProperties: false - DayProvenance: - type: object - properties: - type: - type: string - enum: - - WEIGHT - - BLOOD_PRESSURE_SYS - - BLOOD_PRESSURE_DIA - - PULSE - - BODY_FAT - - SLEEP_DURATION - - ACTIVITY_STEPS - - BLOOD_GLUCOSE - - TOTAL_BODY_WATER - - BONE_MASS - - OXYGEN_SATURATION - - HEART_RATE_VARIABILITY - - RESTING_HEART_RATE - - ACTIVE_ENERGY_BURNED - - FLIGHTS_CLIMBED - - WALKING_RUNNING_DISTANCE - - VO2_MAX - - BODY_TEMPERATURE - - FAT_FREE_MASS - - FAT_MASS - - MUSCLE_MASS - - SKIN_TEMPERATURE - - PULSE_WAVE_VELOCITY - - VASCULAR_AGE - - VISCERAL_FAT - - AUDIO_EXPOSURE_ENV - - AUDIO_EXPOSURE_HEADPHONE - - TIME_IN_DAYLIGHT - - WALKING_STEADINESS - - AUDIO_EXPOSURE_EVENT - - RESPIRATORY_RATE - - BODY_MASS_INDEX - - LEAN_BODY_MASS - - WALKING_HEART_RATE_AVERAGE - - WALKING_ASYMMETRY - - WALKING_DOUBLE_SUPPORT - - WALKING_STEP_LENGTH - - WALKING_SPEED - - CARDIO_RECOVERY - - WRIST_TEMPERATURE - - FALL_COUNT - - SIX_MINUTE_WALK_DISTANCE - - STAIR_ASCENT_SPEED - - STAIR_DESCENT_SPEED - - BREATHING_DISTURBANCES - - IRREGULAR_RHYTHM_NOTIFICATION - - HIGH_HEART_RATE_EVENT - - LOW_HEART_RATE_EVENT - - WALKING_STEADINESS_EVENT - - BREATHING_DISTURBANCE_EVENT - - HYPERTENSION_EVENT - - RECOVERY_SCORE - - STRESS_SCORE - - STRAIN_SCORE - - HRV_RMSSD - - DAY_STRAIN - - WORKOUT_STRAIN - - SLEEP_PERFORMANCE - - SLEEP_EFFICIENCY - - SLEEP_CONSISTENCY - - SLEEP_NEED - - ENERGY_EXPENDITURE_KJ - - AVERAGE_HEART_RATE - - MAX_HEART_RATE - - SLEEP_DISTURBANCE_COUNT - - ANS_CHARGE - - CARDIO_LOAD - - SLEEP_SCORE - - BODY_TEMPERATURE_DEVIATION - - RESILIENCE - - PHQ9_SCORE - - GAD7_SCORE - - GRIP_STRENGTH - - PAIN_NRS - - WAIST_CIRCUMFERENCE - - WAIST_TO_HEIGHT - - WHO5_SCORE - - SCI_SCORE - - EXERCISE_MINUTES - - STAND_MINUTES - - STAND_HOURS - - MINDFUL_MINUTES - - STATE_OF_MIND_VALENCE - - AFIB_BURDEN - - INDOOR_CO2 - - INDOOR_TEMPERATURE - - INDOOR_HUMIDITY - - BODY_BATTERY - - STRESS_LEVEL - - TRAINING_READINESS - - ACUTE_TRAINING_LOAD - - BASAL_ENERGY_BURNED - - BLOOD_KETONES - - LOW_CARDIO_FITNESS_EVENT - - MENOPAUSAL_STATE - - BLEEDING_AFTER_MENOPAUSE - - INSULIN_DELIVERY - - INHALER_USAGE - - FEV1 - - FVC - - PEAK_EXPIRATORY_FLOW - date: - type: string - format: date - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ - aggregation: - type: string - enum: - - sum - - mean - ranked: - type: boolean - metricKey: - type: - - string - - "null" - ladder: - type: array - items: - type: string - enum: - - MANUAL - - WITHINGS - - IMPORT - - APPLE_HEALTH - - COMPUTED - - WHOOP - - FITBIT - - NIGHTSCOUT - - POLAR - - OURA - - TELEGRAM - - MCP - - GOOGLE_HEALTH - - STRAVA - - EXTERNAL - - HEALTH_CONNECT - - GARMIN - picked: - anyOf: - - type: string - enum: - - MANUAL - - WITHINGS - - IMPORT - - APPLE_HEALTH - - COMPUTED - - WHOOP - - FITBIT - - NIGHTSCOUT - - POLAR - - OURA - - TELEGRAM - - MCP - - GOOGLE_HEALTH - - STRAVA - - EXTERNAL - - HEALTH_CONNECT - - GARMIN - - type: "null" - pickReason: - anyOf: - - type: string - enum: - - only_source - - highest_on_ladder - - name_tiebreak - - not_ranked - description: "`only_source`: one source that day. `highest_on_ladder`: it stands highest on the ladder among the day's - sources. `name_tiebreak`: none of them is on the ladder, the source name decided. `not_ranked`: this - metric has no ladder, every source counts." - - type: "null" - sources: - type: array - items: - type: object - properties: - source: - type: string - enum: - - MANUAL - - WITHINGS - - IMPORT - - APPLE_HEALTH - - COMPUTED - - WHOOP - - FITBIT - - NIGHTSCOUT - - POLAR - - OURA - - TELEGRAM - - MCP - - GOOGLE_HEALTH - - STRAVA - - EXTERNAL - - HEALTH_CONNECT - - GARMIN - rank: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - description: Position on the ladder, 0 = highest; 90 = not on the ladder. - readings: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - value: - description: "The day's value from this source: the day total for a cumulative metric (sleep counts asleep stages only), - the mean of the readings otherwise." - type: - - number - - "null" - min: - type: - - number - - "null" - max: - type: - - number - - "null" - firstAt: - type: string - description: ISO instant of the first reading that day. - lastAt: - type: string - unit: - type: - - string - - "null" - devices: - type: array - items: - type: string - description: Device kinds the readings carry; `unknown` when untagged. - pass: - anyOf: - - type: string - enum: - - lower_on_ladder - - not_on_ladder - - name_tiebreak - - type: "null" - description: Why this source was not the one picked; null for the picked one. - required: - - source - - rank - - readings - - value - - min - - max - - firstAt - - lastAt - - unit - - devices - - pass - additionalProperties: false - required: - - type - - date - - aggregation - - ranked - - metricKey - - ladder - - picked - - pickReason - - sources - additionalProperties: false - SourceComparisonEnvelope: + AdminPushRelayTestEnvelope: type: object properties: data: - $ref: "#/components/schemas/SourceComparison" + $ref: "#/components/schemas/AdminPushRelayTest" error: type: "null" meta: @@ -57993,353 +62879,228 @@ components: type: string additionalProperties: false required: - - data - - error - additionalProperties: false - SourceComparison: - type: object - properties: - type: - type: string - enum: - - WEIGHT - - BLOOD_PRESSURE_SYS - - BLOOD_PRESSURE_DIA - - PULSE - - BODY_FAT - - SLEEP_DURATION - - ACTIVITY_STEPS - - BLOOD_GLUCOSE - - TOTAL_BODY_WATER - - BONE_MASS - - OXYGEN_SATURATION - - HEART_RATE_VARIABILITY - - RESTING_HEART_RATE - - ACTIVE_ENERGY_BURNED - - FLIGHTS_CLIMBED - - WALKING_RUNNING_DISTANCE - - VO2_MAX - - BODY_TEMPERATURE - - FAT_FREE_MASS - - FAT_MASS - - MUSCLE_MASS - - SKIN_TEMPERATURE - - PULSE_WAVE_VELOCITY - - VASCULAR_AGE - - VISCERAL_FAT - - AUDIO_EXPOSURE_ENV - - AUDIO_EXPOSURE_HEADPHONE - - TIME_IN_DAYLIGHT - - WALKING_STEADINESS - - AUDIO_EXPOSURE_EVENT - - RESPIRATORY_RATE - - BODY_MASS_INDEX - - LEAN_BODY_MASS - - WALKING_HEART_RATE_AVERAGE - - WALKING_ASYMMETRY - - WALKING_DOUBLE_SUPPORT - - WALKING_STEP_LENGTH - - WALKING_SPEED - - CARDIO_RECOVERY - - WRIST_TEMPERATURE - - FALL_COUNT - - SIX_MINUTE_WALK_DISTANCE - - STAIR_ASCENT_SPEED - - STAIR_DESCENT_SPEED - - BREATHING_DISTURBANCES - - IRREGULAR_RHYTHM_NOTIFICATION - - HIGH_HEART_RATE_EVENT - - LOW_HEART_RATE_EVENT - - WALKING_STEADINESS_EVENT - - BREATHING_DISTURBANCE_EVENT - - HYPERTENSION_EVENT - - RECOVERY_SCORE - - STRESS_SCORE - - STRAIN_SCORE - - HRV_RMSSD - - DAY_STRAIN - - WORKOUT_STRAIN - - SLEEP_PERFORMANCE - - SLEEP_EFFICIENCY - - SLEEP_CONSISTENCY - - SLEEP_NEED - - ENERGY_EXPENDITURE_KJ - - AVERAGE_HEART_RATE - - MAX_HEART_RATE - - SLEEP_DISTURBANCE_COUNT - - ANS_CHARGE - - CARDIO_LOAD - - SLEEP_SCORE - - BODY_TEMPERATURE_DEVIATION - - RESILIENCE - - PHQ9_SCORE - - GAD7_SCORE - - GRIP_STRENGTH - - PAIN_NRS - - WAIST_CIRCUMFERENCE - - WAIST_TO_HEIGHT - - WHO5_SCORE - - SCI_SCORE - - EXERCISE_MINUTES - - STAND_MINUTES - - STAND_HOURS - - MINDFUL_MINUTES - - STATE_OF_MIND_VALENCE - - AFIB_BURDEN - - INDOOR_CO2 - - INDOOR_TEMPERATURE - - INDOOR_HUMIDITY - - BODY_BATTERY - - STRESS_LEVEL - - TRAINING_READINESS - - ACUTE_TRAINING_LOAD - - BASAL_ENERGY_BURNED - - BLOOD_KETONES - - LOW_CARDIO_FITNESS_EVENT - - MENOPAUSAL_STATE - - BLEEDING_AFTER_MENOPAUSE - - INSULIN_DELIVERY - - INHALER_USAGE - - FEV1 - - FVC - - PEAK_EXPIRATORY_FLOW - from: - type: string - format: date - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ - to: - type: string - format: date - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ - aggregation: + - data + - error + additionalProperties: false + AdminPushRelayTest: + type: object + properties: + outcome: type: string enum: - - sum - - mean - ranked: - type: boolean - ladder: - type: array - items: - type: string - enum: - - MANUAL - - WITHINGS - - IMPORT - - APPLE_HEALTH - - COMPUTED - - WHOOP - - FITBIT - - NIGHTSCOUT - - POLAR - - OURA - - TELEGRAM - - MCP - - GOOGLE_HEALTH - - STRAVA - - EXTERNAL - - HEALTH_CONNECT - - GARMIN - unit: - type: - - string - - "null" - sources: + - accepted + - failed + - waiting + - no_device + description: "`accepted` only when the relay accepted the push to every device; `failed` when one failed for good; + `waiting` when the rest waits for a retry. Per device in `results`." + results: type: array items: type: object properties: - source: + deviceId: type: string - enum: - - MANUAL - - WITHINGS - - IMPORT - - APPLE_HEALTH - - COMPUTED - - WHOOP - - FITBIT - - NIGHTSCOUT - - POLAR - - OURA - - TELEGRAM - - MCP - - GOOGLE_HEALTH - - STRAVA - - EXTERNAL - - HEALTH_CONNECT - - GARMIN - days: + model: + type: + - string + - "null" + relayStatus: type: integer minimum: -9007199254740991 maximum: 9007199254740991 + description: The item status the relay signed; 0 when no signed answer arrived. + relayResult: + type: string + relayReason: + type: + - string + - "null" + delivery: + type: string required: - - source - - days + - deviceId + - model + - relayStatus + - relayResult + - relayReason + - delivery additionalProperties: false - a: - anyOf: - - type: string + required: + - outcome + - results + additionalProperties: false + AdminPushRelayRotateEnvelope: + type: object + properties: + data: + type: object + properties: + outcome: + type: string enum: - - MANUAL - - WITHINGS - - IMPORT - - APPLE_HEALTH - - COMPUTED - - WHOOP - - FITBIT - - NIGHTSCOUT - - POLAR - - OURA - - TELEGRAM - - MCP - - GOOGLE_HEALTH - - STRAVA - - EXTERNAL - - HEALTH_CONNECT - - GARMIN - - type: "null" - b: + - rotated + - refused + - unreachable + - not_registered + required: + - outcome + additionalProperties: false + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + AdminPushRelaySenderRotateEnvelope: + type: object + properties: + data: + type: object + properties: + rotated: + type: boolean + const: true + required: + - rotated + additionalProperties: false + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + AdminServerSetupStateEnvelope: + type: object + properties: + data: + $ref: "#/components/schemas/AdminServerSetupState" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + AdminServerSetupState: + type: object + properties: + offered: + type: boolean + description: False on a demo deploy, where the setup screens refuse and nothing points at them. + completedAt: anyOf: - type: string - enum: - - MANUAL - - WITHINGS - - IMPORT - - APPLE_HEALTH - - COMPUTED - - WHOOP - - FITBIT - - NIGHTSCOUT - - POLAR - - OURA - - TELEGRAM - - MCP - - GOOGLE_HEALTH - - STRAVA - - EXTERNAL - - HEALTH_CONNECT - - GARMIN + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - type: "null" - days: + description: When the setup was finished; null while it is offered. An instance that had accounts before 1.49 was + stamped by its migration. + steps: type: array items: type: object properties: - date: + id: type: string - format: date - pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$ - a: - type: - - number - - "null" - b: - type: - - number - - "null" - picked: - anyOf: - - type: string - enum: - - MANUAL - - WITHINGS - - IMPORT - - APPLE_HEALTH - - COMPUTED - - WHOOP - - FITBIT - - NIGHTSCOUT - - POLAR - - OURA - - TELEGRAM - - MCP - - GOOGLE_HEALTH - - STRAVA - - EXTERNAL - - HEALTH_CONNECT - - GARMIN - - type: "null" + enum: + - accounts + - notifications + - ai + - privacy + - health + status: + type: string + enum: + - pending + - done + - skipped required: - - date - - a - - b - - picked + - id + - status additionalProperties: false - summary: + description: Every step, in order. A missing stored step reads pending. + noticePending: + type: boolean + description: "Whether the start-page notice shows for the calling admin: offered, not finished, not dismissed by this + admin." + facts: type: object properties: - daysA: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - daysB: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - daysBoth: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - meanA: - type: - - number - - "null" - meanB: - type: - - number - - "null" - meanDifference: - type: - - number - - "null" - meanAbsoluteDifference: - type: - - number - - "null" - pickedA: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - pickedB: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 + oidc: + type: object + properties: + configured: + type: boolean + only: + type: boolean + required: + - configured + - only + additionalProperties: false + smtp: + type: object + properties: + configured: + type: boolean + missing: + type: array + items: + type: string + description: Names of the required SMTP variables that are unset. + required: + - configured + - missing + additionalProperties: false + telegram: + type: object + properties: + webhookSecret: + type: boolean + required: + - webhookSecret + additionalProperties: false required: - - daysA - - daysB - - daysBoth - - meanA - - meanB - - meanDifference - - meanAbsoluteDifference - - pickedA - - pickedB + - oidc + - smtp + - telegram additionalProperties: false + description: What the environment says, as booleans and variable names. Never a value. required: - - type - - from - - to - - aggregation - - ranked - - ladder - - unit - - sources - - a - - b - - days - - summary + - offered + - completedAt + - steps + - noticePending + - facts additionalProperties: false - DeviceRegisterResponse: + AdminServerSetupNoticeEnvelope: type: object properties: data: type: object properties: - id: - type: string + dismissed: + type: boolean + const: true required: - - id + - dismissed additionalProperties: false error: type: "null" @@ -58353,11 +63114,11 @@ components: - data - error additionalProperties: false - DeviceRevokeEnvelope: + AdminSetupHealthEnvelope: type: object properties: data: - $ref: "#/components/schemas/DeviceRevokeResponse" + $ref: "#/components/schemas/AdminSetupHealth" error: type: "null" meta: @@ -58370,32 +63131,63 @@ components: - data - error additionalProperties: false - DeviceRevokeResponse: + AdminSetupHealth: type: object properties: - id: + state: type: string - revoked: - type: boolean - const: true - refreshTokensRevoked: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - description: Refresh tokens the cascade revoked. - accessTokensRevoked: - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - description: Access tokens the cascade revoked. + enum: + - ok + - attention + - failing + signals: + type: array + items: + type: object + properties: + id: + type: string + enum: + - encryption_keys + - secure_cookie + - app_url + - database_dump + state: + type: string + enum: + - ok + - attention + - failing + reason: + type: string + description: A closed code per signal, rendered as `admin.setupHealth.reason..`. + params: + type: object + propertyNames: + type: string + additionalProperties: + type: + - string + - number + description: Values the sentence interpolates. Never a secret. + fixPath: + type: + - string + - "null" + docsUrl: + type: string + required: + - id + - state + - reason + - params + - fixPath + - docsUrl + additionalProperties: false required: - - id - - revoked - - refreshTokensRevoked - - accessTokensRevoked + - state + - signals additionalProperties: false - description: What the revocation cascade actually removed. The counts let a client say how many credentials were killed - rather than only that something happened. MedicationIntakeAggregateEnvelope: type: object properties: @@ -58438,6 +63230,43 @@ components: format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - type: "null" + syncVersion: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: The row's current version. Send it as `expectedSyncVersion` on `DELETE + /api/medications/{id}/intake/{eventId}` to undo this dose only if nothing changed it since; a changed row + answers 409 `medications.intake.changedSinceSeen`. + source: + type: string + enum: + - WEB + - API + - REMINDER + - IMPORT + - APPLE_HEALTH + description: "Which writer created the row. A take that converges onto a projected or reminder slot keeps `REMINDER` + here; read `takenVia` for where the take came from. Values: `WEB` the web app, `API` a Bearer client (the + iOS app, the ingest hook a pill box or home automation posts to), `REMINDER` a Telegram reminder button (or + the server's own projection while the slot is still open), `IMPORT` a file import, `APPLE_HEALTH` the Apple + Health medication sync. Read it with `takenAt` to warn before a second take of the same slot." + takenVia: + anyOf: + - type: string + enum: + - WEB + - APP + - INTEGRATION + - TELEGRAM + - APPLE_HEALTH + - IMPORT + - AUTO + - type: "null" + description: "How the take on this slot was recorded, whatever wrote the row: `WEB` the web app, `APP` a Bearer client + such as the iOS app, `INTEGRATION` the ingest hook (a pill box, home automation), `TELEGRAM` a Telegram + button, `APPLE_HEALTH` the Apple Health medication sync, `IMPORT` a file import, `AUTO` the server's + auto-take. Null while the slot is not taken, and on takes recorded before this field existed. Show it with + `takenAt` before offering a second take: \"already taken at 07:12 via an integration\"." status: type: string enum: @@ -58447,23 +63276,89 @@ components: - pending - snoozed description: "Resolved in that precedence order. `missed` is TERMINAL — the nightly cron closed a never-acted slot — and - is not a `pending` that can still be answered. `snoozed` is not a property of this event at all: it reflects - the MEDICATION's deferral stamp still lying in the future, so every pending dose of that medication reads - snoozed at once." + is not a `pending` that can still be answered. `snoozed` means the medication's running deferral holds THIS + slot: the slot whose reminder window was open when the snooze was set, or, set while none was open, the next + slot to open. It is the same rule the reminder worker applies, so another slot of the same medication stays + `pending` and is still reminded." snoozedUntil: anyOf: - type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - type: "null" - description: The medication's deferral stamp, repeated on each of its events. Null when the medication is not deferred. + description: When the snooze holding this slot ends. Null when no running snooze holds this slot, including other slots + of a snoozed medication. + state: + anyOf: + - type: string + enum: + - upcoming + - due + - overdue + - taken + - skipped + - missed + - type: "null" + description: The resolved state of this dose, computed once on the server from the same bands the dose history, the + adherence rate and the reminders use (the medication's stored dose windows included). `upcoming` before + `dueAt`; `due` from `dueAt`; `overdue` past the on-time window (see `overdueSince`) until `missedAfter`; + `missed` after that with nothing recorded (or closed by the auto-miss pass); `taken` (see `takenLate`); + `skipped`. Render from this instead of fixed thresholds. Null only for a row on no slot that records + nothing. Distinct from the older `status` field above. + takenLate: + type: boolean + description: "With `state: taken`: taken after the on-time window (it still counts, late). False otherwise." + slotInstant: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: The slot's scheduled time. Null for a take on no slot (ad hoc). + dueAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: When the dose window opens; the dose is `due` from here. + overdueSince: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: Since when the dose is overdue (the end of its on-time window). Null unless `state` is `overdue`. + missedAfter: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: The miss cutoff; past it an unanswered dose is `missed`. Schedule a client-side state change at `dueAt`, + `overdueSince` and `missedAfter` instead of polling. + lateTakeCounts: + type: boolean + description: "A take recorded for this dose now still counts for it (as `taken_late` after the on-time window): true + while `due`, `overdue` and `missed`. A client that shows `missed` with a take action says that a late take + still counts." required: - id - medicationId - scheduledAt - takenAt + - syncVersion + - source + - takenVia - status - snoozedUntil + - state + - takenLate + - slotInstant + - dueAt + - overdueSince + - missedAfter + - lateTakeCounts additionalProperties: false description: One of today's dose slots, flattened for the dose sheet and the dashboard tile. A deliberately narrow projection — not the full intake-event row. @@ -58555,6 +63450,21 @@ components: - REMINDER - IMPORT - APPLE_HEALTH + takenVia: + anyOf: + - type: string + enum: + - WEB + - APP + - INTEGRATION + - TELEGRAM + - APPLE_HEALTH + - IMPORT + - AUTO + - type: "null" + description: Where the take on this row came from, whatever wrote the row (`source` keeps the writer that created it, + `REMINDER` for a projected slot). Null until a take reaches the row, and on takes recorded before migration + 0515. idempotencyKey: type: - string @@ -58613,6 +63523,16 @@ components: - type: "null" description: Soft-delete tombstone. Non-null rows are excluded from every list/aggregate read; sync readers use it to propagate deletions. + appleHealthDeletedAt: + description: "Since v1.49.0: who deleted a tombstone. Equal to `deletedAt` when the phone reported the dose deleted + through `DELETE /api/medications/intake/by-external-ids`; null, or different, when it was deleted in + HealthLog. A re-post of a dose deleted in HealthLog is refused (`skipped`, reason `deleted_in_healthlog`), + one the phone reported is written again. Null on every live row; do not show it." + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" required: - id - userId @@ -58624,6 +63544,7 @@ components: - autoRecorded - attributionSource - source + - takenVia - idempotencyKey - createdAt - updatedAt @@ -59454,11 +64375,20 @@ components: - inserted - updated - duplicate + - alreadyTaken - skipped - description: "`inserted`/`updated`/`duplicate` — the row landed (advance the cursor). `skipped` — not stored; see - `reason`." + description: "`inserted`/`updated`/`duplicate` — the row landed (advance the cursor); `duplicate` is an idempotent + replay of an entry already stored, nothing else. A dose the phone reported deleted through `DELETE + /api/medications/intake/by-external-ids` is the other case: posted again, it is back in Apple Health and + lands as a new dose (`inserted`). `alreadyTaken` — the slot already holds a take recorded by another writer + or another key, and this entry was a take or a skip: nothing was written, no stock consumed or refunded; + `intake` is the recorded row, `takenAt` and `takenVia` say when and how it was taken. Advance the cursor and + warn before a second dose. `skipped` — not stored; see `reason`. Since v1.49.0 that includes the re-post of + an Apple Health dose (`externalId`) the person deleted in HealthLog, `deleted_in_healthlog`: it stays + deleted, nothing was written and no stock was taken." reason: - description: "Why a `skipped` entry was not stored. Among others: `medication_not_found`, `unstable_external_id`, + description: "Why a `skipped` entry was not stored. Among others: `deleted_in_healthlog` (since v1.49.0) for the re-post + of a dose the person deleted in HealthLog, `medication_not_found`, `unstable_external_id`, `force_slot_invalid`, `force_slot_occupied`, `injection_site_not_allowed`, and (v1.42.0) `intake_not_tracked` for an entry against a medication kept as a record only (`trackIntake: false`), the per-entry form of `medication.intake.notTracked`. A skip is final: resending the entry gives the same @@ -59467,9 +64397,55 @@ components: id: description: The landed row id (absent on skips). type: string + syncVersion: + description: The landed row's version after the batch settled (absent on skips). Send it as `expectedSyncVersion` to + undo the entry; a row changed since answers 409 `medications.intake.changedSinceSeen`. The `intake` row on + `alreadyTaken` carries the same value. + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + intake: + description: "On `alreadyTaken`: the recorded row the slot already holds." + $ref: "#/components/schemas/MedicationIntakeEvent" + takenAt: + description: "On `alreadyTaken`, and since v1.49.0 on a `force_slot_occupied` skip: when the take that holds the slot + was recorded (null when a skip holds it)." + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + takenVia: + description: "On `alreadyTaken`, and since v1.49.0 on a `force_slot_occupied` skip: where the slot's take came from + (null for takes before migration 0515, and when a skip holds the slot)." + anyOf: + - type: string + enum: + - WEB + - APP + - INTEGRATION + - TELEGRAM + - APPLE_HEALTH + - IMPORT + - AUTO + - type: "null" + slotInstant: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: "Since v1.49.0, on every entry. The canonical slot the entry's row is on, as `POST + /api/medications/{id}/intake` answers it: the slot a take or skip bound to (by its window, a named + `scheduledFor` or a `forceSlotInstant` pin), and on `alreadyTaken` the slot of the recorded take. Null for a + row on no slot (an ad-hoc take, an extra dose) and for an entry that stored nothing; a `force_slot_occupied` + skip names the slot it was refused. An entry answered by a row it did not write (`duplicate`) reads the slot + off that row. The device that sent the batch gets no silent `MEDICATION_INTAKE_SYNC` for it; this field is + its answer." required: - index - status + - slotInstant additionalProperties: false ListMedicationsResponse: type: object @@ -59586,8 +64562,9 @@ components: type: boolean liveActivityEnabled: type: boolean - description: v1.7.0 iOS Live Activity opt-in for this medication's reminders. Default false. The iOS client owns the - ActivityKit lifecycle; the server only stores + echoes the flag. + description: v1.7.0 iOS Live Activity opt-in for this medication's reminders. Default false. The iOS client plans its + own Activities by it; a server start over the push relay requires it, and a server-started Activity ends + once it is off. criticalAlarmEnabled: type: boolean description: v1.7.0 iOS 26 AlarmKit critical-reminder opt-in. Default false. Critical alarms bypass the device mute @@ -59613,6 +64590,13 @@ components: type: - string - "null" + leafletUrl: + description: '#1430 — the official leaflet the person saved for this medication: an `https:` URL, any host. NULL = none + saved. Show it only as an external link (a new tab, `rel="noopener noreferrer"` on the web); never fetch or + embed it. Set or cleared through `leafletUrl` on the create and update bodies.' + type: + - string + - "null" pausedAt: anyOf: - type: string @@ -59825,6 +64809,8 @@ components: description: v1.43 — whether a composition per unit is stored (`GET /api/medications/{id}` carries it as `ingredients`). Absent on older servers. type: boolean + leafletSearch: + $ref: "#/components/schemas/MedicationLeafletSearch" required: - id - name @@ -59841,6 +64827,7 @@ components: - atcCode - rxNormCode - note + - leafletUrl - pausedAt - snoozedUntil - remindersActive @@ -59871,6 +64858,7 @@ components: - stockUnitsRemaining - stockDosesRemaining - runwayDays + - leafletSearch additionalProperties: false description: List-row variant of the medication resource enriched with the joined `category`, the v1.32.25 `externalSource` provenance echo, `lastTakenAt`, `todayEventCount`, and the v1.16.10 aggregated stock fields @@ -59941,6 +64929,61 @@ components: description: v1.40 (#1024) — one course of a medication. Courses never overlap and every course except the latest has ended, so the medication's `startsOn`/`endsOn`/`courseStatus`/`intakeActionable` are always those of the latest course. + MedicationLeafletSearch: + anyOf: + - type: object + properties: + registry: + type: string + enum: + - PL + - DE + - ES + - FR + - GB + - BE + - NL + - US + - CA + - AU + - BR + - EU + authority: + type: string + description: Who runs the search the link opens, as a proper name ("DailyMed", "AEMPS CIMA"). Not translated. + url: + type: string + description: The registry's own search page, ready to open in a browser (a new tab, or an in-app browser). Always + `https:` on `host`. Built by the server from a static table; the server never requests it. + host: + type: string + description: The registry's host, for a label that names where the link goes. + prefill: + type: string + enum: + - nameAndStrength + - name + - none + description: "How much of the medication the link carries. `nameAndStrength` and `name`: the registry opens on its + results for `searchTerm`. `none`: the registry's search takes nothing from its address, so the page + opens empty and the client asks the person to search for `searchTerm` there." + searchTerm: + type: string + description: "What is searched for: the medication name, plus the strength when `prefill` is `nameAndStrength` and the + dose reads as one." + required: + - registry + - authority + - url + - host + - prefill + - searchTerm + additionalProperties: false + - type: "null" + description: "#1430 — the official registry search for this medication, built for the CALLER's `medicineRegistry` (the + person who will open it, not the record's owner). NULL when the caller chose `NONE`. Remind the person that the + leaflet comes from the national registry and that they should check it matches the medication's name, strength + and form." CreateMedicationResponse: type: object properties: @@ -60052,8 +65095,9 @@ components: type: boolean liveActivityEnabled: type: boolean - description: v1.7.0 iOS Live Activity opt-in for this medication's reminders. Default false. The iOS client owns the - ActivityKit lifecycle; the server only stores + echoes the flag. + description: v1.7.0 iOS Live Activity opt-in for this medication's reminders. Default false. The iOS client plans its + own Activities by it; a server start over the push relay requires it, and a server-started Activity ends + once it is off. criticalAlarmEnabled: type: boolean description: v1.7.0 iOS 26 AlarmKit critical-reminder opt-in. Default false. Critical alarms bypass the device mute @@ -60079,6 +65123,13 @@ components: type: - string - "null" + leafletUrl: + description: '#1430 — the official leaflet the person saved for this medication: an `https:` URL, any host. NULL = none + saved. Show it only as an external link (a new tab, `rel="noopener noreferrer"` on the web); never fetch or + embed it. Set or cleared through `leafletUrl` on the create and update bodies.' + type: + - string + - "null" pausedAt: anyOf: - type: string @@ -60277,6 +65328,8 @@ components: type: array items: $ref: "#/components/schemas/RelatedLink" + leafletSearch: + $ref: "#/components/schemas/MedicationLeafletSearch" required: - id - name @@ -60292,6 +65345,7 @@ components: - atcCode - rxNormCode - note + - leafletUrl - pausedAt - snoozedUntil - remindersActive @@ -60317,6 +65371,7 @@ components: - stockUnitsRemaining - stockDosesRemaining - runwayDays + - leafletSearch additionalProperties: false description: Detail variant of the medication resource enriched with the joined `category`. The base medication fields are inlined; see the `Medication` component for their semantics. @@ -60738,9 +65793,50 @@ components: type: string minLength: 1 maxLength: 64 + groupBy: + description: Grouping mode ("none" or "category"). Default "none". + type: string + enum: + - none + - category + groupsOpen: + description: Which groups open by default ("expanded", "flagged", "collapsed"). Default "expanded". + type: string + enum: + - expanded + - flagged + - collapsed + categoryOrder: + description: "The category order of the grouped list, first = top: built-in category values and `custom:` keys, at + most 64. A malformed key is a 422; a well-formed custom key the account does not have is dropped on write. + Categories not listed follow in the default order, OTHER last. Optional on PUT (preserve-when-absent); + always present on responses." + maxItems: 64 + type: array + items: + anyOf: + - type: string + enum: + - BLOOD_PRESSURE + - VITAMIN + - SUPPLEMENT + - PAIN_RELIEF + - ALLERGY + - DIGESTIVE + - THYROID + - HORMONE + - SKIN + - SLEEP_AID + - DIABETES + - ANTIBIOTIC + - MENTAL_HEALTH + - OTHER + - type: string + pattern: ^custom:[0-9a-f-]{36}$ updatedAt: - description: "Optimistic-concurrency token: the stored row's `updatedAt` at read/write time. Echo it back as - `baseUpdatedAt` on the next write. Opaque." + description: "Optimistic-concurrency token: this resource's own revision at read/write time, which moves only when this + resource changes, never on another write to the account. Echo it back as `baseUpdatedAt` on the next write. + Opaque." type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ @@ -60843,7 +65939,7 @@ components: type: object properties: data: - $ref: "#/components/schemas/MedicationIntakeEvent" + $ref: "#/components/schemas/RecordedMedicationIntakeEvent" error: type: "null" meta: @@ -60856,11 +65952,180 @@ components: - data - error additionalProperties: false + RecordedMedicationIntakeEvent: + type: object + properties: + id: + type: string + userId: + type: string + medicationId: + type: string + scheduledFor: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + takenAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + skipped: + type: boolean + autoMissed: + type: boolean + description: True when the nightly cron closed the slot as missed (no user action). Auto-missed rows count against + adherence but never consume inventory. + autoRecorded: + type: boolean + description: v1.42.2 — true when the server recorded this dose because the medication has `autoMarkTaken` on, not the + person. It counts as taken everywhere (adherence, history, Coach) and consumed inventory like a manual take. + Any take or skip the person records on the row clears it. Clients label such a dose "recorded + automatically". + attributionSource: + type: string + enum: + - AUTO + - USER_PIN + description: "How the row bound to its schedule slot: AUTO = the write path's nearest-slot resolution; USER_PIN = the + user explicitly pinned the slot (the dedup converge keeps the pinned row)." + source: + type: string + enum: + - WEB + - API + - REMINDER + - IMPORT + - APPLE_HEALTH + takenVia: + anyOf: + - type: string + enum: + - WEB + - APP + - INTEGRATION + - TELEGRAM + - APPLE_HEALTH + - IMPORT + - AUTO + - type: "null" + description: Where the take on this row came from, whatever wrote the row (`source` keeps the writer that created it, + `REMINDER` for a projected slot). Null until a take reaches the row, and on takes recorded before migration + 0515. + idempotencyKey: + type: + - string + - "null" + createdAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + updatedAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + injectionSite: + anyOf: + - type: string + enum: + - ABDOMEN_LEFT + - ABDOMEN_RIGHT + - ABDOMEN_UPPER_LEFT + - ABDOMEN_UPPER_RIGHT + - THIGH_LEFT + - THIGH_RIGHT + - UPPER_ARM_LEFT + - UPPER_ARM_RIGHT + - type: "null" + description: Recorded injection site for a site-tracked medication (GLP-1 rotation surface). NULL when the medication + does not track sites or none was recorded. + doseTaken: + description: Free-text dose actually taken when it differed from the scheduled dose (titration weeks, split doses). NULL + = the scheduled dose. + type: + - string + - "null" + inventoryConsumption: + anyOf: + - {} + - type: "null" + description: JSON ledger of the container decrements this intake caused (`[{itemId, units}]`), written by the + consumption hook. NULL when nothing was consumed (skipped / no tracked inventory). + externalId: + description: v1.28 — client-supplied stable id for externally-mirrored intakes (Apple Health sync); the dedup key for + re-synced rows. NULL for native rows. + type: + - string + - "null" + syncVersion: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: Monotonic per-row version for incremental sync readers; bumps on every mutation. + deletedAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: Soft-delete tombstone. Non-null rows are excluded from every list/aggregate read; sync readers use it to + propagate deletions. + appleHealthDeletedAt: + description: "Since v1.49.0: who deleted a tombstone. Equal to `deletedAt` when the phone reported the dose deleted + through `DELETE /api/medications/intake/by-external-ids`; null, or different, when it was deleted in + HealthLog. A re-post of a dose deleted in HealthLog is refused (`skipped`, reason `deleted_in_healthlog`), + one the phone reported is written again. Null on every live row; do not show it." + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + alreadyTaken: + type: boolean + description: "True when this POST reported a dose already recorded, or skipped one: the slot it binds to already holds a + take. Nothing was written and no stock was consumed; the body is the recorded row, so `takenAt` and + `takenVia` say when and how. False on a fresh dose (201) and on an idempotency replay (200)." + slotInstant: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: "Since v1.49.0. The canonical slot the dose is on: the slot the take or skip bound to (by its window, the + nearest open slot, a named `scheduledFor` or a `forceSlotInstant` pin), equal to `scheduledFor` then. Null + for a dose on no slot (an ad-hoc take or an extra dose, stored on its own instant). On `alreadyTaken` the + slot of the recorded take. The device that recorded the dose gets no silent `MEDICATION_INTAKE_SYNC` for it: + this field is its answer, and the sync goes to the account's other devices only." + required: + - id + - userId + - medicationId + - scheduledFor + - takenAt + - skipped + - autoMissed + - autoRecorded + - attributionSource + - source + - takenVia + - idempotencyKey + - createdAt + - updatedAt + - injectionSite + - doseTaken + - inventoryConsumption + - externalId + - syncVersion + - deletedAt + - alreadyTaken + - slotInstant + additionalProperties: false CreateMedicationIntakeResponse: type: object properties: data: - $ref: "#/components/schemas/MedicationIntakeEvent" + $ref: "#/components/schemas/RecordedMedicationIntakeEvent" error: type: "null" meta: @@ -61687,10 +66952,58 @@ components: format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ - type: "null" - description: Target instant of the open dose. Null when no dose is open. + description: "Target instant of the open dose: the earliest slot still due or overdue, before any upcoming one, so a + dose whose clock time has passed stays the current dose until it is recorded or missed. Null when no + dose is open." + state: + anyOf: + - type: string + enum: + - upcoming + - due + - overdue + - taken + - skipped + - missed + - type: "null" + description: The open dose's resolved state, the same vocabulary as the today list's `state`. Null when no dose is open. + `status` above is the same state in the older vocabulary. + takenLate: + type: boolean + description: "With `state: taken`: taken after the on-time window." + dueAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: When the open dose's window opens. + overdueSince: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: End of its on-time window; past it the dose is overdue. + missedAfter: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: Its miss cutoff; past it an unanswered dose is missed. + lateTakeCounts: + type: boolean + description: A take recorded for this dose now still counts for it (late after `overdueSince`). required: - status - targetAt + - state + - takenLate + - dueAt + - overdueSince + - missedAfter + - lateTakeCounts additionalProperties: false description: v1.15.9 — the open dose's per-dose status + target, so the card highlights the actionable take-window green and escalates an overdue dose without re-deriving the window math client-side. @@ -62523,6 +67836,22 @@ components: - missed - upcoming - ad_hoc + state: + anyOf: + - type: string + enum: + - upcoming + - due + - overdue + - taken + - skipped + - missed + - type: "null" + description: "The slot's resolved dose state, the same vocabulary as the today rows and `complianceDisplay.currentDose`: + an open slot (`status: upcoming`) reads `upcoming`, `due` or `overdue`. Null on an ad-hoc row." + takenLate: + type: boolean + description: True when the take came after the on-time window; `state` is then `taken`. pinned: description: Present and true when the row is served by a deliberate user pin ('zugeordnet'). type: boolean @@ -62605,8 +67934,158 @@ components: - at - timeOfDay - status + - state + - takenLate - intake additionalProperties: false + GetResolvedMedicationSlotsResponse: + type: object + properties: + data: + $ref: "#/components/schemas/ResolvedMedicationSlotsResponse" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + ResolvedMedicationSlotsResponse: + type: object + properties: + from: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + description: The window start the slots were read over. + to: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + description: The window end the slots were read over. + medications: + type: array + items: + type: object + properties: + medicationId: + type: string + family: + type: string + enum: + - daily + - weekly + - one_shot + - none + description: Cadence family the window's slots were minted under. + slots: + type: array + items: + $ref: "#/components/schemas/ResolvedMedicationSlot" + description: Every scheduled dose of the medication with its slot time in the window, oldest first. Off-schedule takes + are not slots and are not listed; the dose history has them. + required: + - medicationId + - family + - slots + additionalProperties: false + required: + - from + - to + - medications + additionalProperties: false + description: Every active medication of the record that can be due (active, not as-needed, intake tracked), each with + its resolved slots over the window. + ResolvedMedicationSlot: + type: object + properties: + slotInstant: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + description: "The slot's scheduled time: the same instant as `at` in the dose history and `slotInstant` on the today + rows, and what a take of this dose answers as `slotInstant`." + state: + type: string + enum: + - upcoming + - due + - overdue + - taken + - skipped + - missed + description: "The resolved dose state, the vocabulary of the today rows and the dose history's `state`: `upcoming` + before `dueAt`, `due` from `dueAt`, `overdue` past `overdueSince`, `missed` past `missedAfter` with nothing + recorded (or closed by the auto-miss pass), `taken` (see `takenLate`), `skipped`." + takenLate: + type: boolean + description: "With `state: taken`: taken after the on-time window." + dueAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + description: When the dose window opens. + overdueSince: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + description: The end of the on-time window; past it an open dose is `overdue`. Always present here, unlike the today rows. + missedAfter: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + description: The miss cutoff; past it an unanswered dose is `missed`. + lateTakeCounts: + type: boolean + description: "A take recorded for this dose now still counts for it: true while `due`, `overdue` and `missed`." + takenAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: When the dose was taken; null unless `state` is `taken`. + takenVia: + anyOf: + - type: string + enum: + - WEB + - APP + - INTEGRATION + - TELEGRAM + - APPLE_HEALTH + - IMPORT + - AUTO + - type: "null" + description: How the take was recorded (as on the today rows); null while not taken and for takes recorded before the + field existed. + intakeId: + description: The intake row on the slot, when one exists (a projected pending row included); null for a slot no row + holds yet. + type: + - string + - "null" + pinned: + type: boolean + description: True when a deliberate user pin serves the slot. + required: + - slotInstant + - state + - takenLate + - dueAt + - overdueSince + - missedAfter + - lateTakeCounts + - takenAt + - takenVia + - intakeId + - pinned + additionalProperties: false ListScheduleRevisionsResponse: type: object properties: @@ -63398,6 +68877,53 @@ components: - high - type: "null" description: "#1126 — the same for the OpenAI-compatible gateway entry." + localCoachBudget: + anyOf: + - type: object + properties: + snapshotChars: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + turnTokens: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + maxRounds: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + turnSeconds: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + additionalProperties: false + - type: "null" + description: "The Coach budget of the Local provider as a turn applies it (clamped to its bounds): snapshot characters, + tokens, rounds and seconds. A field left out runs on the built-in value; null when none is set." + compatCoachBudget: + anyOf: + - type: object + properties: + snapshotChars: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + turnTokens: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + maxRounds: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + turnSeconds: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + additionalProperties: false + - type: "null" + description: The same for the OpenAI-compatible gateway. serverProviderHealth: type: string enum: @@ -63445,6 +68971,8 @@ components: - responseTimeoutSeconds - localReasoningEffort - compatReasoningEffort + - localCoachBudget + - compatCoachBudget - serverProviderHealth - serverProviderOffer - serverProviderConsent @@ -63600,9 +69128,9 @@ components: - medium - high updatedAt: - description: "Optimistic-concurrency token: the stored row's `updatedAt` at read/write time. Echo it back as - `baseUpdatedAt` on the next write. Opaque — only ever echo a server-returned value, never parse or - synthesise it." + description: "Optimistic-concurrency token: this resource's own revision at read/write time, which moves only when this + resource changes, never on another write to the account. Echo it back as `baseUpdatedAt` on the next write. + Opaque — only ever echo a server-returned value, never parse or synthesise it." type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ @@ -63749,9 +69277,9 @@ components: - type: "null" description: When the recipe last changed; null while it never has. updatedAt: - description: "Optimistic-concurrency token: the stored row's `updatedAt` at read/write time. Echo it back as - `baseUpdatedAt` on the next write. Opaque — only ever echo a server-returned value, never parse or - synthesise it." + description: "Optimistic-concurrency token: this resource's own revision at read/write time, which moves only when this + resource changes, never on another write to the account. Echo it back as `baseUpdatedAt` on the next write. + Opaque — only ever echo a server-returned value, never parse or synthesise it." type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ @@ -63804,9 +69332,9 @@ components: modules: $ref: "#/components/schemas/ModuleMap" updatedAt: - description: "Optimistic-concurrency token: the stored row's `updatedAt` at read/write time. Echo it back as - `baseUpdatedAt` on the next write. Opaque — only ever echo a server-returned value, never parse or - synthesise it." + description: "Optimistic-concurrency token: this resource's own revision at read/write time, which moves only when this + resource changes, never on another write to the account. Echo it back as `baseUpdatedAt` on the next write. + Opaque — only ever echo a server-returned value, never parse or synthesise it." type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ @@ -65447,11 +70975,19 @@ components: description: Reorder lead time in days (0–60) the low-stock alert assumes. The alert fires this lead plus one dose-interval before the supply runs out so a refill arrives before the last dose. Default 10; a per-medication reorderLeadDays overrides it. + snoozeMinutes: + type: integer + minimum: 5 + maximum: 240 + description: "How long \"Remind me later\" defers a dose reminder, in minutes (5–240, default 30). One value for every + surface: the web card, Telegram and the app's notification action show it as \"Remind me later (30 + min)\". A snooze written without `snoozedUntil` defers by this much." required: - clientManaged - deliveryDefault - lowStockRunwayDays - reorderLeadDays + - snoozeMinutes additionalProperties: false mood: type: object @@ -65529,9 +71065,9 @@ components: - detail additionalProperties: false updatedAt: - description: "Optimistic-concurrency token: the stored row's `updatedAt` at read/write time. Echo it back as - `baseUpdatedAt` on the next write. Opaque — only ever echo a server-returned value, never parse or - synthesise it." + description: "Optimistic-concurrency token: this resource's own revision at read/write time, which moves only when this + resource changes, never on another write to the account. Echo it back as `baseUpdatedAt` on the next write. + Opaque — only ever echo a server-returned value, never parse or synthesise it." type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ @@ -68751,8 +74287,9 @@ components: - order additionalProperties: false updatedAt: - description: "Optimistic-concurrency token: the stored row's `updatedAt` at read/write time. Echo it back as - `baseUpdatedAt` on the next write. Opaque." + description: "Optimistic-concurrency token: this resource's own revision at read/write time, which moves only when this + resource changes, never on another write to the account. Echo it back as `baseUpdatedAt` on the next write. + Opaque." type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ @@ -70678,6 +76215,72 @@ components: - data - error additionalProperties: false + AdminMigrationStatusResponse: + type: object + properties: + data: + $ref: "#/components/schemas/AdminMigrationStatus" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + AdminMigrationStatus: + type: object + properties: + shipped: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + description: Migrations in this image; null when the folder is absent. + applied: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + pending: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + pendingNames: + type: array + items: + type: string + description: The first 20 pending migrations, in apply order. + failedNames: + type: array + items: + type: string + description: Migrations that started and did not finish (first 20). + lastApplied: + anyOf: + - type: object + properties: + name: + type: string + at: + type: string + required: + - name + - at + additionalProperties: false + - type: "null" + required: + - shipped + - applied + - pending + - pendingNames + - failedNames + - lastApplied + additionalProperties: false AdminMeasurementMaintenanceStatusResponse: type: object properties: @@ -70993,6 +76596,32 @@ components: type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + relayState: + type: string + description: v1.49.0 — `none` | `bound` | `rebind_needed` | `conflict`, as `push.device.relayState` reads it (a + `conflict` older than 30 minutes reads `rebind_needed`). + relayBoundAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: v1.49.0 — when the relay last confirmed the binding. + liveActivityStartedAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: v1.49.0 — when the relay accepted the server's last Live Activity start on the device; null while a start + is in flight or after one the relay refused. + envelopesReportedAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: v1.49.0 — when the device last reported which sealed pushes it opened (`GET /api/sync/state`). required: - id - platform @@ -71001,6 +76630,10 @@ components: - apnsTokenSuffix - apnsEnvironment - lastSeenAt + - relayState + - relayBoundAt + - liveActivityStartedAt + - envelopesReportedAt additionalProperties: false description: Per-device APNs registration snapshot. The APNs token is masked to its 8-char hex prefix + 8-char suffix so an operator can correlate with iOS-side logs without disclosing the delivery target. @@ -71615,10 +77248,13 @@ components: - nextDueMedicationId additionalProperties: false description: "Today's medication block: active-medication count, today-window tally (scheduled / taken / skipped), every - active medication's current display-due candidate, and legacy scalar fields projected from candidate zero. - `overdue: true` marks an OPEN overdue slot (anchor passed, still inside its catch-up band); `availableFrom` - is the canonical cadence- and dose-window-derived attribution-band start. `dueCandidates` is optional so - older cached snapshots remain valid. Medication ids let consumers deep-link straight to the relevant card." + active medication's next dose, and legacy scalar fields projected from candidate zero. Since v1.49.0 each + candidate comes from the dose resolver, the same one behind the today rows and + `complianceDisplay.currentDose`: the medication's earliest open dose (`due` or `overdue`), else its earliest + `upcoming` one. `overdue: true` means the resolver's `overdue` state (past the on-time window, before the + miss cutoff); `availableFrom` is the resolver's `dueAt`, when the dose turns due. For the state of a dose, + read the today rows or `currentDose`. `dueCandidates` is optional so older cached snapshots remain valid. + Medication ids let consumers deep-link straight to the relevant card." healthScore: anyOf: - type: object @@ -72333,14 +77969,18 @@ components: - "null" compliance7: type: number - description: Percent, 0-100. + description: "Percent, 0-100. When `taken7 + missed7` is 0 there is no dose to score and this is not adherence: show an + empty state, not the number." compliance30: type: number - description: Percent, 0-100. + description: "Percent, 0-100. When `expected30` is 0 there is no dose to score and this is not adherence: show an empty + state, not the number." streak: type: integer minimum: -9007199254740991 maximum: 9007199254740991 + description: Days in a row with every expected dose taken or skipped. Starts on a day with an answered dose, so it is 0 + before the first one. taken7: type: integer minimum: -9007199254740991 @@ -72353,6 +77993,11 @@ components: type: integer minimum: -9007199254740991 maximum: 9007199254740991 + expected30: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: "Since v1.49.0: the doses the 30-day rate counts (taken plus missed)." required: - id - name @@ -72365,6 +78010,7 @@ components: - taken7 - skipped7 - missed7 + - expected30 additionalProperties: false description: Cadence-aware compliance per active medication. alerts: @@ -75194,6 +80840,13 @@ components: description: "v1.48.0 — the direction of `delta`: `flat` under 0.05 in the metric's own unit, `unknown` when `delta` is null. The dashboard summary's metric card takes its `trend` from this same comparison over `30d` (its `trendWindowDays` is then 30), so the arrow on the card and on the metric page agree." + unit: + type: string + description: "The unit every number of this answer is in, resolved for the account: BLOOD_GLUCOSE in its glucose unit + (`mg/dL` or `mmol/L`), the metric/imperial types (weight, length, distance, temperature, …) in its unit + system, everything else in the stored unit. `min`, `max`, `mean`, `sum` and `delta` are converted; + `deltaPct` is recomputed from the converted means. Render the values with this unit; never convert them + again." required: - range - windowDays @@ -75203,6 +80856,7 @@ components: - delta - deltaPct - trend + - unit additionalProperties: false description: Single-metric period-over-period aggregate. Reads the current and previous comparable windows from the rollup tier and composes a count-weighted-mean delta, one source per day. Step-like totals compare average daily @@ -76036,25 +81690,24 @@ components: properties: id: type: string - description: "The recording row's id (cuid). Required and never null, so a client decoding it as a plain string keeps - working: on a `duplicate` for a recording deleted through `DELETE /api/insights/ecg/by-external-ids` it is - the id of the deletion record instead, which names no recording. Do not fetch or link it; treat it as - opaque." + description: "The recording row's id (cuid): the written one, or on a `duplicate` the row that already holds the + recording." status: type: string enum: - inserted - updated - duplicate - description: "What the write did. `inserted` — a new recording landed (HTTP 201). `updated` — this `externalRecordingId` + description: What the write did. `inserted` — a new recording landed (HTTP 201). `updated` — this `externalRecordingId` was already stored and the row was overwritten in place (HTTP 200); a retry is safe and creates nothing. `duplicate` — this exact recording is already stored under a DIFFERENT id, i.e. it arrived earlier through the `export.zip` importer (HTTP 200); nothing was written and `id` names the row that already holds it. A recording is the same recording when `(source, recordedAt, samplingFrequency)` match, which is enforced by a - unique index rather than by convention. Since v1.48.2 `duplicate` is also the answer for an `APPLE_HEALTH` - recording deleted through `DELETE /api/insights/ecg/by-external-ids`: it stays deleted, nothing is written, - and `id` names the deletion record rather than a recording. All three statuses mean the client may advance - its cursor." + unique index rather than by convention. From v1.48.2 to v1.48.x `duplicate` was also the answer for an + `APPLE_HEALTH` recording deleted through `DELETE /api/insights/ecg/by-external-ids`; since v1.49.0 such a + re-post is written again (`inserted`), because only the phone can delete a recording, and a recording it + reported deleted that comes back is back in Apple Health. All three statuses mean the client may advance its + cursor. recordedAt: type: string format: date-time @@ -78301,6 +83954,10 @@ components: - skipped description: "`inserted`/`duplicate` — the row landed (advance the cursor). `skipped` — see `reason`." reason: + description: "Why an entry was `skipped`. `deleted_in_healthlog` (since v1.49.0) for an entry whose `(source, + externalId)` names an entry the person deleted in HealthLog; it stays deleted and nothing is written. An + entry the phone reported deleted through `DELETE /api/mood-entries/by-external-ids` is written back when it + is posted again (`inserted`): it is in Apple Health again." type: string id: description: The upserted row id (absent on skips). @@ -78760,9 +84417,9 @@ components: items: type: string updatedAt: - description: "Optimistic-concurrency token: the stored row's `updatedAt` at read/write time. Echo it back as - `baseUpdatedAt` on the next write. Opaque — only ever echo a server-returned value, never parse or - synthesise it." + description: "Optimistic-concurrency token: this resource's own revision at read/write time, which moves only when this + resource changes, never on another write to the account. Echo it back as `baseUpdatedAt` on the next write. + Opaque — only ever echo a server-returned value, never parse or synthesise it." type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ @@ -81024,6 +86681,379 @@ components: - data - error additionalProperties: false + GadgetbridgeImportKickoffEnvelope: + type: object + properties: + data: + type: object + properties: + jobId: + type: string + status: + type: string + idempotent: + type: boolean + required: + - jobId + - status + additionalProperties: false + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + GadgetbridgeImportStatusEnvelope: + type: object + properties: + data: + type: object + properties: + job: + anyOf: + - $ref: "#/components/schemas/RecordFileImportJob" + - type: "null" + required: + - job + additionalProperties: false + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + RecordFileImportJob: + type: object + properties: + jobId: + type: string + status: + type: string + startedAt: + type: string + completedAt: + type: + - string + - "null" + uploadBytes: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + result: + anyOf: + - $ref: "#/components/schemas/RecordFileImportResult" + - type: "null" + failureReason: + description: "On `failed`, a reason led by a closed code and a colon: `not_gadgetbridge`, `unsafe_schema`, + `not_fhir_bundle`, `too_many_entries`, `too_large`, `time_budget`, `staging_missing`." + type: + - string + - "null" + required: + - jobId + - status + - startedAt + - completedAt + - uploadBytes + - result + - failureReason + additionalProperties: false + RecordFileImportResult: + type: object + properties: + kind: + type: string + enum: + - gadgetbridge + - fhir_bundle + imported: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + duplicates: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + skipped: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + failed: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + lines: + type: array + items: + type: object + properties: + key: + type: string + description: A measurement type (`ACTIVITY_STEPS`, `PULSE`, …) or a record family (`lab`, `condition`, `vaccination`, + `medication`, `visit`). + imported: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + duplicates: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + required: + - key + - imported + - duplicates + additionalProperties: false + description: What each kind of row became. + skips: + type: array + items: + type: object + properties: + key: + type: string + description: "A Gadgetbridge table name or a FHIR resource type: a schema name, never content." + reason: + type: string + description: "A closed reason code: `not_read`, `invalid_time`, `invalid_value`, `out_of_range`, `unsupported_type`, + `unsupported_category`, `unit_mismatch`, `not_final`, `no_date`, `future_date`, `no_label`, + `not_confirmed`, `not_completed`, `not_taken`, `not_a_visit`, or one of the lab mapping's reasons." + count: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + required: + - key + - reason + - count + additionalProperties: false + description: What the file held that was not imported, and why. + budgetExceeded: + type: boolean + description: The run stopped at its ten-minute budget. The job is `failed` with `time_budget`; uploading the same file + again continues, and what was written is found under its identities. + measuredSpan: + anyOf: + - type: object + properties: + from: + type: string + to: + type: string + required: + - from + - to + additionalProperties: false + - type: "null" + durationMs: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + required: + - kind + - imported + - duplicates + - skipped + - failed + - lines + - skips + - budgetExceeded + - measuredSpan + - durationMs + additionalProperties: false + FhirBundleImportKickoffEnvelope: + type: object + properties: + data: + type: object + properties: + jobId: + type: string + status: + type: string + idempotent: + type: boolean + required: + - jobId + - status + additionalProperties: false + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + FhirBundleImportStatusEnvelope: + type: object + properties: + data: + type: object + properties: + job: + anyOf: + - $ref: "#/components/schemas/RecordFileImportJob" + - type: "null" + required: + - job + additionalProperties: false + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + HealthConnectRemoteEnvelope: + type: object + properties: + data: + $ref: "#/components/schemas/HealthConnectRemoteState" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + HealthConnectRemoteState: + type: object + properties: + source: + anyOf: + - type: object + properties: + folderUrl: + type: string + fileName: + type: string + enabled: + type: boolean + lastAttemptAt: + type: + - string + - "null" + lastOutcome: + description: "The closed outcome of the last attempt: `imported`, `unchanged`, `busy`, `not_found`, `unauthorized`, + `redirected`, `upstream_error`, `too_large`, `timeout`, `network`, `private_origin_not_approved`, + `invalid_origin`, `no_worker`." + type: + - string + - "null" + nextAttemptAt: + type: string + consecutiveFailures: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + lastImportJobId: + type: + - string + - "null" + required: + - folderUrl + - fileName + - enabled + - lastAttemptAt + - lastOutcome + - nextAttemptAt + - consecutiveFailures + - lastImportJobId + additionalProperties: false + - type: "null" + required: + - source + additionalProperties: false + HealthConnectRemoteSavedEnvelope: + type: object + properties: + data: + $ref: "#/components/schemas/HealthConnectRemoteState" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + HealthConnectRemoteDeletedEnvelope: + type: object + properties: + data: + type: object + properties: + deleted: + type: boolean + required: + - deleted + additionalProperties: false + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + HealthConnectRemoteFetchEnvelope: + type: object + properties: + data: + type: object + properties: + queued: + type: boolean + required: + - queued + additionalProperties: false + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false MeasurementReminderListEnvelope: type: object properties: @@ -85872,7 +91902,7 @@ components: assessments: type: array items: - $ref: "#/components/schemas/MentalHealthAssessment" + $ref: "#/components/schemas/MentalHealthAssessmentListRow" trends: description: v1.44 — one per PHQ-9 / GAD-7 / WHO-5 with at least one administration. Absent on older servers. type: array @@ -85881,7 +91911,7 @@ components: required: - assessments additionalProperties: false - MentalHealthAssessment: + MentalHealthAssessmentListRow: type: object properties: id: @@ -85924,6 +91954,15 @@ components: type: string createdAt: type: string + source: + type: string + description: "Where the administration came from: `WEB`, `IOS` or `APPLE_HEALTH`, as on the detail read. Decode unknown + values leniently." + itemsUnavailable: + type: boolean + description: "The detail read's own verdict, without its answers: true when the detail read would answer `items: null`, + for a score-only `APPLE_HEALTH` row whose answers were never shared or a row whose answers no longer + decrypt. Lets a history say \"answers not shared\" without a detail read per row." required: - id - instrument @@ -85936,11 +91975,10 @@ components: - crisisShownAt - takenAt - createdAt + - source + - itemsUnavailable additionalProperties: false - description: One completed screener administration. `severityBand` is a descriptive label for the screen (never a - diagnosis). `item9Flagged` is true when the PHQ-9 self-harm item was answered > 0 — the client MUST show crisis - resources when it is. Raw per-item answers are intentionally absent from list rows; the by-id detail read - returns them decrypted. + description: "One row of the screener history: the administration plus `source` and `itemsUnavailable`. No item answer." MentalHealthAssessmentTrend: type: object properties: @@ -86067,6 +92105,66 @@ components: - actionThreshold - crisis additionalProperties: false + MentalHealthAssessment: + type: object + properties: + id: + type: string + instrument: + type: string + enum: + - PHQ9 + - GAD7 + - WHO5 + - SCI + locale: + type: string + wording: + anyOf: + - type: string + enum: + - validated + - unvalidated_translation + - original_en + - type: "null" + description: "Which text the answers were given in. `validated`: the published validated version for `locale` (the + original for English). `unvalidated_translation`: a translation written for HealthLog where no validated + version exists; clients show that the result is orientation only. `original_en`: the English original, + chosen by a reader of another language (`englishOriginal` on create). Null on administrations recorded + before v1.46." + version: + type: string + totalScore: + type: number + severityBand: + type: string + item9Flagged: + type: boolean + crisisShownAt: + type: + - string + - "null" + takenAt: + type: string + createdAt: + type: string + required: + - id + - instrument + - locale + - wording + - version + - totalScore + - severityBand + - item9Flagged + - crisisShownAt + - takenAt + - createdAt + additionalProperties: false + description: One completed screener administration. `severityBand` is a descriptive label for the screen (never a + diagnosis). `item9Flagged` is true when the PHQ-9 self-harm item was answered > 0 — the client MUST show crisis + resources when it is. Raw per-item answers are intentionally absent from list rows; the by-id detail read + returns them decrypted. CrisisResourceSet: type: object properties: @@ -86644,6 +92742,7 @@ components: - PAPERLESS - PAPRA - OTHER + - REPORT_SCHEDULE - type: "null" sourceId: type: @@ -86698,13 +92797,14 @@ components: index, and is null when the attempt succeeded or none ran. `hasThumbnail` is true when a preview thumbnail has been rendered in the background (fetch it from `/api/documents/inbound/{id}/thumbnail`); false means no preview yet or an unsupported type — show a placeholder. `sourceSystem` / `sourceId` say where an imported document came - from and its id there (both null for a document added in HealthLog); treat an unknown `sourceSystem` as OTHER - when decoding. `sourceUrl` is the document's page in the Paperless-ngx or Papra archive the owner has connected - (http or https), built by the server from that connection; it is filled on the list (`GET - /api/documents/inbound`) and on the detail read and edit (`GET` / `PATCH /api/documents/inbound/{id}`), only for - the owner acting on their own record and only while the connection, the id and the operator's origin list allow - it; it is null for a delegate or a guardian and in every other response. Open it in a browser; never send - credentials to it. Treat an unknown `kind` value as OTHER when decoding. + from and its id there (both null for a document added in HealthLog); `REPORT_SCHEDULE` marks a doctor report the + server filed on the owner's schedule (no `sourceUrl`); treat an unknown `sourceSystem` as OTHER when decoding. + `sourceUrl` is the document's page in the Paperless-ngx or Papra archive the owner has connected (http or + https), built by the server from that connection; it is filled on the list (`GET /api/documents/inbound`) and on + the detail read and edit (`GET` / `PATCH /api/documents/inbound/{id}`), only for the owner acting on their own + record and only while the connection, the id and the operator's origin list allow it; it is null for a delegate + or a guardian and in every other response. Open it in a browser; never send credentials to it. Treat an unknown + `kind` value as OTHER when decoding. DocumentConditionLink: type: object properties: @@ -87228,6 +93328,7 @@ components: - PAPERLESS - PAPRA - OTHER + - REPORT_SCHEDULE - type: "null" sourceId: type: @@ -87278,6 +93379,13 @@ components: more facts than one review takes. Kept from the last extraction (the extract route, its background run, or automatic lab staging) until the next one replaces the facts; false for a document never extracted. A review shows it whenever it is opened, not only when the run ends." + aiFailures: + type: array + items: + $ref: "#/components/schemas/AiJobFailure" + description: v1.49 — why the latest background AI work on this document stopped, one entry per kind (`documentSummary`, + `documentIndex`, `documentRead`), newest first. Empty when nothing failed or the work succeeded since. + Absent on servers older than v1.49. required: - id - kind @@ -87311,6 +93419,7 @@ components: - summaryGeneratedAt - summaryState - extractionIncomplete + - aiFailures additionalProperties: false description: 'A stored document plus its staged facts. `summary` is a short (3-4 sentence) plain-language description of WHAT the document is, generated once and then served from storage; it is descriptive only, never a diagnosis. @@ -87462,6 +93571,89 @@ components: catalogue entry when this release still knows the dose's slug, for the reader's own bundle to name; null is the signal to show `vaccineName`, the person's own wording. The same table the dose's own `/api/vaccinations/{id}/links` writes from the other end. + AiJobFailure: + type: object + properties: + job: + type: string + enum: + - documentSummary + - documentIndex + - documentRead + - labScan + - supplementLabel + - statusText + - briefing + - periodNarrative + - workoutInsight + - reactionLine + - coachNudge + - coachMemory + description: "The kind of background AI work: `documentSummary`, `documentIndex` (making a document searchable), + `documentRead` (reading a document's values or filing suggestions), `labScan`, `supplementLabel`, + `statusText` (the notes on the cards), `briefing`, `periodNarrative`, `workoutInsight`, `reactionLine`, + `coachNudge`, `coachMemory`. Treat an unknown value as other background work." + code: + type: string + enum: + - no_provider + - chain_no_provider + - consent_required + - not_permitted + - check_failed + - credential_expired + - rate_limited + - provider_timeout + - provider_unreachable + - provider_empty + - provider_reasoning_only + - provider_paused + - provider_error + - budget_exhausted + - unreadable_file + description: "Why it stopped. `no_provider`: no provider is set up that could do this work. `chain_no_provider`: the + work is bound to a named chain and none of its entries is set up. `consent_required`: the provider needs a + consent receipt and none is active. `not_permitted`: the work may not run on this record. `check_failed`: + the server could not check whether it may run. `credential_expired`: the provider refused the key. + `rate_limited`: the provider said too many requests. `provider_timeout`: no answer in time. + `provider_unreachable`: the provider could not be reached. `provider_empty`: it answered with nothing. + `provider_reasoning_only`: the model reasoned and never answered. `provider_paused`: the provider failed so + often that background work waits before trying again. `provider_error`: another provider failure. + `budget_exhausted`: today's AI allowance is used up. `unreadable_file`: the file could not be prepared for + the provider. Treat an unknown value as `provider_error`." + documentId: + description: The document the work was for, or null. + type: + - string + - "null" + providerType: + description: The provider entry that failed (a chain provider type such as `local` or `anthropic`), when one was called. + type: + - string + - "null" + failCount: + type: integer + minimum: 1 + maximum: 9007199254740991 + description: Failures in a row since the last success. + firstFailedAt: + type: string + description: ISO 8601. + lastFailedAt: + type: string + description: ISO 8601. + required: + - job + - code + - documentId + - providerType + - failCount + - firstFailedAt + - lastFailedAt + additionalProperties: false + description: Why the latest background AI work of one kind stopped (v1.49). Recorded by the server from closed codes + only; no provider message or payload is stored. A later success removes it; it is no longer served thirty days + after its last failure. InboundDocumentUpdateEnvelope: type: object properties: @@ -87596,6 +93788,7 @@ components: - PAPERLESS - PAPRA - OTHER + - REPORT_SCHEDULE - type: "null" description: The system an imported document came from, or null for one added in HealthLog. deletedAt: @@ -88293,6 +94486,119 @@ components: - data - error additionalProperties: false + OnboardingChecklistExtrasEnvelope: + type: object + properties: + data: + $ref: "#/components/schemas/OnboardingChecklistExtras" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + OnboardingChecklistExtras: + type: object + properties: + emergencyCard: + type: object + properties: + applies: + type: boolean + description: "Whether the row means anything for this record: inside a managed profile only the guardian's rows + (emergency card, care feed, report schedule) apply." + done: + type: boolean + description: Whether it is already set up. + required: + - applies + - done + additionalProperties: false + careFeed: + type: object + properties: + applies: + type: boolean + description: "Whether the row means anything for this record: inside a managed profile only the guardian's rows + (emergency card, care feed, report schedule) apply." + done: + type: boolean + description: Whether it is already set up. + required: + - applies + - done + additionalProperties: false + sharing: + type: object + properties: + applies: + type: boolean + description: "Whether the row means anything for this record: inside a managed profile only the guardian's rows + (emergency card, care feed, report schedule) apply." + done: + type: boolean + description: Whether it is already set up. + required: + - applies + - done + additionalProperties: false + imports: + type: object + properties: + applies: + type: boolean + description: "Whether the row means anything for this record: inside a managed profile only the guardian's rows + (emergency card, care feed, report schedule) apply." + done: + type: boolean + description: Whether it is already set up. + required: + - applies + - done + additionalProperties: false + reportSchedule: + type: object + properties: + applies: + type: boolean + description: "Whether the row means anything for this record: inside a managed profile only the guardian's rows + (emergency card, care feed, report schedule) apply." + done: + type: boolean + description: Whether it is already set up. + required: + - applies + - done + additionalProperties: false + iosApp: + type: object + properties: + applies: + type: boolean + description: "Whether the row means anything for this record: inside a managed profile only the guardian's rows + (emergency card, care feed, report schedule) apply." + done: + type: boolean + description: Whether it is already set up. + required: + - applies + - done + additionalProperties: false + required: + - emergencyCard + - careFeed + - sharing + - imports + - reportSchedule + - iosApp + additionalProperties: false + description: 1.49 — presence behind the getting-started checklist's optional rows. Existence and counts only, never contents. OnboardingStateEnvelope: type: object properties: @@ -88338,14 +94644,17 @@ components: anyOf: - $ref: "#/components/schemas/OnboardingFirstResult" - type: "null" + offers: + $ref: "#/components/schemas/OnboardingOffers" required: - steps - needs - completedAt - firstResult + - offers additionalProperties: false description: The needs-based setup flow for one record. Always present on the account payload — a record that never - entered the flow reads as empty answers with nine `pending` steps, so a client branches on the step statuses + entered the flow reads as empty answers and every step `pending`, so a client branches on the step statuses rather than on the field's existence. On the account payload it describes the ACTIVE record, so a client under an account switch reads the same record its counts and module map describe; under a scoped grant the answers come back empty. @@ -88362,6 +94671,8 @@ components: - visit - units - confirm + - reminders + - ai - first-result - done status: @@ -88382,6 +94693,12 @@ components: `units` carries one resolution the others do not: a record whose account already holds BOTH unit preferences reads as `done` whether or not the question was ever put, which is what stops the flow re-asking a value the account holds. + + + 1.49 adds two follow-ups after `confirm`: `reminders` (where reminders arrive; for a medication schedule or a + mood or cycle area) and `ai` (the Coach, yes or no; only while `offers.ai`). Neither holds the setup open for a + client that skips them: a follow-up that does not apply reads `skipped`, and a ledger confirmed before 1.49 + reads both as `skipped`. OnboardingNeeds: type: object properties: @@ -88462,12 +94779,41 @@ components: - metric - imperial - type: "null" + timezone: + description: 1.49 — the IANA time zone confirmed on the "Region & units" screen, as given. `timezone` on the account + payload is the value every surface reads. + type: + - string + - "null" + medicineRegistry: + anyOf: + - type: string + enum: + - PL + - DE + - ES + - FR + - GB + - BE + - NL + - US + - CA + - AU + - BR + - EU + - NONE + - type: "null" + description: 1.49 — the medicine registry chosen on the same screen (asked only when medication was chosen), as given. + `medicineRegistry` on the account payload is the value the medication read uses. required: - glucoseUnit - unitPreference + - timezone + - medicineRegistry additionalProperties: false - description: "Q6 — the unit answers as given. NOT the source of truth for display: `glucoseUnit` and `unitPreference` on - the account payload are, and the answers step writes them. This records what the flow was told." + description: "Q6 (\"Region & units\" since 1.49, id unchanged) — the answers as given. NOT the source of truth for + display: the account payload's columns are, and the answers step writes them. This records what the flow was + told." required: - recordTarget - areas @@ -88505,6 +94851,19 @@ components: - completedAt additionalProperties: false description: The one task the flow offered at the end, and whether it produced its result. + OnboardingOffers: + type: object + properties: + ai: + type: boolean + description: "The server offers this record the Coach: available, waiting only for the person's consent, or waiting for + a provider the person may set up. Never while the operator or the person switched it off. The `ai` step + applies only while true." + required: + - ai + additionalProperties: false + description: 1.49 — the server facts the conditional follow-up steps depend on, resolved on the server so no client + recomputes them. OnboardingCompleteEnvelope: type: object properties: @@ -89014,6 +95373,144 @@ components: additionalProperties: false description: A user-set daily amount in the nutrient's canonical unit. `target` = an amount to reach, `limit` = an amount to stay under. + EnergyBalanceEnvelope: + type: object + properties: + data: + type: object + properties: + windowDays: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + days: + type: array + items: + type: object + properties: + day: + type: string + format: date + intakeKcal: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + description: The day's folded `energy` intake; null when nothing was logged (never 0). + restingKcal: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + description: "Resting energy: the day's `BASAL_ENERGY_BURNED` sum, else the Mifflin-St Jeor estimate, else null." + restingEstimated: + type: boolean + description: True when `restingKcal` is the estimate, not a reading. + activeKcal: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + description: The day's `ACTIVE_ENERGY_BURNED` sum, or null. + expenditureKcal: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + description: Resting plus active; null when either is missing. + balanceKcal: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + description: Intake minus expenditure; negative is a deficit. Null when either is missing. + trendKcal: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + description: Mean balance of the seven days ending here, once four of them hold one; null on the partial day. + partial: + type: boolean + description: "Today, still running: outside the trend and the window means." + required: + - day + - intakeKcal + - restingKcal + - restingEstimated + - activeKcal + - expenditureKcal + - balanceKcal + - trendKcal + - partial + additionalProperties: false + description: One entry per local day, oldest first. + summary: + type: object + properties: + daysWithBalance: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + meanIntakeKcal: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + meanExpenditureKcal: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + meanBalanceKcal: + anyOf: + - type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + - type: "null" + required: + - daysWithBalance + - meanIntakeKcal + - meanExpenditureKcal + - meanBalanceKcal + additionalProperties: false + estimateGaps: + type: array + items: + type: string + enum: + - weight + - height + - birthDate + - sex + description: What the resting estimate lacks; empty when it can be made. A day without a resting reading has no + expenditure while any is missing. + required: + - windowDays + - days + - summary + - estimateGaps + additionalProperties: false + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false NutrientWaterWriteEnvelope: type: object properties: @@ -89282,6 +95779,15 @@ components: type: boolean description: This type has gone quiet while the source around it reads healthy — the dead-pipe signature (e.g. a single revoked HealthKit permission). Only ever true when the verdict is `fresh`. + oldestSeenAt: + description: "Since v1.49.0: the oldest stored reading of this type from Apple Health, in the same scope as `lastSeenAt` + (live rows only; the oldest `takenAt`, or slot of a skipped dose, on `MEDICATION_DOSE`; the oldest start on + `WORKOUTS`). Below it the server holds nothing of the type from Apple Health, so a history walk that has met + only duplicates can jump here and go on below. Unlike `lastSeenAt` on a type the app writes back, it never + counts a reading entered here. Absent on a server before v1.49.0." + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ lastReceivedAt: description: "When a live sync batch last brought a new or changed row of this type. Since v1.45 a batch that carried the type with duplicates only (an unchanged `stats:` re-post or an hour posted again with its stored value @@ -91420,10 +97926,10 @@ components: type: array items: $ref: "#/components/schemas/IntegrationStatusEntry" - description: "All nine providers, always, in the fixed order withings, whoop, google-health, polar, oura, strava, - nightscout, dawarich, garmin. A provider the user has never touched still appears, with `connected: false` - and the ledger state `unknown` — absence from this list never means anything, because nothing is ever absent - from it." + description: "All ten providers, always, in the fixed order withings, whoop, google-health, polar, oura, strava, + nightscout, dawarich, garmin, health-connect-remote. A provider the user has never touched still appears, + with `connected: false` and the ledger state `unknown` — absence from this list never means anything, + because nothing is ever absent from it." required: - threshold - fitbitRemovalNotice @@ -91431,8 +97937,8 @@ components: - integrations additionalProperties: false description: The one read behind the integrations settings surface. It carries every field the per-provider status - routes carry, so a client has the choice of nine round-trips or this one; the per-provider routes remain for - callers that want a single provider. + routes carry, so a client has the choice of one round-trip per provider or this one; the per-provider routes + remain for callers that want a single provider. IntegrationStatusEntry: type: object properties: @@ -91448,7 +97954,11 @@ components: - nightscout - dawarich - garmin - description: Which provider this entry describes. + - health-connect-remote + description: "Which provider this entry describes. `health-connect-remote` is the scheduled Health Connect export + fetched from a WebDAV or Nextcloud folder (`/api/import/health-connect-remote`): `configured` when a folder + is set up, `connected` when it is also switched on. A refused user name or app password reads as + `reauth_required`; the fix is a new password on that route, not an OAuth reconnect." state: type: string enum: @@ -92971,8 +99481,9 @@ components: again. Additive. type: boolean updatedAt: - description: "Optimistic-concurrency token: the stored row's `updatedAt` at read/write time. Echo it back as - `baseUpdatedAt` on the next write. Opaque." + description: "Optimistic-concurrency token: this resource's own revision at read/write time, which moves only when this + resource changes, never on another write to the account. Echo it back as `baseUpdatedAt` on the next write. + Opaque." type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ @@ -93239,8 +99750,9 @@ components: again. Additive. type: boolean updatedAt: - description: "Optimistic-concurrency token: the stored row's `updatedAt` at read/write time. Echo it back as - `baseUpdatedAt` on the next write. Opaque." + description: "Optimistic-concurrency token: this resource's own revision at read/write time, which moves only when this + resource changes, never on another write to the account. Echo it back as `baseUpdatedAt` on the next write. + Opaque." type: string format: date-time pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ @@ -93529,6 +100041,29 @@ components: - type: "null" description: The account's chosen glucose display unit, as stored. `null` means the person never chose one (or the stored value is neither unit), and the server then shows glucose in mg/dL. + medicineRegistry: + type: string + enum: + - PL + - DE + - ES + - FR + - GB + - BE + - NL + - US + - CA + - AU + - BR + - EU + - NONE + description: '#1430 — which official medicine registry the "Find leaflet" link opens: an ISO 3166 alpha-2 country code + (`PL`, `DE`, `ES`, `FR`, `GB`, `BE`, `NL`, `US`, `CA`, `AU`, `BR`, `EU`; `GB` is the United Kingdom, `EU` + the European Medicines Agency), or `NONE` for no leaflet search. Independent of the interface language. + Never null: an account that never chose one has it derived once from its language and time zone where the + two agree on one registry, otherwise `NONE`, and stored, so a later change of language does not move it. Set + it with `PATCH /api/auth/me/medicine-registry`. Clients show and edit it; the link itself comes ready-built + on the medication list and detail as `leafletSearch`.' features: type: object properties: @@ -93575,6 +100110,21 @@ components: absent or `false` means this server does not have the feature; a client checks for `true` before it calls a route or sends a request form the flag names. Absent on servers older than v1.42.0. A client that meets a flag it does not know ignores it. + push: + type: object + properties: + relay: + $ref: "#/components/schemas/PushRelayCapability" + device: + anyOf: + - $ref: "#/components/schemas/DevicePushState" + - type: "null" + description: The calling device, named by `X-Device-Id`; null when the header names none of the caller's devices. + required: + - relay + - device + additionalProperties: false + description: v1.49 — the push relay and the calling device's push state. Clients gate on these fields, never on a version. accountAccess: $ref: "#/components/schemas/AccountAccess" moduleAccess: @@ -93609,7 +100159,9 @@ components: - createdAt - timezone - glucoseUnit + - medicineRegistry - features + - push - accountAccess - moduleAccess - ai @@ -93631,6 +100183,116 @@ components: with the same masking; it replaces reading `GET /api/feature-flags`. `coachReasoning` (v1.41) is the Coach's resolved thinking depth: the caller's own preference against the operator's reasoning controls and the record's provider." + PushRelayCapability: + type: object + properties: + host: + description: "The relay host, lower case, without scheme or port: the `host` field of every statement the app signs + (`hl-bind-v1`, `hl-activity-v1`) and of the relay's response signatures." + type: + - string + - "null" + available: + type: boolean + description: This server can use a relay at all (`PUSH_RELAY_MODE` is not `off` and the relay's identity keys are pinned). + offered: + type: boolean + description: The operator turned the relay on. Show the opt-in card only when this is true and `push.device.consent` is + false; when it turns false, revoke the binding at the relay directly and return to local reminders. + state: + type: string + enum: + - ok + - degraded + - down + - off + description: The relay's health as this server sees it; `off` while not offered. + since: + description: When `state` last changed, ISO 8601. + type: + - string + - "null" + reason: + description: A short code for a non-`ok` state. + type: + - string + - "null" + instanceId: + description: "The instance id the relay issued: what `hl-bind-v1` and `hl-activity-v1` are signed for. Null until + registered." + type: + - string + - "null" + senderKeys: + type: array + items: + $ref: "#/components/schemas/PushSenderKey" + description: "The keys to pin for this account, at most three: `next` (announced at least 7 days before it seals + anything), `current`, and `previous` for 30 days after it retired. Pin all of them and try each. The server + enforces the notice: sealing switches only to a key that was published as `next` for 7 days, and a new + `next` is announced only after `previous` retired. The one exception is the operator's emergency rotation of + an exposed key, which replaces `current` at once and drops `next` and `previous`. Present whenever this + server seals envelopes, over the relay or over its own APNs key." + envelopeVersions: + type: array + items: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: Envelope versions this server seals (`[1]`). Non-empty means the device must refuse unsealed content. + liveActivity: + type: array + items: + type: string + description: "Live Activity events the relay carries: `[\"end\"]`, and `[\"end\", \"start\", \"update\"]` while the + operator's switch (`PUSH_RELAY_LIVE_ACTIVITY=on`) is on; start and update reach only a device with + `push.device.liveActivityConsent`. Empty while the relay is not offered. Offer the second switch only when + it lists `start`." + liveActivityConsentTextVersion: + type: string + description: The text version of the Live Activity consent sentence; sent back as `liveActivityConsent.textVersion`. + termsUrl: + type: + - string + - "null" + privacyUrl: + type: + - string + - "null" + consentTextVersion: + type: string + description: The consent text version the card shows; sent back as `relayConsent.textVersion`. + operatorDecision: + description: "The operator's one answer, for the whole server, to \"Send push notifications through the HealthLog + relay?\". `on` once the registration at the relay succeeded; `off` when an admin said no or switched the + relay off, and also when there is nothing to decide (`available: false`, or the server has an APNs key of + its own, which the relay would never be used beside); `undecided` otherwise. Ask each person about the relay + only while it is `on`." + $ref: "#/components/schemas/PushRelayOperatorDecision" + canDecide: + type: boolean + description: "The caller is an admin of a server whose relay is available (never on a demo deploy). Informational for a + Bearer client: the answer is given on the web admin page (`/admin`), because the routes that give it (`POST + /api/admin/push-relay/decision`, `PUT /api/admin/push-relay`) are cookie-only like every admin route and + refuse a Bearer token." + required: + - host + - available + - offered + - state + - since + - reason + - instanceId + - senderKeys + - envelopeVersions + - liveActivity + - liveActivityConsentTextVersion + - termsUrl + - privacyUrl + - consentTextVersion + - operatorDecision + - canDecide + additionalProperties: false AccountAccess: type: object properties: @@ -94838,6 +101500,37 @@ components: - data - error additionalProperties: false + ManagedProfileActivityEnvelope: + type: object + properties: + data: + $ref: "#/components/schemas/ManagedProfileActivity" + error: + type: "null" + meta: + $ref: "#/components/schemas/ListCapMeta" + required: + - data + - error + - meta + additionalProperties: false + ManagedProfileActivity: + type: object + properties: + entries: + type: array + items: + $ref: "#/components/schemas/RecordActivityEntry" + retentionDays: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: "How far back this feed can see, in days: the instance's audit retention setting, the same number `GET + /api/account/activity` sends." + required: + - entries + - retentionDays + additionalProperties: false ManagedProfileGuardianListEnvelope: type: object properties: @@ -95227,6 +101920,7 @@ components: - MEDICATION_LOW_STOCK - MEASUREMENT_REMINDER - MEDICATION_INTAKE_SYNC + - MEDICATION_INTAKE_RECORDED - SECURITY_ALERT - DAILY_BRIEFING - SHARED_RECORD_INTAKE @@ -95250,6 +101944,7 @@ components: - MEDICATION_LOW_STOCK - MEASUREMENT_REMINDER - MEDICATION_INTAKE_SYNC + - MEDICATION_INTAKE_RECORDED - SECURITY_ALERT - DAILY_BRIEFING - SHARED_RECORD_INTAKE @@ -95322,6 +102017,7 @@ components: - MEDICATION_LOW_STOCK - MEASUREMENT_REMINDER - MEDICATION_INTAKE_SYNC + - MEDICATION_INTAKE_RECORDED - SECURITY_ALERT - DAILY_BRIEFING - SHARED_RECORD_INTAKE @@ -95951,6 +102647,7 @@ components: - coach - insights - documents + - aiSource description: The closed set of configuration families a Guardian may read and write on a managed record. Identity, credentials, delivery channels, Coach memories and provider connections are absent by construction — no family accepts them, so every future field fails closed until one deliberately does. @@ -95963,6 +102660,7 @@ components: - $ref: "#/components/schemas/RecordCoachSettings" - $ref: "#/components/schemas/RecordInsightsSettings" - $ref: "#/components/schemas/RecordDocumentsSettings" + - $ref: "#/components/schemas/RecordAiSourceSettings" description: The DTO for the family in the path. Which variant arrives is determined entirely by `{family}`, so branch on `family` rather than probing the shape — OpenAPI cannot express the dependency between a path parameter and a response variant. @@ -96369,6 +103067,51 @@ components: pipeline reads. Off by default. Turning it on records the record's document-reading consent (an `ai_extraction` receipt) when none is active, and queues a bounded catch-up over documents already stored when the record's `documentAi` capability is open. + RecordAiSourceSettings: + type: object + properties: + source: + type: string + enum: + - INSTANCE + - NONE + - GUARDIAN + chainId: + type: + - string + - "null" + servedByYou: + type: boolean + guardianChainUsable: + type: boolean + yourChains: + type: array + items: + type: object + properties: + id: + type: string + name: + type: string + required: + - id + - name + additionalProperties: false + instanceKeyConfigured: + type: boolean + required: + - source + - chainId + - servedByYou + - guardianChainUsable + - yourChains + - instanceKeyConfigured + additionalProperties: false + description: "Which provider a managed profile's AI work uses: the operator's key (`INSTANCE`, the default), none + (`NONE`), or a chain of a guardian (`GUARDIAN`; `chainId` a named chain of that guardian, null for their default + chain). `servedByYou` says whether the reading guardian is the lender; `guardianChainUsable` whether the lender + still manages the profile and the chain still exists. `yourChains` lists the reading guardian's named chains to + pick from, ids and names only." PatchRecordSettingsFamilyEnvelope: type: object properties: @@ -97285,7 +104028,7 @@ components: type: object properties: data: - $ref: "#/components/schemas/MedicationIntakeEvent" + $ref: "#/components/schemas/RepeatedMedicationIntakeEvent" error: type: "null" meta: @@ -97298,11 +104041,168 @@ components: - data - error additionalProperties: false + RepeatedMedicationIntakeEvent: + type: object + properties: + id: + type: string + userId: + type: string + medicationId: + type: string + scheduledFor: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + takenAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + skipped: + type: boolean + autoMissed: + type: boolean + description: True when the nightly cron closed the slot as missed (no user action). Auto-missed rows count against + adherence but never consume inventory. + autoRecorded: + type: boolean + description: v1.42.2 — true when the server recorded this dose because the medication has `autoMarkTaken` on, not the + person. It counts as taken everywhere (adherence, history, Coach) and consumed inventory like a manual take. + Any take or skip the person records on the row clears it. Clients label such a dose "recorded + automatically". + attributionSource: + type: string + enum: + - AUTO + - USER_PIN + description: "How the row bound to its schedule slot: AUTO = the write path's nearest-slot resolution; USER_PIN = the + user explicitly pinned the slot (the dedup converge keeps the pinned row)." + source: + type: string + enum: + - WEB + - API + - REMINDER + - IMPORT + - APPLE_HEALTH + takenVia: + anyOf: + - type: string + enum: + - WEB + - APP + - INTEGRATION + - TELEGRAM + - APPLE_HEALTH + - IMPORT + - AUTO + - type: "null" + description: Where the take on this row came from, whatever wrote the row (`source` keeps the writer that created it, + `REMINDER` for a projected slot). Null until a take reaches the row, and on takes recorded before migration + 0515. + idempotencyKey: + type: + - string + - "null" + createdAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + updatedAt: + type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + injectionSite: + anyOf: + - type: string + enum: + - ABDOMEN_LEFT + - ABDOMEN_RIGHT + - ABDOMEN_UPPER_LEFT + - ABDOMEN_UPPER_RIGHT + - THIGH_LEFT + - THIGH_RIGHT + - UPPER_ARM_LEFT + - UPPER_ARM_RIGHT + - type: "null" + description: Recorded injection site for a site-tracked medication (GLP-1 rotation surface). NULL when the medication + does not track sites or none was recorded. + doseTaken: + description: Free-text dose actually taken when it differed from the scheduled dose (titration weeks, split doses). NULL + = the scheduled dose. + type: + - string + - "null" + inventoryConsumption: + anyOf: + - {} + - type: "null" + description: JSON ledger of the container decrements this intake caused (`[{itemId, units}]`), written by the + consumption hook. NULL when nothing was consumed (skipped / no tracked inventory). + externalId: + description: v1.28 — client-supplied stable id for externally-mirrored intakes (Apple Health sync); the dedup key for + re-synced rows. NULL for native rows. + type: + - string + - "null" + syncVersion: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: Monotonic per-row version for incremental sync readers; bumps on every mutation. + deletedAt: + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + description: Soft-delete tombstone. Non-null rows are excluded from every list/aggregate read; sync readers use it to + propagate deletions. + appleHealthDeletedAt: + description: "Since v1.49.0: who deleted a tombstone. Equal to `deletedAt` when the phone reported the dose deleted + through `DELETE /api/medications/intake/by-external-ids`; null, or different, when it was deleted in + HealthLog. A re-post of a dose deleted in HealthLog is refused (`skipped`, reason `deleted_in_healthlog`), + one the phone reported is written again. Null on every live row; do not show it." + anyOf: + - type: string + format: date-time + pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$ + - type: "null" + alreadyTaken: + type: boolean + description: "True when this POST reported a dose already recorded, or skipped one: the slot it binds to already holds a + take. Nothing was written and no stock was consumed; the body is the recorded row, so `takenAt` and + `takenVia` say when and how. False on a fresh dose (201) and on an idempotency replay (200)." + required: + - id + - userId + - medicationId + - scheduledFor + - takenAt + - skipped + - autoMissed + - autoRecorded + - attributionSource + - source + - takenVia + - idempotencyKey + - createdAt + - updatedAt + - injectionSite + - doseTaken + - inventoryConsumption + - externalId + - syncVersion + - deletedAt + - alreadyTaken + additionalProperties: false ExternalMedicationIntakeCreatedEnvelope: type: object properties: data: - $ref: "#/components/schemas/MedicationIntakeEvent" + $ref: "#/components/schemas/RepeatedMedicationIntakeEvent" error: type: "null" meta: @@ -98227,6 +105127,31 @@ components: type: string updatedAt: type: string + doseOffset: + description: "Since v1.49.0, on `GET /api/symptoms/events` only (feature key `day.dose-offset`). The same value `GET + /api/day/{date}` carries for this occurrence: its distance from the nearest dose taken at or before it on + the same local day of the record's zone, else the nearest one after it. Absent when that day holds no timed + dose, when the medications module is off, or when a delegate's grant does not cover medications. A distance + in time and nothing more; never a cause." + type: object + properties: + intakeId: + type: string + description: The anchoring intake event's id. + title: + type: string + description: The medication's name. + minutes: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: "Minutes from the dose to the symptom. Positive: after the dose; negative: before it, when the day holds no + earlier dose." + required: + - intakeId + - title + - minutes + additionalProperties: false required: - id - definitionId @@ -98351,12 +105276,31 @@ components: description: "Why an entry was `skipped`: `unsupported_source` (source other than `APPLE_HEALTH`), `unstable_external_id`, `unknown_code`, `value_out_of_range` (intensity not an integer 0-10), `implausible_timestamp` (in the future beyond five minutes, before 1900, or ending before it started). - Decode unknown reasons leniently." + `deleted_in_healthlog` (since v1.49.0) for a sample the person deleted in HealthLog, which stays deleted. A + sample the phone reported deleted through `DELETE /api/symptoms/events/by-external-ids` is written back when + it is posted again (`inserted`). Decode unknown reasons leniently." type: string required: - index - status additionalProperties: false + GetSymptomEventEnvelope: + type: object + properties: + data: + $ref: "#/components/schemas/SymptomEvent" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false UpdateSymptomEventEnvelope: type: object properties: @@ -98441,6 +105385,7 @@ components: - medications - illness - symptoms + - seizures - allergies - labs - visits @@ -98573,6 +105518,7 @@ components: - illnessResolved - illnessDayLog - symptom + - seizure - allergyOnset - labResult - visit @@ -98596,6 +105542,7 @@ components: - medications - illness - symptoms + - seizures - allergies - labs - visits @@ -98713,6 +105660,7 @@ components: - medications - illness - symptoms + - seizures - allergies - labs - visits @@ -98787,6 +105735,7 @@ components: - medications - illness - symptoms + - seizures - allergies - labs - visits @@ -98958,6 +105907,7 @@ components: - illnessResolved - illnessDayLog - symptom + - seizure - allergyOnset - labResult - visit @@ -98981,6 +105931,7 @@ components: - medications - illness - symptoms + - seizures - allergies - labs - visits @@ -99026,6 +105977,28 @@ components: type: - string - "null" + doseOffset: + description: "Symptoms only, and only on a day with a timed dose: the symptom's distance from the nearest dose taken at + or before it, else the nearest one after it. A distance in time and nothing more; never a cause." + type: object + properties: + intakeId: + type: string + description: The anchoring intake event's id. + title: + type: string + description: The medication's name. + minutes: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + description: "Minutes from the dose to the symptom. Positive: after the dose; negative: before it, when the day holds no + earlier dose." + required: + - intakeId + - title + - minutes + additionalProperties: false required: - at - kind @@ -99389,6 +106362,8 @@ components: - seizureDay - document - cycle + - pregnancy + - postpartum start: type: string description: A local calendar date, `YYYY-MM-DD`. @@ -100038,6 +107013,33 @@ components: - data - error additionalProperties: false + GetAiJobFailuresResponse: + type: object + properties: + data: + $ref: "#/components/schemas/AiJobFailuresList" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + AiJobFailuresList: + type: object + properties: + failures: + type: array + items: + $ref: "#/components/schemas/AiJobFailure" + required: + - failures + additionalProperties: false PutMedicationIngredientsResponse: type: object properties: @@ -100072,6 +107074,45 @@ components: - data - error additionalProperties: false + PatchMedicineRegistryEnvelope: + type: object + properties: + data: + $ref: "#/components/schemas/MedicineRegistryResponse" + error: + type: "null" + meta: + type: object + properties: + requestId: + type: string + additionalProperties: false + required: + - data + - error + additionalProperties: false + MedicineRegistryResponse: + type: object + properties: + medicineRegistry: + type: string + enum: + - PL + - DE + - ES + - FR + - GB + - BE + - NL + - US + - CA + - AU + - BR + - EU + - NONE + required: + - medicineRegistry + additionalProperties: false LifeCircumstancesEnvelope: type: object properties: @@ -102548,8 +109589,9 @@ components: type: boolean liveActivityEnabled: type: boolean - description: v1.7.0 iOS Live Activity opt-in for this medication's reminders. Default false. The iOS client owns the - ActivityKit lifecycle; the server only stores + echoes the flag. + description: v1.7.0 iOS Live Activity opt-in for this medication's reminders. Default false. The iOS client plans its + own Activities by it; a server start over the push relay requires it, and a server-started Activity ends + once it is off. criticalAlarmEnabled: type: boolean description: v1.7.0 iOS 26 AlarmKit critical-reminder opt-in. Default false. Critical alarms bypass the device mute @@ -102575,6 +109617,13 @@ components: type: - string - "null" + leafletUrl: + description: '#1430 — the official leaflet the person saved for this medication: an `https:` URL, any host. NULL = none + saved. Show it only as an external link (a new tab, `rel="noopener noreferrer"` on the web); never fetch or + embed it. Set or cleared through `leafletUrl` on the create and update bodies.' + type: + - string + - "null" pausedAt: anyOf: - type: string @@ -102707,6 +109756,7 @@ components: - atcCode - rxNormCode - note + - leafletUrl - pausedAt - snoozedUntil - startsOn diff --git a/docs/contributing/benchmarks.md b/docs/contributing/benchmarks.md index 9ceb4b7a0b..8f8917d8a1 100644 --- a/docs/contributing/benchmarks.md +++ b/docs/contributing/benchmarks.md @@ -104,6 +104,36 @@ On the seeded account, idle, with the worker running and no requests (`results/v Result on the same machine (`results/v1.45.0-boot.md`): the worker graph loads in stretches of at most 246 ms instead of one of 753 ms (the longest application stretch left is the query compiler's start, 336 ms, unchanged); the live heap after five idle minutes went from 162 to 172 MB to 142 to 153 MB; two parsed catalogs (1.6 MB) instead of 32 (14.1 MB), and no catalog chunk sources. +## First-sync burst under the heap ceiling + +`scripts/bench/ingest-burst.ts` replays what a phone sends right after it signs in to a fresh account, against the production build under the heap of a 1 GB container (`--max-old-space-size=524`), and reads the server's heap through the inspector while it runs. + +The integration test `tests/integration/ingest-burst-memory.test.ts` holds the gated burst under its budget on every CI run. Its counterproof, the same burst with the gate opened wide, depends on the machine and runs only with `HEALTHLOG_BENCH=1`; run it after touching the ingest gate, to see the budget is still a real limit. + +```sh +pnpm dlx tsx scripts/bench/ingest-burst.ts --out scripts/bench/results/} />", + filename: FILE, + }, + // A counted exception, exactly as many as counted. + { + code: "", + filename: `/repo/${MATRIX}`, + options: [{ allow: { [MATRIX]: 2 } }], + }, + // The primitive itself, tests, and code outside the UI roots. + { + code: "", + filename: "/repo/src/components/ui/switch-row.tsx", + }, + { + code: "", + filename: "/repo/src/components/settings/__tests__/x.test.tsx", + }, + { code: "", filename: "/repo/src/lib/x.tsx" }, + ], + invalid: [ + // The five shapes all come down to this. + { + code: '
', + filename: FILE, + errors: [{ messageId: "bareSwitch" }], + }, + { + code: '', + filename: FILE, + errors: [{ messageId: "bareSwitch" }], + }, + // One more than the file's allowance: the extra one is reported. + { + code: "
", + filename: `/repo/${MATRIX}`, + options: [{ allow: { [MATRIX]: 2 } }], + errors: [{ messageId: "bareSwitch" }], + }, + // One fewer: the allowance has to come down with it. + { + code: "
", + filename: `/repo/${MATRIX}`, + options: [{ allow: { [MATRIX]: 2 } }], + errors: [{ messageId: "staleAllow" }], + }, + { + code: '', + filename: `/repo/${MATRIX}`, + options: [{ allow: { [MATRIX]: 1 } }], + errors: [{ messageId: "staleAllow" }], + }, + ], +}); diff --git a/eslint-plugins/healthlog/card-action-row.js b/eslint-plugins/healthlog/card-action-row.js new file mode 100644 index 0000000000..bf36d2ff66 --- /dev/null +++ b/eslint-plugins/healthlog/card-action-row.js @@ -0,0 +1,274 @@ +/** + * @fileoverview ESLint rule — the action row of a card has one shape, and + * `SettingsCardActions` owns it (UI standards §12). + * + * The row was a primitive, its buttons were not: 177 buttons in 121 rows + * carried eight different class lists for the same job. Five new cards hung + * `w-full sm:w-auto` on theirs and so stretched across the phone while the + * other ninety-eight sat compact on the right; two dozen dropped + * `size="sm"` and stood 8 px taller on a desktop; three put the primary + * action on the left. The primitive now sets height and width on every + * button inside it, so a caller has nothing left to spell, and this rule + * refuses the spellings that used to diverge. + * + * Inside `` (dialog and popover content written inside + * the row is skipped, it renders in a portal): + * + * - `size`: a `Button` or `ConfirmButton` says `size="sm"`. + * - `sizing`: a button or link carries no width, height, self-alignment or + * auto-margin class. The row decides those. + * - `rowClass`: the row takes no `className` but `mt-auto` (a card in an + * equal-height grid pins its row to the bottom). A control that stands + * apart on the left goes in `leading`. + * - `startWithPrimary`: `align="start"` is for a row of links out of the + * card. A row with a primary or destructive action is right-aligned. + * - `saveIcon`: a save button carries its word and no disk glyph. The + * loading spinner still swaps in. + * - `notLast`: the row is the last thing in its parent. A status line or a + * result list goes above it. + * + * WHAT THIS RULE DOES NOT CATCH + * + * A wrapper component that renders a `Button` of another size in its own + * file (the row's CSS still sets its height and width), a class list built + * at runtime, a second primary action, and a row of buttons that never used + * `SettingsCardActions` at all. + */ + +"use strict"; + +const ROW = "SettingsCardActions"; + +/** Content that renders in a portal, wherever it is written. */ +const PORTAL_RE = + /^(?:AlertDialogContent|DialogContent|PopoverContent|DropdownMenuContent|SheetContent|ConfirmDialog|ResponsiveSheet)$/; +/** Siblings that may follow the row: they paint nothing in the card. */ +const OVERLAY_RE = /(?:Dialog|Sheet|Popover|Drawer|DialogContent)$/; + +const SIZED_TAG_RE = /(?:^button$|^a$|^Link$|Button$)/; +const SIZING_RE = + /(?:^|\s)(?:[a-z0-9-]+:)*(?:w-|min-w-|max-w-|h-|min-h-|max-h-|size-|self-|basis-|grow(?:\s|$)|flex-1(?:\s|$)|m[lrx]-auto(?:\s|$))/; + +function tagName(opening) { + const name = opening.name; + if (name.type === "JSXIdentifier") return name.name; + if (name.type === "JSXMemberExpression") return name.property.name; + return ""; +} + +function attribute(opening, name) { + return opening.attributes.find( + (attr) => attr.type === "JSXAttribute" && attr.name.name === name, + ); +} + +/** Every string a class expression can resolve to, or null when unknown. */ +function classStrings(node) { + if (!node) return []; + if (node.type === "Literal") { + return typeof node.value === "string" ? [node.value] : []; + } + if (node.type === "JSXExpressionContainer") { + return classStrings(node.expression); + } + if (node.type === "TemplateLiteral") { + return node.quasis.map((quasi) => quasi.value.cooked ?? ""); + } + if (node.type === "CallExpression") { + return node.arguments.flatMap((arg) => classStrings(arg) ?? []); + } + if (node.type === "ConditionalExpression") { + return [ + ...(classStrings(node.consequent) ?? []), + ...(classStrings(node.alternate) ?? []), + ]; + } + if (node.type === "LogicalExpression") { + return classStrings(node.right) ?? []; + } + return null; +} + +/** Whether a `variant` attribute can resolve to a filled action. */ +function isFilledVariant(attr, tag) { + // ConfirmButton is outline unless it says otherwise. + if (!attr) return tag === "Button"; + const value = attr.value; + if (!value) return false; + const strings = classStrings(value); + if (strings === null) return true; + return strings.some((s) => s === "default" || s === "destructive"); +} + +function isHiddenInput(node) { + if (node.type !== "JSXElement") return false; + const opening = node.openingElement; + if (tagName(opening) !== "input") return false; + const type = attribute(opening, "type"); + return type?.value?.type === "Literal" && type.value.value === "file"; +} + +/** Tags of the JSX elements a child slot can render. */ +function renderedElements(node, out = []) { + if (!node) return out; + if (node.type === "JSXElement") { + out.push(node); + } else if (node.type === "JSXFragment") { + node.children.forEach((child) => renderedElements(child, out)); + } else if (node.type === "JSXExpressionContainer") { + renderedElements(node.expression, out); + } else if (node.type === "LogicalExpression") { + renderedElements(node.right, out); + } else if (node.type === "ConditionalExpression") { + renderedElements(node.consequent, out); + renderedElements(node.alternate, out); + } + return out; +} + +/** @type {import("eslint").Rule.RuleModule} */ +module.exports = { + meta: { + type: "problem", + docs: { + description: + "The action row of a card has one shape, owned by SettingsCardActions.", + }, + schema: [], + messages: { + size: 'A button in a card\'s action row is size="sm" (UI standards §12). The row sets its height.', + sizing: + "`{{cls}}` on a button in a card's action row. SettingsCardActions owns height and width: every action is compact, at every viewport (UI standards §12).", + rowClass: + "SettingsCardActions takes no className but `mt-auto`. Its layout is the primitive's; a control that stands apart on the left goes in `leading`.", + startWithPrimary: + 'align="start" is for a row of links out of the card. A row with a primary or destructive action is right-aligned (UI standards §12).', + saveIcon: + "A save button carries its word and no disk glyph (UI standards §12).", + notLast: + "The action row is the last thing in the card. Status lines and results go above it (UI standards §12).", + }, + }, + create(context) { + /** Depth of `SettingsCardActions` rows the walk is inside. */ + const rows = []; + /** Portal content inside a row: its buttons are not the row's. */ + let portalDepth = 0; + + function checkRow(node) { + const opening = node.openingElement; + const cls = attribute(opening, "className"); + if (cls) { + const strings = classStrings(cls.value); + const only = + strings !== null && strings.join(" ").trim().split(/\s+/).join(" "); + if (only !== "mt-auto") { + context.report({ node: cls, messageId: "rowClass" }); + } + } + + // The slot the row fills in its parent: the row itself, or the + // `{cond && }` expression around it. + let slot = node; + let parent = node.parent; + while ( + parent && + (parent.type === "LogicalExpression" || + parent.type === "ConditionalExpression" || + parent.type === "JSXExpressionContainer") + ) { + slot = parent; + parent = parent.parent; + } + if (parent && parent.type === "JSXElement") { + const after = parent.children + .slice(parent.children.indexOf(slot) + 1) + .flatMap((child) => + renderedElements(child).filter( + (el) => + !OVERLAY_RE.test(tagName(el.openingElement)) && + !isHiddenInput(el), + ), + ); + if (after.length > 0) { + context.report({ node: node.openingElement, messageId: "notLast" }); + } + } + } + + return { + JSXElement(node) { + const tag = tagName(node.openingElement); + if (tag === ROW) { + checkRow(node); + const align = attribute(node.openingElement, "align"); + rows.push({ + start: + align?.value?.type === "Literal" && align.value.value === "start", + node, + }); + return; + } + if (rows.length > 0 && PORTAL_RE.test(tag)) portalDepth++; + }, + "JSXElement:exit"(node) { + const tag = tagName(node.openingElement); + if (tag === ROW) { + rows.pop(); + return; + } + if (rows.length > 0 && PORTAL_RE.test(tag)) portalDepth--; + }, + // A prop that holds JSX of its own is not one of the row's actions: a + // confirm dialog's `extra` renders in the dialog, and `leading` is the + // control that stands apart from them. + JSXAttribute(node) { + if (rows.length > 0 && node.value?.type === "JSXExpressionContainer") { + portalDepth++; + } + }, + "JSXAttribute:exit"(node) { + if (rows.length > 0 && node.value?.type === "JSXExpressionContainer") { + portalDepth--; + } + }, + JSXOpeningElement(node) { + if (rows.length === 0 || portalDepth > 0) return; + const tag = tagName(node); + if (tag === ROW) return; + const row = rows[rows.length - 1]; + + if (tag === "Save") { + context.report({ node, messageId: "saveIcon" }); + return; + } + + if (tag === "Button" || tag === "ConfirmButton") { + const size = attribute(node, "size"); + const isSm = + size?.value?.type === "Literal" && size.value.value === "sm"; + if (!isSm) context.report({ node: size ?? node, messageId: "size" }); + if (row.start && isFilledVariant(attribute(node, "variant"), tag)) { + context.report({ node, messageId: "startWithPrimary" }); + } + } + + if (SIZED_TAG_RE.test(tag)) { + const cls = attribute(node, "className"); + const strings = cls ? classStrings(cls.value) : []; + for (const value of strings ?? []) { + const hit = SIZING_RE.exec(value); + if (hit) { + context.report({ + node: cls, + messageId: "sizing", + data: { cls: value.trim() }, + }); + break; + } + } + } + }, + }; + }, +}; diff --git a/eslint-plugins/healthlog/index.js b/eslint-plugins/healthlog/index.js index 590d89d7e7..4c1f8caa8a 100644 --- a/eslint-plugins/healthlog/index.js +++ b/eslint-plugins/healthlog/index.js @@ -23,6 +23,10 @@ * primitive, not bg-card + border + rounded-xl. * - `import-boundaries` — src/lib never imports components or app, and * a "use client" file imports no server module. + * - `card-action-row` — the buttons of a card's action row take their + * height, width and place from SettingsCardActions. + * - `switch-row` — a switch with a name is a SwitchRow; the rest + * are counted per file, and the count only falls. */ "use strict"; @@ -39,6 +43,8 @@ const noPlanningTags = require("./no-planning-tags.js"); const noUnlocalisedDecimal = require("./no-unlocalised-decimal.js"); const noRawCardShell = require("./no-raw-card-shell.js"); const importBoundaries = require("./import-boundaries.js"); +const cardActionRow = require("./card-action-row.js"); +const switchRow = require("./switch-row.js"); module.exports = { rules: { @@ -59,5 +65,7 @@ module.exports = { "no-unlocalised-decimal": noUnlocalisedDecimal, "no-raw-card-shell": noRawCardShell, "import-boundaries": importBoundaries, + "card-action-row": cardActionRow, + "switch-row": switchRow, }, }; diff --git a/eslint-plugins/healthlog/switch-row.js b/eslint-plugins/healthlog/switch-row.js new file mode 100644 index 0000000000..20bb442bbf --- /dev/null +++ b/eslint-plugins/healthlog/switch-row.js @@ -0,0 +1,120 @@ +/** + * @fileoverview ESLint rule — a switch with a name is a `SwitchRow` + * (`src/components/ui/switch-row.tsx`). + * + * Five shapes put a name beside a switch: the switch under the title, the + * switch in a row of its own below the text on a phone, a name with a colon + * and a 14 px description, a `