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

# RMH search API

> POST /search/rmh — recursive multi-hop retrieval on top of hybrid search.

# RMH search API

`POST /search/rmh` runs **hybrid search** (vector + keyword), then optionally expands with **same-file neighbors** and a **second hybrid pass** seeded from the top hit. Responses match the normal search payload plus an `rmh` metadata object describing what ran.

Requires the same authentication and search quota as `GET`/`POST` `/search`.

## Endpoint

```
POST /search/rmh
```

## Request body

All fields from [`POST /search`](/api-reference/search) are supported, plus:

<ParamField body="max_rounds" type="integer" default="2">
  Number of hybrid search rounds (1–3)
</ParamField>

<ParamField body="neighbor_line_radius" type="integer" default="80">
  Lines around each hit to pull additional chunks from the same file (0–500)
</ParamField>

<ParamField body="expand_neighbors" type="boolean" default="true">
  When true, merge overlapping chunks from the same file as neighbors
</ParamField>

<ParamField body="secondary_search" type="boolean" default="true">
  When true, run a second hybrid search using the original query plus terms from the top hit
</ParamField>

<RequestExample>
  ```bash theme={null}
  curl -X POST https://api.trygroundai.com/search/rmh \
    -H "Authorization: Bearer gnd_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{
      "query": "How does authentication work?",
      "top_k": 10,
      "max_tokens": 4000,
      "max_rounds": 2,
      "expand_neighbors": true,
      "secondary_search": true
    }'
  ```
</RequestExample>

## Response

Same as [Search API](/api-reference/search) **SearchResponse**, with an extra top-level object:

```json theme={null}
"rmh": {
  "rounds_executed": 2,
  "seed_result_count": 8,
  "neighbors_added": 12,
  "secondary_search_ran": true,
  "merged_chunk_count": 18
}
```

If no evidence is found, the API may return the same **no evidence** payload as `/search`.
