# Search the knowledge base

Operation ID: `patient.searchKnowledge`

Lexical keyword search over the assistant's knowledge base, optionally scoped to a `collection`. Returns an empty result set when `q` is omitted. No authentication is required.

## Public method

`searchKnowledge`

Signature: `patient.searchKnowledge(query)`

Return type: `Promise<SearchKnowledgeResponse>`

## Authentication

Classification: **PUBLIC**

## Prerequisites

None documented.

## HTTP

`GET /assistant/knowledge/search`

## Path parameters

None.

## Query parameters

| Name | Type | Required | Format | Allowed values | Default | Nullable | Description |
|---|---|---:|---|---|---|---:|---|
| `collection` | `string` | No |  |  |  | No |  |
| `limit` | `integer` | No |  |  | `8` | No |  |
| `q` | `string` | No |  |  |  | No |  |

## Body parameters

None.

Request model: None.

## Request example

None declared in canonical OpenAPI.

## Success responses

| Status | Shape | Content type | Description |
|---|---|---|---|
| `200` | [`SearchKnowledgeResponse`](../models/SearchKnowledgeResponse.md) | application/json | Search results |

## Success response examples

### 200

```json
{
  "query": "swab collection",
  "results": [
    {
      "body": "Use the swab provided in the kit. Insert gently along the floor of the nasal passage, rotate for several seconds, then place the swab directly into the transport tube and seal it before labeling.",
      "collection": "sample_collection",
      "id": "kb_007",
      "tags": [
        "sample"
      ],
      "title": "Nasal swab collection steps"
    }
  ],
  "total": 2
}
```

## Common errors

None declared in canonical OpenAPI.

## Error examples

None declared in canonical OpenAPI.

## NodeJS / TypeScript implementation

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

```ts
const query = {
  "collection": "<COLLECTION>",
  "limit": 8,
  "q": "<Q>"
};

const result = await patient.searchKnowledge(query);
```

## cURL

```bash
curl -X GET \
  'https://dev-api-patient.health.cloud/assistant/knowledge/search?collection=%3CCOLLECTION%3E&limit=8&q=%3CQ%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.
