Dashboard Sign InKR

Function that delivers the analyzed results by calling the desired HTTP callback URL, if the parameter is entered in the upload and session end API at Session API, the analysis results will be delivered in the following format

Request

Method

POST

Header

FieldTypeDescription
x-api-keyStringAPI key used to upload data or end session
x-user-idStringThe user id that created the sleep session

Body

FieldTypeDescription
callback_eventString (INFERENCE_COMPLETE,SESSION_COMPLETE)Callback event type
INFERENCE_COMPLETE: If the analysis is completed within 5 or 40 minute increments
SESSION_COMPLETE: The entire session analysis is complete
callback_versionString
(V1,V2,V3)
Callback version
V1: Follows the callback format of v1.0 documentation
V2: Follows the callback format of v2.0
V3: Follows the callback format of the current version
callback_dataWebhook Data ObjectWebhook data

Callback Data Object in case of INFERENCE_COMPLETE

FieldTypeDescription
user_idStringuser id
session_idStringsession id
seq_numIntOrder number of the audio data uploaded
inference_seq_numIntNumber that converted seq_num into 5 minutes increments
e.g.) when uploading MELSPECTROGRAM, if seq_num 39, inference_seq_num is 3
stage_list[Int]Sleep stage results in previous 5 minutes frame
e.g.) if inference_seq_num is 6, you get back 40 values from 3 to 6
snoring_stages[Int]Snoring stage results in previous 5 minutes frame

{
    "event": "INFERENCE_COMPLETE",
    "version": "V3",
    "data": {
        "user_id": "G-20250115025029-vLErWBfQNtnfvgDccFOQ",
        "session_id": "20250115025029_fvivn",
        "seq_num": 39,
        "inference_seq_num": 3,
        "sleep_stages": [0], // omitted
        "breath_stages": null,
        "snoring_stages": [0] // omitted
    }
}

Webhook Data Object in case of SESSION_COMPLETE

FieldTypeDescription
dataSleep Data ObjectThe response format is the same as Get Session in the Data API, with the only difference being the addition of user_id.

{
    "event": "SESSION_COMPLETE",
    "version": "V3",
    "data": {
        "timezone": "UTC",
        "peculiarities": ["NO_BREATHING_STABILITY"],
        "missing_data_ratio": 0.0,
        "user_id": "G-20250115025029-vLErWBfQNtnfvgDccFOQ",
        "session": {
            "id": "20250115025029_fvivn",
            "state": "COMPLETE",
            "start_time": "2025-01-15T02:50:29+00:00",
            "end_time": "2025-01-15T03:50:29+00:00",
            "unexpected_end_time": null,
            "created_timezone": "UTC",
            "sleep_stages": [0], // omitted
            "breath_stages": null, 
            "snoring_stages": [0] // omitted
        },
        "stat": {
            "sleep_time": "2025-01-15T03:05:29+00:00",
            "wake_time": "2025-01-15T03:26:29+00:00",
            "sleep_index": 50,
            "sleep_latency": 900,
            "wakeup_latency": 1440,
            "light_latency": 0,
            "deep_latency": null,
            "rem_latency": null,
            "time_in_bed": 3600,
            "time_in_sleep_period": 1260,
            "time_in_sleep": 1080,
            "time_in_wake": 180,
            "time_in_light": 1080,
            "time_in_deep": 0,
            "time_in_rem": 0,
            "time_in_stable_breath": null,
            "time_in_unstable_breath": null,
            "time_in_snoring": 0,
            "time_in_no_snoring": 1260,
            "sleep_efficiency": 0.3,
            "sleep_ratio": 0.86,
            "wake_ratio": 0.14,
            "light_ratio": 0.86,
            "deep_ratio": 0.0,
            "rem_ratio": 0.0,
            "stable_breath_ratio": null,
            "unstable_breath_ratio": null,
            "snoring_ratio": 0.0,
            "no_snoring_ratio": 1.0,
            "breathing_index": null,
            "breathing_pattern": null,
            "waso_count": 1,
            "longest_waso": 180,
            "sleep_cycle_count": 0,
            "sleep_cycle": null,
            "sleep_cycle_time": [],
            "unstable_breath_count": null,
            "snoring_count": 0
        }
    }
}