---
title: "Update Document"
method: PATCH
path: "/agents/documents/{document_id}"
tags: ["Documents"]
---

# Update Document

`PATCH /agents/documents/{document_id}`

Update a [knowledge base](/line/knowledge-base) document's name, content, metadata, or folder

## Path parameters

- `document_id` string, required

## Headers

- `Cartesia-Version` '2026-03-01', date, required

## Request body

- UpdateDocumentBody — Fields to update on a document
  - `content` string — New document text. Maximum 1 MB. Updating this property triggers re-indexing of the document.
  - `name` string, nullable — New display name. Pass `null` to clear.
  - `metadata` object — Replacement metadata map. Updating this property triggers re-indexing of the document.
  - `folder_id` string — Move the document to a different folder.

## Response `200`

Document updated.

- DocumentResponse
  - `id` string, required — The ID of the document.
  - `name` string, nullable, required — The document's display name, or `null` if unnamed.
  - `content` string, required — The full document text.
  - `created_at` string, date-time, required — When the document was uploaded.
  - `metadata` object, required — User-defined string-keyed metadata.

## Other responses

- `404` — Document not found (`error_code: kb_document_not_found`) or target folder not found (`error_code: kb_folder_not_found`).
- `413` — Document content exceeds the 1 MB limit.

---

[API](https://skmtc.net/cartesia/apis/cartesia-api.md) · [All operations](https://skmtc.net/cartesia/apis/cartesia-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/cartesia/cartesia-api/revisions/8910812440d3/schema)
