> For the complete documentation index, see [llms.txt](https://support.docstudio.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.docstudio.com/admin-panel/conversion-rules/how-to-create-a-conversion-rule-incoming-documents.md).

# How to Create a Conversion Rule (Incoming Documents)

<figure><img src="/files/vgZgn7uBqXJrQbfdwBOT" alt=""><figcaption></figcaption></figure>

### Create an incoming conversion rule

1. Enter a rule name or keep the default name.
2. Turn on/off the rule.
3. Enable the incoming conversion rule option.
4. Configure the converted file naming pattern.
5. Enter the template UUID that matches the outgoing document.
6. Select the template version.

   * The system auto-fills the latest template version by default.
   * Select another version from the list if needed.

   When the template UUID and version are filled, the system auto-generates the conversion rule and the template.
7. Upload a source example file from your local machine.
   * The file content appears in the source file preview.
   * To update the content, update the local file and upload it again.
8. Review the generated conversion rule.

   * Click the info icon to see an example.
   * Update the conversion rule if needed.

   Review the auto-generated template.
9. Click the **Run Conversation** <img src="/files/qjZr81hFulId2RXBhRPO" alt="" data-size="line"> button to check the conversion result.
10. Review the result in **Result** window.
11. After successful execution, click the <img src="/files/ACG5de7RE8J5HuWqUniH" alt="" data-size="line"> button to create the conversion rule.

### Configure the converted file naming pattern

Use a naming pattern to generate the converted document name. If a document with the same name already exists, the system appends the conversion time.

Use these variables:

* `{mailboxUuid}`. Mailbox UUID that uses the integration.
* `{envelopeUuid}`. Envelope UUID created on the platform.
* `{randomNumber}`. Random number.
* `{templateUuid}`. Template UUID used to create the envelope.
* `{date dateFormat}`. Envelope receive date in the format you need. Use `DDMMYYYY` or another supported format.
* `{"documentId":"fieldName"}`. Value from a field in the template version used in the integration rule.

Restrictions for `{"documentId":"fieldName"}`:

* Supported field types: text, number, currency, date, dictionary, lookup, formula, duplicate, autonumber.
* Do not use fields from dynamic tables in the naming pattern.

Naming pattern validation:

* Use empty values for variables that are not filled in.
* If the naming pattern contains only an optional field, or no required fields are filled in at the moment of file creation, use `filename_empty` instead of variables.

### (Optional) Receive the envelope archive on your server

Use this option to send a ZIP archive to your server based on the selected protocol.

<figure><img src="/files/isx7VQd9Ou2Hp9ZND0BK" alt=""><figcaption></figcaption></figure>

1. Enter the template UUID you want to integrate with.
2. Enable the ZIP archive option.
3. Select the archive type to send when the envelope is **COMPLETED**.
