Rune Labs Stream API
Rune Labs Stream API
The V1 stream API is now longer supported aside from the /v1/session endpoint (see below).
section/Overview Overview
section/Overview/Key-Concepts 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.
section/Overview/Authentication 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 IDX-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
- Log in to the Rune web app
- Click on the profile icon in the top right corner.
- Click on User Settings.
- On the left sidebar, click on Access Tokens.
- Click CREATE ACCESS TOKEN.
- 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 IDX-Rune-Client-Access-Key- client access key (secret)
Note that each client may only fetch data for its associated patient.
Register a New Client
- Log in to the Rune web app as an admin user.
- Find the patient you want to access data for, and open Patient Settings.
- Open the Clients section.
- Create a new client. You can name it anything, though typically it is named after your app.
- 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).
tag/v1session 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 to 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.
tag/v1session/paths/1v11session/get 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
200 Successful request
400 Bad request
401 Not authorized to perform the request
404 Not found
429 Client IP throttled
500 Internal server error
503 Service unavailable
get/v1/session
https://stream.runelabs.io/v1/session
Response samples
- 400
- 401
- 404
- 500
Content type
application/json
{"success": false,
"error": {"message": "string",
"type": "string"
},
"result": null
}