# Responses

Medical Device processing is synchronous — the extracted data is returned directly in the API response body. No callback configuration is required.

## Response Structure Overview

The top-level response wraps all file processing results in an `extractions` array, with one entry per uploaded file. Each extraction contains the detected device measurements, timestamps, processing duration, and status.

```json
{
  "success": true,
  "data": {
    "type": "medical",
    "extractions": [
      {
        "fileName": "glucosemeter.jpg",
        "result": {
          "status": "extracted",
          "success": true,
          "count": 1,
          "items": [
            {
              "index": 0,
              "deviceType": "glucose-meter",
              "data": {
                "glucose": {
                  "value": 5.8,
                  "unit": "mg/dL"
                },
                "unit": "mmol/L"
              }
            }
          ],
          "timestamp": "2026-08-28T04:38:15.672Z",
          "processingTime": "2619ms",
          "message": "Medical data extracted successfully from JPG file"
        }
      }
    ],
    "filesCount": 1,
    "message": "1 medical file(s) processed successfully"
  }
}
```

### Upload response field reference

| Field | Type | Description |
|  --- | --- | --- |
| `success` | boolean | `true` when the request was processed successfully |
| `data.type` | string | Always `"medical"` |
| `data.extractions` | array | One entry per uploaded file |
| `data.extractions[].fileName` | string | Original filename of the uploaded file |
| `data.extractions[].result` | object | Extraction result containing device measurements and status |
| `data.extractions[].result.status` | string | Extraction status (`"extracted"`) |
| `data.extractions[].result.success` | boolean | Whether extraction succeeded for this file |
| `data.extractions[].result.count` | integer | Number of medical devices detected in this file |
| `data.extractions[].result.items` | array | Array of detected devices and measurements |
| `data.extractions[].result.items[].index` | integer | Zero-based index of the detected device in the image |
| `data.extractions[].result.items[].deviceType` | string | Standardized device type identifier |
| `data.extractions[].result.items[].data` | object | Extracted measurements enriched with numeric values and standardized units |
| `data.extractions[].result.timestamp` | string | ISO 8601 timestamp of extraction |
| `data.extractions[].result.processingTime` | string | Extraction processing duration (e.g. `"2619ms"`) |
| `data.extractions[].result.message` | string | File-level extraction message |
| `data.filesCount` | integer | Total number of files processed |
| `data.message` | string | Human-readable summary |


## 1. Single Image Upload (Single Device)

When uploading a single image containing one medical device, the `extractions` array contains one entry, and `items` contains the detected device readings.

```json
{
    "success": true,
    "data": {
        "type": "medical",
        "extractions": [
            {
                "fileName": "glucosemeter.jpg",
                "result": {
                    "status": "extracted",
                    "success": true,
                    "count": 1,
                    "items": [
                        {
                            "index": 0,
                            "deviceType": "glucose-meter",
                            "data": {
                                "glucose": {
                                    "value": 5.8,
                                    "unit": "mg/dL"
                                },
                                "unit": "mmol/L"
                            }
                        }
                    ],
                    "timestamp": "2026-08-28T04:38:15.672Z",
                    "processingTime": "2619ms",
                    "message": "Medical data extracted successfully from JPG file"
                }
            }
        ],
        "filesCount": 1,
        "message": "1 medical file(s) processed successfully"
    }
}
```

## 2. Batch Upload (Multiple Files)

When uploading multiple files in a single request, `extractions` contains an entry for every processed file.

```json
{
    "success": true,
    "data": {
        "type": "medical",
        "extractions": [
            {
                "fileName": "glucosemeter.jpg",
                "result": {
                    "status": "extracted",
                    "success": true,
                    "count": 1,
                    "items": [
                        {
                            "index": 0,
                            "deviceType": "glucose-meter",
                            "data": {
                                "glucose": {
                                    "value": 5.8,
                                    "unit": "mg/dL"
                                },
                                "unit": "mmol/L"
                            }
                        }
                    ],
                    "timestamp": "2026-08-28T04:44:27.582Z",
                    "processingTime": "2245ms",
                    "message": "Medical data extracted successfully from JPG file"
                }
            },
            {
                "fileName": "blood_pressure.png",
                "result": {
                    "status": "extracted",
                    "success": true,
                    "count": 1,
                    "items": [
                        {
                            "index": 0,
                            "deviceType": "blood-pressure",
                            "data": {
                                "systolic": {
                                    "value": 97,
                                    "unit": "mmHg"
                                },
                                "diastolic": {
                                    "value": 70,
                                    "unit": "mmHg"
                                },
                                "pulse": {
                                    "value": 96,
                                    "unit": "/min"
                                }
                            }
                        }
                    ],
                    "timestamp": "2026-08-28T04:44:32.982Z",
                    "processingTime": "2420ms",
                    "message": "Medical data extracted successfully from PNG file"
                }
            }
        ],
        "filesCount": 2,
        "message": "2 medical file(s) processed successfully"
    }
}
```

## 3. Multi-Device Detection (One Image)

When an uploaded image contains multiple medical devices (e.g. a blood pressure monitor, glucose meter, and pulse oximeter captured together), JondaX detects each device and returns them as distinct elements in the `items` array with their corresponding `index` and measurement `data`.

```json
{
    "success": true,
    "data": {
        "type": "medical",
        "extractions": [
            {
                "fileName": "Multi device pic_page-0001.jpg",
                "result": {
                    "status": "extracted",
                    "success": true,
                    "count": 3,
                    "items": [
                        {
                            "index": 0,
                            "deviceType": "blood-pressure",
                            "data": {
                                "systolic": {
                                    "value": 97,
                                    "unit": "mmHg"
                                },
                                "diastolic": {
                                    "value": 70,
                                    "unit": "mmHg"
                                },
                                "pulse": {
                                    "value": 96,
                                    "unit": "/min"
                                }
                            }
                        },
                        {
                            "index": 1,
                            "deviceType": "glucose-meter",
                            "data": {
                                "glucose": {
                                    "value": 5.8,
                                    "unit": "mg/dL"
                                },
                                "unit": "mmol/L"
                            }
                        },
                        {
                            "index": 2,
                            "deviceType": "pulse-oximeter",
                            "data": {
                                "spo2": {
                                    "value": 98,
                                    "unit": "%"
                                },
                                "pulse": {
                                    "value": 87,
                                    "unit": "/min"
                                }
                            }
                        }
                    ],
                    "timestamp": "2026-08-28T04:46:13.420Z",
                    "processingTime": "3173ms",
                    "message": "Medical data extracted successfully from JPG file"
                }
            }
        ],
        "filesCount": 1,
        "message": "1 medical file(s) processed successfully"
    }
}
```

## Supported device types and metrics

Numeric measurements are automatically structured as `{ value: <number>, unit: <string> }` objects for standardized downstream integration:

| `deviceType` | Common Extracted Measurement Fields | Standard Units |
|  --- | --- | --- |
| `blood-pressure` | `systolic`, `diastolic`, `pulse` | `mmHg`, `/min` |
| `glucose-meter` | `glucose`, `unit` | `mg/dL`, `mmol/L` |
| `pulse-oximeter` | `spo2`, `pulse` | `%`, `/min` |
| `thermometer` | `temperature` | `°C`, `°F` |
| `weight-scale` | `weight`, `bmi` | `kg`, `lbs`, `kg/m²` |
| `ecg-monitor` | `heart_rate`, `rhythm` | `/min`, string |


> Measurement keys within `data` are dynamically mapped based on device type and reading. Always handle unexpected keys safely.


## Unsupported file type (HTTP 201, success: false)

```json
{
  "success": false,
  "message": "Unsupported file type for medical module. Supported types: JPEG, PNG, GIF, WEBP."
}
```

## Unauthorized (HTTP 401)

```json
{
  "success": false,
  "statusCode": 401,
  "path": "/v1/master?module=medical",
  "timestamp": "2026-04-02T08:26:13.716Z",
  "message": {
    "message": "Invalid API token format",
    "error": "Unauthorized",
    "statusCode": 401
  }
}
```