{
  "components": {
    "schemas": {
      "AccountDeleteRequest": {
        "description": "Request schema for account deletion.",
        "properties": {
          "reason": {
            "$ref": "#/components/schemas/AccountDeletionReason"
          },
          "reason_details": {
            "anyOf": [
              {
                "maxLength": 1000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional free-text elaboration on the deletion reason",
            "title": "Reason Details"
          }
        },
        "required": [
          "reason"
        ],
        "title": "AccountDeleteRequest",
        "type": "object"
      },
      "AccountDeleteResponse": {
        "description": "Response schema for account deletion.",
        "properties": {
          "deleted_at": {
            "format": "date-time",
            "title": "Deleted At",
            "type": "string"
          },
          "message": {
            "title": "Message",
            "type": "string"
          }
        },
        "required": [
          "message",
          "deleted_at"
        ],
        "title": "AccountDeleteResponse",
        "type": "object"
      },
      "AccountDeletionReason": {
        "description": "Reasons for account deletion (Apple App Store 5.1.1 compliance).",
        "enum": [
          "no_longer_using",
          "privacy_concerns",
          "found_alternative",
          "too_many_notifications",
          "not_working",
          "other"
        ],
        "title": "AccountDeletionReason",
        "type": "string"
      },
      "Activity": {
        "description": "A discrete unit of action in the user's plan.",
        "properties": {
          "description": {
            "description": "Actionable description with specific amounts in the user's unit system. E.g. 'Drink 500ml water with electrolytes' (metric) / 'Drink 16oz water with electrolytes' (imperial).",
            "title": "Description",
            "type": "string"
          },
          "estimated_duration_minutes": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Total estimated duration in minutes",
            "title": "Estimated Duration Minutes"
          },
          "headline": {
            "default": "",
            "description": "Imperative + quantified, 3-5 words, in the user's unit system. E.g. 'Toma 500ml Agua', 'Run 5km Easy' (metric) / 'Drink 16oz Water', 'Run 3mi Easy' (imperial). Must include a specific number/amount.",
            "title": "Headline",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "params": {
            "$ref": "#/components/schemas/ActivityParams"
          },
          "requires_completion": {
            "default": true,
            "description": "false ONLY for final sleep/rest items in the plan. These passive items must be LAST in the list.",
            "title": "Requires Completion",
            "type": "boolean"
          },
          "sentiment": {
            "default": "neutral",
            "description": "urgent: immediate health needs (dehydration, overtraining). caution: needs attention (poor sleep, high stress). positive: on track. neutral: informational.",
            "enum": [
              "positive",
              "caution",
              "urgent",
              "neutral"
            ],
            "title": "Sentiment",
            "type": "string"
          },
          "short_description": {
            "default": "",
            "description": "Brief context, 2-4 words. E.g. 'Pre-run Hydration'. Never repeat headline words.",
            "title": "Short Description",
            "type": "string"
          },
          "status": {
            "default": "pending",
            "description": "Execution status",
            "enum": [
              "pending",
              "completed",
              "skipped"
            ],
            "title": "Status",
            "type": "string"
          },
          "steps": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/ActivityStep"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Detailed step-by-step instructions for executing the activity",
            "title": "Steps"
          },
          "technique_notes": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/TechniqueNote"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Technique tips and guidance for proper execution",
            "title": "Technique Notes"
          },
          "title": {
            "description": "Short title. E.g. 'Hydration'.",
            "title": "Title",
            "type": "string"
          },
          "type": {
            "description": "Category of the activity",
            "enum": [
              "hydration",
              "nutrition",
              "movement",
              "rest",
              "mental",
              "preparation",
              "facilities"
            ],
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "type",
          "params",
          "title",
          "description"
        ],
        "title": "Activity",
        "type": "object"
      },
      "ActivityParams": {
        "description": "Structured parameters for activity execution and validation.",
        "properties": {
          "item": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Specific item (e.g., water, zone 2 run, protein)",
            "title": "Item"
          },
          "target_value": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Numeric target (e.g., 500, 5, 30)",
            "title": "Target Value"
          },
          "unit": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Unit of measure in the user's system (e.g., ml or oz, km or mi, min)",
            "title": "Unit"
          }
        },
        "title": "ActivityParams",
        "type": "object"
      },
      "ActivityResolveRequest": {
        "description": "Request schema for resolving an activity (complete or skip).",
        "properties": {
          "action": {
            "default": "complete",
            "enum": [
              "complete",
              "skip"
            ],
            "title": "Action",
            "type": "string"
          },
          "activity_id": {
            "title": "Activity Id",
            "type": "string"
          },
          "board_id": {
            "title": "Board Id",
            "type": "string"
          },
          "now_iso": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Now Iso"
          }
        },
        "required": [
          "board_id",
          "activity_id"
        ],
        "title": "ActivityResolveRequest",
        "type": "object"
      },
      "ActivityStep": {
        "description": "A micro-instruction within an activity for detailed guidance.",
        "properties": {
          "duration_seconds": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Duration in seconds if time-based",
            "title": "Duration Seconds"
          },
          "instruction": {
            "description": "Clear instruction of what to do, e.g. 'Swing each leg forward and back 10 times'",
            "title": "Instruction",
            "type": "string"
          },
          "order": {
            "description": "Step sequence number (1, 2, 3...)",
            "title": "Order",
            "type": "integer"
          },
          "repetitions": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Number of repetitions if rep-based",
            "title": "Repetitions"
          },
          "tip": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional technique tip, e.g. 'Keep your core engaged'",
            "title": "Tip"
          },
          "title": {
            "description": "Short step title, e.g. 'Leg Swings', 'Main Set'",
            "title": "Title",
            "type": "string"
          }
        },
        "required": [
          "order",
          "title",
          "instruction"
        ],
        "title": "ActivityStep",
        "type": "object"
      },
      "AttestRegisterRequest": {
        "description": "Body for ``POST /attest/register``.",
        "properties": {
          "attestation_object": {
            "title": "Attestation Object",
            "type": "string"
          },
          "key_id": {
            "title": "Key Id",
            "type": "string"
          },
          "nonce": {
            "title": "Nonce",
            "type": "string"
          }
        },
        "required": [
          "key_id",
          "attestation_object",
          "nonce"
        ],
        "title": "AttestRegisterRequest",
        "type": "object"
      },
      "AttestRegisterResponse": {
        "description": "Response for ``POST /attest/register``.",
        "properties": {
          "ok": {
            "default": true,
            "title": "Ok",
            "type": "boolean"
          }
        },
        "title": "AttestRegisterResponse",
        "type": "object"
      },
      "Body_heylo_webhook_heylo_webhooks_post": {
        "properties": {
          "image": {
            "anyOf": [
              {
                "contentMediaType": "application/octet-stream",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Image"
          },
          "payload": {
            "title": "Payload",
            "type": "string"
          }
        },
        "required": [
          "payload"
        ],
        "title": "Body_heylo_webhook_heylo_webhooks_post",
        "type": "object"
      },
      "Body_onboarding_intake_onboarding_intake_post": {
        "properties": {
          "audio": {
            "anyOf": [
              {
                "contentMediaType": "application/octet-stream",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Audio"
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Session Id"
          },
          "text": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Text"
          }
        },
        "title": "Body_onboarding_intake_onboarding_intake_post",
        "type": "object"
      },
      "Body_race_recommendations_onboarding_race_recommendations_post": {
        "properties": {
          "audio": {
            "anyOf": [
              {
                "contentMediaType": "application/octet-stream",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Audio"
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Session Id"
          },
          "text": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Text"
          }
        },
        "title": "Body_race_recommendations_onboarding_race_recommendations_post",
        "type": "object"
      },
      "Body_whatsapp_webhook_whatsapp_webhooks_post": {
        "properties": {
          "audio": {
            "anyOf": [
              {
                "contentMediaType": "application/octet-stream",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Audio"
          },
          "document": {
            "anyOf": [
              {
                "contentMediaType": "application/octet-stream",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Document"
          },
          "image": {
            "anyOf": [
              {
                "contentMediaType": "application/octet-stream",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Image"
          },
          "payload": {
            "title": "Payload",
            "type": "string"
          }
        },
        "required": [
          "payload"
        ],
        "title": "Body_whatsapp_webhook_whatsapp_webhooks_post",
        "type": "object"
      },
      "BrowserRouteAnalyticsRequest": {
        "additionalProperties": false,
        "description": "Privacy-conscious browser funnel or route outcome event.",
        "properties": {
          "event_type": {
            "maxLength": 80,
            "minLength": 1,
            "pattern": "^[a-z0-9_.-]+$",
            "title": "Event Type",
            "type": "string"
          },
          "metadata": {
            "additionalProperties": true,
            "title": "Metadata",
            "type": "object"
          },
          "option_id": {
            "anyOf": [
              {
                "maxLength": 160,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Option Id"
          },
          "outcome": {
            "anyOf": [
              {
                "enum": [
                  "viewed",
                  "selected",
                  "rejected",
                  "continued",
                  "published",
                  "shared",
                  "downloaded",
                  "abandoned",
                  "error"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Outcome"
          },
          "reason_code": {
            "anyOf": [
              {
                "maxLength": 160,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason Code"
          },
          "route_id": {
            "anyOf": [
              {
                "maxLength": 160,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Route Id"
          }
        },
        "required": [
          "event_type"
        ],
        "title": "BrowserRouteAnalyticsRequest",
        "type": "object"
      },
      "BrowserRouteAnalyticsResponse": {
        "description": "Acknowledgement for a retained browser analytics event.",
        "properties": {
          "accepted": {
            "title": "Accepted",
            "type": "boolean"
          },
          "run": {
            "$ref": "#/components/schemas/BrowserRouteRunSummary"
          }
        },
        "required": [
          "accepted",
          "run"
        ],
        "title": "BrowserRouteAnalyticsResponse",
        "type": "object"
      },
      "BrowserRouteContinueRequest": {
        "additionalProperties": false,
        "description": "Continue or iterate a browser-owned public route run.",
        "properties": {
          "browser_location": {
            "$ref": "#/components/schemas/PublicRouteBrowserLocation"
          },
          "locale": {
            "default": "en-US",
            "maxLength": 35,
            "minLength": 2,
            "title": "Locale",
            "type": "string"
          },
          "prompt": {
            "maxLength": 2000,
            "minLength": 1,
            "title": "Prompt",
            "type": "string"
          },
          "provenance": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PublicRouteProvenance"
              },
              {
                "type": "null"
              }
            ]
          },
          "timezone": {
            "anyOf": [
              {
                "maxLength": 80,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Timezone"
          },
          "units": {
            "anyOf": [
              {
                "maxLength": 80,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Units"
          }
        },
        "required": [
          "prompt",
          "browser_location"
        ],
        "title": "BrowserRouteContinueRequest",
        "type": "object"
      },
      "BrowserRouteCreateRequest": {
        "additionalProperties": false,
        "description": "Start a public route run from an anonymous browser session.",
        "properties": {
          "browser_location": {
            "$ref": "#/components/schemas/PublicRouteBrowserLocation"
          },
          "locale": {
            "default": "en-US",
            "maxLength": 35,
            "minLength": 2,
            "title": "Locale",
            "type": "string"
          },
          "prompt": {
            "maxLength": 2000,
            "minLength": 1,
            "title": "Prompt",
            "type": "string"
          },
          "provenance": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PublicRouteProvenance"
              },
              {
                "type": "null"
              }
            ]
          },
          "timezone": {
            "anyOf": [
              {
                "maxLength": 80,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Timezone"
          },
          "units": {
            "anyOf": [
              {
                "maxLength": 80,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Units"
          }
        },
        "required": [
          "prompt",
          "browser_location"
        ],
        "title": "BrowserRouteCreateRequest",
        "type": "object"
      },
      "BrowserRouteEvent": {
        "description": "Browser-safe event persisted from a Cheshire public route stream.",
        "properties": {
          "payload": {
            "additionalProperties": true,
            "title": "Payload",
            "type": "object"
          },
          "seq": {
            "minimum": 1.0,
            "title": "Seq",
            "type": "integer"
          },
          "ts": {
            "format": "date-time",
            "title": "Ts",
            "type": "string"
          },
          "type": {
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "seq",
          "type",
          "ts",
          "payload"
        ],
        "title": "BrowserRouteEvent",
        "type": "object"
      },
      "BrowserRouteLocationSummary": {
        "description": "Approximate browser-shared location retained for history/analytics.",
        "properties": {
          "accuracy_m": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Accuracy M"
          },
          "captured_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Captured At"
          },
          "lat_approx": {
            "maximum": 90.0,
            "minimum": -90.0,
            "title": "Lat Approx",
            "type": "number"
          },
          "lng_approx": {
            "maximum": 180.0,
            "minimum": -180.0,
            "title": "Lng Approx",
            "type": "number"
          }
        },
        "required": [
          "lat_approx",
          "lng_approx"
        ],
        "title": "BrowserRouteLocationSummary",
        "type": "object"
      },
      "BrowserRoutePublishRequest": {
        "additionalProperties": false,
        "description": "Request a shareable route page for one browser-visible option.",
        "properties": {
          "label": {
            "anyOf": [
              {
                "maxLength": 80,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Label"
          },
          "option_id": {
            "anyOf": [
              {
                "maxLength": 160,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Option Id"
          },
          "route_id": {
            "anyOf": [
              {
                "maxLength": 160,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Route Id"
          },
          "share_id": {
            "anyOf": [
              {
                "pattern": "[A-Za-z0-9][A-Za-z0-9_-]{15,63}",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Share Id"
          }
        },
        "title": "BrowserRoutePublishRequest",
        "type": "object"
      },
      "BrowserRoutePublishResponse": {
        "description": "Published route-page outcome for the current browser session.",
        "properties": {
          "route_page": {
            "$ref": "#/components/schemas/BrowserRoutePublishedPage"
          },
          "run": {
            "$ref": "#/components/schemas/BrowserRouteRunSummary"
          },
          "status": {
            "const": "published",
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "status",
          "run",
          "route_page"
        ],
        "title": "BrowserRoutePublishResponse",
        "type": "object"
      },
      "BrowserRoutePublishedPage": {
        "description": "Browser-safe public route-page data for a route option.",
        "properties": {
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Label"
          },
          "manifest_path": {
            "title": "Manifest Path",
            "type": "string"
          },
          "manifest_url": {
            "title": "Manifest Url",
            "type": "string"
          },
          "option_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Option Id"
          },
          "page_path": {
            "title": "Page Path",
            "type": "string"
          },
          "page_url": {
            "title": "Page Url",
            "type": "string"
          },
          "published_at": {
            "format": "date-time",
            "title": "Published At",
            "type": "string"
          },
          "route_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Route Id"
          },
          "share_id": {
            "pattern": "[A-Za-z0-9][A-Za-z0-9_-]{15,63}",
            "title": "Share Id",
            "type": "string"
          },
          "slug": {
            "pattern": "[a-z0-9][a-z0-9-]{1,63}",
            "title": "Slug",
            "type": "string"
          },
          "title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Title"
          }
        },
        "required": [
          "share_id",
          "slug",
          "page_url",
          "page_path",
          "manifest_url",
          "manifest_path",
          "published_at"
        ],
        "title": "BrowserRoutePublishedPage",
        "type": "object"
      },
      "BrowserRouteRunListResponse": {
        "description": "Current-browser public route history.",
        "properties": {
          "runs": {
            "items": {
              "$ref": "#/components/schemas/BrowserRouteRunSummary"
            },
            "title": "Runs",
            "type": "array"
          }
        },
        "required": [
          "runs"
        ],
        "title": "BrowserRouteRunListResponse",
        "type": "object"
      },
      "BrowserRouteRunResponse": {
        "description": "Browser-safe route run state including collected stream events.",
        "properties": {
          "browser_session_id": {
            "title": "Browser Session Id",
            "type": "string"
          },
          "candidate_summaries": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Candidate Summaries",
            "type": "array"
          },
          "completed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed At"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "events": {
            "items": {
              "$ref": "#/components/schemas/BrowserRouteEvent"
            },
            "title": "Events",
            "type": "array"
          },
          "generation_locale": {
            "title": "Generation Locale",
            "type": "string"
          },
          "location": {
            "$ref": "#/components/schemas/BrowserRouteLocationSummary"
          },
          "parent_run_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Parent Run Id"
          },
          "prompt_preview": {
            "title": "Prompt Preview",
            "type": "string"
          },
          "published_route_pages": {
            "items": {
              "$ref": "#/components/schemas/BrowserRoutePublishedPage"
            },
            "title": "Published Route Pages",
            "type": "array"
          },
          "root_run_id": {
            "title": "Root Run Id",
            "type": "string"
          },
          "run_id": {
            "title": "Run Id",
            "type": "string"
          },
          "source_public_route_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Public Route Id"
          },
          "source_route_hash": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Route Hash"
          },
          "source_route_slug": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Route Slug"
          },
          "source_session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Session Id"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "terminal_event_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Terminal Event Type"
          },
          "timezone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Timezone"
          },
          "units": {
            "title": "Units",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "viewer_locale": {
            "title": "Viewer Locale",
            "type": "string"
          }
        },
        "required": [
          "run_id",
          "browser_session_id",
          "status",
          "root_run_id",
          "prompt_preview",
          "viewer_locale",
          "generation_locale",
          "units",
          "location",
          "created_at",
          "updated_at"
        ],
        "title": "BrowserRouteRunResponse",
        "type": "object"
      },
      "BrowserRouteRunSummary": {
        "description": "Browser-safe route run metadata for history and resume.",
        "properties": {
          "browser_session_id": {
            "title": "Browser Session Id",
            "type": "string"
          },
          "candidate_summaries": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Candidate Summaries",
            "type": "array"
          },
          "completed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed At"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "generation_locale": {
            "title": "Generation Locale",
            "type": "string"
          },
          "location": {
            "$ref": "#/components/schemas/BrowserRouteLocationSummary"
          },
          "parent_run_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Parent Run Id"
          },
          "prompt_preview": {
            "title": "Prompt Preview",
            "type": "string"
          },
          "published_route_pages": {
            "items": {
              "$ref": "#/components/schemas/BrowserRoutePublishedPage"
            },
            "title": "Published Route Pages",
            "type": "array"
          },
          "root_run_id": {
            "title": "Root Run Id",
            "type": "string"
          },
          "run_id": {
            "title": "Run Id",
            "type": "string"
          },
          "source_public_route_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Public Route Id"
          },
          "source_route_hash": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Route Hash"
          },
          "source_route_slug": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Route Slug"
          },
          "source_session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Session Id"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "terminal_event_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Terminal Event Type"
          },
          "timezone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Timezone"
          },
          "units": {
            "title": "Units",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "viewer_locale": {
            "title": "Viewer Locale",
            "type": "string"
          }
        },
        "required": [
          "run_id",
          "browser_session_id",
          "status",
          "root_run_id",
          "prompt_preview",
          "viewer_locale",
          "generation_locale",
          "units",
          "location",
          "created_at",
          "updated_at"
        ],
        "title": "BrowserRouteRunSummary",
        "type": "object"
      },
      "BrowserRouteSessionListResponse": {
        "description": "List response for sessions visible to the current browser.",
        "properties": {
          "sessions": {
            "items": {
              "$ref": "#/components/schemas/BrowserRouteSessionSummary"
            },
            "title": "Sessions",
            "type": "array"
          }
        },
        "required": [
          "sessions"
        ],
        "title": "BrowserRouteSessionListResponse",
        "type": "object"
      },
      "BrowserRouteSessionResponse": {
        "description": "Bootstrap response containing the in-memory CSRF token.",
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "csrf_token": {
            "minLength": 1,
            "title": "Csrf Token",
            "type": "string"
          },
          "expires_at": {
            "format": "date-time",
            "title": "Expires At",
            "type": "string"
          },
          "last_seen_at": {
            "format": "date-time",
            "title": "Last Seen At",
            "type": "string"
          },
          "session_id": {
            "title": "Session Id",
            "type": "string"
          },
          "source_public_route_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Public Route Id"
          },
          "source_route_hash": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Route Hash"
          },
          "source_route_slug": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Route Slug"
          },
          "source_session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Session Id"
          }
        },
        "required": [
          "session_id",
          "created_at",
          "last_seen_at",
          "expires_at",
          "csrf_token"
        ],
        "title": "BrowserRouteSessionResponse",
        "type": "object"
      },
      "BrowserRouteSessionSummary": {
        "description": "Browser-safe metadata for the current public Routes session.",
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "expires_at": {
            "format": "date-time",
            "title": "Expires At",
            "type": "string"
          },
          "last_seen_at": {
            "format": "date-time",
            "title": "Last Seen At",
            "type": "string"
          },
          "session_id": {
            "title": "Session Id",
            "type": "string"
          },
          "source_public_route_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Public Route Id"
          },
          "source_route_hash": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Route Hash"
          },
          "source_route_slug": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Route Slug"
          },
          "source_session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Session Id"
          }
        },
        "required": [
          "session_id",
          "created_at",
          "last_seen_at",
          "expires_at"
        ],
        "title": "BrowserRouteSessionSummary",
        "type": "object"
      },
      "ChallengeResponse": {
        "description": "Register nonce minted by ``POST /attest/challenge``.",
        "properties": {
          "nonce": {
            "title": "Nonce",
            "type": "string"
          }
        },
        "required": [
          "nonce"
        ],
        "title": "ChallengeResponse",
        "type": "object"
      },
      "Channel": {
        "description": "Messaging channel discriminator on the generic channel-associations core.\n\nOne value per integrated bridge. Adding a channel = new enum value + new\n:class:`app.lib.channels.bridge.BridgeClient` impl + new thin webhook\nroute. No new backend tables \u2014 every channel reuses\n``channel_associations`` / ``channel_association_requests`` /\n``channel_processed_messages``.",
        "enum": [
          "whatsapp",
          "heylo"
        ],
        "title": "Channel",
        "type": "string"
      },
      "ChannelAssociationConfirmRequest": {
        "description": "Body of the mobile-side confirm call after tapping the deep link.\n\nChannel-blind by #858: the token alone identifies which channel and\nwhich channel-user the request was minted for, so the body shape stays\na single field across all channels.",
        "properties": {
          "token": {
            "minLength": 1,
            "title": "Token",
            "type": "string"
          }
        },
        "required": [
          "token"
        ],
        "title": "ChannelAssociationConfirmRequest",
        "type": "object"
      },
      "ChannelMessageReferenceCaptureRequest": {
        "description": "Bind one outbound platform message id to route identity.",
        "properties": {
          "board_message_id": {
            "anyOf": [
              {
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Board Message Id"
          },
          "channel": {
            "$ref": "#/components/schemas/Channel"
          },
          "platform_message_id": {
            "minLength": 1,
            "title": "Platform Message Id",
            "type": "string"
          },
          "route_session_id": {
            "anyOf": [
              {
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Route Session Id"
          },
          "share_id": {
            "anyOf": [
              {
                "pattern": "[A-Za-z0-9][A-Za-z0-9_-]{15,63}",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Share Id"
          },
          "source_route_page_id": {
            "anyOf": [
              {
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Route Page Id"
          },
          "user_id": {
            "minLength": 1,
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "channel",
          "platform_message_id"
        ],
        "title": "ChannelMessageReferenceCaptureRequest",
        "type": "object"
      },
      "ChannelMessageReferenceCaptureResponse": {
        "description": "Stored route reference binding.",
        "properties": {
          "board_message_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Board Message Id"
          },
          "channel": {
            "$ref": "#/components/schemas/Channel"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "platform_message_id": {
            "title": "Platform Message Id",
            "type": "string"
          },
          "route_session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Route Session Id"
          },
          "share_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Share Id"
          },
          "source_route_page_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Route Page Id"
          },
          "user_id": {
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "user_id",
          "channel",
          "platform_message_id"
        ],
        "title": "ChannelMessageReferenceCaptureResponse",
        "type": "object"
      },
      "CheshireAskRequest": {
        "description": "Request schema for asking Cheshire a question via SSE stream.\n\n``/cheshire/ask`` is cross-provider (issue #785) \u2014 Cheshire's\n``/users/{user_id}/ask`` route has no per-table scope, so there's no\n``data_type`` field on the body. Scope comes from the question text\nand Cheshire's agent picks the right tables across linked providers.",
        "properties": {
          "effort": {
            "default": "low",
            "description": "Analysis effort level.",
            "enum": [
              "low",
              "medium",
              "high",
              "xhigh",
              "max"
            ],
            "title": "Effort",
            "type": "string"
          },
          "include_context": {
            "default": true,
            "description": "Whether to enrich the question with user profile context.",
            "title": "Include Context",
            "type": "boolean"
          },
          "question": {
            "description": "Natural language question about fitness data.",
            "maxLength": 2000,
            "minLength": 1,
            "title": "Question",
            "type": "string"
          },
          "stream": {
            "default": true,
            "description": "Whether Cheshire should stream the response via SSE tokens.",
            "title": "Stream",
            "type": "boolean"
          },
          "units": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Free-form unit-system preference forwarded to Cheshire (e.g. 'imperial', 'metric'). When omitted, Cheshire derives from locale's region.",
            "title": "Units"
          }
        },
        "required": [
          "question"
        ],
        "title": "CheshireAskRequest",
        "type": "object"
      },
      "CheshireFollowUpRequest": {
        "description": "Request schema for a follow-up question in an existing Cheshire conversation.",
        "properties": {
          "effort": {
            "default": "low",
            "description": "Analysis effort level.",
            "enum": [
              "low",
              "medium",
              "high",
              "xhigh",
              "max"
            ],
            "title": "Effort",
            "type": "string"
          },
          "question": {
            "description": "Follow-up question.",
            "maxLength": 2000,
            "minLength": 1,
            "title": "Question",
            "type": "string"
          },
          "stream": {
            "default": true,
            "description": "Whether Cheshire should stream the response via SSE tokens.",
            "title": "Stream",
            "type": "boolean"
          },
          "units": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Free-form unit-system preference forwarded to Cheshire (e.g. 'imperial', 'metric'). When omitted, Cheshire derives from locale's region.",
            "title": "Units"
          }
        },
        "required": [
          "question"
        ],
        "title": "CheshireFollowUpRequest",
        "type": "object"
      },
      "CheshireVisualizeRequest": {
        "description": "Request schema for generating a chart via Cheshire.",
        "properties": {
          "data_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional data type scope: 'sleeps', 'activities', etc.",
            "title": "Data Type"
          },
          "effort": {
            "default": "low",
            "description": "Analysis effort level.",
            "enum": [
              "low",
              "medium",
              "high",
              "xhigh",
              "max"
            ],
            "title": "Effort",
            "type": "string"
          },
          "height": {
            "anyOf": [
              {
                "maximum": 2000.0,
                "minimum": 200.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Chart height in pixels. When omitted, Cheshire picks a compact height suited to the content.",
            "title": "Height"
          },
          "include_context": {
            "default": true,
            "description": "Whether to enrich the question with user profile context.",
            "title": "Include Context",
            "type": "boolean"
          },
          "include_html": {
            "default": false,
            "description": "Whether to include the rendered HTML in the response.",
            "title": "Include Html",
            "type": "boolean"
          },
          "locale": {
            "default": "en-US",
            "description": "Locale for number/date formatting.",
            "title": "Locale",
            "type": "string"
          },
          "max_aspect_ratio": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional maximum width / height ratio. When height is omitted, Cheshire may pad the canvas to keep the render within bounds.",
            "title": "Max Aspect Ratio"
          },
          "min_aspect_ratio": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional minimum width / height ratio. When height is omitted, Cheshire may pad the canvas to keep the render within bounds.",
            "title": "Min Aspect Ratio"
          },
          "question": {
            "description": "Natural language description of the chart to generate.",
            "maxLength": 2000,
            "minLength": 1,
            "title": "Question",
            "type": "string"
          },
          "row_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional row id for deterministic renderers (requires data_type). Used for activity route maps.",
            "title": "Row Id"
          },
          "theme": {
            "default": "light",
            "description": "Chart color theme.",
            "enum": [
              "light",
              "dark"
            ],
            "title": "Theme",
            "type": "string"
          },
          "units": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Free-form unit-system preference forwarded to Cheshire (e.g. 'imperial', 'metric'). When omitted, Cheshire derives from locale's region.",
            "title": "Units"
          },
          "width": {
            "default": 800,
            "description": "Chart width in pixels.",
            "maximum": 2000.0,
            "minimum": 200.0,
            "title": "Width",
            "type": "integer"
          }
        },
        "required": [
          "question"
        ],
        "title": "CheshireVisualizeRequest",
        "type": "object"
      },
      "DiscoverRecommendationRequest": {
        "description": "Payload to run web discovery for a missing event named by the user.",
        "properties": {
          "approximate_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Approximate Date"
          },
          "city": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "City"
          },
          "country": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Country"
          },
          "discipline_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Discipline Name"
          },
          "distance_km": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Distance Km"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "sport_type": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/EventType"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "name"
        ],
        "title": "DiscoverRecommendationRequest",
        "type": "object"
      },
      "EventSearchRequest": {
        "properties": {
          "force_refresh": {
            "default": false,
            "title": "Force Refresh",
            "type": "boolean"
          },
          "query": {
            "title": "Query",
            "type": "string"
          }
        },
        "required": [
          "query"
        ],
        "title": "EventSearchRequest",
        "type": "object"
      },
      "EventType": {
        "description": "Supported event types.",
        "enum": [
          "trail_running",
          "road_running",
          "cycling_road",
          "cycling_mtb",
          "triathlon",
          "swimming",
          "generic"
        ],
        "title": "EventType",
        "type": "string"
      },
      "EventURLSearchRequest": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "url": {
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "title": "EventURLSearchRequest",
        "type": "object"
      },
      "FCMTokenRequest": {
        "description": "Request schema for adding an FCM token.",
        "properties": {
          "device_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Device Id"
          },
          "platform": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Platform"
          },
          "token": {
            "title": "Token",
            "type": "string"
          }
        },
        "required": [
          "token"
        ],
        "title": "FCMTokenRequest",
        "type": "object"
      },
      "Gender": {
        "enum": [
          "male",
          "female",
          "other"
        ],
        "title": "Gender",
        "type": "string"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "title": "Detail",
            "type": "array"
          }
        },
        "title": "HTTPValidationError",
        "type": "object"
      },
      "HealthProbeResponse": {
        "description": "Response for ``POST /auth/health-probe``.",
        "properties": {
          "custom_token": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Custom Token"
          },
          "decision": {
            "$ref": "#/components/schemas/ProbeDecision"
          },
          "recovered": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Recovered"
          }
        },
        "required": [
          "decision"
        ],
        "title": "HealthProbeResponse",
        "type": "object"
      },
      "HealthProviderAppleRegisterRequest": {
        "description": "Request to register Apple Health.",
        "properties": {
          "device_uuid": {
            "description": "Opaque device identifier persisted in iCloud-synced Keychain on the mobile side. Used as the Apple Health provider_user_id.",
            "minLength": 1,
            "title": "Device Uuid",
            "type": "string"
          }
        },
        "required": [
          "device_uuid"
        ],
        "title": "HealthProviderAppleRegisterRequest",
        "type": "object"
      },
      "HealthProviderCallbackRequest": {
        "description": "Request with OAuth callback data.",
        "properties": {
          "code": {
            "description": "Authorization code from OAuth callback",
            "title": "Code",
            "type": "string"
          },
          "state": {
            "description": "State parameter from callback",
            "title": "State",
            "type": "string"
          }
        },
        "required": [
          "code",
          "state"
        ],
        "title": "HealthProviderCallbackRequest",
        "type": "object"
      },
      "HealthProviderCallbackResponse": {
        "description": "Response after a provider connect/callback or Apple Health register.\n\n``result`` indicates the branch that ran:\n\n- ``connected``: a new ``HealthProviderConnection`` was created.\n- ``already_connected``: the caller already owns this provider identity.\n- ``recovered``: the provider identity maps to a different imperfect\n  user (typical after a reinstall/new device). ``custom_token`` is set\n  so the mobile client can ``signInWithCustomToken`` and adopt the\n  existing user's Firebase UID.",
        "properties": {
          "custom_token": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Custom Token"
          },
          "permissions": {
            "items": {
              "type": "string"
            },
            "title": "Permissions",
            "type": "array"
          },
          "provider": {
            "$ref": "#/components/schemas/HealthProviderType"
          },
          "provider_user_id": {
            "title": "Provider User Id",
            "type": "string"
          },
          "result": {
            "default": "connected",
            "enum": [
              "connected",
              "already_connected",
              "recovered"
            ],
            "title": "Result",
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/HealthProviderConnectionStatus"
          }
        },
        "required": [
          "provider",
          "provider_user_id",
          "permissions",
          "status"
        ],
        "title": "HealthProviderCallbackResponse",
        "type": "object"
      },
      "HealthProviderConnectRequest": {
        "description": "Request to initiate OAuth connection with a health provider.",
        "properties": {
          "redirect_uri": {
            "description": "Deep link URI where the app will receive the OAuth callback",
            "title": "Redirect Uri",
            "type": "string"
          }
        },
        "required": [
          "redirect_uri"
        ],
        "title": "HealthProviderConnectRequest",
        "type": "object"
      },
      "HealthProviderConnectResponse": {
        "description": "Response with authorization URL for OAuth flow.",
        "properties": {
          "authorization_url": {
            "description": "URL to redirect user for authorization",
            "title": "Authorization Url",
            "type": "string"
          },
          "state": {
            "description": "State parameter to validate callback",
            "title": "State",
            "type": "string"
          }
        },
        "required": [
          "authorization_url",
          "state"
        ],
        "title": "HealthProviderConnectResponse",
        "type": "object"
      },
      "HealthProviderConnectionResponse": {
        "description": "Response schema for a health provider connection.",
        "properties": {
          "brand": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Brand"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "last_sync_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Sync At"
          },
          "permissions": {
            "items": {
              "type": "string"
            },
            "title": "Permissions",
            "type": "array"
          },
          "provider": {
            "$ref": "#/components/schemas/HealthProviderType"
          },
          "provider_user_id": {
            "title": "Provider User Id",
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/HealthProviderConnectionStatus"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "provider",
          "provider_user_id",
          "permissions",
          "status",
          "created_at",
          "updated_at"
        ],
        "title": "HealthProviderConnectionResponse",
        "type": "object"
      },
      "HealthProviderConnectionStatus": {
        "description": "Status of a health provider connection.",
        "enum": [
          "active",
          "expired",
          "revoked",
          "error"
        ],
        "title": "HealthProviderConnectionStatus",
        "type": "string"
      },
      "HealthProviderListResponse": {
        "description": "Response with list of user's health provider connections.",
        "properties": {
          "connections": {
            "items": {
              "$ref": "#/components/schemas/HealthProviderConnectionResponse"
            },
            "title": "Connections",
            "type": "array"
          }
        },
        "required": [
          "connections"
        ],
        "title": "HealthProviderListResponse",
        "type": "object"
      },
      "HealthProviderType": {
        "description": "Health data providers (OAuth connections).",
        "enum": [
          "garmin",
          "whoop",
          "coros",
          "terra",
          "apple_health"
        ],
        "title": "HealthProviderType",
        "type": "string"
      },
      "NotificationResponseRequest": {
        "description": "Request schema for responding to an interactive notification.",
        "properties": {
          "action": {
            "description": "Action identifier: 'reply' for text input, or 'button_1'/'button_2'/'button_3' for button taps.",
            "title": "Action",
            "type": "string"
          },
          "label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The button label that was tapped (null for text replies).",
            "title": "Label"
          },
          "text": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "User's text reply (null for button taps).",
            "title": "Text"
          }
        },
        "required": [
          "action"
        ],
        "title": "NotificationResponseRequest",
        "type": "object"
      },
      "NotificationResponseResponse": {
        "description": "Response schema after storing a notification response.",
        "properties": {
          "acknowledged": {
            "default": true,
            "title": "Acknowledged",
            "type": "boolean"
          },
          "action": {
            "title": "Action",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "notification_id": {
            "title": "Notification Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "notification_id",
          "action"
        ],
        "title": "NotificationResponseResponse",
        "type": "object"
      },
      "OnboardingInsight": {
        "description": "A single onboarding insight card.\n\nMirrors the seven cards the mobile teaser extracts from HealthKit, but\ncomputed server-side from connected provider data (Garmin direct, or\nCoros via Terra). The client maps ``kind`` to the localized label,\nicon, and subtitle copy.\n\nOnly the fields relevant to ``kind`` are populated; the rest are ``None``.",
        "properties": {
          "avg": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avg"
          },
          "avg_hours": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avg Hours"
          },
          "avg_kcal": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avg Kcal"
          },
          "bpm": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bpm"
          },
          "count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Count"
          },
          "date": {
            "anyOf": [
              {
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Date"
          },
          "hours": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hours"
          },
          "kind": {
            "enum": [
              "hrv",
              "sleep",
              "sleep_worst_night",
              "steps",
              "workouts",
              "resting_heart_rate",
              "active_energy"
            ],
            "title": "Kind",
            "type": "string"
          },
          "sentiment": {
            "enum": [
              "positive",
              "caution",
              "urgent",
              "neutral"
            ],
            "title": "Sentiment",
            "type": "string"
          },
          "value_ms": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Value Ms"
          }
        },
        "required": [
          "kind",
          "sentiment"
        ],
        "title": "OnboardingInsight",
        "type": "object"
      },
      "OnboardingInsightsResponse": {
        "description": "Response for GET /onboarding/{provider}/insights.",
        "properties": {
          "insights": {
            "items": {
              "$ref": "#/components/schemas/OnboardingInsight"
            },
            "title": "Insights",
            "type": "array"
          }
        },
        "required": [
          "insights"
        ],
        "title": "OnboardingInsightsResponse",
        "type": "object"
      },
      "ProbeChallengeResponse": {
        "description": "Probe nonce minted by ``POST /auth/health-probe/challenge``.",
        "properties": {
          "expires_at": {
            "format": "date-time",
            "title": "Expires At",
            "type": "string"
          },
          "nonce": {
            "title": "Nonce",
            "type": "string"
          }
        },
        "required": [
          "nonce",
          "expires_at"
        ],
        "title": "ProbeChallengeResponse",
        "type": "object"
      },
      "ProbeDecision": {
        "enum": [
          "confident",
          "ambiguous",
          "none",
          "insufficient_signal"
        ],
        "title": "ProbeDecision",
        "type": "string"
      },
      "ProviderType": {
        "description": "Identity/auth providers.",
        "enum": [
          "google",
          "apple"
        ],
        "title": "ProviderType",
        "type": "string"
      },
      "PublicRouteBrowserLocation": {
        "description": "GPS fix explicitly shared by the browser for one route run.",
        "properties": {
          "accuracy_m": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Accuracy M"
          },
          "captured_at": {
            "format": "date-time",
            "title": "Captured At",
            "type": "string"
          },
          "label": {
            "anyOf": [
              {
                "maxLength": 240,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Label"
          },
          "lat": {
            "maximum": 90.0,
            "minimum": -90.0,
            "title": "Lat",
            "type": "number"
          },
          "lng": {
            "maximum": 180.0,
            "minimum": -180.0,
            "title": "Lng",
            "type": "number"
          }
        },
        "required": [
          "lat",
          "lng",
          "captured_at"
        ],
        "title": "PublicRouteBrowserLocation",
        "type": "object"
      },
      "PublicRouteProvenance": {
        "description": "Read-only ancestry for route iterations and forks.",
        "properties": {
          "source_public_route_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Public Route Id"
          },
          "source_route_hash": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Route Hash"
          },
          "source_route_slug": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Route Slug"
          },
          "source_run_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Run Id"
          },
          "source_session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Session Id"
          }
        },
        "title": "PublicRouteProvenance",
        "type": "object"
      },
      "RouteSendCallbackRequest": {
        "description": "Callback handoff from the static looking-glass Garmin page.",
        "properties": {
          "code": {
            "anyOf": [
              {
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Code"
          },
          "error": {
            "anyOf": [
              {
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "state": {
            "minLength": 1,
            "title": "State",
            "type": "string"
          }
        },
        "required": [
          "state"
        ],
        "title": "RouteSendCallbackRequest",
        "type": "object"
      },
      "RouteSendConsentRequest": {
        "description": "Legal acceptance receipt carried by the route-send CTA.",
        "properties": {
          "accepted": {
            "title": "Accepted",
            "type": "boolean"
          },
          "locale": {
            "maxLength": 35,
            "minLength": 2,
            "title": "Locale",
            "type": "string"
          },
          "privacy_content_hash": {
            "anyOf": [
              {
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Privacy Content Hash"
          },
          "privacy_version": {
            "anyOf": [
              {
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Privacy Version"
          },
          "terms_content_hash": {
            "anyOf": [
              {
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Terms Content Hash"
          },
          "terms_version": {
            "anyOf": [
              {
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Terms Version"
          },
          "ts": {
            "format": "date-time",
            "title": "Ts",
            "type": "string"
          }
        },
        "required": [
          "accepted",
          "ts",
          "locale"
        ],
        "title": "RouteSendConsentRequest",
        "type": "object"
      },
      "RouteSendLinkResolveRequest": {
        "description": "Resolve a durable route-send Garmin link from an opaque pointer.",
        "properties": {
          "returning_authorizer_token": {
            "maxLength": 256,
            "minLength": 16,
            "title": "Returning Authorizer Token",
            "type": "string"
          }
        },
        "required": [
          "returning_authorizer_token"
        ],
        "title": "RouteSendLinkResolveRequest",
        "type": "object"
      },
      "RouteSendLinkResolveResponse": {
        "description": "Browser-safe result of resolving a durable Garmin route-send link.",
        "properties": {
          "detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Detail"
          },
          "linked": {
            "title": "Linked",
            "type": "boolean"
          },
          "retry_after_seconds": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Retry After Seconds"
          },
          "status": {
            "$ref": "#/components/schemas/RouteSendLinkResolveStatus"
          }
        },
        "required": [
          "status",
          "linked"
        ],
        "title": "RouteSendLinkResolveResponse",
        "type": "object"
      },
      "RouteSendLinkResolveStatus": {
        "description": "Browser-safe status for a returning Garmin link lookup.",
        "enum": [
          "linked",
          "authorization_required",
          "rate_limited",
          "retry"
        ],
        "title": "RouteSendLinkResolveStatus",
        "type": "string"
      },
      "RouteSendResponse": {
        "description": "Browser-safe route-send state returned by public endpoints.",
        "properties": {
          "authorization_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Authorization Url"
          },
          "detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Detail"
          },
          "garmin_course_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Garmin Course Id"
          },
          "garmin_course_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Garmin Course Url"
          },
          "gpx_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gpx Url"
          },
          "historical_data_permissions": {
            "items": {
              "type": "string"
            },
            "title": "Historical Data Permissions",
            "type": "array"
          },
          "historical_data_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Historical Data Status"
          },
          "missing_source_fields": {
            "items": {
              "type": "string"
            },
            "title": "Missing Source Fields",
            "type": "array"
          },
          "response_surface": {
            "$ref": "#/components/schemas/RouteSendResponseSurface",
            "default": "imperfect_owned"
          },
          "retry_after_seconds": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Retry After Seconds"
          },
          "returning_authorizer_token": {
            "anyOf": [
              {
                "maxLength": 256,
                "minLength": 16,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Returning Authorizer Token"
          },
          "route_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Route Url"
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Session Id"
          },
          "status": {
            "$ref": "#/components/schemas/RouteSendStatus"
          },
          "success_redirect_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Success Redirect Url"
          }
        },
        "required": [
          "status"
        ],
        "title": "RouteSendResponse",
        "type": "object"
      },
      "RouteSendResponseSurface": {
        "description": "Browser destination surface for the returned route-send state.",
        "enum": [
          "garmin_connect_course",
          "imperfect_owned"
        ],
        "title": "RouteSendResponseSurface",
        "type": "string"
      },
      "RouteSendStartRequest": {
        "description": "Start a public Garmin route-send OAuth attempt.",
        "properties": {
          "consent": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RouteSendConsentRequest"
              },
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Consent"
          },
          "firebase_uid": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Firebase Uid"
          },
          "returning_authorizer_token": {
            "anyOf": [
              {
                "maxLength": 256,
                "minLength": 16,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Returning Authorizer Token"
          },
          "route_slug": {
            "pattern": "^[a-z0-9][a-z0-9-]*$",
            "title": "Route Slug",
            "type": "string"
          },
          "share_id": {
            "pattern": "[A-Za-z0-9][A-Za-z0-9_-]{15,63}",
            "title": "Share Id",
            "type": "string"
          }
        },
        "required": [
          "share_id",
          "route_slug"
        ],
        "title": "RouteSendStartRequest",
        "type": "object"
      },
      "RouteSendStatus": {
        "description": "Browser-safe route-send UX states.",
        "enum": [
          "authorization_required",
          "course_ready",
          "already_sent",
          "cancelled",
          "expired",
          "route_not_found",
          "route_not_ready",
          "missing_course_import",
          "provider_identity_collision",
          "alice_error",
          "rate_limited",
          "retry",
          "poll_needed",
          "session_not_found"
        ],
        "title": "RouteSendStatus",
        "type": "string"
      },
      "StateCreateRequest": {
        "description": "Request schema for creating/updating user state.",
        "properties": {
          "feedback": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Feedback"
          },
          "latitude": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Latitude"
          },
          "longitude": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Longitude"
          },
          "notification_action": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "'reply' (default) for text/voice input, or 'button_1'/'button_2'/'button_3' for quick-reply chip taps.",
            "title": "Notification Action"
          },
          "notification_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Notification Id"
          },
          "notification_label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The chip label that was tapped (null for replies).",
            "title": "Notification Label"
          },
          "now_iso": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Now Iso"
          },
          "timezone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Timezone"
          }
        },
        "title": "StateCreateRequest",
        "type": "object"
      },
      "TechniqueNote": {
        "description": "Technique guidance for an activity.",
        "properties": {
          "focus": {
            "description": "Area of focus, e.g. 'Breathing', 'Posture', 'Cadence', 'Zone 2'",
            "title": "Focus",
            "type": "string"
          },
          "instruction": {
            "description": "Clear technique instruction, e.g. 'Breathe in through nose for 3 steps, out through mouth for 2'",
            "title": "Instruction",
            "type": "string"
          },
          "why": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional explanation of why this matters, e.g. 'Helps maintain aerobic zone'",
            "title": "Why"
          }
        },
        "required": [
          "focus",
          "instruction"
        ],
        "title": "TechniqueNote",
        "type": "object"
      },
      "UserCreateRequest": {
        "properties": {
          "latitude": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Latitude"
          },
          "longitude": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Longitude"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "provider": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ProviderType"
              },
              {
                "type": "null"
              }
            ]
          },
          "timezone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Timezone"
          }
        },
        "required": [
          "name"
        ],
        "title": "UserCreateRequest",
        "type": "object"
      },
      "UserEventCancelRequest": {
        "description": "Optional body for ``DELETE /user_events/{id}``.",
        "properties": {
          "reason": {
            "anyOf": [
              {
                "maxLength": 1000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          }
        },
        "title": "UserEventCancelRequest",
        "type": "object"
      },
      "UserEventCreateRequest": {
        "description": "Request schema for creating/updating a user event.\n\nTwo payload shapes share this endpoint:\n\n- **Catalog attach** (``event_id`` provided): the user picked a\n  race we already have indexed. Backend looks up the ``Event`` and\n  attaches via ``UserEvent.attach``.\n- **Prefilled attach** (``event_id`` omitted, ``name`` + ``city`` +\n  ``country`` + ``approximate_date`` provided): the user picked a\n  non-catalog recommendation. Backend materializes an\n  ``Event(data_quality=prefilled)``, attaches, and enqueues\n  ``confirm_prefilled_event`` to enrich it via web discovery.",
        "properties": {
          "approximate_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Approximate Date"
          },
          "city": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "City"
          },
          "country": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Country"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "discipline_name": {
            "title": "Discipline Name",
            "type": "string"
          },
          "distance_km": {
            "title": "Distance Km",
            "type": "number"
          },
          "elevation_gain_m": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Elevation Gain M"
          },
          "event_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Event Id"
          },
          "intent": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Intent"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "replace_existing": {
            "default": true,
            "title": "Replace Existing",
            "type": "boolean"
          },
          "sport_type": {
            "title": "Sport Type",
            "type": "string"
          },
          "start_time": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Start Time"
          }
        },
        "required": [
          "discipline_name",
          "distance_km",
          "sport_type"
        ],
        "title": "UserEventCreateRequest",
        "type": "object"
      },
      "UserEventStatus": {
        "description": "User-event lifecycle status.",
        "enum": [
          "planned",
          "active",
          "completed",
          "cancelled"
        ],
        "title": "UserEventStatus",
        "type": "string"
      },
      "UserEventUpdateRequest": {
        "description": "Request schema for updating post-goal questionnaire fields.",
        "properties": {
          "motivation": {
            "anyOf": [
              {
                "maxLength": 1000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Motivation"
          },
          "race_experience": {
            "anyOf": [
              {
                "maxLength": 1000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Race Experience"
          },
          "target_time": {
            "anyOf": [
              {
                "maxLength": 1000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Time"
          }
        },
        "title": "UserEventUpdateRequest",
        "type": "object"
      },
      "UserProfileUpdateRequest": {
        "properties": {
          "age": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Age"
          },
          "gender": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Gender"
              },
              {
                "type": "null"
              }
            ]
          },
          "height": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Height"
          },
          "height_unit": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Height Unit"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "nickname": {
            "anyOf": [
              {
                "maxLength": 50,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Nickname"
          },
          "weight": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Weight"
          },
          "weight_unit": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Weight Unit"
          }
        },
        "title": "UserProfileUpdateRequest",
        "type": "object"
      },
      "ValidationError": {
        "properties": {
          "ctx": {
            "title": "Context",
            "type": "object"
          },
          "input": {
            "title": "Input"
          },
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "title": "Location",
            "type": "array"
          },
          "msg": {
            "title": "Message",
            "type": "string"
          },
          "type": {
            "title": "Error Type",
            "type": "string"
          }
        },
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError",
        "type": "object"
      },
      "WidgetSessionRequest": {
        "description": "Request schema for generating a Terra widget session.",
        "properties": {
          "auth_failure_redirect_url": {
            "title": "Auth Failure Redirect Url",
            "type": "string"
          },
          "auth_success_redirect_url": {
            "title": "Auth Success Redirect Url",
            "type": "string"
          },
          "language": {
            "default": "en",
            "title": "Language",
            "type": "string"
          },
          "reference_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reference Id"
          }
        },
        "required": [
          "auth_success_redirect_url",
          "auth_failure_redirect_url"
        ],
        "title": "WidgetSessionRequest",
        "type": "object"
      }
    },
    "securitySchemes": {
      "HTTPBearer": {
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "description": "FastAPI backend for the Imperfect health and fitness application",
    "title": "imperfect-api",
    "version": "0.1.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/": {
      "get": {
        "description": "Root endpoint.",
        "operationId": "root__get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Root  Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Root"
      }
    },
    "/account": {
      "delete": {
        "description": "Request account deletion.\n\nRequired for Apple App Store Review Guideline 5.1.1.\nRecords the deletion request and disconnects health providers.",
        "operationId": "delete_account_endpoint_account_delete",
        "parameters": [
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountDeleteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountDeleteResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete Account Endpoint"
      }
    },
    "/attest/challenge": {
      "post": {
        "description": "Issue a single-use register nonce (5 min TTL).",
        "operationId": "attest_challenge_attest_challenge_post",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChallengeResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Attest Challenge"
      }
    },
    "/attest/register": {
      "post": {
        "description": "Verify a fresh attestation and upsert the device's App Attest key.\n\nIdempotent: a re-register with the same ``key_id`` overwrites the\nexisting row (the public key is deterministic for a given key id,\nso a \"different key\" would have failed Apple's attestation check).",
        "operationId": "attest_register_attest_register_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AttestRegisterRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AttestRegisterResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Attest Register"
      }
    },
    "/auth/health-probe": {
      "post": {
        "description": "Validate App Attest assertion + alice lookup \u2192 maybe mint a custom token.\n\nValidation order matches the cross-repo spec:\n1. App Attest (consume nonce, verify assertion, monotonic counter).\n2. ``fresh_sample.end_date`` within adaptive freshness window.\n3. ``len(record_ids) >= 10`` else ``insufficient_signal``.\n4. Rate-limit per key (5/hour).\n5. Alice ``/apple/identity-lookup`` and score.\n\nOn ``confident`` we set the ``imperfect_user_id`` custom claim before\nminting the token so alice (and other services reading the JWT) see\nthe resolved id immediately \u2014 mirrors ``/health-providers`` flow.\n\nThe raw body is read first so the canonical-JSON hash is computed\nfrom the parsed-but-not-Pydantic-reserialized ``payload`` sub-tree.\nPydantic v2 normalizes datetimes (``\"...Z\"`` \u2192 ``\"...+00:00\"``),\nwhich would mismatch the assertion's expected hash from the\nmobile client.",
        "operationId": "health_probe_auth_health_probe_post",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthProbeResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Health Probe"
      }
    },
    "/auth/health-probe/challenge": {
      "post": {
        "description": "Issue a single-use probe nonce (60s TTL).",
        "operationId": "health_probe_challenge_auth_health_probe_challenge_post",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProbeChallengeResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Health Probe Challenge"
      }
    },
    "/channel_associations": {
      "post": {
        "description": "Bind the channel identity from the token to the authenticated user.\n\nMounted on both ``POST /channel_associations`` (canonical, #858) and\n``POST /whatsapp_associations`` (legacy alias kept so the existing\nmobile client keeps working without a coordinated release). Both routes\nshare this handler; the channel is resolved from the token's\n:class:`ChannelAssociationRequest` row.",
        "operationId": "confirm_channel_association_channel_associations_post",
        "parameters": [
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChannelAssociationConfirmRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Confirm Channel Association Channel Associations Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Confirm Channel Association"
      }
    },
    "/channels/message-references": {
      "post": {
        "description": "Capture ``platform_message_id -> share_id`` after a bridge sends.",
        "operationId": "capture_channel_message_reference_channels_message_references_post",
        "parameters": [
          {
            "in": "header",
            "name": "X-WhatsApp-Bridge-Token",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Whatsapp-Bridge-Token"
            }
          },
          {
            "in": "header",
            "name": "X-Heylo-Bridge-Token",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Heylo-Bridge-Token"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChannelMessageReferenceCaptureRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChannelMessageReferenceCaptureResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Capture Channel Message Reference"
      }
    },
    "/cheshire/ask": {
      "post": {
        "description": "Ask Cheshire a cross-provider question about your fitness data (SSE stream).\n\nHits Cheshire's ``POST /users/{user_id}/ask`` so per-schema RLS is\napplied independently for every linked provider (issue #785) \u2014 the\nold single-vendor URL froze on a \"primary vendor\" and hid data from\nevery other connected provider when the primary went stale.\n\nSSE events emitted:\n- ``token``    \u2014 ``{\"text\": \"...\"}`` incremental text chunk\n- ``metadata`` \u2014 ``{\"conversation_id\": \"...\"}`` sent once when available\n- ``error``    \u2014 ``{\"message\": \"...\"}`` on upstream error\n- ``done``     \u2014 ``{}`` stream complete",
        "operationId": "cheshire_ask_cheshire_ask_post",
        "parameters": [
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheshireAskRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Cheshire Ask",
        "tags": [
          "cheshire"
        ]
      }
    },
    "/cheshire/conversations/{conversation_id}/ask": {
      "post": {
        "description": "Send a follow-up question in an existing Cheshire conversation (SSE stream).\n\nThe ``conversation_id`` must belong to the authenticated user.",
        "operationId": "cheshire_follow_up_cheshire_conversations__conversation_id__ask_post",
        "parameters": [
          {
            "in": "path",
            "name": "conversation_id",
            "required": true,
            "schema": {
              "title": "Conversation Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheshireFollowUpRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Cheshire Follow Up",
        "tags": [
          "cheshire"
        ]
      }
    },
    "/cheshire/visualize/stream": {
      "post": {
        "description": "Stream a chart from the user's fitness data as NDJSON.\n\nReturns ``application/x-ndjson`` \u2014 one complete JSON object per line.\nEach chunk carries ``status`` (``\"reviewing\"`` for intermediate\npreviews, ``\"final\"`` for the committed render), a monotonically\nincreasing ``version``, and the latest ``svg`` / ``svg_url`` /\n``png_url``. Clients stop reading after ``status=\"final\"``. The\nrow-scoped deterministic renderer emits a single ``\"final\"`` chunk.\n\nIf the upstream request fails before streaming starts, the endpoint\nterminates the stream with a single NDJSON line containing an\n``error`` field so clients can distinguish it from a missing\n``final`` chunk.",
        "operationId": "cheshire_visualize_stream_cheshire_visualize_stream_post",
        "parameters": [
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          },
          {
            "in": "header",
            "name": "Cache-Control",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Cache-Control"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheshireVisualizeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Cheshire Visualize Stream",
        "tags": [
          "cheshire"
        ]
      }
    },
    "/events/by-slug/{slug}": {
      "get": {
        "description": "Fetch a single canonical ``Event`` by its ``slug``.\n\nAuth is ``verify_token`` (not ``current_user``): a valid Firebase\ntoken is required, but the domain ``User`` does not have to exist\nyet. Anonymous callers MUST be able to reach this endpoint before\nthe provider-connect step mints their domain User, otherwise they\ncan't render the public event they came in for.",
        "operationId": "get_event_by_slug_events_by_slug__slug__get",
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "title": "Slug",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Get Event By Slug Events By Slug  Slug  Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Event By Slug",
        "tags": [
          "events"
        ]
      }
    },
    "/events/discover-url": {
      "post": {
        "description": "Extract event data from a user-provided URL.\nSkips web search and LLM selection \u2014 goes directly to Browser Use extraction.\nReturns a STREAM of NDJSON (Newline Delimited JSON) events.\n\nEvent Types:\n- {\"type\": \"status\", \"msg\": \"...\", \"step\": \"...\"}\n- {\"type\": \"result\", \"data\": [...events...]}\n- {\"type\": \"error\", \"msg\": \"...\"}",
        "operationId": "extract_event_from_url_events_discover_url_post",
        "parameters": [
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventURLSearchRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Extract Event From Url",
        "tags": [
          "events"
        ]
      }
    },
    "/events/search": {
      "post": {
        "description": "Search for events using the hybrid discovery agent (DB + Web).\nReturns a STREAM of NDJSON (Newline Delimited JSON) events.\n\nEvent Types:\n- {\"type\": \"status\", \"msg\": \"...\", \"step\": \"...\"}\n- {\"type\": \"result\", \"data\": [...events...]}\n- {\"type\": \"error\", \"msg\": \"...\"}\n\n- **force_refresh**: If True, bypasses local cache and triggers a fresh web scrape.",
        "operationId": "search_for_events_events_search_post",
        "parameters": [
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventSearchRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Search For Events",
        "tags": [
          "events"
        ]
      }
    },
    "/events/{event_id}": {
      "get": {
        "description": "Fetch a single canonical ``Event`` by its ID.",
        "operationId": "get_event_by_id_events__event_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "event_id",
            "required": true,
            "schema": {
              "title": "Event Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Get Event By Id Events  Event Id  Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Event By Id",
        "tags": [
          "events"
        ]
      }
    },
    "/events/{slug}/translations/{lang}": {
      "post": {
        "description": "Translate an event into ``lang`` on demand from the frontend (#659).\n\nIdempotent: if the cache is already warm for ``(slug, lang)``, the\nagent is NOT re-run (the ``source_hash`` short-circuit fires) and\nthe cached entry is returned verbatim. Frontend can call this on\nevery cache-miss without worrying about double-billing.\n\nReturns the persisted translation payload \u2014 caller doesn't need a\nsecond Mongo round-trip.",
        "operationId": "translate_event_on_demand_events__slug__translations__lang__post",
        "parameters": [
          {
            "description": "Event slug.",
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "description": "Event slug.",
              "title": "Slug",
              "type": "string"
            }
          },
          {
            "description": "Target BCP47 locale (``de-DE``, ``es-MX``, ``ca-ES``, ``en-GB``, \u2026). Any code ``langcodes`` resolves to a real (language, territory) pair is accepted; de-DE, es-MX are pre-warmed during enrichment so cache hits are cheap, but other locales are translated on first request and cached the same way.",
            "in": "path",
            "name": "lang",
            "required": true,
            "schema": {
              "description": "Target BCP47 locale (``de-DE``, ``es-MX``, ``ca-ES``, ``en-GB``, \u2026). Any code ``langcodes`` resolves to a real (language, territory) pair is accepted; de-DE, es-MX are pre-warmed during enrichment so cache hits are cheap, but other locales are translated on first request and cached the same way.",
              "title": "Lang",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-revalidate-secret",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Revalidate-Secret"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Translate Event On Demand Events  Slug  Translations  Lang  Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Translate Event On Demand",
        "tags": [
          "events"
        ]
      }
    },
    "/health-providers": {
      "get": {
        "description": "List all health provider connections for the current user.\n\nReturns an empty list when the caller holds an authenticated Firebase\ntoken but no domain User has been created yet (anonymous onboarding,\npre-Terra-auth). This avoids a noisy 403 on the welcome screen.",
        "operationId": "list_health_providers_health_providers_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthProviderListResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Health Providers"
      }
    },
    "/health-providers/apple-health/register": {
      "post": {
        "deprecated": true,
        "description": "Register Apple Health as the user's health data provider.\n\nApple Health has no OAuth flow \u2014 the mobile client calls this endpoint\nafter the user grants HealthKit permissions. ``device_uuid`` is an\nopaque identifier persisted in the iCloud-synced Keychain, so it\nsurvives reinstalls on the same Apple ID. Branch behavior mirrors the\nOAuth callback \u2014 see ``_link_provider_identity``.\n\nDevice timezone arrives via the ``X-Device-Timezone`` header (validated\nby the ``device_timezone`` dependency) so the auto-created ``User`` on\nthe anonymous-onboarding branch lands with the caller's real IANA\ntimezone instead of the ``User.create`` default of ``\"UTC\"``. Mirrors\nthe Garmin OAuth callback path landed in #689 \u2014 required so mobile\ncan drop its pre-emptive ``POST /users`` priming call (#541) and let\nthe recovery branch of ``_link_provider_identity`` fire (#711).",
        "operationId": "register_apple_health_health_providers_apple_health_register_post",
        "parameters": [
          {
            "in": "header",
            "name": "x-device-timezone",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Device-Timezone"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HealthProviderAppleRegisterRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthProviderCallbackResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Register Apple Health"
      }
    },
    "/health-providers/apple/register": {
      "post": {
        "description": "Register Apple Health as the user's health data provider.\n\nApple Health has no OAuth flow \u2014 the mobile client calls this endpoint\nafter the user grants HealthKit permissions. ``device_uuid`` is an\nopaque identifier persisted in the iCloud-synced Keychain, so it\nsurvives reinstalls on the same Apple ID. Branch behavior mirrors the\nOAuth callback \u2014 see ``_link_provider_identity``.\n\nDevice timezone arrives via the ``X-Device-Timezone`` header (validated\nby the ``device_timezone`` dependency) so the auto-created ``User`` on\nthe anonymous-onboarding branch lands with the caller's real IANA\ntimezone instead of the ``User.create`` default of ``\"UTC\"``. Mirrors\nthe Garmin OAuth callback path landed in #689 \u2014 required so mobile\ncan drop its pre-emptive ``POST /users`` priming call (#541) and let\nthe recovery branch of ``_link_provider_identity`` fire (#711).",
        "operationId": "register_apple_health_health_providers_apple_register_post",
        "parameters": [
          {
            "in": "header",
            "name": "x-device-timezone",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Device-Timezone"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HealthProviderAppleRegisterRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthProviderCallbackResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Register Apple Health"
      }
    },
    "/health-providers/connections/{connection_id}": {
      "delete": {
        "description": "Disconnect a specific health provider connection by ID.\n\nUseful when a user has multiple connections for the same provider\n(e.g., multiple Terra brands like Whoop + Clue).",
        "operationId": "disconnect_by_connection_id_health_providers_connections__connection_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "title": "Connection Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Disconnect By Connection Id Health Providers Connections  Connection Id  Delete",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Disconnect By Connection Id"
      }
    },
    "/health-providers/supported": {
      "get": {
        "description": "List all supported health providers.",
        "operationId": "list_supported_providers_health_providers_supported_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response List Supported Providers Health Providers Supported Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "List Supported Providers"
      }
    },
    "/health-providers/{provider}": {
      "delete": {
        "description": "Disconnect from a health provider.\n\nDelegates revocation to alice and deletes the local connection mapping.",
        "operationId": "disconnect_provider_health_providers__provider__delete",
        "parameters": [
          {
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/HealthProviderType"
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Disconnect Provider Health Providers  Provider  Delete",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Disconnect Provider"
      },
      "get": {
        "description": "Get the current user's connection to a specific health provider.",
        "operationId": "get_provider_connection_health_providers__provider__get",
        "parameters": [
          {
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/HealthProviderType"
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthProviderConnectionResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Provider Connection"
      }
    },
    "/health-providers/{provider}/callback": {
      "post": {
        "description": "Handle OAuth callback from health provider.\n\nThe app should call this endpoint after receiving the OAuth callback\nwith the authorization code and state parameters. ``user`` may be\n``None`` during first-time onboarding when the caller holds an\nanonymous Firebase token \u2014 identity is resolved via\n``_link_provider_identity``.\n\nFlow:\n1. Validate OAuth state\n2. Delegate code exchange + token storage to alice\n3. Resolve mapping via ``_link_provider_identity`` (branches on\n   whether the provider identity is new, already-owned, a collision,\n   or recoverable).",
        "operationId": "handle_provider_callback_health_providers__provider__callback_post",
        "parameters": [
          {
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/HealthProviderType"
            }
          },
          {
            "description": "When true, return 404 if the provider identity does not already map to a User. Used by the mobile login flow to avoid auto-creating ghost accounts.",
            "in": "query",
            "name": "login_only",
            "required": false,
            "schema": {
              "default": false,
              "description": "When true, return 404 if the provider identity does not already map to a User. Used by the mobile login flow to avoid auto-creating ghost accounts.",
              "title": "Login Only",
              "type": "boolean"
            }
          },
          {
            "in": "header",
            "name": "x-device-timezone",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Device-Timezone"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HealthProviderCallbackRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthProviderCallbackResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Handle Provider Callback"
      }
    },
    "/health-providers/{provider}/connect": {
      "post": {
        "description": "Initiate OAuth connection with a health provider.\n\nReturns an authorization URL that the app should open in a browser/webview.\nThe user will authenticate with the provider and be redirected back to the app.\nAnonymous Firebase tokens are accepted so onboarding can begin before a\nUser exists; identity is resolved on the callback.",
        "operationId": "initiate_provider_connection_health_providers__provider__connect_post",
        "parameters": [
          {
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/HealthProviderType"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HealthProviderConnectRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthProviderConnectResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Initiate Provider Connection"
      }
    },
    "/heylo_webhooks": {
      "post": {
        "description": "Parse the Heylo multipart into an ``InboundMessage`` and dispatch.\n\nMultipart contract mirrors WhatsApp: ``payload`` is the JSON-encoded\n``HeyloWebhookRequest`` body; ``image`` is an optional file part (the\nbridge downloads it from Heylo's CDN before forwarding). At least one of\n``text``/``image`` must survive validation.\n\nReturns 200 after the durable turn is enqueued; the coach run or invite\nsend happens in the channel worker.",
        "operationId": "heylo_webhook_heylo_webhooks_post",
        "parameters": [
          {
            "in": "header",
            "name": "x-heylo-bridge-token",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Heylo-Bridge-Token"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_heylo_webhook_heylo_webhooks_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Heylo Webhook Heylo Webhooks Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Heylo Webhook"
      }
    },
    "/notifications/token": {
      "post": {
        "operationId": "register_fcm_token_notifications_token_post",
        "parameters": [
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          },
          {
            "in": "header",
            "name": "x-app-version",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-App-Version"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FCMTokenRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Register Fcm Token Notifications Token Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Register Fcm Token"
      }
    },
    "/notifications/{notification_id}/response": {
      "post": {
        "description": "Receive a user's response to an interactive push notification.\n\nAccepts button taps (action=button_1/2/3) or text replies (action=reply).\nThe response is treated as board feedback: it gets persisted as a\nBoardMessage and triggers a board regeneration so the coach can react.",
        "operationId": "respond_to_notification_notifications__notification_id__response_post",
        "parameters": [
          {
            "in": "path",
            "name": "notification_id",
            "required": true,
            "schema": {
              "title": "Notification Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NotificationResponseRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationResponseResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Respond To Notification"
      }
    },
    "/onboarding/intake": {
      "post": {
        "description": "Drive one turn of the conversational onboarding intake.\n\nAccepts either ``text`` or ``audio`` (exactly one). Returns an\n``application/x-ndjson`` stream with the per-turn event sequence:\n``session`` \u2192 optional ``transcribing``/``transcribed`` \u2192\n``thinking`` \u2192 ``writes`` \u2192 ``agent_reply`` \u2192 ``done``. Heartbeats\n(``{\"event\": \"heartbeat\"}``) keep the socket alive during slow\nsteps.",
        "operationId": "onboarding_intake_onboarding_intake_post",
        "parameters": [
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_onboarding_intake_onboarding_intake_post"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Onboarding Intake",
        "tags": [
          "onboarding"
        ]
      }
    },
    "/onboarding/race-recommendations": {
      "post": {
        "description": "Stream race recommendations as NDJSON.\n\nAccepts text, audio (Whisper), or neither. Location is resolved\nfrom the request IP via ipgeolocation.io (cached in Mongo); failures\nfall back to ``None`` and the agent runs without a country bias.",
        "operationId": "race_recommendations_onboarding_race_recommendations_post",
        "parameters": [
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_race_recommendations_onboarding_race_recommendations_post"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Race Recommendations",
        "tags": [
          "onboarding"
        ]
      }
    },
    "/onboarding/race-recommendations/discover": {
      "post": {
        "description": "Stream web discovery for a user-named race and attach on success.\n\nOn success: streams the underlying discovery events plus a final\n``attached`` event with the resulting ``user_event``. On failure:\ncreates an ``EventCandidate`` for manual review and emits a\n``not_found`` terminal event.",
        "operationId": "race_recommendations_discover_onboarding_race_recommendations_discover_post",
        "parameters": [
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DiscoverRecommendationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Race Recommendations Discover",
        "tags": [
          "onboarding"
        ]
      }
    },
    "/onboarding/{provider}/insights": {
      "get": {
        "description": "Seven onboarding insight cards for the teaser animation.\n\nMirrors the cards the mobile HealthKit teaser extracts locally for Apple\nHealth users, but computed server-side from the provider the user just\nconnected. Kinds with no supporting data are omitted.\n\n``provider`` is the brand the mobile client just connected:\n``garmin`` (direct OAuth) or any Terra-backed wearable (``coros``,\n``whoop``, \u2026). The HPC lookup is the gatekeeper \u2014 passing a brand the\nuser isn't connected to returns 422.",
        "operationId": "get_onboarding_insights_onboarding__provider__insights_get",
        "parameters": [
          {
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "title": "Provider",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OnboardingInsightsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Onboarding Insights"
      }
    },
    "/route-send/garmin/callback": {
      "post": {
        "description": "Complete the static callback handoff from looking-glass.",
        "operationId": "complete_garmin_route_send_callback_route_send_garmin_callback_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RouteSendCallbackRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteSendResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Complete Garmin Route Send Callback"
      }
    },
    "/route-send/garmin/links/resolve": {
      "post": {
        "description": "Resolve a durable Garmin link without trusting the cookie alone.",
        "operationId": "resolve_garmin_route_send_link_route_send_garmin_links_resolve_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RouteSendLinkResolveRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteSendLinkResolveResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Resolve Garmin Route Send Link"
      }
    },
    "/route-send/garmin/sessions/{session_id}": {
      "get": {
        "description": "Return the browser-safe status for a route-send session.",
        "operationId": "get_garmin_route_send_status_route_send_garmin_sessions__session_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteSendResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Garmin Route Send Status"
      }
    },
    "/route-send/garmin/sessions/{session_id}/send": {
      "post": {
        "description": "Retry course creation after callback exchange has succeeded.",
        "operationId": "retry_garmin_route_send_route_send_garmin_sessions__session_id__send_post",
        "parameters": [
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteSendResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Retry Garmin Route Send"
      }
    },
    "/route-send/garmin/start": {
      "post": {
        "description": "Start a public web Garmin route-send OAuth attempt.",
        "operationId": "start_garmin_route_send_route_send_garmin_start_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RouteSendStartRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteSendResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Start Garmin Route Send"
      }
    },
    "/routes": {
      "get": {
        "description": "List route runs visible to the current browser session.",
        "operationId": "list_browser_route_runs_routes_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserRouteRunListResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "List Browser Route Runs"
      },
      "post": {
        "description": "Start a browser-owned public route run through Cheshire.",
        "operationId": "create_browser_route_run_routes_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BrowserRouteCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserRouteRunResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Browser Route Run"
      }
    },
    "/routes/session": {
      "get": {
        "description": "Create or refresh the current browser's public Routes session.",
        "operationId": "bootstrap_browser_route_session_routes_session_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserRouteSessionResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Bootstrap Browser Route Session"
      }
    },
    "/routes/sessions": {
      "get": {
        "description": "List route sessions visible to the current browser.",
        "operationId": "list_browser_route_sessions_routes_sessions_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserRouteSessionListResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "List Browser Route Sessions"
      }
    },
    "/routes/sessions/{session_id}": {
      "get": {
        "description": "Return one browser route session if the cookie owns it.",
        "operationId": "get_browser_route_session_routes_sessions__session_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserRouteSessionSummary"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Browser Route Session"
      }
    },
    "/routes/sessions/{session_id}/heartbeat": {
      "post": {
        "description": "Unsafe no-op used by the browser to keep the session warm.",
        "operationId": "heartbeat_browser_route_session_routes_sessions__session_id__heartbeat_post",
        "parameters": [
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserRouteSessionSummary"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Heartbeat Browser Route Session"
      }
    },
    "/routes/{run_id}": {
      "get": {
        "description": "Read a browser-owned public route run.",
        "operationId": "get_browser_route_run_routes__run_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "title": "Run Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserRouteRunResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Browser Route Run"
      }
    },
    "/routes/{run_id}/analytics": {
      "post": {
        "description": "Retain a sanitized browser route funnel/outcome event.",
        "operationId": "record_browser_route_analytics_routes__run_id__analytics_post",
        "parameters": [
          {
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "title": "Run Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BrowserRouteAnalyticsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserRouteAnalyticsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Record Browser Route Analytics"
      }
    },
    "/routes/{run_id}/continue": {
      "post": {
        "description": "Continue or iterate an existing browser-owned public route run.",
        "operationId": "continue_browser_route_run_routes__run_id__continue_post",
        "parameters": [
          {
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "title": "Run Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BrowserRouteContinueRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserRouteRunResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Continue Browser Route Run"
      }
    },
    "/routes/{run_id}/publish": {
      "post": {
        "description": "Publish one browser-owned route option as a public route page.",
        "operationId": "publish_browser_route_run_routes__run_id__publish_post",
        "parameters": [
          {
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "title": "Run Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BrowserRoutePublishRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserRoutePublishResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Publish Browser Route Run"
      }
    },
    "/session": {
      "post": {
        "description": "Generate a Terra widget session for user authentication.\n\nThe User row is not required (and not created) at this point \u2014 the\nTerra ``auth`` webhook handler creates it once the user actually\ncompletes the provider connection.\n\nWe pass a **fresh, never-reused** ``reference_id`` (not the Firebase\nUID) so Terra never sees the same reference twice across reinstalls \u2014\nthat's what stops the duplicate-account / orphaned-data bleeding\n(#979, #1094): no ambiguous state, ``user_reauth`` never fires. The\nFirebase UID and the device timezone (from the ``X-Device-Timezone``\nheader, PR #529) are persisted on a ``TerraSession`` row keyed by the\nwidget session id Terra returns. The ``auth`` webhook reads the row by\n``widget_session_id`` to recover the identity and canonicalize the\nreference to the imperfect-api user id.",
        "operationId": "generate_widget_session_session_post",
        "parameters": [
          {
            "in": "header",
            "name": "x-device-timezone",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Device-Timezone"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WidgetSessionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Generate Widget Session Session Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Generate Widget Session"
      }
    },
    "/session/sdk-token": {
      "post": {
        "description": "Generate a Terra SDK auth token for mobile-only sources (Health Connect).",
        "operationId": "generate_sdk_token_session_sdk_token_post",
        "parameters": [
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Generate Sdk Token Session Sdk Token Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Generate Sdk Token"
      }
    },
    "/user_events": {
      "get": {
        "description": "Return the user's calendar ordered closest-by-date first.\n\nDefaults to ``planned`` + ``active`` so the new mobile calendar UI can\nrender upcoming races without filtering completed/cancelled history.\nCustom status filters use the same calendar ordering so the contract\nis uniform across queries.",
        "operationId": "list_user_events_user_events_get",
        "parameters": [
          {
            "description": "Filter by status. Defaults to planned + active.",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "items": {
                    "$ref": "#/components/schemas/UserEventStatus"
                  },
                  "type": "array"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by status. Defaults to planned + active.",
              "title": "Status"
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "additionalProperties": true,
                    "type": "object"
                  },
                  "title": "Response List User Events User Events Get",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List User Events"
      },
      "post": {
        "description": "Create or update a user's association with an event.\n\n- **Catalog attach** (``event_id`` provided): looks up the existing\n  ``Event`` and attaches via ``UserEvent.attach``.\n- **Prefilled attach** (no ``event_id``): materializes an\n  ``Event(data_quality=prefilled)`` from the prefilled payload,\n  attaches, and dispatches a ``DiscoverySession(prefilled_confirm)``\n  so the discovery worker enriches it asynchronously.\n\n``replace_existing`` (default ``True``) preserves the legacy\nsingle-goal flow that old mobile builds depend on \u2014 every other\nplanned/active row is cancelled before the new one is inserted.\nCalendar-aware clients send ``False`` to append.",
        "operationId": "create_user_event_user_events_post",
        "parameters": [
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserEventCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Create User Event User Events Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create User Event"
      }
    },
    "/user_events/history": {
      "get": {
        "description": "Get all user events (planned, active, completed, cancelled).",
        "operationId": "get_user_event_history_user_events_history_get",
        "parameters": [
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "additionalProperties": true,
                    "type": "object"
                  },
                  "title": "Response Get User Event History User Events History Get",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get User Event History"
      }
    },
    "/user_events/{user_event_id}": {
      "delete": {
        "description": "Soft-cancel a user event (status=cancelled).\n\nThe row stays in Mongo/PG to preserve history \u2014 same shape as the\n``cancel_event`` tool path. Idempotent on already-cancelled rows\n(returns 404 because there's nothing active to cancel).",
        "operationId": "delete_user_event_user_events__user_event_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "user_event_id",
            "required": true,
            "schema": {
              "title": "User Event Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/UserEventCancelRequest"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Req"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Delete User Event User Events  User Event Id  Delete",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete User Event"
      },
      "patch": {
        "description": "Update post-goal questionnaire fields on a user event.",
        "operationId": "update_user_event_user_events__user_event_id__patch",
        "parameters": [
          {
            "in": "path",
            "name": "user_event_id",
            "required": true,
            "schema": {
              "title": "User Event Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserEventUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Update User Event User Events  User Event Id  Patch",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Update User Event"
      }
    },
    "/user_states": {
      "get": {
        "operationId": "get_user_states_user_states_get",
        "parameters": [
          {
            "in": "query",
            "name": "latitude",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Latitude"
            }
          },
          {
            "in": "query",
            "name": "longitude",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Longitude"
            }
          },
          {
            "in": "query",
            "name": "timezone",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Timezone"
            }
          },
          {
            "in": "query",
            "name": "now_iso",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Now Iso"
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          },
          {
            "in": "header",
            "name": "x-app-version",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-App-Version"
            }
          },
          {
            "in": "header",
            "name": "x-home-trigger",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Home-Trigger"
            }
          },
          {
            "in": "header",
            "name": "accept-language",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Accept-Language"
            }
          },
          {
            "in": "header",
            "name": "x-device-timezone",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Device-Timezone"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Get User States User States Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get User States"
      },
      "post": {
        "operationId": "post_user_states_user_states_post",
        "parameters": [
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          },
          {
            "in": "header",
            "name": "x-app-version",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-App-Version"
            }
          },
          {
            "in": "header",
            "name": "x-home-trigger",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Home-Trigger"
            }
          },
          {
            "in": "header",
            "name": "accept-language",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Accept-Language"
            }
          },
          {
            "in": "header",
            "name": "x-device-timezone",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Device-Timezone"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StateCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Post User States User States Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Post User States"
      }
    },
    "/user_states/activity/complete": {
      "post": {
        "deprecated": true,
        "description": "Deprecated: use POST /user_states/activity/resolve instead.",
        "operationId": "complete_activity_user_states_activity_complete_post",
        "parameters": [
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActivityResolveRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Complete Activity User States Activity Complete Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Complete Activity"
      }
    },
    "/user_states/activity/resolve": {
      "post": {
        "description": "Resolve an activity (complete or skip) within a board.\nUpdates the plan status and marks the activity as completed or skipped.",
        "operationId": "resolve_activity_user_states_activity_resolve_post",
        "parameters": [
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActivityResolveRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Resolve Activity User States Activity Resolve Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Resolve Activity"
      }
    },
    "/user_states/boards/{board_id}/activities/{activity_id}/details": {
      "get": {
        "description": "Generate or return cached activity details (steps, technique_notes).\n\nFirst request triggers a lightweight agent call (~2-3s).\nSubsequent requests return cached details instantly.",
        "operationId": "get_activity_details_user_states_boards__board_id__activities__activity_id__details_get",
        "parameters": [
          {
            "in": "path",
            "name": "board_id",
            "required": true,
            "schema": {
              "title": "Board Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "activity_id",
            "required": true,
            "schema": {
              "title": "Activity Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          },
          {
            "in": "header",
            "name": "accept-language",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Accept-Language"
            }
          },
          {
            "in": "header",
            "name": "x-device-timezone",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Device-Timezone"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Activity"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Activity Details"
      }
    },
    "/user_states/stream": {
      "post": {
        "description": "Stream board generation via SSE.\n\nAccepts ``application/json`` (legacy, text-only) or ``multipart/form-data``\n(new, supports any combination of ``audio``, ``image``, ``document``, and\n``feedback`` fields). When audio is provided, the stream emits\n``transcribing`` \u2192 ``transcript`` before board partials. When an image or\nPDF is provided, the stream emits ``analyzing`` immediately so the UI can\nshow progress before the agent starts.\n\nDelivers partial board fields progressively as the agent generates them.\nIf the client disconnects mid-stream on a text-only turn, generation\ncompletes in the background and a push notification is sent. Multimodal\nturns skip recovery (the upload would have to be redone) and surface the\ndisconnect to the client instead.",
        "operationId": "stream_user_states_user_states_stream_post",
        "parameters": [
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          },
          {
            "in": "header",
            "name": "accept-language",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Accept-Language"
            }
          },
          {
            "in": "header",
            "name": "x-device-timezone",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Device-Timezone"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Stream User States"
      }
    },
    "/user_states/week": {
      "get": {
        "description": "Assembly of the rolling plan view.\n\nReturns past boards (up to 6 days), today's board, and intents\nfor future days (up to 4 days). If no ``WeeklyPlan`` exists for the\nuser, creates a ``trigger=\"pending\"`` placeholder and enqueues a\nbackground generation \u2014 the response comes back immediately with\n``plan_trigger=\"pending\"`` so the client can poll until the real plan\nis ready. Concurrent calls while pending do not re-enqueue: the\nplaceholder short-circuits the ``current_plan is None`` check.",
        "operationId": "get_week_view_user_states_week_get",
        "parameters": [
          {
            "in": "query",
            "name": "latitude",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Latitude"
            }
          },
          {
            "in": "query",
            "name": "longitude",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Longitude"
            }
          },
          {
            "in": "query",
            "name": "timezone",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Timezone"
            }
          },
          {
            "in": "query",
            "name": "now_iso",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Now Iso"
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          },
          {
            "in": "header",
            "name": "accept-language",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Accept-Language"
            }
          },
          {
            "in": "header",
            "name": "x-device-timezone",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Device-Timezone"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Get Week View User States Week Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Week View"
      }
    },
    "/users": {
      "post": {
        "operationId": "create_user_users_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Create User Users Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create User"
      }
    },
    "/users/me": {
      "get": {
        "operationId": "get_current_user_users_me_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Get Current User Users Me Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Current User"
      }
    },
    "/users/{user_id}": {
      "get": {
        "operationId": "get_user_users__user_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Get User Users  User Id  Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get User"
      }
    },
    "/users/{user_id}/active_event": {
      "get": {
        "description": "Get the user's closest-by-date active or planned event.\n\nBack-compat surface for old mobile builds \u2014 always returns exactly one\nevent. New clients should call ``GET /user_events`` for the full\ncalendar.",
        "operationId": "get_active_user_event_users__user_id__active_event_get",
        "parameters": [
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Get Active User Event Users  User Id  Active Event Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Active User Event"
      }
    },
    "/users/{user_id}/profile": {
      "get": {
        "operationId": "get_user_profile_users__user_id__profile_get",
        "parameters": [
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Get User Profile Users  User Id  Profile Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get User Profile"
      }
    },
    "/users/{user_id}/send-silent": {
      "post": {
        "description": "Debug endpoint to trigger silent push.",
        "operationId": "send_silent_push_debug_users__user_id__send_silent_post",
        "parameters": [
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "title": "User Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Send Silent Push Debug Users  User Id  Send Silent Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Send Silent Push Debug"
      }
    },
    "/users_profiles/{profile_id}": {
      "patch": {
        "operationId": "patch_user_profile_users_profiles__profile_id__patch",
        "parameters": [
          {
            "in": "path",
            "name": "profile_id",
            "required": true,
            "schema": {
              "title": "Profile Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserProfileUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Patch User Profile Users Profiles  Profile Id  Patch",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Patch User Profile"
      }
    },
    "/whatsapp_associations": {
      "post": {
        "description": "Bind the channel identity from the token to the authenticated user.\n\nMounted on both ``POST /channel_associations`` (canonical, #858) and\n``POST /whatsapp_associations`` (legacy alias kept so the existing\nmobile client keeps working without a coordinated release). Both routes\nshare this handler; the channel is resolved from the token's\n:class:`ChannelAssociationRequest` row.",
        "operationId": "confirm_channel_association_whatsapp_associations_post",
        "parameters": [
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChannelAssociationConfirmRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Confirm Channel Association Whatsapp Associations Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Confirm Channel Association"
      }
    },
    "/whatsapp_webhooks": {
      "post": {
        "description": "Parse the WhatsApp multipart, build a channel-blind ``InboundMessage``,\nand dispatch to the generic core.\n\nMultipart contract (#810, #814): ``payload`` is the JSON-encoded\n``WhatsAppWebhookRequest`` body; ``audio``, ``image``, and ``document``\nare mutually-exclusive optional file fields. At least one of\n``text``/``audio``/``image``/``document`` must be present.\n\nReturns 200 after the durable turn is enqueued; the coach run or invite\nsend happens in the channel worker.",
        "operationId": "whatsapp_webhook_whatsapp_webhooks_post",
        "parameters": [
          {
            "in": "header",
            "name": "x-whatsapp-bridge-token",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Whatsapp-Bridge-Token"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_whatsapp_webhook_whatsapp_webhooks_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Whatsapp Webhook Whatsapp Webhooks Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Whatsapp Webhook"
      }
    }
  },
  "servers": [
    {
      "url": "/"
    }
  ]
}
