# Get a single test result

Operation ID: `diagnostics.getTestResult`

Get a single diagnostic test result by its domain UUID (test_id), returned by diagnostics.createRapidTest. Supports both single-panel and multi-panel tests via the response's panels list.

## Public method

`getTestResult`

Signature: `diagnostics.getTestResult(patientId, testId)`

Return type: `Promise<TestResult>`

## Authentication

Classification: **AUTHENTICATED**

Schemes: `bearerAuth`

## Prerequisites

None documented.

## HTTP

`GET /patients/{patient_id}/diagnostics/{test_id}`

## Path parameters

| Name | Type | Required | Format | Allowed values | Default | Nullable | Description |
|---|---|---:|---|---|---|---:|---|
| `patient_id` | `string` | Yes |  |  |  | No |  |
| `test_id` | `string` | Yes |  |  |  | No |  |

## Query parameters

None.

## Body parameters

None.

Request model: None.

## Request example

None declared in canonical OpenAPI.

## Success responses

| Status | Shape | Content type | Description |
|---|---|---|---|
| `200` | [`GetTestResultResponse`](../models/GetTestResultResponse.md) | application/json | Single test result, supports 1-N panels |

## Success response examples

### 200

```json
{
  "code": 0,
  "data": {},
  "message": "string",
  "success": true
}
```

## Common errors

| Status | Shape | Content type | Description |
|---|---|---|---|
| `401` | [`diagnostics.ErrorResponse`](../models/diagnostics.ErrorResponse.md) | application/json | Authorization required — missing or invalid Bearer JWT |
| `403` | [`diagnostics.ErrorResponse`](../models/diagnostics.ErrorResponse.md) | application/json | A PATIENT-pool caller attempted to access another patient's data |
| `404` | [`diagnostics.ErrorResponse`](../models/diagnostics.ErrorResponse.md) | application/json | The PATIENT-pool caller's own FHIR Patient record could not be resolved |
| `500` | [`diagnostics.ErrorResponse`](../models/diagnostics.ErrorResponse.md) | application/json | Internal server error |

## Error examples

### 401 — Missing or invalid access token

```json
{
  "error": "Authorization required"
}
```

### 403 — The caller's own FHIR patient id does not match patient_id

```json
{
  "error": "Cannot access another patient's data"
}
```

### 404 — The caller's own patient record was not found

```json
{
  "error": "Patient not found"
}
```

### 500 — Unexpected service failure (sanitized example)

```json
{
  "error": "Internal server error"
}
```

## NodeJS / TypeScript implementation

```ts
import { HCSDK } from "@healthcloudai/hc-sdk";
```

```ts
const patientId = "<PATIENT_ID>";

const testId = "<TEST_ID>";

const result = await diagnostics.getTestResult(patientId, testId);
```

## cURL

```bash
curl -X GET \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  'https://dev-api-diagnostics.health.cloud/patients/%3CPATIENT_ID%3E/diagnostics/%3CTEST_ID%3E'
```

## Notes

- Interim note pending a backend contract update: since the SAFE CDX integration (merged to healthcloud-services main 2026-08-21), the live response no longer matches the `SingleTestResultResponse` schema shown on this page. The actual response is `{success: boolean, data: object, message: string, code: integer}`, where `data` carries the processed SAFE CVML result (including `userID`, `testID`, `uploadID`, and analyte-specific fields) rather than the documented `test_id`/`patient_id`/`panels` fields. `SingleTestResultResponse` will be replaced once the backend declares a typed response model for this operation and the contract is re-synced. Confirmed live against DEV on 2026-08-21.

## Prepared Test Console scenario

No canonical scenario is currently associated.

## Real response

No approved real integration response is currently published. Unapproved candidates are never rendered as examples.
