# Household Sleep-Wake Times Data This endpoint retrieves the timezone of the user from the network model and supplies it to the micro service. The micro service will return hour values for wake and sleep in the network's timezone. Endpoint: GET /sleep_times/data/{queried_days} Security: Authorization ## Path parameters: - `queried_days` (integer, required) can be omitted. when omitted defaults to ## Query parameters: - `force_past` (boolean) Specifically for QA and load validation, this switch if set to true force allows a request sleep data to query the full 7 days back despite the enable time being later than this. The number of queried days will be respected in the path param ## Response 200 fields (application/json): - `avg_sleep_time_s` (integer) Example: 82380 - `avg_wake_time_s` (integer) Example: 23280 - `average_interruptions` (number) - `duration_avg_s` (integer) Example: 27900 - `queried_days` (integer) the number of days actually queried to the insights micro-service Example: 6 - `motion_state` (object) the // or // history of the network Example: {"data":[0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"from_ts":1618243200,"bucket":3600} - `motion_state.data` (array) hourly unarmed/armed or home/away state. meaning unarmed (home) meaning armed (away) starting from the hour equivalent to the number of queried days from now (UTC) to the last completed hour. The start can be limited to the last completed hour from when sleep settings were enabled if the enabling of sleep settings was more recent than the number of queried days. Example: [0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] - `motion_state.from_ts` (integer) the UTC timestamp from which the motion_state hourly data begins Example: 1618243200 - `motion_state.bucket` (integer) the resolution of motion state. is hourly Example: 3600 - `data` (array) the array of days queried, length of array will match queried number of days Example: [{"house_day":18729,"sleep_ts":1618266600,"sleep_weight":0.923879533,"wake_ts":1618286400,"wake_weight":0.965925826},{"house_day":18730,"sleep_ts":1618353900,"sleep_weight":0.896872742,"wake_ts":1618372800,"wake_weight":0.965925826},{"house_day":18731,"sleep_ts":1618440300,"sleep_weight":0.896872742,"wake_ts":1618476300,"wake_weight":0.555570233},{"house_day":18732,"sleep_ts":1618517700,"sleep_weight":0.98078528,"wake_ts":1618545600,"wake_weight":0.965925826},{"house_day":18734,"sleep_ts":1618687800,"sleep_weight":0.923879533,"wake_ts":1618711200,"wake_weight":0.707106781},{"house_day":18735,"sleep_ts":1618766100,"sleep_weight":0.555570233,"wake_ts":1618807500,"wake_weight":0.997858923}] - `data.house_day` (integer) day count from the unix epoch - `data.sleep_ts` (integer) sleep timestamp in UTC (seconds) - `data.sleep_weight` (number) the certainty that that the user supplied sleep time matches the data - `data.wake_ts` (integer) wake timestamp in UTC (seconds) - `data.wake_weight` (number) weight of certainty that that the user supplied wake time matches the data - `data.sleep_interruptions` (number) binary response if you were interrupted or not ## Response 422 fields (application/json): - `error` (string) response when sleep data is queried by the user has not yet initialized sleep settings with a valid request to Example: "you must first create a sleep setting"