> For the complete documentation index, see [llms.txt](https://doc.dastra.eu/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.dastra.eu/en/features/contracts/declare.md).

# Create a document

To declare a contract, a policy or any other document, click **Create a document** in the record of the **Contracts & policies** module. A wizard offers four ways to create the document.

<figure><img src="https://2697025545-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LvBxs22wUMicv9uWp6C-1972196547%2Fuploads%2Fgit-blob-37a674a87787c260ee05ed1db00035afa97c3bb2%2Fcontracts-declare-1.png?alt=media" alt="The Create a document window with the four creation options"><figcaption><p>The four options to create a document</p></figcaption></figure>

| Option                           | What it does                                                                                                         |
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| **Create your document with AI** | Writes the document with AI from your instruction.                                                                   |
| **Import your document**         | Analyzes an existing file with AI and fills in the record for you.                                                   |
| **Personalized**                 | Creates an empty record that you fill in yourself.                                                                   |
| **Generate document**            | Generates the document from a [dynamic contract template](https://doc.dastra.eu/en/features/contracts/templates.md). |

The first two options require the matching AI features. If they are not included in your plan, they are greyed out.

## Start from scratch

1. Choose **Personalized**.
2. Select the **Document type**: contract, policy, notice, procedure or other.
3. Enter the **Document name**.
4. Optional: add files with **Add related files**. You can also add them later, once the document is created.
5. Choose the **Area**.
6. Click **Create a document**.

Dastra then opens the document record (see [Structure of a document](https://doc.dastra.eu/en/features/contracts/structure.md)).

<figure><img src="https://2697025545-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LvBxs22wUMicv9uWp6C-1972196547%2Fuploads%2Fgit-blob-e4c2bf00ee682197b3e8519304a580a63f10ba3d%2Fcontracts-declare-2.png?alt=media" alt="The creation form with the Document type, Document name, Add related files and Area fields"><figcaption><p>The form to create a document</p></figcaption></figure>

## Write a policy in Dastra

A document without an attachment shows a drop zone. You can drop the file there, or click **Write policy** to write the text in an editor. The text is saved as an attachment of the document, with the other files.

<figure><img src="https://2697025545-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LvBxs22wUMicv9uWp6C-1972196547%2Fuploads%2Fgit-blob-05704718621d951843dc6b4b6ce02207f9a80270%2Fcontracts-declare-3.png?alt=media" alt="A document without an attachment, with the drop zone and the Write policy button"><figcaption><p>The drop zone and the Write policy button</p></figcaption></figure>

## Generate a document with AI

1. Choose **Create your document with AI**.
2. Type a short description of the document you want to generate. You can add **Attachments** or a **Website url** as additional documentation.
3. Click **Generate**, then review the preview.
4. Check the **Document name** and the **Organizational unit**, then click **Validate**.

The document is created with the **Policy** type. You can change the type afterwards from the badge next to the title.

## Import an existing document

1. Choose **Import your document**.
2. Choose the **Organizational unit**.
3. Drop a file (PDF, DOCX, TXT, Markdown, JPG or PNG).

The analysis starts as soon as you drop the file. The Dastra AI assistant extracts the metadata from the file (name, description, tags, deadline, custom fields, etc.), infers the document type and creates the record with the file as an attachment. Review the record: the AI analysis can be wrong.

## Generate from a template

Choose **Generate document** to create the document from a template. The process is described in [Contract templates](https://doc.dastra.eu/en/features/contracts/templates.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://doc.dastra.eu/en/features/contracts/declare.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
