---
title: "Update a knowledge document"
method: PUT
path: "/api/v1/topics/{ref}/documents/{id}"
---

# Update a knowledge document

`PUT /api/v1/topics/{ref}/documents/{id}`

## Request

- Base URL: `https://myagentda.com`
- URL: `https://myagentda.com/api/v1/topics/{ref}/documents/{id}`
- Auth: API key in header `Authorization`

Saves a new version of the document (previous versions stay recoverable via the version query parameter). Requires write access.

## Path parameters

- `ref` string, required
- `id` string, required

## Request body

- object: Markdown document.
  - `title` string, required: Document title.
  - `content_md` string, required: Markdown content (max 4 MB).
  - `source` string: Where this came from (meeting, URL, research session).

## Response `200`

The document was saved.

- object: Saved document reference.
  - `document` object: Saved document.
    - `id` string: Document ID.
    - `title` string: Title.
    - `version` integer: Version after this save.
    - `topic` string: Topic number, e.g. T-3.

## Other responses

- `400`: The request was invalid.
- `401`: The access token is missing or invalid.
- `403`: The caller's role does not allow this action.
- `404`: Not found — or not visible to the caller (no existence leak).

---

[API](https://skmtc.dev/myagentda/apis/agentda.md) · [All operations](https://skmtc.dev/myagentda/apis/agentda/llms.txt) · [OpenAPI document](https://skmtc.dev/myagentda/apis/agentda/revisions/66a449ab49dc?raw)
