---
title: "Update Document"
method: POST
path: "/documents/update-document"
tags: ["Documents"]
---

# Update Document

`POST /documents/update-document`

Updates a document. This endpoint is atomic.

Currently both `metadata` and `index_status` are supported.

- When updating with a non-null `metadata`, the document must have `index_status` of `indexed`. After this call, the document will have an `index_status` of `not_indexed`, since the document will need to reindex with the new metadata.
- When updating with a non-null `index_status`, setting it to `not_parsed` or `not_indexed` requires that the document must have `index_status` of `parsing_failed` or `indexing_failed`, respectively.

A `404 Not Found` status code will be returned, if the provided collection name or document path does not exist.

## Request body

- UpdateDocumentRequest
  - `collection_name` string, required — The name of the collection.
  - `path` string, required — The filepath of the document that you are updating. A `404 Not Found` status code will be returned if no document with this path was found.
  - `metadata` DocumentMetadataJson
  - `index_status` 'not_parsed' | 'not_indexed', nullable — If the document is in the index_status of `parsing_failed or `indexing_failed`, then this endpoint allows you to update the index status to `not_parsed` and `not_indexed`, respectively. This allows the document to re-attempt to parse/index after failure.

## Response `200`

Successful Response

- DefaultResponse
  - `message` string — This string will always be "Success!". This may change in the future.

## Other responses

- `400` — Bad Request
- `404` — Not Found
- `422` — Validation Error

## Changes

- **2025-07-08** `bd2f55f423e0` — 2 breaking, 2 info
  - removed the required property `new_id` from the response with the `200` status
  - removed the required property `previous_id` from the response with the `200` status
  - added the new optional request property `index_status`
  - added the optional property `message` to the response with the `200` status
- **2025-01-27** `99a41bb73e43` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/zeroentropy-ai/apis/zeroentropy-api/changes/documents/update-document/post.md)

---

[API](https://skmtc.dev/zeroentropy-ai/apis/zeroentropy-api.md) · [All operations](https://skmtc.dev/zeroentropy-ai/apis/zeroentropy-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/zeroentropy-ai/zeroentropy-api/revisions/5ff1b24060b9/schema)
