07-04-2017 17:36
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-04-2017 17:36
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Hi,
I am using the new v1.2 sleep API, and have noticed that when requesting sleep logs by date range, the isMainSleep attribute is missing from the returned sleep logs. The API reference - https://dev.fitbit.com/docs/sleep/#get-sleep-logs-by-date-range shows that the field should be there, and states that the endpoint "returns a list of a user's sleep log entries (including naps)", so it is not clear which entries are naps. When requesting logs for a single date, the field is present.
Could you please explain the discrepancy between the reference and the data returned, and how we should differentiate between naps and main sleep when retrieving data over a range?
Thanks
07-07-2017 08:06
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



07-07-2017 08:06
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
@sleepster Thanks for pointing this out. I'll pass it along to get it clarified.
01-18-2018 11:33
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-18-2018 11:33
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Hey @AndrewFitbit,
I can see that this has been reported quite a long time ago. Unfortunately, as of today this still seems to be the case. Could you please provide an update about the state of this issue?
01-18-2018 14:40
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-18-2018 14:40
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Just to add more information -- this field is missing for all date range results. I initially thought it was only missing for days with only one sleep (i.e., days where it's obvious what the main sleep is), but it's also missing for days with multiple sleep intervals. This is clearly a bug, not a feature. Please fix. It's amazing that this was flagged up 6 months ago and still has not been addressed. And not the good kind of amazing 😉

01-18-2018 23:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-18-2018 23:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-24-2018 13:32
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-24-2018 13:32
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
@AndrewFitbit any updates on this?
09-05-2019 00:38
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

09-05-2019 00:38
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Same situation after more than 2 years.

09-09-2019 01:25
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



09-09-2019 01:25
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I'm not sure when it was added, but I see isMainSleep is returned by the sleep API. When I execute
https://api.fitbit.com/1.2/user/-/sleep/date/2019-09-09.json
I get the following output
Would you please provide me the endpoint you're executing where you do not see isMainSleep returned?
Thanks!
Gordon
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google

09-09-2019 03:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

09-09-2019 03:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Hi Gordon,
The issue is only present when you request the sleep logs by date range. When requesting logs for a single date, the field is present.
09-09-2019 08:44
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

09-09-2019 08:44
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
As stated in the original question from 2+ years ago:
"When requesting logs for a single date, the field is present."

09-10-2019 02:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

09-10-2019 02:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
isMainSleep dissapears from the output when a daterange is requested (for example, https://api.fitbit.com/1.2/user/-/sleep/date/2019-09-09/2019-09-11.json) instead of a single day, as you posted.

09-13-2019 09:48 - edited 09-13-2019 09:49
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



09-13-2019 09:48 - edited 09-13-2019 09:49
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
@salvadormoreno Thanks for following up on this topic. Our team is looking into it as we speak and I'll provide you with an update once I have it.
I appreciate your patience so far, please let me know if you have any additional questions in the meantime.

09-27-2019 13:57
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



09-27-2019 13:57
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
@sleepster @salvadormoreno Thank you for all your patience. Our team has confirmed that the isMainSleep attribute was re-added to the Get Sleep by date range endpoint. Please go ahead and query the endpoint and let me know if you are still not seeing it.

