Health

Ingest a batch of health-platform samples for the current user (Apple HealthKit / Google Health Connect). Stores in health_samples, upserts sync anchors and device-connection rows, invalidates the capabilities cache. Up to 500 samples per request — clients paginate larger backfills. Premium-only.

post/api/health/sync

Request

  • Base URL
    https://api.rewritelifestyle.ai (the document declares no server; this is the origin it was published from)
  • URL
    https://api.rewritelifestyle.ai/api/health/sync
  • Auth
    HTTP bearer

Request body

platform'apple_health' | 'health_connect' required
preferred_sourcesobject

Platform-resolved preferred source per sample type. Key = sample_type (e.g. "steps"), value = source_bundle_id the platform considers authoritative (e.g. "com.apple.health.9B9B995F-..."). When present, the backend records these in user_source_preferences so all aggregate queries (step totals, HRV, sleep) return the same numbers the user sees in Apple Health / Google Fit. Omit types for which the platform has no clear preference.

Example request

{
  "preferred_sources": {
    "steps": "com.apple.health.9B9B995F-8827-4CC1-BDF5-4D8E9BCE948A",
    "heart_rate": "com.apple.health.9B9B995F-8827-4CC1-BDF5-4D8E9BCE948A",
    "weight": "com.yolanda.fitindex"
  }
}

Changes

No recorded changes to this operation across all 34 revisions of this API.