Integration Guide

Build a complete Helios integration from recording to results.
View as Markdown

This guide covers everything required to build a production-ready Helios integration — user data, recording requirements, data deletion, tagging, and error handling. If you have not yet made your first Helios API call, start with the Quickstart.

Architecture

A Helios integration has three components:

  1. Your backend — creates model runs, handles recording uploads, and polls for results via the thymia API. Your API key must never be exposed in client-side code.
  2. Your frontend — captures audio from your users and passes it to your backend for upload, or embeds the thymia Widget to handle capture directly.
  3. thymia API — processes the recording and returns biomarker scores.

How your frontend and backend communicate is specific to your infrastructure. The thymia API is called exclusively from your backend.

User data

Every model run requires a user object containing three fields. This data is used to benchmark results against a matched population — accuracy is directly affected by the quality of information supplied.

FieldTypeDescription
userLabelstringA unique identifier for the user in your system. Max 50 characters. Model runs with the same userLabel are assumed to refer to the same individual.
dateOfBirthdateISO 8601 date. If day or month are unknown, supply the known parts and use 01 for the rest.
birthSexenumSex assigned at birth. Accepted values: MALE, FEMALE, INTERSEX, UNKNOWN.
POST
/v1/models/mental-wellness
1curl -X POST /v1/models/mental-wellness \
2 -H "x-api-key: <apiKey>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "user": {
6 "userLabel": "42baba59-fa4a-4a22-ba1c-2e4a88a3badb",
7 "dateOfBirth": "1990-08-24",
8 "birthSex": "MALE"
9 },
10 "language": "en-GB"
11}'

Language and accent

The language field specifies the language and dialect the user will be speaking. Choosing the most accurate code for your user improves transcription quality and benchmarking accuracy.

FieldTypeDescription
languageenumBCP 47 language code. Required.
accentenumAccent in addition to language. Optional. Accepted values: ID, NG, KE.

Recording requirements

RequirementValue
Minimum speech duration10 seconds
Maximum recording length3 minutes
Supported formatsFLAC, MP3, MP4, Ogg, WebM, WAV
Upload URL validity1 hour

The upload URL returned when creating a model run is valid for 1 hour. If the URL expires before the recording is uploaded, create a new model run.

Sleep and recording time

For more accurate results, you can optionally pass the user’s sleep and wake times alongside the time the recording was made:

FieldFormatDescription
sleepTimeISO 8601 datetime, no timezoneWhen the user fell asleep for their last main sleep
wakeTimeISO 8601 datetime, no timezoneWhen the user woke from their last main sleep
recordingTimeISO 8601 datetime, no timezoneWhen the recording was made
POST
/v1/models/mental-wellness
1curl -X POST /v1/models/mental-wellness \
2 -H "x-api-key: <apiKey>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "user": {
6 "userLabel": "42baba59-fa4a-4a22-ba1c-2e4a88a3badb",
7 "dateOfBirth": "1990-08-24",
8 "birthSex": "MALE"
9 },
10 "language": "en-GB"
11}'

Sleep and recording time fields should not include timezone information. They are assumed to be in the local timezone of the user at the time of recording.

Tagging model runs

Tags are name/value pairs you can attach to a model run for later identification and filtering.

ConstraintValue
Maximum tags per run20
Maximum tag name length40 characters
Maximum tag value length100 characters
Tag namesMust be unique per run
POST
/v1/models/mental-wellness
1curl -X POST /v1/models/mental-wellness \
2 -H "x-api-key: <apiKey>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "user": {
6 "userLabel": "42baba59-fa4a-4a22-ba1c-2e4a88a3badb",
7 "dateOfBirth": "1990-08-24",
8 "birthSex": "MALE"
9 },
10 "language": "en-GB"
11}'

Data deletion

FieldTypeDescription
deleteDatabooleanIf true, all data associated with the model run is deleted 12 hours after completion. Default: false.
dataToDeletearraySpecify which data types to delete. Currently supports RECORDINGS. If deleteData is true and dataToDelete is omitted, all data is deleted.
POST
/v1/models/mental-wellness
1curl -X POST /v1/models/mental-wellness \
2 -H "x-api-key: <apiKey>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "user": {
6 "userLabel": "42baba59-fa4a-4a22-ba1c-2e4a88a3badb",
7 "dateOfBirth": "1990-08-24",
8 "birthSex": "MALE"
9 },
10 "language": "en-GB"
11}'

thymia is GDPR and HIPAA compliant. For data processing agreements or privacy queries, contact support@thymia.ai.

Polling for results

After uploading the recording, poll GET /v1/models/mental-wellness/{model_run_id} until the status field is no longer RUNNING. We recommend polling every 3 seconds.

GET
/v1/models/mental-wellness/:model_run_id
1curl /v1/models/mental-wellness/model_run_id \
2 -H "x-api-key: <apiKey>" \
3 -H "Content-Type: application/json"
StatusAction
CREATEDRecording not yet uploaded. Check your upload completed successfully.
RUNNINGModel is processing. Continue polling.
COMPLETE_OKResults available in the results field.
COMPLETE_ERRORProcessing failed. Check errorCode and errorReason.

Error handling

If the model run completes with COMPLETE_ERROR, check the errorCode field to determine the cause and next action. See the Error Reference for the full list of error codes and recommended responses.

The most common errors in production are:

Error codeCauseRecommended action
ERR_RECORDING_TOO_SHORTRecording contained less than 10 seconds of speechAsk the user to speak for longer and submit a new model run
ERR_TRANSCRIPTION_FAILEDNo speech detected in the recordingCheck audio quality and resubmit
ERR_RECORDING_INVALID_FORMATUnsupported file formatConvert to a supported format and resubmit

Multi-region

RegionBase URL
Defaulthttps://api.thymia.ai
Canadahttps://ca.api.thymia.ai
United Stateshttps://us.api.thymia.ai

Contact support@thymia.ai to enable regional data storage for your account.

Next steps


Crown Commercial ServiceNHS DigitalISO 27001ISO 13485HIPAAGDPRCyber Essentials Certified