# Documents

Markdown/HTML document CRUD and full-text search over /v1/docs.

## Read and search

`client.docs.read(path)` (`GET /v1/docs/{path}`, nested segments supported) reads a document; `client.docs.search(query)` issues `GET /v1/docs/_search?q=<query>`. Reads need `seadb:content:read`.

```bash
const doc = await client.docs.read("sdk-examples/notes.md");
const hits = await client.docs.search("SeaChat platform SDK");
```

## Write and mutate

`client.docs.write(path, content)` (`POST /v1/docs/{path}`) writes a string as `text/markdown` or an object as JSON. `client.docs.patch(path, body, op?)` mutates with `op` of `append | edit | sed | patch`. `client.docs.delete(path)` deletes. Writes need `seadb:content:write`.

```bash
await client.docs.write("sdk-examples/notes.md", "# Note\n\nHello from the SDK.\n");
await client.docs.patch("sdk-examples/notes.md", { content: "\nAppended.\n" }, "append");
```
