A beginner's guide
Explore Plans
Mobile menu Close menu
iOS HealthiOS Health

Log sleep

This action logs sleep to your iPhone's Health app.

About this action

Triggers, queries, and actions are the building blocks of Applets. Triggers tell an Applet to start, queries ask a question, and actions are its end result.

Developer info

Description
This action logs sleep to your iPhone's Health app.
API endpoint slug
ios_health.log_sleep
Filter code method
IosHealth.logSleep.skip(string?: reason)
Runtime method
runAction("ios_health.log_sleep", {})

Action fields

Sleep duration Text input > Other

Label
Duration of sleep
Helper text
e.g. "1 hour" or "90 minutes"
Slug
sleep_duration
Required
false
Can have default value
true
Filter code method
IosHealth.logSleep.setSleepDuration(string: sleepDuration)

Asleep at Text input > Other

Label
Date and time sleep started
Helper text
e.g. "Today at 9pm" or "In two hours" or "06/21/2017"
Slug
asleep_at
Required
true
Can have default value
true
Filter code method
IosHealth.logSleep.setAsleepAt(string: asleepAt)

Date sleep ended Text input > Other

Label
Date and time sleep ended
Helper text
Optional e.g. "Tomorrow at 9am" or "In eight hours" or "06/22/2017"
Slug
date_sleep_ended
Required
false
Can have default value
true
Filter code method
IosHealth.logSleep.setDateSleepEnded(string: dateSleepEnded)