# Does Apple Health have an API?

Source: https://healthsql.app/apple-health-api · Updated 2026-11-30

Only on the device: HealthKit is Apple's API for Health data, and it works inside apps on iPhone, iPad, Apple Watch and Vision Pro, with the person's permission for each type of data. There is no web or cloud API for Health data, and on a Mac, HealthKit cannot read it (Apple developer documentation, as of November 2026).

So any program off the phone, such as a script, a server or an AI agent on your computer, gets Health data only through an iPhone app that sends it out. HealthSQL is an iPhone app and a command-line tool that copy your whole Apple Health record into a local SQLite database on your computer, so AI agents can query it with SQL or MCP. That makes a local API out of your own record: SQL from a shell, or two MCP tools.

## What HealthKit is

- **An on-device framework.** Apple: "The user's device stores all HealthKit data locally." ([Protecting user privacy](https://developer.apple.com/documentation/healthkit/protecting-user-privacy))
- **Available on iOS, watchOS and visionOS**, and on iPads with iPadOS 17 or later. On macOS the framework exists, but an app "can't read or write HealthKit data." ([isHealthDataAvailable](https://developer.apple.com/documentation/healthkit/hkhealthstore/ishealthdataavailable()))
- **Locked when the phone is locked.** The device encrypts the Health store when the user locks it, so an app may not be able to read it in the background. ([Protecting user privacy](https://developer.apple.com/documentation/healthkit/protecting-user-privacy))
- **Permission by type.** The person chooses which types each app may read. On iOS 27 they can also limit an app to the past 30 days ([getEarliestAuthorizedSampleDate](https://developer.apple.com/documentation/healthkit/hkhealthstore/getearliestauthorizedsampledate(for:completion:))).

## Which route fits what you need

| You want | Route |
|---|---|
| Your own data, for your AI agents or SQL on your Mac | An iPhone app that exports it to you, such as HealthSQL: local SQLite, SQL and MCP |
| A one-time look at your whole history | Health's Export All Health Data, an XML file ([Apple](https://support.apple.com/guide/iphone/share-your-health-data-iph5ede58c3d/ios)) |
| Health data from many users, in your own product | Your own iOS app with HealthKit, or a health-data company's SDK inside it. Terra, for one, starts at $399 a month on a yearly plan ([pricing](https://tryterra.co/pricing), November 2026) |

## HealthSQL as your local Health API

After [setup](https://healthsql.app/setup), these are the calls:

```sh
healthsql                              # what the database holds: views, columns, metrics, date ranges
healthsql query "SELECT ..."           # rows as JSON, read-only, at most 2000
healthsql status                       # is the feed alive, and what clears it if not
healthsql mcp                          # the same, as an MCP server over stdio
```

A query answers in JSON:

```json
{"rows": [{"day": "2026-11-29", "steps": 8412.0, "resting_hr": 58.0}], "truncated": false, "phone_synced": "2026-11-30T07:41:09-08:00"}
```

The numbers above are made up. `phone_synced` is when the iPhone last exported; when something is wrong, the answer adds a `problem` line with the act that clears it. The views and columns are in the [schema reference](https://healthsql.app/docs/schema); the MCP tools in the [MCP guide](https://healthsql.app/mcp).

## Questions

### Is there an Apple Health REST API?

Not from Apple. Some third-party apps upload your Health data to their servers and offer a REST API there. HealthSQL has no server and no REST API; its API is the command and the MCP server on your own Mac.

### Can I read Apple Health from a Mac app?

No. On macOS, HealthKit is present but cannot read or write Health data ([Apple](https://developer.apple.com/documentation/healthkit/hkhealthstore/ishealthdataavailable())). A Mac app has to get the data from an iPhone app.

### Can I write to Apple Health through HealthSQL?

No. HealthSQL only reads. Nothing is written back to Apple Health.

### Do ChatGPT and Claude have an Apple Health API?

No. Both connect to Apple Health inside their own apps, for US users, and their help pages mention no API or MCP server for other programs, as of November 2026 ([details](https://healthsql.app/blog/chatgpt-health-claude-apple-health-limits)).
