---
title: "Updates attributes of an existing document."
method: PATCH
path: "/documents/{document_id}"
tags: ["Documents"]
---

# Updates attributes of an existing document.

`PATCH /documents/{document_id}`

## Request

- Base URL: `https://h2ogpte.genai.h2o.ai/api/v1`
- URL: `https://h2ogpte.genai.h2o.ai/api/v1/documents/{document_id}`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/h2o/apis/h2ogpte-rest-api/docs/documents/:document_id/patch.ts> (a function with typed inputs; its response is checked against the schema)

Updates attributes of an existing document, particularly name and uri.

## Path parameters

- `document_id` string, required

## Request body

- DocumentUpdateRequest
  - `name` string
  - `uri` string

## Response `200`

Successful operation

- Document
  - `id` string, required: A unique identifier of the document
  - `name` string, required: Name of the document
  - `username` string, required: A username owning the document
  - `type` string, required: Type of the document
  - `size` integer, required: Size of the document in bytes
  - `page_count` integer, required: A number of pages contained in the document
  - `status` 'unknown' | 'scheduled' | 'queued' | 'running' | 'completed' | 'failed' | 'canceled' | 'agent_only', required: Status of the document
  - `usage_stats` string: Usage stats
  - `connector` string
  - `original_type` string
  - `original_mtime` string, datetime
  - `created_at` string, date-time, required: Time when document was created
  - `updated_at` string, date-time, required: Last time when document was modified
  - `uri` string
  - `summary` string
  - `summary_parameters` string
  - `metadata_dict` Metadata
  - `is_encrypted` boolean: Whether the document files are encrypted at rest
  - `chat_session_id` string: A unique identifier of the chat session that generated the document. Returned by GET /documents. Only set for agent-generated files, null for user-uploaded documents.
  - `chat_session_name` string: Name of the chat session that generated the document. Returned by GET /documents. Null when the document was not generated by an agent, or when the session is not visible to the caller.
  - `chat_session_visible` boolean: Whether the caller can open the chat session that generated the document. Returned by GET /documents. Distinct from chat_session_name being null, which also happens when a visible session has no name yet.

## Other responses

- `400`: Bad request
- `401`: Unauthorized - Invalid or missing API key
- `404`: Not found
- `default`: Unexpected error

---

[API](https://skmtc.dev/h2o/apis/h2ogpte-rest-api.md) - [All operations](https://skmtc.dev/h2o/apis/h2ogpte-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/h2o/apis/h2ogpte-rest-api/revisions/a82a117320f4?raw)
