# Create a retrieval document

```http
POST /projects/{project_reference}/knowledge/retrieval-documents
```

Create retrieval document. Requires project.knowledge.write.

## Parameters

| Name                | In   | Required | Description |
| ------------------- | ---- | -------- | ----------- |
| `project_reference` | path | Yes      |             |

## 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.                                                                                                    |
| `id`       | string |          | Caller-chosen record ID. Omit to let the API choose one. An ID that already exists is a conflict. Create the record before writing its chunks; use update to change an existing record. |

## Responses

| Status | Description                                    |
| ------ | ---------------------------------------------- |
| 201    | The created record with its first revision.    |
| 400    | invalid\_input: invalid title, ID or metadata  |
| 401    | unauthenticated                                |
| 404    | not\_found: project not found or not visible   |
| 409    | conflict: a record with this ID already exists |
| 500    | internal                                       |
