# Update a retrieval document

```http
PUT /projects/{project_reference}/knowledge/retrieval-documents/{retrieval_document_id}
```

Update retrieval document. Requires project.knowledge.write.

## Parameters

| Name                    | In   | Required | Description            |
| ----------------------- | ---- | -------- | ---------------------- |
| `project_reference`     | path | Yes      |                        |
| `retrieval_document_id` | path | Yes      | Retrieval document ID. |

## Request body

| Field               | Type   | Required | Description                                                                                                                                                                       |
| ------------------- | ------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `title`             | string | Yes      | Document title, at least one character.                                                                                                                                           |
| `source`            | string |          | Upstream source reference, such as a file path or URL. Defaults to "".                                                                                                            |
| `type`              | string |          | Document type label. Defaults to "".                                                                                                                                              |
| `metadata`          | object |          | Structured metadata stored with the record: an object of string keys to JSON values.                                                                                              |
| `expected_revision` | string | Yes      | The revision you read. A changed record is a conflict; a missing record is not\_found. Title, source, type and metadata are replaced, and the response includes the new revision. |

## Responses

| Status | Description                                                    |
| ------ | -------------------------------------------------------------- |
| 200    | The updated record with its new revision.                      |
| 400    | invalid\_input: invalid title, metadata or expected\_revision  |
| 401    | unauthenticated                                                |
| 404    | not\_found: project or retrieval document not found            |
| 409    | conflict: the record changed since expected\_revision was read |
| 500    | internal                                                       |
