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,"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, "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 Bodyrequired
Section titled “Request Bodyrequired”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.
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
Device identifier used to select the latest waiting task.
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.
Examplegenerated
{ "stream_id": 1}Bad Request - missing or invalid parameters.
Error payload carried by every non-2xx response.
object
Human-readable description of the failure. The wording is not part of the API contract; do not match on it programmatically.
Stable machine-readable failure code in snake_case, e.g. “api_token_missing” or “invalid_task_id”. Omitted for 500 responses.
Examplegenerated
{ "message": "example", "reason": "example"}Unauthorized - missing, expired, or invalid token.
Error payload carried by every non-2xx response.
object
Human-readable description of the failure. The wording is not part of the API contract; do not match on it programmatically.
Stable machine-readable failure code in snake_case, e.g. “api_token_missing” or “invalid_task_id”. Omitted for 500 responses.
Examplegenerated
{ "message": "example", "reason": "example"}Forbidden - the provided token is not authorized to call this endpoint.
Error payload carried by every non-2xx response.
object
Human-readable description of the failure. The wording is not part of the API contract; do not match on it programmatically.
Stable machine-readable failure code in snake_case, e.g. “api_token_missing” or “invalid_task_id”. Omitted for 500 responses.
Examplegenerated
{ "message": "example", "reason": "example"}Conflict - current resource state does not allow the operation.
Error payload carried by every non-2xx response.
object
Human-readable description of the failure. The wording is not part of the API contract; do not match on it programmatically.
Stable machine-readable failure code in snake_case, e.g. “api_token_missing” or “invalid_task_id”. Omitted for 500 responses.
Examplegenerated
{ "message": "example", "reason": "example"}Unsupported Media Type - Content-Type must be application/json.
Error payload carried by every non-2xx response.
object
Human-readable description of the failure. The wording is not part of the API contract; do not match on it programmatically.
Stable machine-readable failure code in snake_case, e.g. “api_token_missing” or “invalid_task_id”. Omitted for 500 responses.
Examplegenerated
{ "message": "example", "reason": "example"}Too Many Requests - rate limit exceeded.
Error payload carried by every non-2xx response.
object
Human-readable description of the failure. The wording is not part of the API contract; do not match on it programmatically.
Stable machine-readable failure code in snake_case, e.g. “api_token_missing” or “invalid_task_id”. Omitted for 500 responses.
Examplegenerated
{ "message": "example", "reason": "example"}