# API: Knowledge base

| Method | Path | What it does | Scope |
|---|---|---|---|
| GET | `/v1/kb` | The company knowledge base: sections (positioning, products, proof points, voice, ICP, exclusions, playbooks…) and the suggested ones not written yet | `knowledge:read` |
| GET | `/v1/kb-proposals` | Text offered to knowledge base sections from proof points and interview syntheses | `knowledge:read` |
| POST | `/v1/kb-proposals/:id/accept` | Accept a proposal: its text is added to the section as a new version (owners, from the app) (web app only) | `settings:write` |
| POST | `/v1/kb-proposals/:id/dismiss` | Dismiss a proposal (nothing is written) (web app only) | `settings:write` |
| 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, ICP, exclusions, playbooks…) and the suggested ones not written yet

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

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

### GET /v1/kb-proposals

Text offered to knowledge base sections from proof points and interview syntheses

```bash
curl -s "https://api.closefinch.com/v1/kb-proposals" \
  -H "Authorization: Bearer $RA_API_KEY"
```

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

### DELETE /v1/kb/$KEY

Archive a section (its revisions stay)

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

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

### GET /v1/kb/$KEY

One section with its revisions

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

```js
const res = await fetch(`https://api.closefinch.com/v1/kb/${key}`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.RA_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.closefinch.com/v1/kb/$KEY" \
  -H "Authorization: Bearer $RA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.closefinch.com/v1/kb/${key}`, {
  method: "PUT",
  headers: { authorization: `Bearer ${process.env.RA_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.closefinch.com/openapi.json](https://www.closefinch.com/openapi.json). All resources: [API reference](https://www.closefinch.com/docs/api).
