# Get a diagnostic test's 1-hop relationships

Operation ID: `graph.getDiagnosticTestRelationships`

Return the flat 1-hop edge table for a diagnostic test — its direct relationships to dimension nodes (analyte, test system, specialty, complexity), filterable by direction and relationship type.

## Public method

`listDiagnosticTestRelationships`

Signature: `graph.listDiagnosticTestRelationships(testId, query)`

Return type: `Promise<DiagnosticTestRelationship[]>`

## Authentication

Classification: **AUTHENTICATED**

Schemes: `bearerAuth`

## Prerequisites

None documented.

## HTTP

`GET /diagnostic-tests/{test_id}/relationships`

## Path parameters

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

## Query parameters

| Name | Type | Required | Format | Allowed values | Default | Nullable | Description |
|---|---|---:|---|---|---|---:|---|
| `direction` | `string` | No |  | outgoing, incoming, both | `"outgoing"` | No |  |
| `limit` | `integer` | No |  |  | `50` | No |  |
| `offset` | `integer` | No |  |  | `0` | No |  |
| `type` | `string` | No |  |  |  | No |  |

## Body parameters

None.

Request model: None.

## Request example

None declared in canonical OpenAPI.

## Success responses

| Status | Shape | Content type | Description |
|---|---|---|---|
| `200` | [`GetDiagnosticTestRelationshipsResponse`](../models/GetDiagnosticTestRelationshipsResponse.md) | application/json | Flat 1-hop edge table for a diagnostic test |

## Success response examples

### 200

```json
[
  {
    "destination_id": "HIGH",
    "destination_label": "Complexity",
    "destination_name": "HIGH",
    "source_id": "f40168669505218707fefe48b5b56ba838917bb3cae99d75181f8f979a7a22db",
    "type": "HAS_COMPLEXITY"
  }
]
```

## Common errors

| Status | Shape | Content type | Description |
|---|---|---|---|
| `400` | [`graph.ErrorResponse`](../models/graph.ErrorResponse.md) | application/json | An invalid filter value was supplied |
| `401` | [`graph.ErrorResponse`](../models/graph.ErrorResponse.md) | application/json | Authorization required — missing or invalid Bearer JWT |
| `500` | [`graph.ErrorResponse`](../models/graph.ErrorResponse.md) | application/json | Internal server error |

## Error examples

### 400 — A filter value was not recognized (sanitized example)

```json
{
  "error": "Invalid direction"
}
```

### 401 — Missing or invalid access token

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

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

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

## NodeJS / TypeScript implementation

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

```ts
const testId = "<TEST_ID>";

const query = {
  "direction": "outgoing",
  "limit": 50,
  "offset": 0,
  "type": "<TYPE>"
};

const result = await graph.listDiagnosticTestRelationships(testId, query);
```

## cURL

```bash
curl -X GET \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  'https://dev-api-graph.health.cloud/diagnostic-tests/%3CTEST_ID%3E/relationships?direction=outgoing&limit=50&offset=0&type=%3CTYPE%3E'
```

## Notes

None.

## 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.
