Initiate an ECG signal stream
const url = 'https://api.cardio.ai/v3/streams/start';const options = { method: 'POST', headers: {'X-Api-Token': '<X-Api-Token>', 'Content-Type': 'application/json'}, body: '{"task_id":1,"device_id":"example","processing_mode":"PROCESS_ON_FINISH","frame_format":"COMPRESSED_DELTA","sample_rate":1,"lead_codes":["MDC_ECG_LEAD_I"],"digital_minimum":1,"digital_maximum":1,"physical_minimum":1,"physical_maximum":1,"device_state":"WAITING_FOR_START","total_frames":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.cardio.ai/v3/streams/start \ --header 'Content-Type: application/json' \ --header 'X-Api-Token: <X-Api-Token>' \ --data '{ "task_id": 1, "device_id": "example", "processing_mode": "PROCESS_ON_FINISH", "frame_format": "COMPRESSED_DELTA", "sample_rate": 1, "lead_codes": [ "MDC_ECG_LEAD_I" ], "digital_minimum": 1, "digital_maximum": 1, "physical_minimum": 1, "physical_maximum": 1, "device_state": "WAITING_FOR_START", "total_frames": 1 }'Opens a real-time channel that ingests framed ECG samples from a device. A stream is bound to an existing analysis task for its whole lifetime and inherits all access rules of that task.
Optional scaling parameters
Include all four scaling fields to enable backend linear conversion from raw ADC values to millivolts:
physical = (digital - digital_minimum) *
(physical_maximum - physical_minimum) /
(digital_maximum - digital_minimum) +
physical_minimum
If any scaling field is missing, the backend assumes samples are already expressed in millivolts.
Frame format: COMPRESSED_DELTA
COMPRESSED_DELTA is a compact binary container for multi-channel bio-signals. See the Compressed Delta specification for format details.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”Start stream request.
Request payload for starting a stream attached to the specified analysis task.
object
ID of an existing analysis task to which the stream will be attached. Either task_id or device_id must be provided.
Device identifier used to select the latest waiting task if task_id is omitted.
Mode for processing the stream data.
Format for the stream data frames.
Sampling rate in hertz.
Ordered ECG lead descriptors. The array length must equal the number of channels in each data frame.
Raw ADC value that corresponds to physical_minimum.
Raw ADC value that corresponds to physical_maximum.
Signal value in millivolts that corresponds to digital_minimum.
Signal value in millivolts that corresponds to digital_maximum.
Device state indicator for display in the UI.
Total number of frames expected to be streamed.
Request payload for starting a stream by device identifier. The stream is attached to the device’s most recent analysis task.
object
ID of an existing analysis task to which the stream will be attached. Either task_id or device_id must be provided.
Device identifier used to select the latest waiting task if task_id is omitted.
Mode for processing the stream data.
Format for the stream data frames.
Sampling rate in hertz.
Ordered ECG lead descriptors. The array length must equal the number of channels in each data frame.
Raw ADC value that corresponds to physical_minimum.
Raw ADC value that corresponds to physical_maximum.
Signal value in millivolts that corresponds to digital_minimum.
Signal value in millivolts that corresponds to digital_maximum.
Device state indicator for display in the UI.
Total number of frames expected to be streamed.
Responses
Section titled “ Responses ”Successful response containing the initiated stream ID.
Response payload for an initiated stream.
object
Unique identifier for the initiated stream.
Example generated
{ "stream_id": 1}Bad Request - missing or invalid parameters.
Example generated
exampleUnauthorized - missing, expired, or invalid token.
Example generated
exampleForbidden - the provided token is not authorized to call this endpoint.
Example generated
exampleConflict - current resource state does not allow the operation.
Example generated
exampleUnsupported Media Type - Content-Type must be application/json.
Example generated
exampleToo Many Requests - rate limit exceeded.
Example generated
example