Deep Link Automation
Create automations programmatically using URL schemes.
Last updated: February 5, 2026
Deep link automations allow you to create REST API automations programmatically using URL schemes. This is ideal for automation scripts, configuration management, or integrating with external systems that need to configure health data exports.
Overview
Deep link automations use a custom URL scheme to create and configure REST API automations without manually entering settings in the app. When you open a deep link URL, the app automatically creates a new automation with the specified configuration.
Use Cases:
- Programmatic automation setup from scripts or tools
- Bulk automation configuration
- Integration with configuration management systems
- Quick setup from external applications or websites
- Testing and development workflows
Key Features:
- Create automations via URL scheme
- Configure all REST API automation settings
- Type-safe parameter validation
- Comprehensive error messages
Limitations
- Deep links only support REST API automations (not Dropbox, Google Drive, etc.)
- URL length limits may restrict very long parameter lists
- All limitations from REST API automations apply (background processing, health data access, etc.)
URL Format
The deep link URL follows this structure:
com.HealthExport://automation?parameter1=value1¶meter2=value2&...
Base URL: com.HealthExport://automation
Parameters: All parameters are optional except name and url. Parameters are case-insensitive.
Parameter Reference
Required Parameters
url (required)
- Type: String (valid URL)
- Description: The endpoint URL where health data will be sent
- Example:
https://api.example.com/health-data - Note: Must be a valid HTTP/HTTPS URL
name (required)
- Type: String
- Description: A descriptive name for the automation
- Example:
My%20Backend%20API(URL-encoded: My Backend API") - Note: Must be URL-encoded if it contains spaces or special characters
Basic Configuration
format
- Type: Enum (
json,csv) - Default:
json - Description: Export format for the data
- Example:
format=jsonorformat=csv - Note: CSV format automatically enables data aggregation
enabled
- Type: Boolean (
true,false,1,0,yes,no) - Default:
false - Description: Whether the automation is enabled immediately after creation
- Example:
enabled=true
datatype
- Type: Enum (see Data Types below)
- Default:
healthMetrics - Description: Type of health data to export
- Example:
datatype=workouts - Note: Only one data type can be selected. Setting this automatically configures the appropriate include flags.
Valid Data Types:
healthMetrics- Health metrics (steps, heart rate, sleep, etc.)workouts- Exercise and fitness activitiessymptoms- Health symptoms and conditionsecg- Electrocardiogram readingsheartRateNotification- High/low heart rate eventsstateOfMind- Mood and mental state entries (iOS 18.0+)cycleTracking- Menstrual cycle and reproductive health datamedications- Medication logs and adherence (iOS 26.0+)
Export Settings
period
- Type: Enum
- Default:
none - Description: Date range for data export
- Example:
period=today
Valid Values:
none- Default (full previous day plus current day)lastsync- Since last synctoday- Current dayyesterday- Previous dayprevious7days- Previous 7 daysrealtime- Real-time updates (requires seconds sync interval)
interval
- Type: Enum
- Default:
none - Description: Time grouping/aggregation interval (only valid for healthMetrics data type)
- Example:
interval=hours
Valid Values:
none- Default (no aggregation)minutes- Group by minutehours- Group by hourdays- Group by dayweeks- Group by weekmonths- Group by monthyears- Group by year
Note: This parameter is only valid when datatype=healthMetrics. CSV format always aggregates data.
aggregatedata
- Type: Boolean
- Default:
true(for CSV),false(for JSON) - Description: Whether to aggregate/summarize data (only valid for healthMetrics with JSON format)
- Example:
aggregatedata=true - Note: Automatically set to
truewhenformat=csv
aggregatesleep
- Type: Boolean
- Default:
true - Description: Whether to aggregate sleep data
- Example:
aggregatesleep=true
exportversion
- Type: Enum (
v1,v2,1,2) - Default:
v2 - Description: Export format version
- Example:
exportversion=v2 - Note: Version 2 includes enhanced workout data and more detailed metadata
batchrequests
- Type: Boolean
- Default:
false - Description: Send data in batches over multiple requests (only valid for REST API with JSON format)
- Example:
batchrequests=true - Note: Only valid when
format=jsonandexportDestination=restApi
Sync Cadence
syncinterval
- Type: Enum
- Default:
minutes - Description: Interval for sync cadence
- Example:
syncinterval=hours
Valid Values:
minutes- Sync every N minuteshours- Sync every N hoursdays- Sync every N daysweeks- Sync every N weeksseconds- Only valid whenperiod=realtime
Note: For REST API automations, only minutes, hours, days, and weeks are valid unless using real-time export.
syncquantity
- Type: Integer (positive)
- Default:
5 - Description: Number of intervals between syncs
- Example:
syncquantity=10(sync every 10 minutes if syncinterval=minutes) - Note: Must be greater than 0
HTTP Configuration
headers
- Type: String (comma-separated key-value pairs)
- Default: None
- Description: HTTP headers for authentication or metadata
- Example:
headers=Authorization,Bearer%20token123,X-API-Key,abc123 - Format:
key1,value1,key2,value2,... - Note: Values should be URL-encoded. Each header requires both a key and value.
Example Headers:
Authorization, Bearer your-tokenX-API-Key, your-api-keyContent-Type, application/json
requesttimeout
- Type: Integer (60-86400)
- Default:
60 - Description: Request timeout in seconds
- Example:
requesttimeout=300 - Note: Must be between 60 and 86400 seconds (1 minute to 24 hours)
Data Type Specific Settings
Health Metrics Settings
metrics
- Type: String (comma-separated MetricName rawValues)
- Default: All available metrics
- Description: Specific health metrics to include (only valid for healthMetrics data type)
- Example:
metrics=Step%20Count,Heart%20Rate,Active%20Energy - Note: Must use exact MetricName rawValues. If not specified, all available metrics are included.
Common Metric Names:
Step CountHeart RateActive EnergyApple Exercise TimeSleep AnalysisWalking + Running Distance
See the app's metric selection screen for the complete list of available metrics.
Workout Settings
includeroutes
- Type: Boolean
- Default:
true - Description: Include route data for workouts (only valid for workouts data type)
- Example:
includeroutes=true
includeworkoutmetadata
- Type: Boolean
- Default:
true - Description: Include workout metrics (heart rate, calories, etc.) collected during workouts (only valid for workouts data type)
- Example:
includeworkoutmetadata=true
workoutsmetadatainterval
- Type: Enum (
minutes,seconds) - Default:
minutes - Description: Time grouping for workout metrics (only valid for workouts data type with exportVersion v2)
- Example:
workoutsmetadatainterval=seconds - Note: Only valid when
datatype=workoutsandexportversion=v2
workouttypes
- Type: String (comma-separated UInt values)
- Default: Empty (all workout types)
- Description: Specific workout types to include (only valid for workouts data type)
- Example:
workouttypes=1,2,3 - Note: Uses HealthKit workout type identifiers
Notifications
notifyonupdate
- Type: Boolean
- Default:
true - Description: Receive notifications when cached data is updated
- Example:
notifyonupdate=true
notifywhenrun
- Type: Boolean
- Default:
true - Description: Receive notifications each time the automation executes
- Example:
notifywhenrun=false
Examples
Basic REST API Automation
com.HealthExport://automation?url=https://api.example.com/health&name=My%20Automation&format=json&enabled=true
Creates a basic automation that sends JSON data to the specified endpoint.
With Authentication Headers
com.HealthExport://automation?url=https://api.example.com/health&name=Authenticated%20API&format=json&headers=Authorization,Bearer%20your-token-here,X-API-Key,abc123&enabled=true
Creates an automation with custom authentication headers.
Health Metrics with Specific Metrics
com.HealthExport://automation?url=https://api.example.com/metrics&name=Steps%20and%20Heart%20Rate&format=json&datatype=healthMetrics&metrics=Step%20Count,Heart%20Rate&aggregatedata=true&interval=hours&enabled=true
Creates an automation that exports only steps and heart rate, aggregated by hour.
Workouts with Route Data
com.HealthExport://automation?url=https://api.example.com/workouts&name=Workout%20Export&format=json&datatype=workouts&includeroutes=true&includeworkoutmetadata=true&exportversion=v2&workoutsmetadatainterval=minutes&enabled=true
Creates an automation for workouts with route data and workout metrics, using export version 2.
Complete Configuration Example
com.HealthExport://automation?url=https://api.example.com/health-data&name=Complete%20Configuration&format=json&datatype=healthMetrics&period=today&interval=hours&aggregatedata=true&aggregatesleep=true&exportversion=v2&syncinterval=hours&syncquantity=2&headers=Authorization,Bearer%20token123&requesttimeout=300&batchrequests=true¬ifyonupdate=true¬ifywhenrun=false&enabled=true
A comprehensive example with all major parameters configured.
CSV Format Example
com.HealthExport://automation?url=https://api.example.com/csv&name=CSV%20Export&format=csv&datatype=healthMetrics&period=yesterday&enabled=true
Creates a CSV export automation. Note that CSV format automatically enables data aggregation.
URL Encoding
Special characters in parameter values must be URL-encoded. Common encodings:
- Space:
%20 - Comma:
%2C - Colon:
%3A - Semicolon:
%3B - Equals:
%3D - Ampersand:
%26 - Plus:
%2B
Example:
- Original:
My Automation Name - Encoded:
My%20Automation%20Name
Headers Example:
- Original:
Authorization, Bearer token123 - Encoded:
Authorization,Bearer%20token123
Most programming languages and tools provide URL encoding functions:
- Swift:
addingPercentEncoding(withAllowedCharacters:) - JavaScript:
encodeURIComponent() - Python:
urllib.parse.quote()
Testing Deep Links
From Safari (iOS)
- Open Safari on your iOS device
- Enter the deep link URL in the address bar
- Tap Go
- The app should open and create the automation
From Terminal (macOS/iOS Simulator)
xcrun simctl openurl booted "com.HealthExport://automation?url=https://api.example.com/health&name=Test&enabled=true"
From Xcode
Add a breakpoint or use the debugger console:
let url = URL(string: "com.HealthExport://automation?url=https://api.example.com/health&name=Test&enabled=true")!
try DataModel.shared.handleAPIDeepLink(url)
From Shortcuts App
- Create a new shortcut
- Add "Open URLs" action
- Enter your deep link URL
- Run the shortcut
Troubleshooting
Common Issues
"Could not parse the URL"
- Verify the URL scheme is correct:
com.HealthExport://automation - Check that all parameter values are properly URL-encoded
- Ensure parameter names are spelled correctly (case-insensitive)
"Invalid URL parameter value"
- Verify the URL is a valid HTTP/HTTPS URL
- Check for proper URL encoding
- Ensure the URL doesn't contain invalid characters
"Invalid data type"
- Use exact data type values:
healthMetrics,workouts,symptoms,ecg,heartRateNotification,stateOfMind,cycleTracking,medications - Check spelling and case (though case-insensitive matching is supported)
"Invalid sync cadence interval"
- For REST API, use only:
minutes,hours,days,weeks - Use
secondsonly whenperiod=realtime
"Aggregation settings are only valid for healthMetrics data type"
aggregatedataandintervalparameters only work withdatatype=healthMetrics- Remove these parameters or change the data type
"Batch requests are only valid for REST API with JSON format"
batchrequestsonly works whenformat=json- Change format to JSON or remove the batchrequests parameter
"Workout settings are only valid for workouts data type"
includeroutes,includeworkoutmetadata, andworkoutsmetadataintervalonly work withdatatype=workouts- Change data type to workouts or remove these parameters
"Metrics parameter is only valid for healthMetrics data type"
metricsparameter only works withdatatype=healthMetrics- Change data type or remove the metrics parameter
"Invalid metric name"
- Use exact MetricName rawValues (e.g., "Step Count", "Heart Rate")
- Check spelling and capitalization
- See the app's metric selection screen for valid names
"Invalid request timeout"
- Must be between 60 and 86400 seconds
- Use a value within this range
"A name is required for the automation"
- Ensure the
nameparameter is included - Check that the value is not empty after URL decoding
URL Length Limitations
Very long URLs (especially with many metrics or headers) may exceed system limits. Consider:
- Using fewer metrics in the
metricsparameter - Reducing the number of headers
- Using shorter parameter values where possible
- Splitting complex configurations into multiple simpler automations
Parameter Precedence
When multiple parameters conflict:
- Data type selection (
datatype) automatically resets include flags - CSV format (
format=csv) automatically setsaggregatedata=true - Real-time period (
period=realtime) requiressyncinterval=seconds - Validation errors will be thrown for incompatible combinations
Best Practices
- Always URL-encode parameter values containing special characters
- Test with simple URLs first, then add complexity
- Use descriptive names for easier identification
- Validate URLs before creating deep links programmatically
- Handle errors gracefully when parsing deep links
- Document your deep link formats if building tools that generate them
- Consider URL length when including many metrics or headers
- Test on actual devices as well as simulators
Related Documentation
- REST API Automation Guide - Detailed information about REST API automations
- Automations Overview - General automation concepts
- Manual Export Guide - How to manually export data
Support
If you encounter issues not covered in this guide:
- Check the error message for specific parameter issues
- Verify your URL encoding is correct
- Test with a minimal URL first
- Use the Chat Support button in the app for assistance