---
title: "Update Knowledge Base Document"
method: PATCH
path: "/knowledge-bases/{kbId}/documents/{docId}"
tags: ["Knowledge Base"]
---

# Update Knowledge Base Document

`PATCH /knowledge-bases/{kbId}/documents/{docId}`

## Request

- Base URL: `https://api.speakai.co/v1`
- URL: `https://api.speakai.co/v1/knowledge-bases/{kbId}/documents/{docId}`
- Auth: API key in header `x-speakai-key` and API key in header `x-access-token`

### Update Document

Requires the OWNER or ADMIN role. Renames the document's title and/or description -- the only fields this endpoint can change, at any status. A title change also propagates to that document's stored chunk metadata so retrieval citations pick it up immediately.

## Path parameters

- `kbId` string, required
- `docId` string, required

## Request body

- object
  - `title` string: Cannot be sent as an empty string.
  - `description` string

## Response `200`

OK

- object
  - `status` 'success'
  - `data` object
    - `documentId` string: Server-generated. Immutable.
    - `knowledgeBaseId` string
    - `source` 'upload' | 'website' | 'manual': This endpoint set only creates manual documents; upload and website documents come from endpoints not covered here.
    - `title` string
    - `description` string, nullable
    - `fileName` string, nullable: Set only for an uploaded file.
    - `mimeType` string, nullable
    - `sizeBytes` number
    - `sourceUrl` string, nullable: Set only for a website document.
    - `pageUrl` string, nullable: Set only for a website document.
    - `status` 'uploaded' | 'parsing' | 'parsed' | 'embedding' | 'ready' | 'failed'
    - `error` string, nullable
    - `parse` object, nullable
      - `engine` string
      - `pages` number
      - `costUsd` number
      - `parsedAt` string, date-time
    - `createdAt` string, date-time

## Other responses

- `400`: Bad Request
- `403`: Forbidden
- `404`: Not Found

---

[API](https://skmtc.dev/speakai/apis/speak-ai-api.md) · [All operations](https://skmtc.dev/speakai/apis/speak-ai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/speakai/apis/speak-ai-api/revisions/52d777e6d46e?raw)
