# Search documents

`GET /v1/workspaces/{workspaceId}/search`

Full-text search over titles and bodies. Words are matched as prefixes; all words must match.

Scope: `docs:read`.

## Request

```bash
curl "https://api.lydie.co/v1/workspaces/01JCQ3TZ0WJ8K4M2X7T9R6N1PA/search?query=roadmap" \
  -H "Authorization: Bearer $LYDIE_TOKEN"
```

## Path parameters

- `workspaceId` (string, required): (1–64 chars)

## Query parameters

- `query` (string, required): (1–500 chars)
- `limit` (integer, optional): Default: `20`. (1–50)

## Response

- `hits` (SearchHit[], required)
  - `id` (ULID, required)
  - `title` (string, required)
  - `snippet` (string, required): Matching excerpt; matches are wrapped in <mark></mark>.
  - `score` (number, required): Lower is better (bm25).

```json
{
  "hits": [
    {
      "id": "01JCQ3V5MZ8G4ZK2X7T9R6N1PB",
      "title": "Meeting notes",
      "snippet": "string",
      "score": 0
    }
  ]
}
```

Errors use the envelope described at https://developers.lydie.co/errors.md.
