Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
FREEDOM251

Freedom251 › Blog › API

Apple Health Data API: Build a Selective Export with a Free Shortcut

By Freedom251 Team · · 11 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

Apple Health does not offer a general web API that lets an individual send the whole database to any service. Apple’s HealthKit framework is a real API, but it is restricted to apps with the required entitlements and the user’s permission. For a personal export, Apple’s free Shortcuts app is the practical bridge: it can find selected Health samples, filter them, reshape each record, and save or post the result. You can export steps, sleep, heart rate, workouts, or another supported type without building a native app. The shortcut runs on your Apple device, so it is an on-demand or scheduled exporter—not a permanently hosted server.

What API does Apple Health actually provide?

Apple provides HealthKit, an entitlement-controlled framework for apps running on Apple platforms, rather than an open internet endpoint for arbitrary services. An app must request access to each data type, and read permission is separate from write permission. Apple’s Platform Security documentation says that access to HealthKit is controlled with entitlements and that apps must follow restrictions on how the data is used.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

HealthKit is a native-app API

HealthKit acts as a central repository on Apple platforms. A properly signed iPhone or iPad app can query structured samples, request authorization, and write permitted data back to Health. The app still operates inside Apple’s privacy model: the user chooses what the app may read or write, and the developer must have the appropriate HealthKit capabilities.

Why there is no simple “Health data API key”

Health data is not exposed as a user-generated token that you can paste into a web service. A browser request or a server-side script cannot simply authenticate as your Health database. A native HealthKit app, or an on-device automation such as Shortcuts, has to run within Apple’s permission and entitlement controls. That distinction is why a personal integration can be possible without a public API being available.

#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter | 4Pack Type C Female to A Male Cable Converter for Apple Duo 17 16 15 14 Plus,iWatch Watch 12 11 10,iPad 9 8 Air,Airpods 5 4
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Can a free Shortcut export Health data to JSON or my own API?

Yes. Shortcuts can retrieve Health samples, pass them through actions, and hand the resulting text or file to a share sheet, local storage, or a web request. JSON is not Apple Health’s native export format; it is a format you design inside the shortcut by constructing dictionaries or text.

Apple’s Shortcuts guide lists Find Health Samples among the Find actions. The action can apply filters before it passes results to the next action. Shortcuts’ content flow lets output from one action become the input to the next, so a Health sample can be transformed and routed without a custom app.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What should you decide before building the shortcut?

Define a small data contract first. A clear contract prevents an accidental full-database export and makes every run predictable.

  • Health type: choose one type such as steps, sleep analysis, heart rate, or workouts. Different types expose different fields.
  • Date range: decide whether each run covers a day, a week, a month, or a moving window since the previous run.
  • Units: specify the unit your destination expects, such as count, beats per minute, or hours. Preserve the source unit when conversion is not required.
  • Record shape: select the fields you need, commonly a start timestamp, end timestamp, value, unit, source, and relevant metadata.
  • Destination: choose a file, the Share Sheet, or an HTTPS endpoint you control. Decide whether the destination expects one array, one object per request, or newline-delimited records.
  • Identity and duplicates: determine how your receiving system will identify a sample. A combination of type, start time, end time, value, and source can be useful, but the exact key is your system’s design.

How do I build the Health-to-JSON pipeline in Shortcuts?

Create the shortcut as a sequence of seven stages: query, normalize, serialize, deliver, authorize, handle volume, and trigger. The labels below use the current Shortcuts concepts; field names available for extraction vary by Health sample type.

1. Add Find Health Samples and constrain the query

  1. Open Shortcuts, tap + to create a shortcut, and choose Add Action.
  2. Search for Find Health Samples and add it.
  3. Tap the sample type field and choose the data type from your contract, such as Steps, Sleep Analysis, Heart Rate, or Workouts.
  4. Use the action’s filters to set a date condition. Add a source filter when you want readings from a particular device or app, and set a limit when you want to cap the result count.
  5. Run this stage once and inspect the returned content. A zero-result run usually means the type, dates, source, or permission does not match the data that exists on the device.

Filtering at the query stage is safer than retrieving everything and trying to discard records later. It also reduces the amount of sensitive information that travels through the rest of the shortcut.

2. Normalize every sample into the same record shape

Health types are not identical. A step sample may have a numeric quantity and unit, while a workout has a workout type, start and end times, duration, and additional statistics. Use Shortcuts’ content flow to extract the fields that exist for the selected type, then build a Dictionary for each record.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter | USB C Dongle with 90W Max Power Delivery, 3×5Gbps USB A Data Ports, for MacBook, Dell, and More (Charger Not Included)
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

A practical record can contain keys such as type, startDate, endDate, value, unit, and source. Add optional keys only when that sample type supplies them. Keep timestamps unambiguous by retaining the timezone or using a consistent ISO-style representation. Do not claim that every Health sample exposes every field; the exact extraction options depend on the type returned by Find Health Samples.

When Find Health Samples returns multiple items, use a repeat loop to process each item and append its dictionary to a list. The list is your stable intermediate structure, even if the final destination uses a different format.

3. Serialize the list as JSON-shaped text or a file

Shortcuts can pass a Dictionary or List directly to later actions, or you can convert the structure to text. If your endpoint accepts JSON, build a top-level dictionary or array with the keys your server expects and use the resulting text as the request body. If you need a handoff rather than an immediate upload, create a file and save it.

{
  "type": "heartRate",
  "startDate": "2026-10-26T08:15:00Z",
  "endDate": "2026-10-26T08:15:00Z",
  "value": 72,
  "unit": "count/min",
  "source": "device label"
}

The example shows a possible shape, not a value supplied by Apple. Your shortcut should generate the values from the Health sample and should use the field names and units your receiving system documents. Apple’s own Health export remains XML, so choosing JSON here is an integration decision rather than a native export option.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Save locally or post to an endpoint

For a local handoff, add Save File and choose a folder, or finish with the Share Sheet so you can send the file to another app. For a web service, add Get Contents of URL, enter the HTTPS endpoint you control, and configure the request method and body to match that service. Pass the serialized list or dictionary as the request content.

Keep the endpoint and transformation logic understandable. If the server needs authentication, prefer a controlled mechanism that does not expose a long-lived secret inside a shortcut you share with other people. A shortcut can contain its URL and logic, so anyone who receives the shared shortcut may be able to inspect those details.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter | 85W Max PD, 2 USB 3.0 & 1 USBC Data Ports, SD/TF Card Reader, for Laptops/Mac and Other Type C Devices (Charger Not Included)
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

5. Approve Health permissions deliberately

Shortcuts may ask for access when the Find Health Samples action first runs. Approve only the data type and access that the shortcut needs. Health permissions are granular; denying the requested type, or granting access to a different type than the one selected in the action, can produce an empty result.

Read and write permissions are separate in HealthKit. This shortcut needs read access to export samples. It does not need write access unless you deliberately add an action that records new Health data.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

6. Handle large payloads and limits

Broad date ranges and high-frequency measurements can create a large list. Apple provides the setting Settings > Shortcuts > Advanced > Allow Sharing Large Amounts of Data for situations in which a shortcut must pass a substantial amount of content between actions. Enabling it does not remove the need for sensible date and result-limit filters: the phone still has to assemble the data, and the receiving service may impose its own request-size limit.

For a large history, split the export into date windows and save an audit-friendly filename for each window. A smaller incremental run is usually easier to retry than one unbounded request.

7. Choose a trigger that matches the job

You can run the shortcut manually, place it on the Home Screen, assign it to an Action Button where supported, or invoke it from a personal automation. A scheduled trigger is useful for daily or weekly snapshots, while a manual run is safer when you are still validating fields and destination behavior.

Shortcuts is an on-device automation surface, not a continuously running server. A scheduled run depends on the device being available, the permissions remaining enabled, and the network and destination responding at that moment. Design the receiver to accept retries and to recognize records it has already processed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray | Data transfer & Fast charging for MacBook, iPhone 17/16/15, iPad, Samsung Galaxy, Apple Watch
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Which export method should I use?

Use Apple’s native export for a one-time, complete backup; use Shortcuts for a selective or repeatable transfer; and build a HealthKit app only when you need production software with deeper integration.

Path Best for Output and control Trade-off
Health app: Export All Health Data One-off complete backup XML snapshot of all available data Broad and potentially large; it is not a selective JSON endpoint
Shortcuts + Find Health Samples Selective or repeatable automation User-defined fields, filters, and destination You must design, secure, and maintain the shortcut
Native HealthKit app Production software and deeper integration Structured queries within Apple’s authorization model Requires app development, entitlements, and user permissions

To create the native backup, open the Health app, tap your profile picture, and choose Export All Health Data. Apple Support describes this export as all health and fitness data in XML format. The resulting archive should be treated as sensitive personal health information because it covers the full available dataset rather than the narrow selection in your shortcut.

What are the common failure modes and fixes?

Most problems come from permission mismatches, an overly broad query, or a destination that expects a different record shape.

Symptom Likely cause Fix
No records are returned Access was denied, the wrong Health type was selected, or the date/source filter excludes the samples Review the shortcut’s Health access, select the exact type, widen the date temporarily, and remove the source filter for a diagnostic run
Only some expected readings appear A result limit or source filter is narrowing the query Raise or remove the limit, then decide whether source-specific filtering is actually required
The shortcut stops while passing data The payload is large or the destination request exceeds its limit Enable Allow Sharing Large Amounts of Data, reduce the date window, and send several smaller files or requests
The server rejects the request Body format, field names, units, or authentication do not match the endpoint contract Compare the generated dictionary with the endpoint schema and test with one sample before scaling up
Duplicate records appear after a retry The receiver accepted the request but the shortcut did not receive a confirming response Give each record a deterministic identity and make the server’s import operation idempotent
A shared shortcut exposes sensitive details The shortcut includes an endpoint URL or transformation instructions Remove secrets, use a controlled endpoint, and share only a copy that cannot reveal credentials
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How should I protect exported Health data?

Minimize the data first, then protect every copy. A steps-only export for a defined week is less revealing than a full XML archive containing every available category.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Request only the Health type and date range required by the task.
  • Use HTTPS for a web destination and verify that the endpoint belongs to the intended service.
  • Keep authentication secrets out of a shared shortcut. If a service supports short-lived or server-side credentials, use that design instead of embedding a permanent token.
  • Store local files in a location with appropriate device and account protection, and delete temporary exports when they are no longer needed.
  • Document the unit and timezone in your receiving system so a later import cannot silently reinterpret values.
  • Review Health permissions periodically. Removing access stops future reads, but it does not automatically erase files or records that were already exported.

A native export and a shortcut export have different privacy scopes. The native XML archive is a complete snapshot; a shortcut can be deliberately narrow, but it is still sensitive whenever it includes dates, measurements, workouts, sleep, or device-source information.

Is a Shortcut suitable for a production data service?

It is suitable for personal workflows, prototypes, and user-triggered or scheduled snapshots. It is not a replacement for a hosted ingestion service that must run independently of a particular phone.

Best Value
Sale
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display | 85W Max PD, 1 Powered USB-C 5Gbps & 2 Powered USB-A 3.0 5Gbps Data Ports, for MacBook Pro, MacBook Air, Dell and More (Black)
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

For a production product, a native HealthKit app can provide structured queries and a user-facing authorization flow, subject to Apple’s entitlements and data-use restrictions. A Shortcut can still be useful as a lightweight bridge when the user owns the device and accepts on-device execution, but reliability will depend on the phone, permissions, network, and destination at each run.

What is the practical verdict?

Apple’s Health app gives you a complete XML export, not a selective JSON API. HealthKit is the formal API for entitled native apps. If you need selected steps, sleep, heart-rate, or workout samples sent to your own file store or endpoint without writing an app, build a Shortcuts pipeline with strict filters, normalized records, controlled permissions, and retry-safe delivery.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Can I export only one day of Apple Health data?

Yes. Set the Find Health Samples date filter to the day you need and choose a result limit appropriate for that type. A short window is also a useful diagnostic run before you attempt a larger export.

Does the shortcut preserve which device recorded a sample?

It can, when the returned sample exposes source information and you include that field while building each dictionary. If source attribution matters, test the selected Health type and keep the source key in your data contract rather than assuming every type exposes identical metadata.

Can I turn an existing XML Health export into JSON with Shortcuts?

Shortcuts is designed here to query Health samples directly, not to provide a guaranteed XML-to-JSON conversion for the complete archive. Converting the native archive is a separate file-processing task, and the resulting fields may not map cleanly to the narrower records your shortcut creates.

What happens if I revoke the shortcut’s Health permission?

Future runs may return no records or ask for authorization again, depending on the permission you changed. Previously saved files or records already sent to a destination are separate copies and must be removed from those locations independently.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

APIApple HealthAutomationdata exportHealthKitJSONShortcuts

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.