# API: Knowledge base

| Method | Path | What it does | Scope |
|---|---|---|---|
| GET | `/v1/kb` | The company knowledge base: sections (positioning, products, proof points, voice, audience, claims, playbooks…) and the suggested ones not written yet | `knowledge:read` |
| DELETE | `/v1/kb/:key` | Archive a section (its revisions stay) | `settings:write` |
| GET | `/v1/kb/:key` | One section with its revisions | `knowledge:read` |
| PUT | `/v1/kb/:key` | Write a section (owners: every agent reads it; each save is a new version; send the version you edited) | `settings:write` |

## Examples

### GET /v1/kb

The company knowledge base: sections (positioning, products, proof points, voice, audience, claims, playbooks…) and the suggested ones not written yet

```bash
curl -s "https://api.tendbrook.com/v1/kb" \
  -H "Authorization: Bearer $EC_API_KEY"
```

```js
const res = await fetch(`https://api.tendbrook.com/v1/kb`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.EC_API_KEY}` },
});
const data = await res.json();
```

### DELETE /v1/kb/$KEY

Archive a section (its revisions stay)

```bash
curl -s -X DELETE "https://api.tendbrook.com/v1/kb/$KEY" \
  -H "Authorization: Bearer $EC_API_KEY"
```

```js
const res = await fetch(`https://api.tendbrook.com/v1/kb/${key}`, {
  method: "DELETE",
  headers: { authorization: `Bearer ${process.env.EC_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/kb/$KEY

One section with its revisions

```bash
curl -s "https://api.tendbrook.com/v1/kb/$KEY" \
  -H "Authorization: Bearer $EC_API_KEY"
```

```js
const res = await fetch(`https://api.tendbrook.com/v1/kb/${key}`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.EC_API_KEY}` },
});
const data = await res.json();
```

### PUT /v1/kb/$KEY

Write a section (owners: every agent reads it; each save is a new version; send the version you edited)

```bash
curl -s -X PUT "https://api.tendbrook.com/v1/kb/$KEY" \
  -H "Authorization: Bearer $EC_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.tendbrook.com/v1/kb/${key}`, {
  method: "PUT",
  headers: { authorization: `Bearer ${process.env.EC_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

Request and response schemas: [https://www.tendbrook.com/openapi.json](https://www.tendbrook.com/openapi.json). All resources: [API reference](https://www.tendbrook.com/docs/api).
