> ## Documentation Index
> Fetch the complete documentation index at: https://kremis.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Query: Related

> Get the related subgraph from a starting node.

<ParamField path="method" type="POST">
  `/query`
</ParamField>

**Authentication:** Required (if enabled)

Retrieve the subgraph of nodes and edges reachable from a starting node up to a given depth.

## Request

```json theme={null}
{
  "type": "related",
  "node_id": 0,
  "depth": 2
}
```

| Field     | Type          | Required | Constraints | Description    |
| --------- | ------------- | -------- | ----------- | -------------- |
| `type`    | string        | Yes      | `"related"` | —              |
| `node_id` | integer (u64) | Yes      | —           | Starting node. |
| `depth`   | integer       | Yes      | 0-100       | Maximum depth. |

## Response

<CodeGroup>
  ```json 200 OK (found) theme={null}
  {
    "success": true,
    "found": true,
    "path": [0, 1, 2],
    "edges": [
      {"from": 0, "to": 1, "weight": 10},
      {"from": 0, "to": 2, "weight": 7}
    ],
    "grounding": "inference",
    "error": null
  }
  ```

  ```json Not Found theme={null}
  {
    "success": true,
    "found": false,
    "path": [],
    "edges": [],
    "grounding": "unknown",
    "error": null,
    "diagnostic": "node_not_found"
  }
  ```
</CodeGroup>

When `found` is `false`, `diagnostic` explains why (e.g. `node_not_found`).

## Example

```bash theme={null}
curl -X POST http://localhost:8080/query \
     -H "Content-Type: application/json" \
     -d '{"type": "related", "node_id": 0, "depth": 2}'
```
