Rune Labs Stream API

The V1 stream API is now longer supported aside from the /v1/session endpoint (see below).

Overview

Key Concepts

Throughout this document, the following terminology is used:

  • Patient refers to the user of a patient-facing app.
  • Client refers to the patient-facing app itself. A client accesses data programmatically, on behalf of a patient.
  • Device refers to the sensor serving as the datasource, such as a patient implant, phone, or wearable.

A client is associated with exactly one patient. Patients may have multiple clients, depending on how many apps are sending or accessing data. Patients and clients are resources in the Rune platform with unique identifiers, and they are used to control access to patient data.

Authentication

Authentication is required for all API requests. There are several authentication methods:

  • Access tokens (recommended)
  • Client keys

Both the access tokens and the client keys are comprised of two parts: a key ID and an access key. These are analagous to a username and password. Usage is described in detail below.

Access Tokens

Access tokens provide read access to all the patients in your organization. This is the recommended authentication method for the Stream API.

To use an access token for authentication, the HTTP request must include two headers:

  • X-Rune-User-Access-Token-Id - access token ID
  • X-Rune-User-Access-Token-Secret - access token secret

It is highly recommended that you "rotate" user access tokens every 3-6 months, by creating a new token and deactivating the old one. Store your access tokens securely, and do not share them.

Create a New Access Token

  1. Log in to the Rune web app
  2. Click on the profile icon in the top right corner.
  3. Click on User Settings.
  4. On the left sidebar, click on Access Tokens.
  5. Click CREATE ACCESS TOKEN.
  6. Copy the token ID and the token secret before closing the page. The secret will never be shown again.

Client Keys

Client keys provide read and write access to one patient.

To use a client key pair for authentication, the HTTP request must include two headers:

  • X-Rune-Client-Key-Id - client key ID
  • X-Rune-Client-Access-Key - client access key (secret)

Note that each client may only fetch data for its associated patient.

Register a New Client

  1. Log in to the Rune web app as an admin user.
  2. Find the patient you want to access data for, and open Patient Settings.
  3. Open the Clients section.
  4. Create a new client. You can name it anything, though typically it is named after your app.
  5. A default client key pair will be created with the new client. Copy the key ID and the access key before closing the page. The access key will never be shown again.

Create New Client Keys

You can create any number of client keys for a given client, through the Rune web app. If you forget a key, you can always create a new key pair and disable the old.

It is highly recommended that you "rotate" keys for a patient every 3-6 months, by creating a new client key, configuring it in the client (e.g. the patient's app), then disabling the old key. You should do this immediately if you believe the key may have been compromised (e.g. stolen from the device, posted over any insecure/public communication channel, etc).

Session

Fetch raw data that was uploaded to the Rune Platform.

To use this endpoint, you will need a dataset ID, which is generated by the Rune Data API on upload. Rune’s GraphQL API can be used to find dataset IDs for a given patient.

A dataset may be composed of several streams (files). Each request to this endpoint returns one stream: you may need to make multiple requests to download an entire dataset.

Note that unlike other Stream API endpoints, this endpoint returns the raw binary of the original data. It does not have a standard JSON or CSV structure.

The typical use for this endpoint is download a raw dataset into local storage. This is not the optimal way to download entire archives. If for any reason you need to export all data for all your patients, please contact support@runelabs.io, and our team will provide you with a copy of the raw data in a more efficient way.

Session

query Parameters
session_id
required
string
Example: session_id=dataset-37a2a3dc70c825d9ed1dc5bfcc3137b7c63c84f42c89b075975fb99bfb81c105

The dataset ID to download.

Confusingly, this is NOT the session_id that is provided in the client request to the Data Upload API.

stream_name
required
string
Example: stream_name=metadata

The name of the specific stream to download from the dataset. Stream names vary, according to the schema of the dataset.

Responses

Response samples

Content type
application/json
{
  • "success": false,
  • "error": {
    },
  • "result": null
}