U-Sleep API

Overview

It is possible to access the U-Sleep services programmatically using the U-Sleep Web API. The API exposes a set of endpoints for controlling the Sleep Stager, such as setting a model, uploading files, fetching logs and downloading the predicted hypnogram.

The U-Sleep Web API allows for automated scoring of large collections of files without having to repeatedly step through the Sleep Stager. It is also possible to queue multiple prediction sessions concurrently.

Getting Access to the API
To request access to the API, please fill the API Access Request Form.

Terms
Any use of the U-Sleep Web API or Python bindings is subject to the Privacy Policy and Terms of Service .

Python Bindings
A preliminary set of Python bindings to the API are available here. The repository also contains an annotated example of how to use the Python bindings.

Sessions

When using the U-Sleep Web API it is possible to queue multiple prediction sessions concurrently (currently limited to 5 maximum concurrent sessions per user).

All /api/v1/sleep_stager/* endpoints accept the path parameter {session_name}, e.g., /api/v1/sleep_stager/default/set_model. Each session stores information on which model to use, what file to predict on and handles to output log- and hypnogram files. Note that the default session is used by the browser when accessing U-Sleep via the Sleep Stager.