Claude + Local API

Apple Health + Claude (via a Local API)

Claude can reason extremely well—but it can’t (and shouldn’t) ingest your full Apple Health export. Query the exact metric slice locally, then send a compact result for analysis.

Export → AirDrop → Analyze with Claude, ChatGPT, or any AI.

Prerequisite: you must install the Mac app (it hosts the local API on your machine). No Mac app → no API.

  • Base URL: http://127.0.0.1:8765
  • Auth header (most routes): X-Health-Analyzer-Token: <token>
  • Token file path: returned by GET /status

Docs: Apple Health Local API · Hub: Apple Health + AI · Compare: AI health analysis tools

What Claude is great at (once it has the right slice)

According to Anthropic's Claude documentation, Claude supports up to a 200K-token context window. That makes Claude strong for summarizing trends and planning follow-up questions, but the best Apple Health workflow is still to send a focused slice instead of a raw export.

Quickstart

  1. Confirm the app is running: GET http://127.0.0.1:8765/status
  2. Read the token file path from /status, load the token
  3. Call a summary endpoint with X-Health-Analyzer-Token
  4. Paste the JSON into Claude (or wire it up via tools/function calling)

Example Claude prompts (copy/paste)

According to Anthropic's Claude documentation, Claude's 200K-token context window is large enough for compact summaries, not a reason to paste years of noisy HealthKit records. Use prompts that ask for deltas, confidence, and the next API query.

Prompt 1 — Weekly review

Analyze the JSON below for the last 30 days.

1) 5-bullet executive summary
2) Biggest week-over-week deltas
3) 2 hypotheses for what caused the change
4) The next 3 API queries I should run (endpoint + date range)

Return concise bullet points.

Prompt 2 — Recovery signal check

Based on these heart-rate trends and sleep summaries:

- Do you see signs of overreaching, stress, or illness?
- What signals are most predictive here?
- What would you track next to increase confidence?

Be explicit about confidence and alternative explanations.

Example API calls (minimal data in)

Discover metrics:

curl -s \
  -H "X-Health-Analyzer-Token: $TOKEN" \
  "http://127.0.0.1:8765/metrics"

Sleep summary (date range):

curl -s \
  -H "X-Health-Analyzer-Token: $TOKEN" \
  "http://127.0.0.1:8765/sleep/summary?start=2026-02-25&end=2026-03-27"

Heart-rate trends (date range):

curl -s \
  -H "X-Health-Analyzer-Token: $TOKEN" \
  "http://127.0.0.1:8765/heart-rate/trends?start=2026-02-25&end=2026-03-27"

Privacy & security notes

According to IETF RFC 1122, the 127.0.0.0/8 address block is reserved for host loopback. In practical terms, the local API stays on your Mac unless you choose to copy a summarized payload into Claude.

Compatibility routes

Compatibility endpoints also exist under /health/*, for example /health/sleep and /health/workouts.

Ready to query your data?

Start with the Local API docs, then build your Claude workflow.