# Search knowledge files

```http
POST /projects/{project_reference}/knowledge/search
```

Search knowledge files.

## Parameters

| Name                | In   | Required | Description                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------- | ---- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `project_reference` | path | Yes      | Project whose knowledge is selected. Ordinary callers require project.knowledge.read. A run-bound MCP service credential instead must match the persisted run's project and agent plus its actor or runtime transport binding; its effective sealed authority must grant the invoked tool and a knowledge selector. On project-scoped MCP endpoints, the scoped project supplies this value when omitted. |

## Request body

| Field           | Type    | Required | Description                                                                                                                                                                                              |
| --------------- | ------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `query`         | string  |          | Text to match against knowledge file paths and frontmatter. Omit query to list knowledge files.                                                                                                          |
| `cursor`        | string  |          | Opaque pagination token. Omit on the first request. To continue REST or MCP pagination, pass page\_info.next from the previous response as cursor.                                                       |
| `lookup_target` |         |          | Optional. Omit to search the main preview branch (the default). Set this to target another preview branch, a deployed environment, or a published release; unresolved targets are returned as not found. |
| `limit`         | integer |          |                                                                                                                                                                                                          |
| `shard_count`   | integer |          |                                                                                                                                                                                                          |
| `shard_index`   | integer |          |                                                                                                                                                                                                          |

## Responses

| Status | Description                                                    |
| ------ | -------------------------------------------------------------- |
| 200    | Ranked knowledge files and the next-page cursor.               |
| 400    | invalid\_input: invalid query, limit, shard or cursor          |
| 401    | unauthenticated                                                |
| 404    | not\_found: project or lookup\_target not found or not visible |
| 500    | internal                                                       |
