> ## Documentation Index
> Fetch the complete documentation index at: https://veryfront.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a retrieval document

> Create retrieval document.

`createRetrievalDocument(projectReference: ID!, input: CreateRetrievalDocumentInput!): RetrievalDocument!`

Requires project.knowledge.write.

## Arguments

| Argument | Type | Required | Description |
| - | - | - | - |
| `projectReference` | [`ID!`](https://veryfront.com/docs/cloud/graphql/types/id) | Yes | Project UUID or slug. |
| `input` | [`CreateRetrievalDocumentInput!`](https://veryfront.com/docs/cloud/graphql/types/createretrievaldocumentinput) | Yes | |

## Input fields

### input

[`CreateRetrievalDocumentInput`](https://veryfront.com/docs/cloud/graphql/types/createretrievaldocumentinput)

| Field | Type | Required | Description |
| - | - | - | - |
| `id` | [`ID`](https://veryfront.com/docs/cloud/graphql/types/id) | No | 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. |
| `title` | [`String!`](https://veryfront.com/docs/cloud/graphql/types/string) | Yes | |
| `source` | [`String`](https://veryfront.com/docs/cloud/graphql/types/string) | No | Defaults to an empty string. |
| `type` | [`String`](https://veryfront.com/docs/cloud/graphql/types/string) | No | Defaults to an empty string. |
| `metadata` | [`JSONObject`](https://veryfront.com/docs/cloud/graphql/types/jsonobject) | No | |

## Response

Returns [`RetrievalDocument!`](https://veryfront.com/docs/cloud/graphql/types/retrievaldocument). Open the type for its fields and nested types.

| Field | Type | Description |
| - | - | - |
| `id` | [`ID!`](https://veryfront.com/docs/cloud/graphql/types/id) | |
| `revision` | [`String!`](https://veryfront.com/docs/cloud/graphql/types/string) | Opaque revision: 64 lowercase hexadecimal characters. Send it as expectedRevision. |
| `title` | [`String!`](https://veryfront.com/docs/cloud/graphql/types/string) | |
| `source` | [`String!`](https://veryfront.com/docs/cloud/graphql/types/string) | |
| `type` | [`String!`](https://veryfront.com/docs/cloud/graphql/types/string) | |
| `metadata` | [`JSONObject!`](https://veryfront.com/docs/cloud/graphql/types/jsonobject) | |
| `createdAt` | [`DateTime!`](https://veryfront.com/docs/cloud/graphql/types/datetime) | |
| `updatedAt` | [`DateTime!`](https://veryfront.com/docs/cloud/graphql/types/datetime) | |

Types marked with `!` cannot be null. Lists use `[Type]` notation. The [type index](https://veryfront.com/docs/cloud/graphql/schema.md) lists all published input and response types.

## Example

```graphql title="query.graphql" theme={null}
mutation CreateRetrievalDocument($projectReference: ID!, $input: CreateRetrievalDocumentInput!) {
  createRetrievalDocument(projectReference: $projectReference, input: $input) {
    id
    createdAt
    updatedAt
    metadata
    revision
  }
}
```

```json title="variables.json" theme={null}
{
  "projectReference": "00000000-0000-4000-8000-000000000001",
  "input": {
    "title": "example"
  }
}
```

<details>
  <summary>Try this mutation</summary>

  Calls use `https://api.veryfront.com/graphql`. Replace sample values with resources you can access. See [Authentication](https://veryfront.com/docs/cloud/authentication.md) for credentials and permissions.

  Bearer token or API key

  Stored in this tab's session. Clear credential

  Mutation

  Variables (JSON)
</details>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.